V0.2.0: refactored/corrected Ring of Sharpshooting logic
This commit is contained in:
parent
5eea9c6cfc
commit
04b1ace7a7
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user