From 7646489bc0d9e99d45abac3c34487b3bf94e7779 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Wed, 10 Aug 2022 17:43:58 -0400 Subject: [PATCH] v1.4.0: wild magic and flurry now work properly with pushing effects --- .../actors/hero/abilities/mage/WildMagic.java | 24 ++++++++++++++++- .../items/weapon/SpiritBow.java | 26 ++++++++++++++++--- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java index 028dffdd8..5dd12c70a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/mage/WildMagic.java @@ -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 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(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java index 09b16f686..1262aaecd 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java @@ -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(); } } });