v0.7.5: added new properties for traps
This commit is contained in:
parent
8e4e8f495c
commit
59186a3840
|
@ -106,6 +106,7 @@ import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
import com.shatteredpixel.shatteredpixeldungeon.levels.features.Chasm;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.levels.traps.Trap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Earthroot;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
|
import com.shatteredpixel.shatteredpixeldungeon.plants.Swiftthistle;
|
||||||
|
@ -1646,6 +1647,11 @@ public class Hero extends Char {
|
||||||
|
|
||||||
if (Dungeon.level.secret[p]){
|
if (Dungeon.level.secret[p]){
|
||||||
|
|
||||||
|
Trap trap = Dungeon.level.traps.get( p );
|
||||||
|
if (trap != null && !trap.canBeSearched){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
float chance;
|
float chance;
|
||||||
//intentional searches always succeed
|
//intentional searches always succeed
|
||||||
if (intentional){
|
if (intentional){
|
||||||
|
|
|
@ -182,10 +182,13 @@ public class TalismanOfForesight extends Artifact {
|
||||||
|
|
||||||
if (Dungeon.level.heroFOV[p]
|
if (Dungeon.level.heroFOV[p]
|
||||||
&& Dungeon.level.secret[p]
|
&& Dungeon.level.secret[p]
|
||||||
&& Dungeon.level.map[p] != Terrain.SECRET_DOOR)
|
&& Dungeon.level.map[p] != Terrain.SECRET_DOOR) {
|
||||||
|
if (Dungeon.level.traps.get(p) == null || Dungeon.level.traps.get(p).canBeSearched) {
|
||||||
smthFound = true;
|
smthFound = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (smthFound && !cursed){
|
if (smthFound && !cursed){
|
||||||
if (warn == 0){
|
if (warn == 0){
|
||||||
|
|
|
@ -43,12 +43,8 @@ public class DisintegrationTrap extends Trap {
|
||||||
{
|
{
|
||||||
color = VIOLET;
|
color = VIOLET;
|
||||||
shape = CROSSHAIR;
|
shape = CROSSHAIR;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
canBeHidden = false;
|
||||||
public Trap hide() {
|
|
||||||
//this one can't be hidden
|
|
||||||
return reveal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,12 +40,8 @@ public class GrimTrap extends Trap {
|
||||||
{
|
{
|
||||||
color = GREY;
|
color = GREY;
|
||||||
shape = LARGE_DOT;
|
shape = LARGE_DOT;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
canBeHidden = false;
|
||||||
public Trap hide() {
|
|
||||||
//cannot hide this trap
|
|
||||||
return reveal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,12 +40,12 @@ public class PoisonDartTrap extends Trap {
|
||||||
{
|
{
|
||||||
color = GREEN;
|
color = GREEN;
|
||||||
shape = CROSSHAIR;
|
shape = CROSSHAIR;
|
||||||
|
|
||||||
|
canBeHidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
protected int poisonAmount(){
|
||||||
public Trap hide() {
|
return 8 + Math.round(2*Dungeon.depth / 3f);
|
||||||
//this one can't be hidden
|
|
||||||
return reveal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,8 +85,7 @@ public class PoisonDartTrap extends Trap {
|
||||||
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
|
if (finalTarget == Dungeon.hero && !finalTarget.isAlive()){
|
||||||
Dungeon.fail( trap.getClass() );
|
Dungeon.fail( trap.getClass() );
|
||||||
}
|
}
|
||||||
Buff.affect( finalTarget, Poison.class )
|
Buff.affect( finalTarget, Poison.class ).set( poisonAmount() );
|
||||||
.set( 8 + Math.round(2*Dungeon.depth / 3f) );
|
|
||||||
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
|
Sample.INSTANCE.play(Assets.SND_HIT, 1, 1, Random.Float(0.8f, 1.25f));
|
||||||
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
|
finalTarget.sprite.bloodBurstA(finalTarget.sprite.center(), dmg);
|
||||||
finalTarget.sprite.flash();
|
finalTarget.sprite.flash();
|
||||||
|
@ -99,8 +98,7 @@ public class PoisonDartTrap extends Trap {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
|
finalTarget.damage(Random.NormalIntRange(1, 4) - finalTarget.drRoll(), trap);
|
||||||
Buff.affect( finalTarget, Poison.class )
|
Buff.affect( finalTarget, Poison.class ).set( poisonAmount() );
|
||||||
.set( 8 + Math.round(2*Dungeon.depth / 3f) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,12 +47,8 @@ public class RockfallTrap extends Trap {
|
||||||
{
|
{
|
||||||
color = GREY;
|
color = GREY;
|
||||||
shape = DIAMOND;
|
shape = DIAMOND;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
canBeHidden = false;
|
||||||
public Trap hide() {
|
|
||||||
//this one can't be hidden
|
|
||||||
return reveal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,6 +61,9 @@ public abstract class Trap implements Bundlable {
|
||||||
public boolean visible;
|
public boolean visible;
|
||||||
public boolean active = true;
|
public boolean active = true;
|
||||||
|
|
||||||
|
public boolean canBeHidden = true;
|
||||||
|
public boolean canBeSearched = true;
|
||||||
|
|
||||||
public Trap set(int pos){
|
public Trap set(int pos){
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
return this;
|
return this;
|
||||||
|
@ -73,9 +76,13 @@ public abstract class Trap implements Bundlable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Trap hide() {
|
public Trap hide() {
|
||||||
|
if (canBeHidden) {
|
||||||
visible = false;
|
visible = false;
|
||||||
GameScene.updateMap(pos);
|
GameScene.updateMap(pos);
|
||||||
return this;
|
return this;
|
||||||
|
} else {
|
||||||
|
return reveal();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void trigger() {
|
public void trigger() {
|
||||||
|
|
|
@ -40,12 +40,6 @@ public class WornDartTrap extends Trap {
|
||||||
shape = CROSSHAIR;
|
shape = CROSSHAIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Trap hide() {
|
|
||||||
//this one can't be hidden
|
|
||||||
return reveal();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void activate() {
|
public void activate() {
|
||||||
Char target = Actor.findChar(pos);
|
Char target = Actor.findChar(pos);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user