v2.0.0: backup barrier now triggers before wand zaps resolve

This commit is contained in:
Evan Debenham
2022-11-02 17:26:52 -04:00
parent 3a2b427f97
commit 8f6d31d113
3 changed files with 34 additions and 29 deletions

View File

@@ -140,7 +140,7 @@ public abstract class Wand extends Item {
return false;
}
if ( curCharges >= (cursed ? 1 : chargesPerCast())){
if ( curCharges >= chargesPerCast()){
return true;
} else {
GLog.w(Messages.get(this, "fizzles"));
@@ -421,34 +421,13 @@ public abstract class Wand extends Item {
}
}
if (charger != null
&& charger.target == Dungeon.hero){
//If hero owns wand but it isn't in belongings it must be in the staff
if (Dungeon.hero.hasTalent(Talent.EMPOWERED_STRIKE)
&& charger != null && charger.target == Dungeon.hero
&& !Dungeon.hero.belongings.contains(this)){
//if the wand is owned by the hero, but not in their inventory, it must be in the staff
if (!Dungeon.hero.belongings.contains(this)) {
if (curCharges == 0 && Dungeon.hero.hasTalent(Talent.BACKUP_BARRIER)) {
//grants 3/5 shielding
Buff.affect(Dungeon.hero, Barrier.class).setShield(1 + 2 * Dungeon.hero.pointsInTalent(Talent.BACKUP_BARRIER));
}
if (Dungeon.hero.hasTalent(Talent.EMPOWERED_STRIKE)) {
Buff.prolong(Dungeon.hero, Talent.EmpoweredStrikeTracker.class, 10f);
}
Buff.prolong(Dungeon.hero, Talent.EmpoweredStrikeTracker.class, 10f);
//otherwise process logic for metamorphed backup barrier
} else if (curCharges == 0
&& Dungeon.hero.heroClass != HeroClass.MAGE
&& Dungeon.hero.hasTalent(Talent.BACKUP_BARRIER)){
boolean highest = true;
for (Item i : Dungeon.hero.belongings.getAllItems(Wand.class)){
if (i.level() > level()){
highest = false;
}
}
if (highest){
//grants 3/5 shielding
Buff.affect(Dungeon.hero, Barrier.class).setShield(1 + 2 * Dungeon.hero.pointsInTalent(Talent.BACKUP_BARRIER));
}
}
}
Invisibility.dispel();
updateQuickslot();
@@ -620,6 +599,32 @@ public abstract class Wand extends Item {
if (curWand.tryToZap(curUser, target)) {
curUser.busy();
//backup barrier logic
//This triggers before the wand zap, mostly so the barrier helps vs skeletons
if (curUser.hasTalent(Talent.BACKUP_BARRIER)
&& curWand.curCharges == curWand.chargesPerCast()
&& curWand.charger != null && curWand.charger.target == curUser){
//regular. If hero owns wand but it isn't in belongings it must be in the staff
if (curUser.heroClass == HeroClass.MAGE && !curUser.belongings.contains(curWand)){
//grants 3/5 shielding
Buff.affect(Dungeon.hero, Barrier.class).setShield(1 + 2 * Dungeon.hero.pointsInTalent(Talent.BACKUP_BARRIER));
//metamorphed. Triggers if wand is highest level hero has
} else if (curUser.heroClass != HeroClass.MAGE) {
boolean highest = true;
for (Item i : curUser.belongings.getAllItems(Wand.class)){
if (i.level() > curWand.level()){
highest = false;
}
}
if (highest){
//grants 3/5 shielding
Buff.affect(Dungeon.hero, Barrier.class).setShield(1 + 2 * Dungeon.hero.pointsInTalent(Talent.BACKUP_BARRIER));
}
}
}
if (curWand.cursed){
if (!curWand.cursedKnown){

View File

@@ -190,7 +190,7 @@ public class WandOfFireblast extends DamageWand {
@Override
protected int chargesPerCast() {
if (charger != null && charger.target.buff(WildMagic.WildMagicTracker.class) != null){
if (cursed || charger != null && charger.target.buff(WildMagic.WildMagicTracker.class) != null){
return 1;
}
//consumes 30% of current charges, rounded up, with a min of 1 and a max of 3.

View File

@@ -277,7 +277,7 @@ public class WandOfRegrowth extends Wand {
@Override
protected int chargesPerCast() {
if (charger != null && charger.target.buff(WildMagic.WildMagicTracker.class) != null){
if (cursed || charger != null && charger.target.buff(WildMagic.WildMagicTracker.class) != null){
return 1;
}
//consumes 30% of current charges, rounded up, with a min of 1 and a max of 3.