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

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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