v2.5.0: burn & ooze now end when entring water, but do min 1 turn of dmg

This commit is contained in:
Evan Debenham
2024-08-07 12:56:35 -04:00
parent 91cb5c36cc
commit 5ed4162d59
3 changed files with 40 additions and 9 deletions
@@ -53,11 +53,11 @@ public class Burning extends Buff implements Hero.Doom {
private static final float DURATION = 8f; private static final float DURATION = 8f;
private float left; private float left;
private boolean acted = false; //whether the debuff has done any damage at all yet
//for tracking burning of hero items private int burnIncrement = 0; //for tracking burning of hero items
private int burnIncrement = 0;
private static final String LEFT = "left"; private static final String LEFT = "left";
private static final String ACTED = "acted";
private static final String BURN = "burnIncrement"; private static final String BURN = "burnIncrement";
{ {
@@ -69,6 +69,7 @@ public class Burning extends Buff implements Hero.Doom {
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle ); super.storeInBundle( bundle );
bundle.put( LEFT, left ); bundle.put( LEFT, left );
bundle.put( ACTED, acted );
bundle.put( BURN, burnIncrement ); bundle.put( BURN, burnIncrement );
} }
@@ -76,6 +77,7 @@ public class Burning extends Buff implements Hero.Doom {
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
left = bundle.getFloat( LEFT ); left = bundle.getFloat( LEFT );
acted = bundle.getBoolean( ACTED );
burnIncrement = bundle.getInt( BURN ); burnIncrement = bundle.getInt( BURN );
} }
@@ -88,9 +90,12 @@ public class Burning extends Buff implements Hero.Doom {
@Override @Override
public boolean act() { public boolean act() {
if (target.isAlive() && !target.isImmune(getClass())) { if (acted && Dungeon.level.water[target.pos] && !target.flying){
detach();
} else if (target.isAlive() && !target.isImmune(getClass())) {
acted = true;
int damage = Random.NormalIntRange( 1, 3 + Dungeon.scalingDepth()/4 ); int damage = Random.NormalIntRange( 1, 3 + Dungeon.scalingDepth()/4 );
Buff.detach( target, Chill.class); Buff.detach( target, Chill.class);
@@ -192,6 +197,7 @@ public class Burning extends Buff implements Hero.Doom {
} }
} }
left = duration; left = duration;
acted = false;
} }
@Override @Override
@@ -36,20 +36,25 @@ public class Ooze extends Buff {
type = buffType.NEGATIVE; type = buffType.NEGATIVE;
announced = true; announced = true;
} }
private float left; private float left;
private boolean acted = false; //whether the debuff has done any damage at all yet
private static final String LEFT = "left"; private static final String LEFT = "left";
private static final String ACTED = "acted";
@Override @Override
public void storeInBundle( Bundle bundle ) { public void storeInBundle( Bundle bundle ) {
super.storeInBundle( bundle ); super.storeInBundle( bundle );
bundle.put( LEFT, left ); bundle.put( LEFT, left );
bundle.put( ACTED, acted );
} }
@Override @Override
public void restoreFromBundle( Bundle bundle ) { public void restoreFromBundle( Bundle bundle ) {
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
left = bundle.getFloat(LEFT); left = bundle.getFloat(LEFT);
acted = bundle.getBoolean(ACTED);
} }
@Override @Override
@@ -74,17 +79,25 @@ public class Ooze extends Buff {
public void set(float left){ public void set(float left){
this.left = left; this.left = left;
acted = false;
} }
@Override @Override
public boolean act() { public boolean act() {
if (target.isAlive()) { //washing away happens before debuff effects if debuff has gotten to act
if (acted && Dungeon.level.water[target.pos] && !target.flying){
detach();
} else if (target.isAlive()) {
if (Dungeon.scalingDepth() > 5) { if (Dungeon.scalingDepth() > 5) {
target.damage(1 + Dungeon.scalingDepth() / 5, this); target.damage(1 + Dungeon.scalingDepth() / 5, this);
acted = true;
} else if (Dungeon.scalingDepth() == 5){ } else if (Dungeon.scalingDepth() == 5){
target.damage(1, this); //1 dmg per turn vs Goo target.damage(1, this); //1 dmg per turn vs Goo
acted = true;
} else if (Random.Int(2) == 0) { } else if (Random.Int(2) == 0) {
target.damage(1, this); //0.5 dmg per turn in sewers target.damage(1, this); //0.5 dmg per turn in sewers
acted = true;
} }
if (!target.isAlive() && target == Dungeon.hero) { if (!target.isAlive() && target == Dungeon.hero) {
@@ -99,7 +112,7 @@ public class Ooze extends Buff {
} else { } else {
detach(); detach();
} }
if (Dungeon.level.water[target.pos]) { if (Dungeon.level.water[target.pos] && !target.flying){
detach(); detach();
} }
return true; return true;
@@ -35,10 +35,12 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.WellWater;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Awareness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Blindness;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Burning;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.ChampionEnemy;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.LockedFloor;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSight; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MagicalSight;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.MindVision;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Ooze;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.PinCushion;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Regeneration;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.RevealedArea; import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.RevealedArea;
@@ -1096,6 +1098,16 @@ public abstract class Level implements Bundlable {
if (!ch.flying){ if (!ch.flying){
//we call act here instead of detach in case the debuffs haven't managed to deal dmg once yet
if (map[ch.pos] == Terrain.WATER){
if (ch.buff(Burning.class) != null){
ch.buff(Burning.class).act();
}
if (ch.buff(Ooze.class) != null){
ch.buff(Ooze.class).act();
}
}
if ( (map[ch.pos] == Terrain.GRASS || map[ch.pos] == Terrain.EMBERS) if ( (map[ch.pos] == Terrain.GRASS || map[ch.pos] == Terrain.EMBERS)
&& ch == Dungeon.hero && Dungeon.hero.hasTalent(Talent.REJUVENATING_STEPS) && ch == Dungeon.hero && Dungeon.hero.hasTalent(Talent.REJUVENATING_STEPS)
&& ch.buff(Talent.RejuvenatingStepsCooldown.class) == null){ && ch.buff(Talent.RejuvenatingStepsCooldown.class) == null){