v3.0.0: buffed trap mechanism, now reveals some traps

This commit is contained in:
Evan Debenham
2025-01-08 17:06:56 -05:00
parent 28fd34b758
commit f94b793d1f
6 changed files with 69 additions and 18 deletions

View File

@@ -1368,8 +1368,8 @@ items.trinkets.mimictooth.stats_desc=At its current level this trinket will make
items.trinkets.mossyclump.name=mossy clump
items.trinkets.mossyclump.desc=This clump of wet moss seems to hold onto its moisture no matter how hard you squeeze it. It seems to be magically tied to the dungeon itself, making grass and water more likely to appear.
items.trinkets.mossyclump.typical_stats_desc=Typically this trinket will make _%d%%_ of regular floors become filled with either water or grass instead.\n\nThis trinket costs a very large amount of energy to upgrade.
items.trinkets.mossyclump.stats_desc=At its current level this trinket will make _%d%%_ of regular floors become filled with either water or grass instead.\n\nThis trinket costs a very large amount of energy to upgrade.
items.trinkets.mossyclump.typical_stats_desc=Typically this trinket will make _%d%%_ of unthemed floors become filled with either water or grass instead.\n\nThis trinket costs a very large amount of energy to upgrade.
items.trinkets.mossyclump.stats_desc=At its current level this trinket will make _%d%%_ of unthemed floors become filled with either water or grass instead.\n\nThis trinket costs a very large amount of energy to upgrade.
items.trinkets.parchmentscrap.name=parchment scrap
items.trinkets.parchmentscrap.desc=This little scrap of parchment looks like it came from a scroll. It has retained some of its magic, and it seems to be influencing weapons and armor found in the dungeon.
@@ -1409,9 +1409,9 @@ items.trinkets.thirteenleafclover.typical_stats_desc=Typically this trinket will
items.trinkets.thirteenleafclover.stats_desc=At its current level this trinket will cause you to deal maximum damage _%1$d%%_ of the time, and minimum damage _%2$d%%_ of the time.
items.trinkets.trapmechanism.name=trap mechanism
items.trinkets.trapmechanism.desc=The core mechanism of one of the dungeon's pitfall traps, carefully carved out of the floor so it can be carried. It seems to be magically tied to the dungeon itself, making terrain more hazardous for you and the dungeon's inhabitants.
items.trinkets.trapmechanism.typical_stats_desc=Typically this trinket will make _%d%%_ of regular floors become filled with either traps or chasms instead.\n\nThis trinket costs relatively little energy to upgrade.
items.trinkets.trapmechanism.stats_desc=At its current level this trinket will make _%d%%_ of regular floors become filled with either traps or chasms instead.\n\nThis trinket costs relatively little energy to upgrade.
items.trinkets.trapmechanism.desc=The core mechanism of one of the dungeon's pitfall traps, carefully carved out of the floor so it can be carried. It seems to be magically tied to the dungeon itself, making hazardous terrain more common but also increasing your affinity towards it.
items.trinkets.trapmechanism.typical_stats_desc=Typically this trinket will make _%1$d%%_ of unthemed floors become filled with either traps or chasms instead. Additionally, _%2$d%%_ of the dungeon's hidden traps will instead be visible.
items.trinkets.trapmechanism.stats_desc=At its current level this trinket will make _%1$d%%_ of unthemed floors become filled with either traps or chasms instead. Additionally, _%2$d%%_ of the dungeon's hidden traps will instead be visible.
items.trinkets.vialofblood.name=vial of blood
items.trinkets.vialofblood.desc=This thin vial contains the blood of some denizen of the dungeon, it moves slowly as you rotate the vial. It seems to be magically enhancing stronger healing effects, but also delaying them.

View File

@@ -38,16 +38,16 @@ public class TrapMechanism extends Trinket {
@Override
protected int upgradeEnergyCost() {
//6 -> 5(11) -> 7(18) -> 8(26)
return Math.round(5+1.67f*level());
//6 -> 8(14) -> 10(24) -> 12(36)
return 6+2*level();
}
@Override
public String statsDesc() {
if (isIdentified()){
return Messages.get(this, "stats_desc", (int)(100*overrideNormalLevelChance(buffedLvl())));
return Messages.get(this, "stats_desc", (int)(100*overrideNormalLevelChance(buffedLvl())), (int)(100*revealHiddenTrapChance(buffedLvl())));
} else {
return Messages.get(this, "typical_stats_desc", (int)(100*overrideNormalLevelChance(0)));
return Messages.get(this, "typical_stats_desc", (int)(100*overrideNormalLevelChance(0)), (int)(100*revealHiddenTrapChance(0)));
}
}
@@ -63,6 +63,18 @@ public class TrapMechanism extends Trinket {
}
}
public static float revealHiddenTrapChance(){
return revealHiddenTrapChance(trinketLevel(TrapMechanism.class));
}
public static float revealHiddenTrapChance( int level ){
if (level == -1){
return 0f;
} else {
return 0.1f + 0.1f*level;
}
}
//true for traps, false for chasm
//ensures a little consistency of RNG
private ArrayList<Boolean> levelFeels = new ArrayList<>();

View File

@@ -24,6 +24,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.painters;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrapMechanism;
import com.shatteredpixel.shatteredpixeldungeon.journal.Document;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Patch;
@@ -460,6 +461,9 @@ public abstract class RegularPainter extends Painter {
//no more than one trap every 5 valid tiles.
nTraps = Math.min(nTraps, validCells.size()/5);
float revealedChance = TrapMechanism.revealHiddenTrapChance();
float revealInc = 0;
//5x traps on traps level feeling, but the extra traps are all visible
for (int i = 0; i < (l.feeling == Level.Feeling.TRAPS ? 5*nTraps : nTraps); i++) {
@@ -475,8 +479,13 @@ public abstract class RegularPainter extends Painter {
validCells.remove(trapPos);
validNonHallways.remove(trapPos);
if (i < nTraps) trap.hide();
else trap.reveal();
revealInc += revealedChance;
if (i < nTraps || revealInc >= 1) {
trap.reveal();
revealInc--;
} else {
trap.hide();
}
l.setTrap( trap, trapPos );
//some traps will not be hidden

View File

@@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.secret;
import com.shatteredpixel.shatteredpixeldungeon.items.Generator;
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrapMechanism;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -50,11 +51,20 @@ public class SecretSummoningRoom extends SecretRoom {
Point center = center();
level.drop(Generator.random(), level.pointToCell(center)).setHauntedIfCursed().type = Heap.Type.SKELETON;
float revealedChance = TrapMechanism.revealHiddenTrapChance();
float revealInc = 0;
for (Point p : getPoints()){
int cell = level.pointToCell(p);
if (level.map[cell] == Terrain.SECRET_TRAP){
level.setTrap(new SummoningTrap().hide(), cell);
revealInc += revealedChance;
if (revealInc >= 1) {
level.setTrap(new SummoningTrap().reveal(), cell);
Painter.set(level, cell, Terrain.TRAP);
revealInc--;
} else {
level.setTrap(new SummoningTrap().hide(), cell);
}
}
}

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrapMechanism;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -73,7 +74,9 @@ public class BurnedRoom extends PatchRoom {
}
setupPatch(level);
float revealedChance = TrapMechanism.revealHiddenTrapChance();
float revealInc = 0;
for (int i=top + 1; i < bottom; i++) {
for (int j=left + 1; j < right; j++) {
if (!patch[xyToPatchCoords(j, i)])
@@ -92,8 +95,15 @@ public class BurnedRoom extends PatchRoom {
level.setTrap(new BurningTrap().reveal(), cell);
break;
case 3:
t = Terrain.SECRET_TRAP;
level.setTrap(new BurningTrap().hide(), cell);
revealInc += revealedChance;
if (revealInc >= 1){
t = Terrain.TRAP;
level.setTrap(new BurningTrap().reveal(), cell);
revealInc--;
} else {
t = Terrain.SECRET_TRAP;
level.setTrap(new BurningTrap().hide(), cell);
}
break;
case 4:
t = Terrain.INACTIVE_TRAP;

View File

@@ -21,6 +21,7 @@
package com.shatteredpixel.shatteredpixeldungeon.levels.rooms.standard;
import com.shatteredpixel.shatteredpixeldungeon.items.trinkets.TrapMechanism;
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
import com.shatteredpixel.shatteredpixeldungeon.levels.painters.Painter;
@@ -65,6 +66,8 @@ public class MinefieldRoom extends StandardRoom {
break;
}
float revealedChance = TrapMechanism.revealHiddenTrapChance();
float revealInc = 0;
for (int i = 0; i < mines; i++ ){
int pos;
do {
@@ -79,8 +82,15 @@ public class MinefieldRoom extends StandardRoom {
}
}
Painter.set(level, pos, Terrain.SECRET_TRAP);
level.setTrap(new ExplosiveTrap().hide(), pos);
revealInc += revealedChance;
if (revealInc >= 1) {
Painter.set(level, pos, Terrain.TRAP);
level.setTrap(new ExplosiveTrap().reveal(), pos);
revealInc--;
} else {
Painter.set(level, pos, Terrain.SECRET_TRAP);
level.setTrap(new ExplosiveTrap().hide(), pos);
}
}