v1.4.0: waiting now always takes exactly 1 turn, regardless of speed mod

This commit is contained in:
Evan Debenham
2022-08-02 13:13:28 -04:00
parent adc33890f8
commit 630bc0291d
2 changed files with 18 additions and 7 deletions

View File

@@ -54,8 +54,9 @@ public abstract class Actor implements Bundlable {
protected int actPriority = DEFAULT;
protected abstract boolean act();
protected void spend( float time ) {
//Always spends exactly one tick, regardless of time-influencing factors
protected final void spendConstant( float time ){
this.time += time;
//if time is very close to a whole number, round to a whole number to fix errors
float ex = Math.abs(this.time % 1f);
@@ -64,6 +65,11 @@ public abstract class Actor implements Bundlable {
}
}
//can be overridden for time to be affected by various factors
protected void spend( float time ) {
spendConstant( time );
}
public void spendToWhole(){
time = (float)Math.ceil(time);
}

View File

@@ -641,7 +641,13 @@ public class Hero extends Char {
super.spend(time);
}
public void spendAndNextConstant( float time ) {
busy();
spendConstant( time );
next();
}
public void spendAndNext( float time ) {
busy();
spend( time );
@@ -683,7 +689,7 @@ public class Hero extends Char {
if (curAction == null) {
if (resting) {
spend( TIME_TO_REST );
spendConstant( TIME_TO_REST );
next();
} else {
ready();
@@ -893,9 +899,8 @@ public class Hero extends Char {
curAction = null;
} else {
//
if (waitOrPickup) {
spendAndNext(TIME_TO_REST);
spendAndNextConstant(TIME_TO_REST);
//allow the hero to move between levels even if they can't collect the item
} else if (Dungeon.level.getTransition(pos) != null){
@@ -1140,7 +1145,7 @@ public class Hero extends Char {
}
public void rest( boolean fullRest ) {
spendAndNext( TIME_TO_REST );
spendAndNextConstant( TIME_TO_REST );
if (!fullRest) {
if (hasTalent(Talent.HOLD_FAST)){
Buff.affect(this, HoldFast.class);