v2.2.0: traps now use depth if they're levelgen, scaling depth otherwise

This commit is contained in:
Evan Debenham
2023-09-14 10:51:40 -04:00
parent e975ac1cd8
commit 5a1d6e5d91
11 changed files with 19 additions and 16 deletions

View File

@@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ConfusionGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -38,7 +37,7 @@ public class ConfusionTrap extends Trap {
@Override
public void activate() {
GameScene.add(Blob.seed(pos, 300 + 20 * Dungeon.depth, ConfusionGas.class));
GameScene.add(Blob.seed(pos, 300 + 20 * scalingDepth(), ConfusionGas.class));
Sample.INSTANCE.play(Assets.Sounds.GAS);
}

View File

@@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.CorrosiveGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -38,10 +37,10 @@ public class CorrosionTrap extends Trap {
@Override
public void activate() {
CorrosiveGas corrosiveGas = Blob.seed(pos, 80 + 5 * Dungeon.depth, CorrosiveGas.class);
CorrosiveGas corrosiveGas = Blob.seed(pos, 80 + 5 * scalingDepth(), CorrosiveGas.class);
Sample.INSTANCE.play(Assets.Sounds.GAS);
corrosiveGas.setStrength(1+Dungeon.depth/4);
corrosiveGas.setStrength(1+scalingDepth()/4);
GameScene.add(corrosiveGas);

View File

@@ -74,7 +74,7 @@ public class DisintegrationTrap extends Trap {
Sample.INSTANCE.play(Assets.Sounds.RAY);
ShatteredPixelDungeon.scene().add(new Beam.DeathRay(DungeonTilemap.tileCenterToWorld(pos), target.sprite.center()));
}
target.damage( Random.NormalIntRange(30, 50) + Dungeon.depth, this );
target.damage( Random.NormalIntRange(30, 50) + scalingDepth(), this );
if (target == Dungeon.hero){
Hero hero = (Hero)target;
if (!hero.isAlive()){

View File

@@ -49,7 +49,7 @@ public class FlashingTrap extends Trap {
Char c = Actor.findChar( pos );
if (c != null) {
int damage = Math.max( 0, (4 + Dungeon.depth/2) - c.drRoll()/2 );
int damage = Math.max( 0, (4 + scalingDepth()/2) - c.drRoll()/2 );
Buff.affect( c, Bleeding.class ).set( damage );
Buff.prolong( c, Blindness.class, Blindness.DURATION );
Buff.prolong( c, Cripple.class, Cripple.DURATION*2f );

View File

@@ -75,7 +75,7 @@ public class GeyserTrap extends Trap {
//does the equivalent of a bomb's damage against fiery enemies.
if (Char.hasProp(ch, Char.Property.FIERY)){
int dmg = Random.NormalIntRange(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth()*2);
int dmg = Random.NormalIntRange(5 + scalingDepth(), 10 + scalingDepth()*2);
dmg *= 0.67f;
if (!ch.isImmune(GeyserTrap.class)){
ch.damage(dmg, this);
@@ -117,7 +117,7 @@ public class GeyserTrap extends Trap {
//does the equivalent of a bomb's damage against fiery enemies.
if (Char.hasProp(ch, Char.Property.FIERY)){
int dmg = Random.NormalIntRange(5 + Dungeon.scalingDepth(), 10 + Dungeon.scalingDepth()*2);
int dmg = Random.NormalIntRange(5 + scalingDepth(), 10 + scalingDepth()*2);
if (!ch.isImmune(GeyserTrap.class)){
ch.damage(dmg, this);
}

View File

@@ -21,7 +21,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Bleeding;
@@ -45,7 +44,7 @@ public class GrippingTrap extends Trap {
Char c = Actor.findChar( pos );
if (c != null && !c.flying) {
int damage = Math.max( 0, (2 + Dungeon.depth/2) - c.drRoll()/2 );
int damage = Math.max( 0, (2 + scalingDepth()/2) - c.drRoll()/2 );
Buff.affect( c, Bleeding.class ).set( damage );
Buff.prolong( c, Cripple.class, Cripple.DURATION);
Wound.hit( c );

View File

@@ -54,7 +54,7 @@ public class GuardianTrap extends Trap {
Sample.INSTANCE.play( Assets.Sounds.ALERT );
for (int i = 0; i < (Dungeon.depth - 5)/5; i++){
for (int i = 0; i < (scalingDepth() - 5)/5; i++){
Guardian guardian = new Guardian();
guardian.state = guardian.WANDERING;
guardian.pos = Dungeon.level.randomRespawnCell( guardian );

View File

@@ -47,7 +47,7 @@ public class PoisonDartTrap extends Trap {
}
protected int poisonAmount(){
return 8 + Math.round(2*Dungeon.depth / 3f);
return 8 + Math.round(2*scalingDepth() / 3f);
}
protected boolean canTarget( Char ch ){

View File

@@ -94,7 +94,7 @@ public class RockfallTrap extends Trap {
Char ch = Actor.findChar( cell );
if (ch != null && ch.isAlive()){
int damage = Random.NormalIntRange(5+Dungeon.depth, 10+Dungeon.depth*2);
int damage = Random.NormalIntRange(5+scalingDepth(), 10+scalingDepth()*2);
damage -= ch.drRoll();
ch.damage( Math.max(damage, 0) , this);

View File

@@ -22,7 +22,6 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.traps;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob;
import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.ToxicGas;
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
@@ -38,7 +37,7 @@ public class ToxicTrap extends Trap{
@Override
public void activate() {
GameScene.add( Blob.seed( pos, 300 + 20 * Dungeon.depth, ToxicGas.class ) );
GameScene.add( Blob.seed( pos, 300 + 20 * scalingDepth(), ToxicGas.class ) );
Sample.INSTANCE.play(Assets.Sounds.GAS);
}

View File

@@ -104,6 +104,13 @@ public abstract class Trap implements Bundlable {
Dungeon.level.disarmTrap(pos);
}
//returns the depth value the trap should use for determining its power
//If the trap is part of the level, it should use the true depth
//If it's not part of the level (e.g. effect from reclaim trap), use scaling depth
protected int scalingDepth(){
return Dungeon.level.traps.get(pos) == this ? Dungeon.depth : Dungeon.scalingDepth();
}
public String name(){
return Messages.get(this, "name");
}