v2.5.3: further censer buffs:

- further increased weighting toward spewing when enemies are seen
- now spews gas 2-5 tiles away, up from 1-3
- tightened possible gas positions when enemies are visible
- reduced spawned gas quantity
This commit is contained in:
Evan Debenham
2024-09-27 11:55:05 -04:00
parent 8db21a3f4e
commit c0ea6f0433
@@ -106,16 +106,16 @@ public class ChaoticCenser extends Trinket {
float triggerChance = 0; float triggerChance = 0;
if (left > 0 && left <= 30) { if (left > 0 && left <= 30) {
if (TargetHealthIndicator.instance != null if (TargetHealthIndicator.instance != null && TargetHealthIndicator.instance.isVisible()
&& TargetHealthIndicator.instance.target() != null && TargetHealthIndicator.instance.target() != null
&& TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY && TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY
&& TargetHealthIndicator.instance.target().isAlive()) { && TargetHealthIndicator.instance.target().isAlive()) {
triggerChance = 0.5f; triggerChance = 0.75f;
} }
} else if (left > -30 && left <= 0) { } else if (left > -30 && left <= 0) {
if (TargetHealthIndicator.instance != null if (TargetHealthIndicator.instance != null && TargetHealthIndicator.instance.isVisible()
&& TargetHealthIndicator.instance.target() != null && TargetHealthIndicator.instance.target() != null
&& TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY && TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY
&& TargetHealthIndicator.instance.target().isAlive()) { && TargetHealthIndicator.instance.target().isAlive()) {
@@ -124,7 +124,7 @@ public class ChaoticCenser extends Trinket {
triggerChance = 0.2f; triggerChance = 0.2f;
} }
} else if (left <= -avgTurns/5) { } else if (left <= -30) {
triggerChance = 1f; triggerChance = 1f;
} }
@@ -223,37 +223,60 @@ public class ChaoticCenser extends Trinket {
} }
Char target = null; Char target = null;
if (TargetHealthIndicator.instance != null && TargetHealthIndicator.instance.target() != null if (TargetHealthIndicator.instance != null && TargetHealthIndicator.instance.isVisible()
&& TargetHealthIndicator.instance.target() != null
&& TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY && TargetHealthIndicator.instance.target().alignment == Char.Alignment.ENEMY
&& TargetHealthIndicator.instance.target().isAlive()) { && TargetHealthIndicator.instance.target().isAlive()) {
target = TargetHealthIndicator.instance.target(); target = TargetHealthIndicator.instance.target();
} }
HashMap<Integer, Float> candidateCells = new HashMap<>(); HashMap<Integer, Float> candidateCells = new HashMap<>();
PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.not(Dungeon.level.solid, null), 3); PathFinder.buildDistanceMap(Dungeon.hero.pos, BArray.not(Dungeon.level.solid, null), 5);
//spawn gas in a random cell 1-3 tiles away, likelihood is 2>3>1 //spawn gas in a random visible cell 2-5 tiles away, likelihood is 3,4 > 2,5
for (int i = 0; i < Dungeon.level.length(); i++){ for (int i = 0; i < Dungeon.level.length(); i++){
switch (PathFinder.distance[i]){ if (Dungeon.level.heroFOV[i] && PathFinder.distance[i] < Integer.MAX_VALUE) {
case 0: default: break; //do nothing switch (PathFinder.distance[i]) {
case 1: candidateCells.put(i, 1f); break; case 3:
case 2: candidateCells.put(i, 3f); break; case 4:
case 3: candidateCells.put(i, 2f); break; candidateCells.put(i, 2f);
break;
case 2:
case 5:
candidateCells.put(i, 1f);
break;
}
} }
} }
//unless we have a target, then strongly prefer cells closer to target //unless we have a target, then strongly prefer cells closer to target
if (target != null){ if (target != null){
float furthest = 0; int targetpos = target.pos;
if (Dungeon.level.trueDistance(target.pos, Dungeon.hero.pos) >= 4){
//if target is a distance from the hero, aim in front of them instead
for (int i : PathFinder.NEIGHBOURS8){
while (!Dungeon.level.solid[targetpos+i]
&& Dungeon.level.trueDistance(target.pos+i, Dungeon.hero.pos) < Dungeon.level.trueDistance(targetpos, Dungeon.hero.pos)){
targetpos = target.pos+i;
}
}
}
float closest = 100;
for (int cell : candidateCells.keySet()){ for (int cell : candidateCells.keySet()){
float dist = Dungeon.level.trueDistance(cell, target.pos); float dist = Dungeon.level.distance(cell, targetpos);
if (dist > furthest){ if (dist < closest){
furthest = dist; closest = dist;
} }
} }
for (int cell : candidateCells.keySet()){ for (int cell : candidateCells.keySet()){
float dist = Dungeon.level.trueDistance(cell, target.pos); float dist = Dungeon.level.distance(cell, targetpos);
candidateCells.put(cell, furthest - dist); if (dist - closest == 0) {
candidateCells.put(cell, 4f);
} else if (dist - closest <= 1) {
candidateCells.put(cell, 1f);
} else {
candidateCells.put(cell, 0f);
}
} }
} }
@@ -280,23 +303,23 @@ public class ChaoticCenser extends Trinket {
private static final HashMap<Class<? extends Blob>, Float> COMMON_GASSES = new HashMap<>(); private static final HashMap<Class<? extends Blob>, Float> COMMON_GASSES = new HashMap<>();
static { static {
COMMON_GASSES.put(ToxicGas.class, 500f); COMMON_GASSES.put(ToxicGas.class, 300f);
COMMON_GASSES.put(ConfusionGas.class, 500f); COMMON_GASSES.put(ConfusionGas.class, 300f);
COMMON_GASSES.put(Regrowth.class, 250f); COMMON_GASSES.put(Regrowth.class, 200f);
} }
private static final HashMap<Class<? extends Blob>, Float> UNCOMMON_GASSES = new HashMap<>(); private static final HashMap<Class<? extends Blob>, Float> UNCOMMON_GASSES = new HashMap<>();
static { static {
UNCOMMON_GASSES.put(StormCloud.class, 500f); UNCOMMON_GASSES.put(StormCloud.class, 300f);
UNCOMMON_GASSES.put(SmokeScreen.class, 500f); UNCOMMON_GASSES.put(SmokeScreen.class, 300f);
UNCOMMON_GASSES.put(StenchGas.class, 250f); UNCOMMON_GASSES.put(StenchGas.class, 200f);
} }
private static final HashMap<Class<? extends Blob>, Float> RARE_GASSES = new HashMap<>(); private static final HashMap<Class<? extends Blob>, Float> RARE_GASSES = new HashMap<>();
static { static {
RARE_GASSES.put(Inferno.class, 500f); RARE_GASSES.put(Inferno.class, 300f);
RARE_GASSES.put(Blizzard.class, 500f); RARE_GASSES.put(Blizzard.class, 300f);
RARE_GASSES.put(CorrosiveGas.class, 250f); RARE_GASSES.put(CorrosiveGas.class, 200f);
} }
private static final HashMap<Class<? extends Blob>, Integer> MISSILE_VFX = new HashMap<>(); private static final HashMap<Class<? extends Blob>, Integer> MISSILE_VFX = new HashMap<>();