v0.4.0: refactor to ring logic

This commit is contained in:
Evan Debenham
2016-06-15 10:51:22 -04:00
committed by Evan Debenham
parent 912fd447d0
commit 16a3e5932b
11 changed files with 84 additions and 81 deletions
@@ -147,10 +147,7 @@ abstract public class Weapon extends KindOfWeapon {
float ACC = this.ACC;
if (this instanceof MissileWeapon) {
int bonus = 0;
for (Buff buff : hero.buffs(RingOfSharpshooting.Aim.class)) {
bonus += ((RingOfSharpshooting.Aim)buff).level;
}
int bonus = RingOfSharpshooting.getBonus(hero, RingOfSharpshooting.Aim.class);
ACC *= (float)(Math.pow(1.1, bonus));
}
@@ -167,10 +164,7 @@ abstract public class Weapon extends KindOfWeapon {
float DLY = imbue.delayFactor(this.DLY);
int bonus = 0;
for (Buff buff : hero.buffs(RingOfFuror.Furor.class)) {
bonus += ((RingOfFuror.Furor)buff).level;
}
int bonus = RingOfFuror.getBonus(hero, RingOfFuror.Furor.class);
DLY = (float)(0.25 + (DLY - 0.25)*Math.pow(0.8, bonus));
@@ -79,10 +79,8 @@ abstract public class MissileWeapon extends Weapon {
if (!curUser.shoot( enemy, this )) {
miss( cell );
} else if (!(this instanceof Boomerang)){
int bonus = 0;
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class))
bonus += ((RingOfSharpshooting.Aim)buff).level;
int bonus = RingOfSharpshooting.getBonus(curUser, RingOfSharpshooting.Aim.class);
if (curUser.heroClass == HeroClass.HUNTRESS && enemy.buff(PinCushion.class) == null)
bonus += 3;
@@ -99,10 +97,7 @@ abstract public class MissileWeapon extends Weapon {
}
protected void miss( int cell ) {
int bonus = 0;
for (Buff buff : curUser.buffs(RingOfSharpshooting.Aim.class)) {
bonus += ((RingOfSharpshooting.Aim)buff).level;
}
int bonus = RingOfSharpshooting.getBonus(curUser, RingOfSharpshooting.Aim.class);
//degraded ring of sharpshooting will even make missed shots break.
if (Random.Float() < Math.pow(0.6, -bonus))