v0.9.1b: code improvements to timing when blobs are added

This commit is contained in:
Evan Debenham
2020-12-28 18:22:58 -05:00
parent 9a27edf1e4
commit 2feeaad42a
5 changed files with 9 additions and 5 deletions

View File

@@ -118,6 +118,7 @@ public abstract class Actor implements Bundlable {
// **********************
// *** Static members ***
// **********************
private static HashSet<Actor> all = new HashSet<>();
private static HashSet<Char> chars = new HashSet<>();
@@ -203,6 +204,10 @@ public abstract class Actor implements Bundlable {
public static boolean processing(){
return current != null;
}
public static int curActorPriority() {
return current != null ? current.actPriority : DEFAULT;
}
public static boolean keepActorThreadAlive = true;

View File

@@ -234,6 +234,10 @@ public class Blob extends Actor {
if (gas == null) {
gas = Reflection.newInstance(type);
//this ensures that gasses do not get an 'extra turn' if they are added by a mob or buff
if (Actor.curActorPriority() < gas.actPriority) {
gas.spend(1f);
}
}
if (gas != null){

View File

@@ -106,9 +106,6 @@ public class DM200 extends Mob {
@Override
protected boolean act() {
//ensures toxic gas acts at the appropriate time when added
//TODO we have this check in 2 places now, can we just ensure that blobs spend an extra turn when added?
GameScene.add(Blob.seed(pos, 0, ToxicGas.class));
ventCooldown--;
return super.act();
}

View File

@@ -63,7 +63,6 @@ public class DM201 extends DM200 {
Dungeon.level.updateFieldOfView( this, fieldOfView );
}
GameScene.add(Blob.seed(pos, 0, CorrosiveGas.class));
if (paralysed <= 0 && state == HUNTING && enemy != null && enemySeen
&& threatened && !Dungeon.level.adjacent(pos, enemy.pos) && fieldOfView[enemy.pos]){
enemySeen = enemy.isAlive() && fieldOfView[enemy.pos] && enemy.invisible <= 0;

View File

@@ -153,7 +153,6 @@ public class NewDM300 extends Mob {
@Override
protected boolean act() {
GameScene.add(Blob.seed(pos, 0, FallingRocks.class));
GameScene.add(Blob.seed(pos, 0, ToxicGas.class));
//ability logic only triggers if DM is not supercharged
if (!supercharged){