diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 70ffdac56..a4ad6e074 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -257,14 +257,8 @@ public class Hero extends Char { @Override public int attackSkill( Char target ) { - if (belongings.weapon != null && !usingRanged) { + if (belongings.weapon != null) { return (int) (attackSkill * belongings.weapon.acuracyFactor(this)); - } else if (usingRanged){ - int bonus = 0; - for (Buff buff : buffs(RingOfSharpshooting.Aim.class)) { - bonus += ((RingOfSharpshooting.Aim)buff).level; - } - return (int)(attackSkill * Math.pow(1.1, bonus)); } else { return attackSkill; } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java index 6ce1cac9d..2b3868edc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/rings/RingOfSharpshooting.java @@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings; * Created by debenhame on 10/09/2014. */ public class RingOfSharpshooting extends Ring { - //TODO: numbers tweaking, acc logic refactor, does this work with boomerang? + //TODO: numbers tweaking { name = "Ring of Sharpshooting"; } @@ -18,7 +18,7 @@ public class RingOfSharpshooting extends Ring { public String desc() { return isKnown() ? "This ring enhances the wearer's precision and aim, which will " + - "make all projectile weapons hit harder and last longer. " + + "make all projectile weapons more accurate and durable. " + "A cursed ring will have the opposite effect.": super.desc(); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index da0a00ef4..6fd089e6a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -19,10 +19,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.actors.Char; +import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon; +import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.enchantments.*; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; @@ -93,9 +95,16 @@ public class Weapon extends KindOfWeapon { break; default: } + int bonus = 0; + for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) { + bonus += ((RingOfSharpshooting.Aim)buff).level; + } + float ACUbonus = (float)(Math.pow(1.1, bonus)); + + return encumbrance > 0 ? (float)((ACU * ACUbonus) / Math.pow( 1.5, encumbrance )) : ACU * ACUbonus; } - return encumbrance > 0 ? (float)(ACU / Math.pow( 1.5, encumbrance )) : ACU; + return encumbrance > 0 ? (float)((ACU) / Math.pow( 1.5, encumbrance )) : ACU; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index a2c4cfd05..e9861110e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -60,7 +60,7 @@ public class MissileWeapon extends Weapon { protected void onThrow( int cell ) { Char enemy = Actor.findChar( cell ); if (enemy == null || enemy == curUser) { - super.onThrow( cell ); + miss( cell ); } else { if (!curUser.shoot( enemy, this )) { miss( cell ); @@ -76,7 +76,13 @@ public class MissileWeapon extends Weapon { } protected void miss( int cell ) { - super.onThrow( cell ); + int bonus = 0; + for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) { + bonus += ((RingOfSharpshooting.Aim)buff).level; + } + + if (Random.Float() > Math.pow(0.7, -bonus)) + super.onThrow( cell ); } @Override