v0.9.1b: code improvements to timing when blobs are added
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user