From baeaae13e03bc89432be62412a819853f9e6a8bb Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Thu, 2 Jun 2016 14:54:18 -0400 Subject: [PATCH] v0.4.0: adjusted encumberance penalties --- .../shatteredpixeldungeon/actors/hero/Hero.java | 12 +++++++++++- .../shatteredpixeldungeon/actors/mobs/Mob.java | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 3f8570b5c..55bd04538 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -78,6 +78,7 @@ import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicMapping; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfMagicalInfusion; import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.ScrollOfUpgrade; +import com.shatteredpixel.shatteredpixeldungeon.items.weapon.Weapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; @@ -347,7 +348,7 @@ public class Hero extends Char { int aEnc = belongings.armor != null ? belongings.armor.STRReq() - STR() : 0; if (aEnc > 0) { - return (float)(speed * Math.pow( 1.3, -aEnc )); + return (float)(speed / Math.pow( 1.2, aEnc )); } else { @@ -360,6 +361,15 @@ public class Hero extends Char { } } + public boolean encumbered(){ + return (belongings.weapon != null + && belongings.weapon instanceof Weapon + && STR() < ((Weapon)belongings.weapon).STRReq()) + || + (belongings.armor != null + && STR() < belongings.armor.STRReq()); + } + public boolean canAttack(Char enemy){ if (enemy == null || pos == enemy.pos) return false; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java index 1704db711..e8fe3401b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Mob.java @@ -339,7 +339,8 @@ public abstract class Mob extends Char { @Override public int defenseSkill( Char enemy ) { - if (enemySeen && paralysed == 0) { + boolean seen = enemySeen || (enemy == Dungeon.hero && Dungeon.hero.encumbered()); + if (seen && paralysed == 0) { int defenseSkill = this.defenseSkill; int penalty = 0; for (Buff buff : enemy.buffs(RingOfAccuracy.Accuracy.class)) { @@ -355,7 +356,7 @@ public abstract class Mob extends Char { @Override public int defenseProc( Char enemy, int damage ) { - if (!enemySeen && enemy == Dungeon.hero) { + if (!enemySeen && enemy == Dungeon.hero && !Dungeon.hero.encumbered()) { if (((Hero)enemy).subClass == HeroSubClass.ASSASSIN) { damage *= 1.34f; Wound.hit(this);