v3.0.0: added checks on castability for all unlockable spells
This commit is contained in:
@@ -56,6 +56,11 @@ public class AuraOfProtection extends ClericSpell {
|
||||
return 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.AURA_OF_PROTECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
|
||||
|
||||
@@ -53,6 +53,11 @@ public class BlessSpell extends TargetedClericSpell {
|
||||
return -1; //auto-targeting behaviour is often wrong, so we don't use it
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.BLESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
if (target == null){
|
||||
|
||||
@@ -21,7 +21,9 @@
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
@@ -40,6 +42,11 @@ public class BodyForm extends ClericSpell {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.BODY_FORM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
GLog.w("not implemented yet!");
|
||||
|
||||
@@ -61,6 +61,11 @@ public class Cleanse extends ClericSpell {
|
||||
return Messages.get(this, "desc", immunity, shield) + "\n\n" + Messages.get(this, "charge_cost", (int)chargeUse(Dungeon.hero));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.CLEANSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
|
||||
|
||||
@@ -204,6 +204,8 @@ public abstract class ClericSpell {
|
||||
spells.add(Radiance.INSTANCE);
|
||||
spells.add(Smite.INSTANCE);
|
||||
spells.add(LayOnHands.INSTANCE);
|
||||
spells.add(AuraOfProtection.INSTANCE);
|
||||
spells.add(WallOfLight.INSTANCE);
|
||||
spells.add(HolyLance.INSTANCE);
|
||||
spells.add(HallowedGround.INSTANCE);
|
||||
spells.add(MnemonicPrayer.INSTANCE);
|
||||
|
||||
@@ -54,6 +54,7 @@ public class DivineIntervention extends ClericSpell {
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero)
|
||||
&& hero.hasTalent(Talent.DIVINE_INTERVENTION)
|
||||
&& hero.buff(AscendedForm.AscendBuff.class) != null
|
||||
&& !hero.buff(AscendedForm.AscendBuff.class).divineInverventionCast;
|
||||
}
|
||||
|
||||
@@ -48,6 +48,11 @@ public class DivineSense extends ClericSpell {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.DIVINE_SENSE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
Buff.affect(hero, DivineSenseTracker.class, 30f);
|
||||
|
||||
@@ -51,7 +51,9 @@ public class Flash extends TargetedClericSpell {
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.buff(AscendedForm.AscendBuff.class) != null;
|
||||
return super.canCast(hero)
|
||||
&& hero.hasTalent(Talent.FLASH)
|
||||
&& hero.buff(AscendedForm.AscendBuff.class) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -73,6 +73,11 @@ public class HallowedGround extends TargetedClericSpell {
|
||||
return Ballistica.STOP_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.HALLOWED_GROUND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Identification;
|
||||
@@ -40,7 +41,7 @@ public class HolyIntuition extends InventoryClericSpell {
|
||||
|
||||
@Override
|
||||
public int icon() {
|
||||
return HeroIcon.DETECT_CURSE;
|
||||
return HeroIcon.HOLY_INTUITION;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -53,6 +54,11 @@ public class HolyIntuition extends InventoryClericSpell {
|
||||
return 4 - hero.pointsInTalent(Talent.HOLY_INTUITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.HOLY_INTUITION);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onItemSelected(HolyTome tome, Hero hero, Item item) {
|
||||
if (item == null){
|
||||
|
||||
@@ -65,7 +65,9 @@ public class HolyLance extends TargetedClericSpell {
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.buff(LanceCooldown.class) == null;
|
||||
return super.canCast(hero)
|
||||
&& hero.hasTalent(Talent.HOLY_LANCE)
|
||||
&& hero.buff(LanceCooldown.class) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,7 +52,9 @@ public class Judgement extends ClericSpell {
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.buff(AscendedForm.AscendBuff.class) != null;
|
||||
return super.canCast(hero)
|
||||
&& hero.hasTalent(Talent.JUDGEMENT)
|
||||
&& hero.buff(AscendedForm.AscendBuff.class) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,6 +56,11 @@ public class LayOnHands extends TargetedClericSpell {
|
||||
return -1; //auto-targeting behaviour is often wrong, so we don't use it
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.LAY_ON_HANDS);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
if (target == null) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
@@ -40,6 +41,11 @@ public class MindForm extends ClericSpell {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.MIND_FORM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
GLog.w("not implemented yet!");
|
||||
|
||||
@@ -74,6 +74,11 @@ public class MnemonicPrayer extends TargetedClericSpell {
|
||||
return Ballistica.STOP_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.MNEMONIC_PRAYER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Light;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
@@ -49,6 +50,11 @@ public class Radiance extends ClericSpell {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.subClass == HeroSubClass.PRIEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
|
||||
|
||||
@@ -119,7 +119,9 @@ public class RecallInscription extends ClericSpell {
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return hero.buff(UsedItemTracker.class) != null;
|
||||
return super.canCast(hero)
|
||||
&& hero.hasTalent(Talent.RECALL_INSCRIPTION)
|
||||
&& hero.buff(UsedItemTracker.class) != null;
|
||||
}
|
||||
|
||||
public static class UsedItemTracker extends FlavourBuff {
|
||||
|
||||
@@ -53,6 +53,11 @@ public class ShieldOfLight extends TargetedClericSpell {
|
||||
return Ballistica.STOP_TARGET;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.SHIELD_OF_LIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ 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.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator;
|
||||
@@ -59,6 +60,11 @@ public class Smite extends TargetedClericSpell {
|
||||
return 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.subClass == HeroSubClass.PALADIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
if (target == null) {
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
package com.shatteredpixel.shatteredpixeldungeon.actors.hero.spells;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HolyTome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
@@ -40,6 +41,11 @@ public class SpiritForm extends ClericSpell {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.SPIRIT_FORM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCast(HolyTome tome, Hero hero) {
|
||||
GLog.w("not implemented yet!");
|
||||
|
||||
@@ -59,6 +59,11 @@ public class Sunray extends TargetedClericSpell {
|
||||
return Messages.get(this, "desc", min, max, dur) + "\n\n" + Messages.get(this, "charge_cost", (int)chargeUse(Dungeon.hero));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.SUNRAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
if (target == null){
|
||||
|
||||
@@ -42,11 +42,21 @@ public class WallOfLight extends TargetedClericSpell {
|
||||
return Messages.get(this, "desc", 1 + 2*Dungeon.hero.pointsInTalent(Talent.WALL_OF_LIGHT)) + "\n\n" + Messages.get(this, "charge_cost", (int)chargeUse(Dungeon.hero));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int targetingFlags(){
|
||||
return -1; //auto-targeting behaviour is often wrong, so we don't use it
|
||||
}
|
||||
|
||||
@Override
|
||||
public float chargeUse(Hero hero) {
|
||||
return 3f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCast(Hero hero) {
|
||||
return super.canCast(hero) && hero.hasTalent(Talent.WALL_OF_LIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTargetSelected(HolyTome tome, Hero hero, Integer target) {
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class HeroIcon extends Image {
|
||||
public static final int GUIDING_LIGHT = 40;
|
||||
public static final int HOLY_WEAPON = 41;
|
||||
public static final int HOLY_WARD = 42;
|
||||
public static final int DETECT_CURSE = 43;
|
||||
public static final int HOLY_INTUITION = 43;
|
||||
public static final int SHIELD_OF_LIGHT = 44;
|
||||
public static final int RECALL_GLYPH = 45;
|
||||
public static final int SUNRAY = 46;
|
||||
|
||||
Reference in New Issue
Block a user