From 95ab214283087e3bb57cb8c7cb66080463cffc35 Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Mon, 15 Aug 2022 17:39:11 -0400 Subject: [PATCH] v1.4.0: heavy boomerangs now always give 1.5x acc when returning --- .../actors/hero/Hero.java | 2 +- .../actors/mobs/Statue.java | 2 +- .../items/KindOfWeapon.java | 4 ++-- .../items/artifacts/DriedRose.java | 2 +- .../items/weapon/SpiritBow.java | 5 ++--- .../items/weapon/Weapon.java | 2 +- .../items/weapon/missiles/HeavyBoomerang.java | 21 +++++++++++++++---- .../items/weapon/missiles/MissileWeapon.java | 19 +++++++++++++++-- 8 files changed, 42 insertions(+), 15 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java index 9fc22bcda..35ca5529a 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/hero/Hero.java @@ -461,7 +461,7 @@ public class Hero extends Char { } if (wep != null) { - return (int)(attackSkill * accuracy * wep.accuracyFactor( this )); + return (int)(attackSkill * accuracy * wep.accuracyFactor( this, target )); } else { return (int)(attackSkill * accuracy); } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java index 88ab0e7c9..09cdcf380 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/mobs/Statue.java @@ -91,7 +91,7 @@ public class Statue extends Mob { @Override public int attackSkill( Char target ) { - return (int)((9 + Dungeon.depth) * weapon.accuracyFactor(this)); + return (int)((9 + Dungeon.depth) * weapon.accuracyFactor( this, target )); } @Override diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java index c4cd4e7d2..00790ca6d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/KindOfWeapon.java @@ -105,11 +105,11 @@ abstract public class KindOfWeapon extends EquipableItem { return Random.NormalIntRange( min(), max() ); } - public float accuracyFactor( Char owner ) { + public float accuracyFactor( Char owner, Char target ) { return 1f; } - public float delayFactor(Char owner ) { + public float delayFactor( Char owner ) { return 1f; } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java index 994ba01f2..6904a2429 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/artifacts/DriedRose.java @@ -586,7 +586,7 @@ public class DriedRose extends Artifact { int acc = Dungeon.hero.lvl + 9; if (rose != null && rose.weapon != null){ - acc *= rose.weapon.accuracyFactor(this); + acc *= rose.weapon.accuracyFactor( this, target ); } return acc; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java index 1262aaecd..d82523a29 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/SpiritBow.java @@ -32,7 +32,6 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Talent; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.abilities.huntress.NaturesPower; import com.shatteredpixel.shatteredpixeldungeon.effects.Splash; 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.weapon.missiles.MissileWeapon; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; @@ -329,11 +328,11 @@ public class SpiritBow extends Weapon { } @Override - public float accuracyFactor(Char owner) { + public float accuracyFactor(Char owner, Char target) { if (sniperSpecial && SpiritBow.this.augment == Augment.DAMAGE){ return Float.POSITIVE_INFINITY; } else { - return super.accuracyFactor(owner); + return super.accuracyFactor(owner, target); } } diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java index 70df650dd..0b542fe65 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/Weapon.java @@ -168,7 +168,7 @@ abstract public class Weapon extends KindOfWeapon { } @Override - public float accuracyFactor( Char owner ) { + public float accuracyFactor(Char owner, Char target) { int encumbrance = 0; diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java index 405996025..28fbe92fa 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/HeavyBoomerang.java @@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.actors.Actor; 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.Talent; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.sprites.MissileSprite; import com.watabou.noosa.tweeners.AlphaTweener; @@ -49,7 +50,18 @@ public class HeavyBoomerang extends MissileWeapon { return 4 * tier + //16 base, down from 20 (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 protected void rangedHit(Char enemy, int cell) { decrementDurability(); @@ -70,14 +82,14 @@ public class HeavyBoomerang extends MissileWeapon { revivePersists = true; } - private MissileWeapon boomerang; + private HeavyBoomerang boomerang; private int thrownPos; private int returnPos; private int returnDepth; 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.thrownPos = thrownPos; this.returnPos = returnPos; @@ -121,6 +133,7 @@ public class HeavyBoomerang extends MissileWeapon { } } else if (returnTarget != null){ + boomerang.circleBackhit = true; if (((Hero)target).shoot( returnTarget, boomerang )) { boomerang.decrementDurability(); } @@ -162,7 +175,7 @@ public class HeavyBoomerang extends MissileWeapon { @Override public void restoreFromBundle(Bundle bundle) { super.restoreFromBundle(bundle); - boomerang = (MissileWeapon) bundle.get(BOOMERANG); + boomerang = (HeavyBoomerang) bundle.get(BOOMERANG); thrownPos = bundle.getInt(THROWN_POS); returnPos = bundle.getInt(RETURN_POS); returnDepth = bundle.getInt(RETURN_DEPTH); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java index a718b1cc4..8366a574d 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/items/weapon/missiles/MissileWeapon.java @@ -171,14 +171,29 @@ abstract public class MissileWeapon extends Weapon { } @Override - public float accuracyFactor(Char owner) { - float accFactor = super.accuracyFactor(owner); + public float accuracyFactor(Char owner, Char target) { + float accFactor = super.accuracyFactor(owner, target); 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 *= adjacentAccFactor(owner, target); + 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 public void doThrow(Hero hero) { parent = null; //reset parent before throwing, just incase