v0.3.1a: fixed spear traps dealing negative damage, also added a safety check for dealing negative damage.
This commit is contained in:
parent
b728dcb31b
commit
7b3c7aa46d
|
@ -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){
|
||||
|
|
|
@ -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...");
|
||||
|
|
Loading…
Reference in New Issue
Block a user