v2.5.1: fixed rare crashes when censor had no cells to spawn gas in
This commit is contained in:
+10
-4
@@ -139,12 +139,13 @@ public class ChaoticCenser extends Trinket {
|
||||
}
|
||||
|
||||
if (Random.Float() < triggerChance){
|
||||
produceGas();
|
||||
if (produceGas()) {
|
||||
Sample.INSTANCE.play(Assets.Sounds.GAS);
|
||||
Dungeon.hero.interrupt();
|
||||
left += Random.IntRange((int) (avgTurns * 0.9f), (int) (avgTurns * 1.1f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//buff ticks an average of every 5 turns
|
||||
int delay = Random.NormalIntRange(2, 8);
|
||||
@@ -175,11 +176,11 @@ public class ChaoticCenser extends Trinket {
|
||||
}
|
||||
}
|
||||
|
||||
private static void produceGas(){
|
||||
private static boolean produceGas(){
|
||||
int level = trinketLevel(ChaoticCenser.class);
|
||||
|
||||
if (level < 0 || level > 3){
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
Class<?extends Blob> gasToSpawn;
|
||||
@@ -235,10 +236,15 @@ public class ChaoticCenser extends Trinket {
|
||||
}
|
||||
|
||||
if (!candidateCells.isEmpty()) {
|
||||
int targetCell = Random.chances(candidateCells);
|
||||
Integer targetCell = Random.chances(candidateCells);
|
||||
if (targetCell != null) {
|
||||
GameScene.add(Blob.seed(targetCell, (int) gasQuantity, gasToSpawn));
|
||||
MagicMissile.boltFromChar(Dungeon.hero.sprite.parent, MISSILE_VFX.get(gasToSpawn), Dungeon.hero.sprite, targetCell, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user