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
|
@Override
|
||||||
public int attackSkill( Char target ) {
|
public int attackSkill( Char target ) {
|
||||||
if (belongings.weapon != null && !usingRanged) {
|
if (belongings.weapon != null) {
|
||||||
return (int) (attackSkill * belongings.weapon.acuracyFactor(this));
|
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 {
|
} else {
|
||||||
return attackSkill;
|
return attackSkill;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ package com.shatteredpixel.shatteredpixeldungeon.items.rings;
|
||||||
* Created by debenhame on 10/09/2014.
|
* Created by debenhame on 10/09/2014.
|
||||||
*/
|
*/
|
||||||
public class RingOfSharpshooting extends Ring {
|
public class RingOfSharpshooting extends Ring {
|
||||||
//TODO: numbers tweaking, acc logic refactor, does this work with boomerang?
|
//TODO: numbers tweaking
|
||||||
{
|
{
|
||||||
name = "Ring of Sharpshooting";
|
name = "Ring of Sharpshooting";
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class RingOfSharpshooting extends Ring {
|
||||||
public String desc() {
|
public String desc() {
|
||||||
return isKnown() ?
|
return isKnown() ?
|
||||||
"This ring enhances the wearer's precision and aim, which will " +
|
"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.":
|
"A cursed ring will have the opposite effect.":
|
||||||
super.desc();
|
super.desc();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,12 @@ package com.shatteredpixel.shatteredpixeldungeon.items.weapon;
|
||||||
|
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
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.Hero;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.KindOfWeapon;
|
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.enchantments.*;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||||
|
@ -93,9 +95,16 @@ public class Weapon extends KindOfWeapon {
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
@Override
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class MissileWeapon extends Weapon {
|
||||||
protected void onThrow( int cell ) {
|
protected void onThrow( int cell ) {
|
||||||
Char enemy = Actor.findChar( cell );
|
Char enemy = Actor.findChar( cell );
|
||||||
if (enemy == null || enemy == curUser) {
|
if (enemy == null || enemy == curUser) {
|
||||||
super.onThrow( cell );
|
miss( cell );
|
||||||
} else {
|
} else {
|
||||||
if (!curUser.shoot( enemy, this )) {
|
if (!curUser.shoot( enemy, this )) {
|
||||||
miss( cell );
|
miss( cell );
|
||||||
|
@ -76,7 +76,13 @@ public class MissileWeapon extends Weapon {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void miss( int cell ) {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user