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 9fe0898ed..fe654e5b5 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 @@ -744,6 +744,7 @@ public class Hero extends Char { damageInterrupt = true; waitOrPickup = false; ready = true; + canSelfTrample = true; AttackIndicator.updateState(); @@ -767,18 +768,26 @@ public class Hero extends Char { next(); } - public boolean isStandingOnTrampleableGrass(){ - return !rooted && !flying && - (Dungeon.level.map[pos] == Terrain.HIGH_GRASS || (heroClass != HeroClass.HUNTRESS && Dungeon.level.map[pos] == Terrain.FURROWED_GRASS)); + private boolean canSelfTrample = false; + public boolean canSelfTrample(){ + return canSelfTrample && !rooted && !flying && + //standing in high grass + (Dungeon.level.map[pos] == Terrain.HIGH_GRASS || + //standing in furrowed grass and not huntress + (heroClass != HeroClass.HUNTRESS && Dungeon.level.map[pos] == Terrain.FURROWED_GRASS) || + //standing on a plant + Dungeon.level.plants.get(pos) != null); } private boolean actMove( HeroAction.Move action ) { if (getCloser( action.dst )) { + canSelfTrample = false; return true; //Hero moves in place if there is grass to trample - } else if (isStandingOnTrampleableGrass()){ + } else if (canSelfTrample()){ + canSelfTrample = false; Dungeon.level.pressCell(pos); spendAndNext( 1 / speed() ); return false; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java index dfdf4279d..e15b84876 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/Toolbar.java @@ -252,7 +252,7 @@ public class Toolbar extends Component { protected void onClick() { if (Dungeon.hero.ready && !GameScene.cancel()) { Dungeon.hero.waitOrPickup = true; - if ((Dungeon.level.heaps.get(Dungeon.hero.pos) != null || Dungeon.hero.isStandingOnTrampleableGrass()) + if ((Dungeon.level.heaps.get(Dungeon.hero.pos) != null || Dungeon.hero.canSelfTrample()) && Dungeon.hero.handle(Dungeon.hero.pos)){ //trigger hold fast here, even if the hero didn't specifically wait if (Dungeon.hero.hasTalent(Talent.HOLD_FAST)){