From 448c170123a895c2dbb79ace5a512b5923755889 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sat, 13 Feb 2021 17:26:49 -0500 Subject: [PATCH] v0.9.2: implemented the hold fast talent --- .../assets/messages/actors/actors.properties | 2 ++ .../shatteredpixeldungeon/actors/hero/Hero.java | 13 +++++++++++-- .../actors/hero/Talent.java | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index d73add5e9..a093075fb 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -334,6 +334,8 @@ actors.hero.talent.lethal_momentum.title=lethal momentum actors.hero.talent.lethal_momentum.desc=_+1:_ When the Warrior lands a killing blow with a physical weapon, it has a _67% chance_ to take 0 turns.\n\n_+2:_ When the Warrior lands a killing blow with a physical weapon, it has a _100% chance_ to take 0 turns. actors.hero.talent.improvised_projectiles.title=improvised projectiles actors.hero.talent.improvised_projectiles.desc=_+1:_ The Warrior can blind an enemy for _2 turns_ by throwing any item that isn’t a thrown weapon at them. This has a 30 turn cooldown.\n\n_+2:_ The Warrior can blind an enemy for _3 turns_ by throwing any item that isn’t a thrown weapon at them. This has a 30 turn cooldown. +actors.hero.talent.hold_fast.title=hold fast +actors.hero.talent.hold_fast.desc=_+1:_ When the warrior waits he gains _+2 armor_ until he moves.\n\n_+2:_ When the warrior waits he gains _+4 armor_ until he moves.\n\n_+3:_ When the warrior waits he gains _+6 armor_ until he moves. actors.hero.talent.strongman.title=strongman actors.hero.talent.strongman.desc=_+1:_ The Warrior needs _1 less strength_ to use armor.\n\n_+2:_ The Warrior needs _1 less strength_ to use armor and _1 less strength_ to use weapons.\n\n_+3:_ The Warrior needs _2 less strength_ to use armor and _1 less strength_ to use weapons. actors.hero.talent.endless_rage.title=endless rage 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 36dcf073d..76faf31da 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 @@ -470,6 +470,10 @@ public class Hero extends Char { Blocking.BlockBuff block = buff(Blocking.BlockBuff.class); if (block != null) dr += block.blockingRoll(); + + if (buff(Talent.HoldFastTracker.class) != null){ + dr += Random.NormalIntRange(0, 2*pointsInTalent(Talent.HOLD_FAST)); + } return dr; } @@ -1061,8 +1065,13 @@ public class Hero extends Char { public void rest( boolean fullRest ) { spendAndNext( TIME_TO_REST ); - if (!fullRest && sprite != null) { - sprite.showStatus( CharSprite.DEFAULT, Messages.get(this, "wait") ); + if (!fullRest) { + if (hasTalent(Talent.HOLD_FAST)){ + Buff.affect(this, Talent.HoldFastTracker.class); + } + if (sprite != null) { + sprite.showStatus(CharSprite.DEFAULT, Messages.get(this, "wait")); + } } resting = fullRest; } 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 eda98f95d..c93a0b53b 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 @@ -71,7 +71,7 @@ public enum Talent { //Warrior T2 IRON_STOMACH(4), RESTORED_WILLPOWER(5), RUNIC_TRANSFERENCE(6), LETHAL_MOMENTUM(7), IMPROVISED_PROJECTILES(8), //Warrior T3 - WARRIOR_T3_1(9, 3), STRONGMAN(10, 3), + HOLD_FAST(9, 3), STRONGMAN(10, 3), //Berserker T3 ENDLESS_RAGE(11, 3), BERSERKING_STAMINA(12, 3), ENRAGED_CATALYST(13, 3), //Gladiator T3 @@ -112,6 +112,19 @@ public enum Talent { public static class ImprovisedProjectileCooldown extends FlavourBuff{}; public static class LethalMomentumTracker extends FlavourBuff{}; + public static class HoldFastTracker extends Buff{ + public int pos = -1; + @Override + public boolean act() { + if (pos == -1) pos = target.pos; + if (pos != target.pos) { + detach(); + } else { + spend(TICK); + } + return true; + } + } public static class WandPreservationCounter extends CounterBuff{}; public static class EmpoweringScrollsTracker extends FlavourBuff{ @Override @@ -428,7 +441,7 @@ public enum Talent { //tier 3 switch (cls){ case WARRIOR: default: - Collections.addAll(tierTalents, WARRIOR_T3_1, STRONGMAN); + Collections.addAll(tierTalents, HOLD_FAST, STRONGMAN); break; case MAGE: Collections.addAll(tierTalents, EMPOWERING_SCROLLS, MAGE_T3_2);