v0.9.4: wild magic now works properly with cursed wands

This commit is contained in:
Evan Debenham 2021-07-30 23:39:12 -04:00
parent 8be67e9e20
commit d776e83bb5

View File

@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.Item;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.CursedWand;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -128,10 +129,28 @@ public class WildMagic extends ArmorAbility {
Ballistica aim = new Ballistica(hero.pos, target, cur.collisionProperties(target)); Ballistica aim = new Ballistica(hero.pos, target, cur.collisionProperties(target));
hero.sprite.zap(target); hero.sprite.zap(target);
if (!cur.cursed) {
cur.fx(aim, new Callback() { cur.fx(aim, new Callback() {
@Override @Override
public void call() { public void call() {
cur.onZap(aim); afterZap(cur, wands, hero, target);
}
});
} else {
CursedWand.cursedZap(cur,
hero,
new Ballistica(hero.pos, target, Ballistica.MAGIC_BOLT),
new Callback() {
@Override
public void call() {
afterZap(cur, wands, hero, target);
}
});
}
}
private void afterZap( Wand cur, ArrayList<Wand> wands, Hero hero, int target){
cur.partialCharge -= (float) Math.pow(0.67f, hero.pointsInTalent(Talent.CONSERVED_MAGIC)); cur.partialCharge -= (float) Math.pow(0.67f, hero.pointsInTalent(Talent.CONSERVED_MAGIC));
if (cur.partialCharge < 0) { if (cur.partialCharge < 0) {
cur.partialCharge++; cur.partialCharge++;
@ -148,8 +167,6 @@ public class WildMagic extends ArmorAbility {
hero.spendAndNext(Actor.TICK); hero.spendAndNext(Actor.TICK);
} }
} }
});
}
@Override @Override
public Talent[] talents() { public Talent[] talents() {