v0.8.1: added a new ability to the wand of magic missile

This commit is contained in:
Evan Debenham 2020-06-04 16:59:32 -04:00
parent a06edcca4d
commit 4a302a6079
8 changed files with 88 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1193,8 +1193,10 @@ items.wands.wandoflivingearth$earthguardian.desc=The rocks from your wand of liv
items.wands.wandofmagicmissile.name=wand of magic missile
items.wands.wandofmagicmissile.staff_name=staff of magic missile
items.wands.wandofmagicmissile.desc=This fairly plain wand launches missiles of pure magical energy. While not as strong as other wands, it makes up for it somewhat with more available charges.
items.wands.wandofmagicmissile.stats_desc=Each bolt from this wand deals _%1$d-%2$d damage,_ and has no additional effects.
items.wands.wandofmagicmissile.desc=This fairly plain wand launches missiles of pure magical energy. While the wand itself lacks any special effects, it has more available charges and can briefly empower other wands when upgraded.
items.wands.wandofmagicmissile.stats_desc=Each bolt from this wand deals _%1$d-%2$d damage,_ and will briefly empower other wands if it is upgraded.
items.wands.wandofmagicmissile$magiccharge.name=Magic Charge
items.wands.wandofmagicmissile$magiccharge.desc=Your wand of magic missile has fed power back into your wands, boosting the effective level of the next zap they make.\n\nYour wands are boosted to: +%d.\n\nTurns of magic charge remaining: %s.
items.wands.wandofprismaticlight.name=wand of prismatic light
items.wands.wandofprismaticlight.staff_name=staff of prismatic light

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -38,6 +38,11 @@ public class Recharging extends FlavourBuff {
return BuffIndicator.RECHARGING;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(1, 1, 0);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);

View File

@ -276,6 +276,18 @@ public abstract class Wand extends Item {
return this;
}
@Override
public int buffedLvl() {
int lvl = super.buffedLvl();
if (curUser != null && !(this instanceof WandOfMagicMissile)) {
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
if (buff != null && buff.level() > lvl){
return buff.level();
}
}
return lvl;
}
public void updateLevel() {
maxCharges = Math.min( initialCharges() + level(), 10 );
curCharges = Math.min( curCharges, maxCharges );
@ -319,6 +331,11 @@ public abstract class Wand extends Item {
curCharges -= cursed ? 1 : chargesPerCast();
WandOfMagicMissile.MagicCharge buff = curUser.buff(WandOfMagicMissile.MagicCharge.class);
if (buff != null && buff.level() > super.buffedLvl()){
buff.detach();
}
if (curUser.heroClass == HeroClass.MAGE) levelKnown = true;
updateQuickslot();

View File

@ -25,6 +25,7 @@ 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.Recharging;
import com.shatteredpixel.shatteredpixeldungeon.effects.SpellSprite;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MagesStaff;
@ -56,6 +57,14 @@ public class WandOfMagicMissile extends DamageWand {
ch.sprite.burst(0xFFFFFFFF, buffedLvl() / 2 + 2);
//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());
break;
}
}
} else {
Dungeon.level.pressCell(bolt.collisionPos);
}
@ -72,4 +81,55 @@ public class WandOfMagicMissile extends DamageWand {
return 3;
}
public static class MagicCharge extends FlavourBuff {
{
type = buffType.POSITIVE;
announced = true;
}
public static float DURATION = 4f;
private int level = 0;
public void setLevel(int level){
this.level = Math.max(level, this.level);
}
@Override
public void detach() {
super.detach();
QuickSlotButton.refresh();
}
public int level(){
return this.level;
}
@Override
public int icon() {
return BuffIndicator.RECHARGING;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(0.2f, 0.6f, 1f);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - visualcooldown()) / DURATION);
}
@Override
public String toString() {
return Messages.get(this, "name");
}
@Override
public String desc() {
return Messages.get(this, "desc", level(), dispTurns());
}
}
}

View File

@ -225,7 +225,7 @@ public class ItemSlot extends Button {
int trueLvl = item.visiblyUpgraded();
int buffedLvl = item.buffedVisiblyUpgraded();
if (trueLvl != 0 && buffedLvl != 0) {
if (trueLvl != 0 || buffedLvl != 0) {
level.text( Messages.format( TXT_LEVEL, buffedLvl ) );
level.measure();
if (trueLvl == buffedLvl || buffedLvl <= 0) {