v1.4.0: heavy boomerangs now always give 1.5x acc when returning

This commit is contained in:
Evan Debenham
2022-08-15 17:39:11 -04:00
parent 67c25df840
commit 95ab214283
8 changed files with 42 additions and 15 deletions
@@ -461,7 +461,7 @@ public class Hero extends Char {
} }
if (wep != null) { if (wep != null) {
return (int)(attackSkill * accuracy * wep.accuracyFactor( this )); return (int)(attackSkill * accuracy * wep.accuracyFactor( this, target ));
} else { } else {
return (int)(attackSkill * accuracy); return (int)(attackSkill * accuracy);
} }
@@ -91,7 +91,7 @@ public class Statue extends Mob {
@Override @Override
public int attackSkill( Char target ) { public int attackSkill( Char target ) {
return (int)((9 + Dungeon.depth) * weapon.accuracyFactor(this)); return (int)((9 + Dungeon.depth) * weapon.accuracyFactor( this, target ));
} }
@Override @Override
@@ -105,7 +105,7 @@ abstract public class KindOfWeapon extends EquipableItem {
return Random.NormalIntRange( min(), max() ); return Random.NormalIntRange( min(), max() );
} }
public float accuracyFactor( Char owner ) { public float accuracyFactor( Char owner, Char target ) {
return 1f; return 1f;
} }
@@ -586,7 +586,7 @@ public class DriedRose extends Artifact {
int acc = Dungeon.hero.lvl + 9; int acc = Dungeon.hero.lvl + 9;
if (rose != null && rose.weapon != null){ if (rose != null && rose.weapon != null){
acc *= rose.weapon.accuracyFactor(this); acc *= rose.weapon.accuracyFactor( this, target );
} }
return acc; return acc;
@@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.huntress.NaturesPower; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.huntress.NaturesPower;
import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash;
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle; import com.shatteredpixel.shatteredpixeldungeon.effects.particles.LeafParticle;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfFuror;
import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting; import com.shatteredpixel.shatteredpixeldungeon.items.rings.RingOfSharpshooting;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.MissileWeapon;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
@@ -329,11 +328,11 @@ public class SpiritBow extends Weapon {
} }
@Override @Override
public float accuracyFactor(Char owner) { public float accuracyFactor(Char owner, Char target) {
if (sniperSpecial && SpiritBow.this.augment == Augment.DAMAGE){ if (sniperSpecial && SpiritBow.this.augment == Augment.DAMAGE){
return Float.POSITIVE_INFINITY; return Float.POSITIVE_INFINITY;
} else { } else {
return super.accuracyFactor(owner); return super.accuracyFactor(owner, target);
} }
} }
@@ -168,7 +168,7 @@ abstract public class Weapon extends KindOfWeapon {
} }
@Override @Override
public float accuracyFactor( Char owner ) { public float accuracyFactor(Char owner, Char target) {
int encumbrance = 0; int encumbrance = 0;
@@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
import com.shatteredpixel.shatteredpixeldungeon.actors.Char; import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff; 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.Talent;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite;
import com.watabou.noosa.tweeners.AlphaTweener; import com.watabou.noosa.tweeners.AlphaTweener;
@@ -50,6 +51,17 @@ public class HeavyBoomerang extends MissileWeapon {
(tier) * lvl; //scaling unchanged (tier) * lvl; //scaling unchanged
} }
boolean circleBackhit = false;
@Override
protected float adjacentAccFactor(Char owner, Char target) {
if (circleBackhit){
circleBackhit = false;
return 1.5f;
}
return super.adjacentAccFactor(owner, target);
}
@Override @Override
protected void rangedHit(Char enemy, int cell) { protected void rangedHit(Char enemy, int cell) {
decrementDurability(); decrementDurability();
@@ -70,14 +82,14 @@ public class HeavyBoomerang extends MissileWeapon {
revivePersists = true; revivePersists = true;
} }
private MissileWeapon boomerang; private HeavyBoomerang boomerang;
private int thrownPos; private int thrownPos;
private int returnPos; private int returnPos;
private int returnDepth; private int returnDepth;
private int left; private int left;
public void setup( MissileWeapon boomerang, int thrownPos, int returnPos, int returnDepth){ public void setup( HeavyBoomerang boomerang, int thrownPos, int returnPos, int returnDepth){
this.boomerang = boomerang; this.boomerang = boomerang;
this.thrownPos = thrownPos; this.thrownPos = thrownPos;
this.returnPos = returnPos; this.returnPos = returnPos;
@@ -121,6 +133,7 @@ public class HeavyBoomerang extends MissileWeapon {
} }
} else if (returnTarget != null){ } else if (returnTarget != null){
boomerang.circleBackhit = true;
if (((Hero)target).shoot( returnTarget, boomerang )) { if (((Hero)target).shoot( returnTarget, boomerang )) {
boomerang.decrementDurability(); boomerang.decrementDurability();
} }
@@ -162,7 +175,7 @@ public class HeavyBoomerang extends MissileWeapon {
@Override @Override
public void restoreFromBundle(Bundle bundle) { public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle); super.restoreFromBundle(bundle);
boomerang = (MissileWeapon) bundle.get(BOOMERANG); boomerang = (HeavyBoomerang) bundle.get(BOOMERANG);
thrownPos = bundle.getInt(THROWN_POS); thrownPos = bundle.getInt(THROWN_POS);
returnPos = bundle.getInt(RETURN_POS); returnPos = bundle.getInt(RETURN_POS);
returnDepth = bundle.getInt(RETURN_DEPTH); returnDepth = bundle.getInt(RETURN_DEPTH);
@@ -171,14 +171,29 @@ abstract public class MissileWeapon extends Weapon {
} }
@Override @Override
public float accuracyFactor(Char owner) { public float accuracyFactor(Char owner, Char target) {
float accFactor = super.accuracyFactor(owner); float accFactor = super.accuracyFactor(owner, target);
if (owner instanceof Hero && owner.buff(Momentum.class) != null && owner.buff(Momentum.class).freerunning()){ if (owner instanceof Hero && owner.buff(Momentum.class) != null && owner.buff(Momentum.class).freerunning()){
accFactor *= 1f + 0.2f*((Hero) owner).pointsInTalent(Talent.PROJECTILE_MOMENTUM); accFactor *= 1f + 0.2f*((Hero) owner).pointsInTalent(Talent.PROJECTILE_MOMENTUM);
} }
accFactor *= adjacentAccFactor(owner, target);
return accFactor; return accFactor;
} }
protected float adjacentAccFactor(Char owner, Char target){
if (Dungeon.level.adjacent( owner.pos, target.pos )) {
if (owner instanceof Hero){
return (0.5f + 0.2f*((Hero) owner).pointsInTalent(Talent.POINT_BLANK));
} else {
return 0.5f;
}
} else {
return 1.5f;
}
}
@Override @Override
public void doThrow(Hero hero) { public void doThrow(Hero hero) {
parent = null; //reset parent before throwing, just incase parent = null; //reset parent before throwing, just incase