v1.4.0: wild magic and flurry now work properly with pushing effects

This commit is contained in:
Evan Debenham
2022-08-10 17:43:58 -04:00
parent db15959069
commit 7646489bc0
2 changed files with 46 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.mage;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
@@ -126,6 +127,8 @@ public class WildMagic extends ArmorAbility {
public static class WildMagicTracker extends FlavourBuff{};
Actor wildMagicActor = null;
private void zapWand( ArrayList<Wand> wands, Hero hero, int cell){
Wand cur = wands.remove(0);
@@ -179,8 +182,27 @@ public class WildMagic extends ArmorAbility {
cur.partialCharge++;
cur.curCharges--;
}
if (wildMagicActor != null){
wildMagicActor.next();
wildMagicActor = null;
}
Char ch = Actor.findChar(target);
if (!wands.isEmpty() && hero.isAlive()) {
zapWand(wands, hero, target);
Actor.add(new Actor() {
{
actPriority = VFX_PRIO-1;
}
@Override
protected boolean act() {
wildMagicActor = this;
zapWand(wands, hero, ch == null ? target : ch.pos);
Actor.remove(this);
return false;
}
});
hero.next();
} else {
if (hero.buff(WildMagicTracker.class) != null) {
hero.buff(WildMagicTracker.class).detach();

View File

@@ -362,7 +362,8 @@ public class SpiritBow extends Weapon {
}
int flurryCount = -1;
Actor flurryActor = null;
@Override
public void cast(final Hero user, final int dst) {
final int cell = throwPos( user, dst );
@@ -388,7 +389,7 @@ public class SpiritBow extends Weapon {
((MissileSprite) user.sprite.parent.recycle(MissileSprite.class)).
reset(user.sprite,
cell,
enemy.pos,
this,
new Callback() {
@Override
@@ -403,6 +404,11 @@ public class SpiritBow extends Weapon {
sniperSpecial = false;
flurryCount = -1;
}
if (flurryActor != null){
flurryActor.next();
flurryActor = null;
}
}
});
@@ -411,7 +417,21 @@ public class SpiritBow extends Weapon {
public void call() {
flurryCount--;
if (flurryCount > 0){
cast(user, dst);
Actor.add(new Actor() {
{
actPriority = VFX_PRIO-1;
}
@Override
protected boolean act() {
flurryActor = this;
cast(user, enemy.pos);
Actor.remove(this);
return false;
}
});
curUser.next();
}
}
});