v0.3.1a: fixed spear traps dealing negative damage, also added a safety check for dealing negative damage.

This commit is contained in:
Evan Debenham 2015-08-20 09:54:34 -04:00
parent b728dcb31b
commit 7b3c7aa46d
2 changed files with 2 additions and 2 deletions

View File

@ -241,7 +241,7 @@ public abstract class Char extends Actor {
public void damage( int dmg, Object src ) {
if (HP <= 0) {
if (HP <= 0 || dmg < 0) {
return;
}
if (this.buff(Frost.class) != null){

View File

@ -60,7 +60,7 @@ public class SpearTrap extends Trap {
if (ch != null){
int damage = Random.NormalIntRange(Dungeon.depth, Dungeon.depth*2);
damage -= Random.IntRange( 0, ch.dr());
ch.damage( damage , this);
ch.damage( Math.max(damage, 0) , this);
if (!ch.isAlive() && ch == Dungeon.hero){
Dungeon.fail(Utils.format(ResultDescriptions.TRAP, name));
GLog.n("You were skewered by the spear trap...");