From c892fb30cf8685b83dd13a81efae98990fa9bfc5 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 19 Feb 2018 13:47:04 -0500 Subject: [PATCH] v0.6.3a: fixed imbues and sharpshooting sometimes affecting str bonus --- .../items/weapon/melee/MeleeWeapon.java | 6 +++--- .../items/weapon/missiles/MissileWeapon.java | 9 +++++---- .../items/weapon/missiles/ThrowingKnife.java | 7 ++++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java index 0107b7fe0..73ea4465c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/melee/MeleeWeapon.java @@ -52,8 +52,8 @@ public class MeleeWeapon extends Weapon { @Override public int damageRoll(Char owner) { - int damage = super.damageRoll( owner ); - + int damage = imbue.damageFactor(super.damageRoll( owner )); + if (owner instanceof Hero) { int exStr = ((Hero)owner).STR() - STRReq(); if (exStr > 0) { @@ -61,7 +61,7 @@ public class MeleeWeapon extends Weapon { } } - return imbue.damageFactor(damage); + return damage; } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index b7e064c80..dde29ce40 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -164,7 +164,8 @@ abstract public class MissileWeapon extends Weapon { @Override public int damageRoll(Char owner) { - int damage = super.damageRoll( owner ); + int damage = imbue.damageFactor(super.damageRoll( owner )); + damage = Math.round( damage * RingOfSharpshooting.damageMultiplier( owner )); if (owner instanceof Hero && ((Hero)owner).heroClass == HeroClass.HUNTRESS) { @@ -174,7 +175,7 @@ abstract public class MissileWeapon extends Weapon { } } - return (int)(imbue.damageFactor(damage) * RingOfSharpshooting.damageMultiplier( owner )); + return damage; } @Override @@ -234,8 +235,8 @@ abstract public class MissileWeapon extends Weapon { String info = desc(); info += "\n\n" + Messages.get( MissileWeapon.class, "stats", - (int)(imbue.damageFactor(min()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )), - (int)(imbue.damageFactor(max()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )), + Math.round(imbue.damageFactor(min()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )), + Math.round(imbue.damageFactor(max()) * RingOfSharpshooting.damageMultiplier( Dungeon.hero )), STRReq()); if (STRReq() > Dungeon.hero.STR()) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java index 7adf98e10..b41f1733d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/ThrowingKnife.java @@ -69,14 +69,15 @@ public class ThrowingKnife extends MissileWeapon { if (enemy instanceof Mob && ((Mob) enemy).surprisedBy(hero)) { //deals 75% toward max to max on surprise, instead of min to max. int diff = max() - min(); - int damage = Random.NormalIntRange( + int damage = imbue.damageFactor(Random.NormalIntRange( min() + Math.round(diff*0.75f), - max()); + max())); + damage = Math.round(damage * RingOfSharpshooting.damageMultiplier( hero )); int exStr = hero.STR() - STRReq(); if (exStr > 0 && hero.heroClass == HeroClass.HUNTRESS) { damage += Random.IntRange(0, exStr); } - return (int)(imbue.damageFactor(damage) * RingOfSharpshooting.damageMultiplier( hero )); + return damage; } } return super.damageRoll(owner);