From 70f5b796e016770c76b5a62bbb3c36c2307db801 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Fri, 9 Jun 2023 12:27:33 -0400 Subject: [PATCH] v2.1.1: big consistency pass on rooted. Now prevents dash, blink, & leap --- core/src/main/assets/messages/actors/actors.properties | 2 +- .../shatteredpixeldungeon/actors/buffs/Combo.java | 4 ++++ .../shatteredpixeldungeon/actors/buffs/MonkEnergy.java | 7 +++++++ .../shatteredpixeldungeon/actors/buffs/Preparation.java | 2 ++ .../actors/hero/abilities/duelist/Challenge.java | 5 ++++- .../actors/hero/abilities/duelist/Feint.java | 7 +++++++ .../actors/hero/abilities/rogue/SmokeBomb.java | 8 +++++++- .../actors/hero/abilities/warrior/HeroicLeap.java | 5 +++++ .../shatteredpixeldungeon/actors/mobs/Succubus.java | 2 +- .../items/artifacts/EtherealChains.java | 2 ++ .../shatteredpixeldungeon/items/weapon/melee/Rapier.java | 2 ++ 11 files changed, 42 insertions(+), 4 deletions(-) diff --git a/core/src/main/assets/messages/actors/actors.properties b/core/src/main/assets/messages/actors/actors.properties index a76af1fa7..d4162e59b 100644 --- a/core/src/main/assets/messages/actors/actors.properties +++ b/core/src/main/assets/messages/actors/actors.properties @@ -347,7 +347,7 @@ actors.buffs.revealedchar.desc=This character is revealed to the hero, They will actors.buffs.roots.name=rooted actors.buffs.roots.heromsg=You can't move! -actors.buffs.roots.desc=Roots (magical or natural) grab at the feet, forcing them down to the ground.\n\nRoots lock a target in place, making it impossible for them to move, but other actions are not affected.\n\nTurns of root remaining: %s. +actors.buffs.roots.desc=Roots (magical or natural) grab at the feet, forcing them down to the ground.\n\nRoots lock a target in place, making movement and most movement abilities impossible. Other actions are not affected, including teleportation effects.\n\nTurns of root remaining: %s. actors.buffs.scrollempower.name=scroll empower actors.buffs.scrollempower.desc=The energy from the Mage's recently read scroll is empowering his wands!\n\nLevel Boost: +%1$d.\nZaps remaining: %2$d. diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java index 0581b5a51..ba17e07bc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Combo.java @@ -45,6 +45,7 @@ import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndCombo; import com.watabou.noosa.BitmapText; +import com.watabou.noosa.Camera; import com.watabou.noosa.Image; import com.watabou.noosa.Visual; import com.watabou.noosa.audio.Sample; @@ -473,6 +474,9 @@ public class Combo extends Buff implements ActionIndicator.Action { final int leapPos = c.path.get(c.dist-1); if (!Dungeon.level.passable[leapPos]){ GLog.w(Messages.get(Combo.class, "bad_target")); + } else if (Dungeon.hero.rooted) { + Camera.main.shake( 1, 1f ); + GLog.w(Messages.get(Combo.class, "bad_target")); } else { Dungeon.hero.busy(); target.sprite.jump(target.pos, leapPos, new Callback() { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java index 37de90d3d..49bf1769d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/MonkEnergy.java @@ -50,6 +50,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.windows.WndMonkAbilities; import com.watabou.noosa.BitmapText; +import com.watabou.noosa.Camera; import com.watabou.noosa.Image; import com.watabou.noosa.Visual; import com.watabou.noosa.audio.Sample; @@ -480,6 +481,12 @@ public class MonkEnergy extends Buff implements ActionIndicator.Action { range += 3; } + if (Dungeon.hero.rooted){ + Camera.main.shake( 1, 1f ); + GLog.w(Messages.get(MeleeWeapon.class, "ability_bad_position")); + return; + } + if (Dungeon.level.distance(hero.pos, target) > range){ GLog.w(Messages.get(MeleeWeapon.class, "ability_bad_position")); return; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java index e385025db..c3e1940b4 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/Preparation.java @@ -41,6 +41,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.watabou.noosa.BitmapText; +import com.watabou.noosa.Camera; import com.watabou.noosa.Image; import com.watabou.noosa.Visual; import com.watabou.noosa.audio.Sample; @@ -305,6 +306,7 @@ public class Preparation extends Buff implements ActionIndicator.Action { if (dest == -1 || PathFinder.distance[dest] == Integer.MAX_VALUE || Dungeon.hero.rooted){ GLog.w(Messages.get(Preparation.class, "out_of_reach")); + if (Dungeon.hero.rooted) Camera.main.shake( 1, 1f ); return; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java index 8a02a1fdd..355270950 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Challenge.java @@ -46,6 +46,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator; import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Camera; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Bundle; import com.watabou.utils.PathFinder; @@ -111,7 +112,7 @@ public class Challenge extends ArmorAbility { int[] reachable = PathFinder.distance.clone(); int blinkpos = hero.pos; - if (hero.hasTalent(Talent.CLOSE_THE_GAP)){ + if (hero.hasTalent(Talent.CLOSE_THE_GAP) && !hero.rooted){ int blinkrange = 1 + hero.pointsInTalent(Talent.CLOSE_THE_GAP); PathFinder.buildDistanceMap(hero.pos, BArray.not(Dungeon.level.solid,null), blinkrange); @@ -135,11 +136,13 @@ public class Challenge extends ArmorAbility { if (PathFinder.distance[blinkpos] == Integer.MAX_VALUE){ GLog.w(Messages.get(this, "unreachable_target")); + if (hero.rooted) Camera.main.shake( 1, 1f ); return; } if (Dungeon.level.distance(blinkpos, targetCh.pos) > 5){ GLog.w(Messages.get(this, "distant_target")); + if (hero.rooted) Camera.main.shake( 1, 1f ); return; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Feint.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Feint.java index fc08e5df4..a5f834c5f 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Feint.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/duelist/Feint.java @@ -46,6 +46,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.MirrorSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; import com.shatteredpixel.shatteredpixeldungeon.ui.TargetHealthIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Camera; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.noosa.tweeners.Delayer; @@ -83,6 +84,12 @@ public class Feint extends ArmorAbility { return; } + if (Dungeon.hero.rooted){ + Camera.main.shake( 1, 1f ); + GLog.w(Messages.get(this, "bad_location")); + return; + } + if (!Dungeon.level.passable[target] || Actor.findChar(target) != null){ GLog.w(Messages.get(this, "bad_location")); return; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/SmokeBomb.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/SmokeBomb.java index 085018e99..96f969344 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/SmokeBomb.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/rogue/SmokeBomb.java @@ -51,6 +51,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.MobSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.HeroIcon; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Camera; import com.watabou.noosa.TextureFilm; import com.watabou.noosa.audio.Sample; import com.watabou.utils.PathFinder; @@ -86,11 +87,16 @@ public class SmokeBomb extends ArmorAbility { protected void activate(ClassArmor armor, Hero hero, Integer target) { if (target != null) { + if (target != hero.pos && hero.rooted){ + Camera.main.shake( 1, 1f ); + return; + } + PathFinder.buildDistanceMap(hero.pos, BArray.not(Dungeon.level.solid,null), 6); if ( PathFinder.distance[target] == Integer.MAX_VALUE || !Dungeon.level.heroFOV[target] || - Actor.findChar( target ) != null) { + (target != hero.pos && Actor.findChar( target ) != null)) { GLog.w( Messages.get(this, "fov") ); return; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/warrior/HeroicLeap.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/warrior/HeroicLeap.java index 31058107b..90825de95 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/warrior/HeroicLeap.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/abilities/warrior/HeroicLeap.java @@ -67,6 +67,11 @@ public class HeroicLeap extends ArmorAbility { public void activate( ClassArmor armor, Hero hero, Integer target ) { if (target != null) { + if (hero.rooted){ + Camera.main.shake( 1, 1f ); + return; + } + Ballistica route = new Ballistica(hero.pos, target, Ballistica.STOP_TARGET | Ballistica.STOP_SOLID); int cell = route.collisionPos; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java index aad7ef0d5..58d4b66ea 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Succubus.java @@ -102,7 +102,7 @@ public class Succubus extends Mob { @Override protected boolean getCloser( int target ) { - if (fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && blinkCooldown <= 0) { + if (fieldOfView[target] && Dungeon.level.distance( pos, target ) > 2 && blinkCooldown <= 0 && !rooted) { if (blink( target )) { spend(-1 / speed()); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java index 9b3515d75..eb92cc4b2 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/EtherealChains.java @@ -44,6 +44,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.tiles.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.utils.BArray; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Camera; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; @@ -206,6 +207,7 @@ public class EtherealChains extends Artifact { //don't pull if rooted if (hero.rooted){ + Camera.main.shake( 1, 1f ); GLog.w( Messages.get(EtherealChains.class, "rooted") ); return; } 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 5df87b7ff..55d06c61e 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 @@ -33,6 +33,7 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.AttackIndicator; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; +import com.watabou.noosa.Camera; import com.watabou.noosa.audio.Sample; import com.watabou.utils.Callback; import com.watabou.utils.PathFinder; @@ -89,6 +90,7 @@ public class Rapier extends MeleeWeapon { if (hero.rooted || Dungeon.level.distance(hero.pos, target) < 2 || Dungeon.level.distance(hero.pos, target)-1 > wep.reachFactor(hero)){ GLog.w(Messages.get(wep, "ability_bad_position")); + if (hero.rooted) Camera.main.shake( 1, 1f ); return; }