v0.9.4: wild magic now works properly with cursed wands
This commit is contained in:
parent
8be67e9e20
commit
d776e83bb5
|
@ -31,6 +31,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.ArmorAbility;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
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.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
|
@ -128,19 +129,37 @@ public class WildMagic extends ArmorAbility {
|
|||
Ballistica aim = new Ballistica(hero.pos, target, cur.collisionProperties(target));
|
||||
|
||||
hero.sprite.zap(target);
|
||||
|
||||
if (!cur.cursed) {
|
||||
cur.fx(aim, new Callback() {
|
||||
@Override
|
||||
public void call() {
|
||||
cur.onZap(aim);
|
||||
cur.partialCharge -= (float)Math.pow(0.67f, hero.pointsInTalent(Talent.CONSERVED_MAGIC));
|
||||
if (cur.partialCharge < 0){
|
||||
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));
|
||||
if (cur.partialCharge < 0) {
|
||||
cur.partialCharge++;
|
||||
cur.curCharges--;
|
||||
}
|
||||
if (!wands.isEmpty()){
|
||||
if (!wands.isEmpty()) {
|
||||
zapWand(wands, hero, target);
|
||||
} else {
|
||||
if (hero.buff(WildMagicTracker.class) != null){
|
||||
if (hero.buff(WildMagicTracker.class) != null) {
|
||||
hero.buff(WildMagicTracker.class).detach();
|
||||
}
|
||||
Item.updateQuickslot();
|
||||
|
@ -148,8 +167,6 @@ public class WildMagic extends ArmorAbility {
|
|||
hero.spendAndNext(Actor.TICK);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Talent[] talents() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user