v0.9.4: fixed magical charge and scroll empower interacting incorrectly
This commit is contained in:
parent
0661a224a3
commit
ed5d5a56ee
|
@ -369,14 +369,19 @@ public abstract class Wand extends Item {
|
|||
|
||||
curCharges -= cursed ? 1 : chargesPerCast();
|
||||
|
||||
//remove magic charge at a higher priority, if we are benefiting from it are and not the
|
||||
//wand that just applied it
|
||||
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
|
||||
if (buff != null
|
||||
&& buff.wandJustApplied() != this
|
||||
&& buff.level() == buffedLvl()
|
||||
&& buffedLvl() > super.buffedLvl()){
|
||||
buff.detach();
|
||||
} else {
|
||||
ScrollEmpower empower = curUser.buff(ScrollEmpower.class);
|
||||
if (empower != null){
|
||||
empower.detach();
|
||||
}
|
||||
|
||||
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
|
||||
if (buff != null && buff.level() > super.buffedLvl()){
|
||||
buff.detach();
|
||||
}
|
||||
|
||||
//if the wand is owned by the hero, but not in their inventory, it must be in the staff
|
||||
|
|
|
@ -67,7 +67,7 @@ public class WandOfMagicMissile extends DamageWand {
|
|||
//apply the magic charge buff if we have another wand in inventory of a lower level, or already have the buff
|
||||
for (Wand.Charger wandCharger : curUser.buffs(Wand.Charger.class)){
|
||||
if (wandCharger.wand().buffedLvl() < buffedLvl() || curUser.buff(MagicCharge.class) != null){
|
||||
Buff.prolong(curUser, MagicCharge.class, MagicCharge.DURATION).setLevel(buffedLvl());
|
||||
Buff.prolong(curUser, MagicCharge.class, MagicCharge.DURATION).setup(this);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -102,9 +102,13 @@ public class WandOfMagicMissile extends DamageWand {
|
|||
public static float DURATION = 4f;
|
||||
|
||||
private int level = 0;
|
||||
private Wand wandJustApplied; //we don't bundle this as it's only used right as the buff is applied
|
||||
|
||||
public void setLevel(int level){
|
||||
this.level = Math.max(level, this.level);
|
||||
public void setup(Wand wand){
|
||||
if (level < wand.buffedLvl()){
|
||||
this.level = wand.buffedLvl();
|
||||
this.wandJustApplied = wand;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,6 +121,13 @@ public class WandOfMagicMissile extends DamageWand {
|
|||
return this.level;
|
||||
}
|
||||
|
||||
//this is used briefly so that a wand of magic missile can't clear the buff it just applied
|
||||
public Wand wandJustApplied(){
|
||||
Wand result = this.wandJustApplied;
|
||||
this.wandJustApplied = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return BuffIndicator.UPGRADE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user