v0.9.3: added targeting logic to abilities, fixed a few not using charge

This commit is contained in:
Evan Debenham
2021-05-21 14:04:08 -04:00
parent dd6bf06c13
commit af5898b6a8
13 changed files with 22 additions and 19 deletions
@@ -53,7 +53,7 @@ public abstract class ArmorAbility implements Bundlable {
} }
//leave null for no targeting //leave null for no targeting
protected String targetingPrompt(){ public String targetingPrompt(){
return null; return null;
} }
@@ -10,7 +10,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Rat;
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.MirrorImage;
import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
@@ -34,7 +33,7 @@ public class Ratmogrify extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -48,6 +48,9 @@ public class NaturesPower extends ArmorAbility {
hero.sprite.operate(hero.pos); hero.sprite.operate(hero.pos);
Sample.INSTANCE.play(Assets.Sounds.CHARGEUP); Sample.INSTANCE.play(Assets.Sounds.CHARGEUP);
hero.sprite.emitter().burst(LeafParticle.GENERAL, 10); hero.sprite.emitter().burst(LeafParticle.GENERAL, 10);
armor.charge -= chargeUse(hero);
armor.updateQuickslot();
hero.spendAndNext(Actor.TICK); hero.spendAndNext(Actor.TICK);
} }
@@ -90,7 +93,5 @@ public class NaturesPower extends ArmorAbility {
return Messages.get(this, "desc", dispTurns(visualcooldown())); return Messages.get(this, "desc", dispTurns(visualcooldown()));
} }
//TODO name/desc
} }
} }
@@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Invisibility;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
@@ -49,7 +48,7 @@ public class SpectralBlades extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -123,9 +123,6 @@ public class ElementalBlast extends ArmorAbility {
@Override @Override
protected void activate(ClassArmor armor, Hero hero, Integer target) { protected void activate(ClassArmor armor, Hero hero, Integer target) {
armor.charge -= chargeUse(hero);
Item.updateQuickslot();
Ballistica aim; Ballistica aim;
//Basically the direction of the aim only matters if it goes outside the map //Basically the direction of the aim only matters if it goes outside the map
//So we just ensure it won't do that. //So we just ensure it won't do that.
@@ -141,7 +138,6 @@ public class ElementalBlast extends ArmorAbility {
} }
if (wandCls == null){ if (wandCls == null){
//TODO
return; return;
} }
@@ -397,6 +393,9 @@ public class ElementalBlast extends ArmorAbility {
Invisibility.dispel(); Invisibility.dispel();
hero.busy(); hero.busy();
armor.charge -= chargeUse(hero);
armor.updateQuickslot();
Sample.INSTANCE.play( Assets.Sounds.CHARGEUP ); Sample.INSTANCE.play( Assets.Sounds.CHARGEUP );
} }
@@ -34,7 +34,6 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile; import com.shatteredpixel.shatteredpixeldungeon.effects.MagicMissile;
import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing; import com.shatteredpixel.shatteredpixeldungeon.effects.Pushing;
import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor; import com.shatteredpixel.shatteredpixeldungeon.items.armor.ClassArmor;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.EtherealChains;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.TimekeepersHourglass;
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfTeleportation;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@@ -61,7 +60,7 @@ public class WarpBeacon extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
if (Dungeon.hero.buff(WarpBeaconTracker.class) == null if (Dungeon.hero.buff(WarpBeaconTracker.class) == null
&& Dungeon.hero.hasTalent(Talent.REMOTE_BEACON)){ && Dungeon.hero.hasTalent(Talent.REMOTE_BEACON)){
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
@@ -106,6 +105,9 @@ public class WarpBeacon extends ArmorAbility {
return; return;
} }
armor.charge -= chargeNeeded;
armor.updateQuickslot();
if (tracker.depth == Dungeon.depth){ if (tracker.depth == Dungeon.depth){
Char existing = Actor.findChar(tracker.pos); Char existing = Actor.findChar(tracker.pos);
@@ -46,7 +46,7 @@ public class WildMagic extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -99,6 +99,9 @@ public class WildMagic extends ArmorAbility {
Buff.affect(hero, WildMagicTracker.class, 0f); Buff.affect(hero, WildMagicTracker.class, 0f);
armor.charge -= chargeUse(hero);
armor.updateQuickslot();
zapWand(wands, hero, target); zapWand(wands, hero, target);
} }
@@ -42,7 +42,7 @@ import com.watabou.utils.Bundle;
public class DeathMark extends ArmorAbility { public class DeathMark extends ArmorAbility {
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -52,7 +52,7 @@ import com.watabou.utils.Random;
public class SmokeBomb extends ArmorAbility { public class SmokeBomb extends ArmorAbility {
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -62,7 +62,6 @@ public class Endure extends ArmorAbility {
hero.spendAndNext(3f); hero.spendAndNext(3f);
} }
//TODO visual buff stuff
public static class EndureTracker extends FlavourBuff { public static class EndureTracker extends FlavourBuff {
public boolean enduring; public boolean enduring;
@@ -46,7 +46,7 @@ public class HeroicLeap extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -51,7 +51,7 @@ public class Shockwave extends ArmorAbility {
} }
@Override @Override
protected String targetingPrompt() { public String targetingPrompt() {
return Messages.get(this, "prompt"); return Messages.get(this, "prompt");
} }
@@ -170,6 +170,7 @@ abstract public class ClassArmor extends Armor {
} else if (charge < hero.armorAbility.chargeUse(hero)) { } else if (charge < hero.armorAbility.chargeUse(hero)) {
GLog.w( Messages.get(this, "low_charge") ); GLog.w( Messages.get(this, "low_charge") );
} else { } else {
usesTargeting = hero.armorAbility.targetingPrompt() != null;
hero.armorAbility.use(this, hero); hero.armorAbility.use(this, hero);
} }