v0.9.1c: fixed various issues with magical charge

This commit is contained in:
Evan Debenham 2021-01-10 15:31:10 -05:00
parent 8fafe2af57
commit 1262b920bc
3 changed files with 18 additions and 11 deletions

View File

@ -299,8 +299,8 @@ public abstract class Wand extends Item {
@Override
public int buffedLvl() {
int lvl = super.buffedLvl();
if (curUser != null) {
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
if (charger != null && charger.target != null) {
WandOfMagicMissile.MagicCharge buff = charger.target.buff(WandOfMagicMissile.MagicCharge.class);
if (buff != null && buff.level() > lvl){
return buff.level();
}

View File

@ -36,6 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
import com.watabou.noosa.Image;
import com.watabou.noosa.audio.Sample;
import com.watabou.utils.Bundle;
import com.watabou.utils.Random;
public class WandOfMagicMissile extends DamageWand {
@ -141,6 +142,20 @@ public class WandOfMagicMissile extends DamageWand {
public String desc() {
return Messages.get(this, "desc", level(), dispTurns());
}
private static final String LEVEL = "level";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put(LEVEL, level);
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
level = bundle.getInt(LEVEL);
}
}
}

View File

@ -38,7 +38,6 @@ import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorrosion;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfCorruption;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfDisintegration;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfLivingEarth;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfMagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfRegrowth;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@ -138,14 +137,7 @@ public class MagesStaff extends MeleeWeapon {
@Override
public int buffedLvl() {
int lvl = super.buffedLvl();
if (curUser != null && wand != null) {
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
if (buff != null && buff.level() > lvl){
return buff.level();
}
}
return lvl;
return Math.max(super.buffedLvl(), wand.buffedLvl());
}
@Override