diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index 72014b68f..12b31cbc9 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -801,6 +801,10 @@ actors.hero.talent.strengthening_meal.desc=_+1:_ Eating food grants the Duelist actors.hero.talent.adventurers_intuition.title=adventurer's intuition actors.hero.talent.adventurers_intuition.desc=_+1:_ The Duelist identifies weapons _2.5x faster_ and armor _1.75x faster_.\n\n_+2:_ The Duelist identifies weapons _when she equips them_ and armor _2.5x faster_. +actors.hero.talent.aggressive_barrier.title=aggressive barrier +actors.hero.talent.aggressive_barrier.desc=_+1:_ The Duelist gain 2 shielding whenever she uses a weapon ability and is below _33% health._\n\n_+2:_ The Duelist gain 2 shielding whenever she uses a weapon ability and is below _50% health._ +actors.hero.talent.aggressive_barrier.meta_desc=_If this talent is gained by a different hero_ it will instead grant shielding when making a melee attack, with a 30 turn cooldown. + #universal actors.hero.talent.heroic_energy.title=heroic energy actors.hero.talent.heroic_energy.rat_title=ratroic energy diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index bcb9e029e..10c543ac4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -38,6 +38,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AnkhInvulnerability import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.AscensionChallenge; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barkskin; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Berserk; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bless; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; @@ -1160,7 +1161,14 @@ public class Hero extends Char { enemy = action.target; if (enemy.isAlive() && canAttack( enemy ) && !isCharmedBy( enemy ) && enemy.invisible == 0) { - + + if (heroClass != HeroClass.DUELIST + && hasTalent(Talent.AGGRESSIVE_BARRIER) + && buff(Talent.AggressiveBarrierCooldown.class) == null + && (HP / (float)HT) < 0.167f*(1+pointsInTalent(Talent.AGGRESSIVE_BARRIER))){ + Buff.affect(this, Barrier.class).setShield(2); + Buff.affect(this, Talent.AggressiveBarrierCooldown.class, 30f); + } sprite.attack( enemy.pos ); return false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java index 52fad4320..d4c9207cc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Talent.java @@ -147,7 +147,7 @@ public enum Talent { EAGLE_EYE(119, 4), GO_FOR_THE_EYES(120, 4), SWIFT_SPIRIT(121, 4), //Duelist T1 - STRENGTHENING_MEAL(128), ADVENTURERS_INTUITION(129), DUELIST_T1_3(130), DUELIST_T1_4(131), + STRENGTHENING_MEAL(128), ADVENTURERS_INTUITION(129), DUELIST_T1_3(130), AGGRESSIVE_BARRIER(131), //Duelist T2 DUELIST_T2_1(132), DUELIST_T2_2(133), DUELIST_T2_3(134), DUELIST_T2_4(135), DUELIST_T2_5(136), //Duelist T3 @@ -227,6 +227,7 @@ public enum Talent { public float iconFadePercent() { return Math.max(0, visualcooldown() / 20); } }; public static class SpiritBladesTracker extends FlavourBuff{}; + public static class AggressiveBarrierCooldown extends FlavourBuff{}; int icon; int maxPoints; @@ -594,7 +595,7 @@ public enum Talent { Collections.addAll(tierTalents, NATURES_BOUNTY, SURVIVALISTS_INTUITION, FOLLOWUP_STRIKE, NATURES_AID); break; case DUELIST: - Collections.addAll(tierTalents, STRENGTHENING_MEAL, ADVENTURERS_INTUITION, DUELIST_T1_3, DUELIST_T1_4); + Collections.addAll(tierTalents, STRENGTHENING_MEAL, ADVENTURERS_INTUITION, DUELIST_T1_3, AGGRESSIVE_BARRIER); break; } for (Talent talent : tierTalents){ diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java index bddc420ad..554199611 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/quest/Pickaxe.java @@ -36,10 +36,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Spinner; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Swarm; import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; -import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.MeleeWeapon; -import com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.RunicBlade; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -204,13 +201,13 @@ public class Pickaxe extends MeleeWeapon { || enemy instanceof Scorpio) { damageMulti = 2f; } + onAbilityUsed(hero); if (hero.attack(enemy, damageMulti, 0, Char.INFINITE_ACCURACY)) { if (enemy.isAlive()) { Buff.affect(enemy, Vulnerable.class, 3f); } Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } - onAbilityUsed(hero); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Dagger.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Dagger.java index c614bbea6..e07d48170 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Dagger.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Dagger.java @@ -37,7 +37,6 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; -import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; import com.watabou.utils.Random; @@ -111,9 +110,9 @@ public class Dagger extends MeleeWeapon { return; } + wep.onAbilityUsed(hero); Buff.affect(hero, Invisibility.class, Math.max(1, 1/hero.speed())); hero.spendAndNext(1/hero.speed()); - wep.onAbilityUsed(hero); Dungeon.hero.sprite.turnTo( Dungeon.hero.pos, target); Dungeon.hero.pos = target; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greataxe.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greataxe.java index a1cba0702..6604268c8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greataxe.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Greataxe.java @@ -25,7 +25,6 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; @@ -79,10 +78,10 @@ public class Greataxe extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { + onAbilityUsed(hero); if (hero.attack(enemy, 1.5f, 0, Char.INFINITE_ACCURACY)){ Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } - onAbilityUsed(hero); hero.spendAndNext(2*hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java index 540c3b3ea..be9b9bbf8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Mace.java @@ -80,6 +80,7 @@ public class Mace extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { + wep.onAbilityUsed(hero); if (hero.attack(enemy, dmgMulti, 0, 0.25f)) { Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); if (enemy.isAlive()){ @@ -87,7 +88,6 @@ public class Mace extends MeleeWeapon { } } hero.spendAndNext(hero.attackDelay()); - wep.onAbilityUsed(hero); } }); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 23b6060c9..105ae6868 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -23,10 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Barrier; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; +import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.CellSelector; @@ -35,7 +37,6 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.utils.Bundle; import com.watabou.utils.Random; -import java.text.DecimalFormat; import java.util.ArrayList; public class MeleeWeapon extends Weapon { @@ -130,8 +131,15 @@ public class MeleeWeapon extends Weapon { //TODO make abstract protected void duelistAbility( Hero hero, Integer target ){} - protected void onAbilityUsed( Hero hero ){ + protected void onAbilityUsed(Hero hero ){ Buff.affect(hero, Charger.class).charges -= abilityChargeUse(); + + if (hero.heroClass == HeroClass.DUELIST + && hero.hasTalent(Talent.AGGRESSIVE_BARRIER) + && (hero.HP / (float)hero.HT) < 0.167f*(1+hero.pointsInTalent(Talent.AGGRESSIVE_BARRIER))){ + Buff.affect(hero, Barrier.class).setShield(2); + } + updateQuickslot(); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java index d19e3798a..df41e7647 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Rapier.java @@ -109,10 +109,10 @@ public class Rapier extends MeleeWeapon { @Override public void call() { //+3+lvl damage, equivalent to +67% damage, but more consistent + onAbilityUsed(hero); if (hero.attack(enemy, 1f, augment.damageFactor(3 + level()), Char.INFINITE_ACCURACY)){ Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } - onAbilityUsed(hero); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java index d796f360f..83693f950 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RoundShield.java @@ -67,9 +67,9 @@ public class RoundShield extends MeleeWeapon { } public static void guardAbility(Hero hero, int duration, MeleeWeapon wep){ + wep.onAbilityUsed(hero); Buff.affect(hero, GuardTracker.class, duration); hero.sprite.operate(hero.pos); - wep.onAbilityUsed(hero); hero.spendAndNext(Actor.TICK); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java index 6aab6d03e..a3ac3c161 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/RunicBlade.java @@ -81,11 +81,11 @@ public class RunicBlade extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { + onAbilityUsed(hero); if (hero.attack(enemy, 1f, 0, Char.INFINITE_ACCURACY)){ Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } tracker.detach(); - onAbilityUsed(hero); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java index 8f14d716e..61d169d67 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sai.java @@ -30,12 +30,10 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.FlavourBuff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; -import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; -import java.util.ArrayList; import java.util.HashSet; public class Sai extends MeleeWeapon { @@ -84,8 +82,8 @@ public class Sai extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { - boolean hit = hero.attack(enemy, 1, 0, Char.INFINITE_ACCURACY); wep.onAbilityUsed(hero); + boolean hit = hero.attack(enemy, 1, 0, Char.INFINITE_ACCURACY); HashSet buffs = hero.buffs(ComboStrikeTracker.class); int recentHits = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java index b8f967d91..e0a9a2553 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Spear.java @@ -25,11 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.Vertigo; -import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Vulnerable; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.items.wands.WandOfBlastWave; import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -85,7 +81,7 @@ public class Spear extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { - + wep.onAbilityUsed(hero); if (hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY)) { if (enemy.isAlive()){ //trace a ballistica to our target (which will also extend past them @@ -97,7 +93,6 @@ public class Spear extends MeleeWeapon { } Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } - wep.onAbilityUsed(hero); hero.spendAndNext(hero.attackDelay()); } }); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sword.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sword.java index 2cd3e050d..9e5ded61c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sword.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Sword.java @@ -79,10 +79,10 @@ public class Sword extends MeleeWeapon { hero.sprite.attack(enemy.pos, new Callback() { @Override public void call() { + wep.onAbilityUsed(hero); if (hero.attack(enemy, dmgMulti, 0, Char.INFINITE_ACCURACY)){ Sample.INSTANCE.play(Assets.Sounds.HIT_STRONG); } - wep.onAbilityUsed(hero); if (!enemy.isAlive()){ hero.next(); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java index 1d2723c11..d9d1b2882 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/Whip.java @@ -25,13 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets; 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.Vulnerable; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import java.util.ArrayList; @@ -76,11 +73,11 @@ public class Whip extends MeleeWeapon { hero.sprite.attack(hero.pos, new Callback() { @Override public void call() { + onAbilityUsed(hero); for (Char ch : targets) { hero.attack(ch); } hero.spendAndNext(hero.attackDelay()); - onAbilityUsed(hero); } }); }