v0.9.4: refactored char interaction and fixed it reducing momentum.

This commit is contained in:
Evan Debenham 2021-07-05 19:13:38 -04:00
parent edfc73aed5
commit 853ecad6e6

View File

@ -47,6 +47,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hex;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Hunger;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LifeLink;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSleep;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Momentum;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Paralysis;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Poison;
@ -191,13 +192,13 @@ public abstract class Char extends Actor {
int curPos = pos;
//warp instantly with allies in this case
if (Dungeon.hero.hasTalent(Talent.ALLY_WARP)){
if (c == Dungeon.hero && Dungeon.hero.hasTalent(Talent.ALLY_WARP)){
PathFinder.buildDistanceMap(c.pos, BArray.or(Dungeon.level.passable, Dungeon.level.avoid, null));
if (PathFinder.distance[pos] == Integer.MAX_VALUE){
return true;
}
ScrollOfTeleportation.appear(this, Dungeon.hero.pos);
ScrollOfTeleportation.appear(Dungeon.hero, curPos);
ScrollOfTeleportation.appear(this, c.pos);
ScrollOfTeleportation.appear(c, curPos);
Dungeon.observe();
GameScene.updateFog();
return true;
@ -208,14 +209,21 @@ public abstract class Char extends Actor {
return true;
}
moveSprite( pos, Dungeon.hero.pos );
move( Dungeon.hero.pos );
moveSprite( pos, c.pos );
move( c.pos );
Dungeon.hero.sprite.move( Dungeon.hero.pos, curPos );
Dungeon.hero.move( curPos );
c.sprite.move( c.pos, curPos );
c.move( curPos );
Dungeon.hero.spend( 1 / Dungeon.hero.speed() );
Dungeon.hero.busy();
c.spend( 1 / c.speed() );
if (c == Dungeon.hero){
if (Dungeon.hero.subClass == HeroSubClass.FREERUNNER){
Buff.affect(Dungeon.hero, Momentum.class).gainStack();
}
Dungeon.hero.busy();
}
return true;
}