v2.0.0: improved self-step logic to work with plants
This commit is contained in:
@@ -744,6 +744,7 @@ public class Hero extends Char {
|
|||||||
damageInterrupt = true;
|
damageInterrupt = true;
|
||||||
waitOrPickup = false;
|
waitOrPickup = false;
|
||||||
ready = true;
|
ready = true;
|
||||||
|
canSelfTrample = true;
|
||||||
|
|
||||||
AttackIndicator.updateState();
|
AttackIndicator.updateState();
|
||||||
|
|
||||||
@@ -767,18 +768,26 @@ public class Hero extends Char {
|
|||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStandingOnTrampleableGrass(){
|
private boolean canSelfTrample = false;
|
||||||
return !rooted && !flying &&
|
public boolean canSelfTrample(){
|
||||||
(Dungeon.level.map[pos] == Terrain.HIGH_GRASS || (heroClass != HeroClass.HUNTRESS && Dungeon.level.map[pos] == Terrain.FURROWED_GRASS));
|
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 ) {
|
private boolean actMove( HeroAction.Move action ) {
|
||||||
|
|
||||||
if (getCloser( action.dst )) {
|
if (getCloser( action.dst )) {
|
||||||
|
canSelfTrample = false;
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//Hero moves in place if there is grass to trample
|
//Hero moves in place if there is grass to trample
|
||||||
} else if (isStandingOnTrampleableGrass()){
|
} else if (canSelfTrample()){
|
||||||
|
canSelfTrample = false;
|
||||||
Dungeon.level.pressCell(pos);
|
Dungeon.level.pressCell(pos);
|
||||||
spendAndNext( 1 / speed() );
|
spendAndNext( 1 / speed() );
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ public class Toolbar extends Component {
|
|||||||
protected void onClick() {
|
protected void onClick() {
|
||||||
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
if (Dungeon.hero.ready && !GameScene.cancel()) {
|
||||||
Dungeon.hero.waitOrPickup = true;
|
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)){
|
&& Dungeon.hero.handle(Dungeon.hero.pos)){
|
||||||
//trigger hold fast here, even if the hero didn't specifically wait
|
//trigger hold fast here, even if the hero didn't specifically wait
|
||||||
if (Dungeon.hero.hasTalent(Talent.HOLD_FAST)){
|
if (Dungeon.hero.hasTalent(Talent.HOLD_FAST)){
|
||||||
|
|||||||
Reference in New Issue
Block a user