v0.9.1: improved quickslot targeting logic in edge cases

This commit is contained in:
Evan Debenham 2020-11-03 15:25:51 -05:00
parent 22036628d3
commit fc319ad420
4 changed files with 18 additions and 4 deletions

View File

@ -509,6 +509,10 @@ public class Item implements Bundlable {
} }
} }
public int targetingPos( Hero user, int dst ){
return throwPos( user, dst );
}
public int throwPos( Hero user, int dst){ public int throwPos( Hero user, int dst){
return new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos; return new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos;
} }

View File

@ -106,8 +106,13 @@ public abstract class Wand extends Item {
} }
} }
protected abstract void onZap( Ballistica attack ); @Override
public int targetingPos(Hero user, int dst) {
return new Ballistica( user.pos, dst, collisionProperties ).collisionPos;
}
protected abstract void onZap(Ballistica attack );
public abstract void onHit( MagesStaff staff, Char attacker, Char defender, int damage); public abstract void onHit( MagesStaff staff, Char attacker, Char defender, int damage);

View File

@ -143,6 +143,11 @@ public class SpiritBow extends Weapon {
+ 2*RingOfSharpshooting.levelDamageBonus(Dungeon.hero) + 2*RingOfSharpshooting.levelDamageBonus(Dungeon.hero)
+ (curseInfusionBonus ? 2 : 0); + (curseInfusionBonus ? 2 : 0);
} }
@Override
public int targetingPos(Hero user, int dst) {
return knockArrow().targetingPos(user, dst);
}
private int targetPos; private int targetPos;
@ -255,7 +260,7 @@ public class SpiritBow extends Weapon {
public int STRReq(int lvl) { public int STRReq(int lvl) {
return SpiritBow.this.STRReq(lvl); return SpiritBow.this.STRReq(lvl);
} }
@Override @Override
protected void onThrow( int cell ) { protected void onThrow( int cell ) {
Char enemy = Actor.findChar( cell ); Char enemy = Actor.findChar( cell );

View File

@ -233,7 +233,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
public static int autoAim(Char target, Item item){ public static int autoAim(Char target, Item item){
//first try to directly target //first try to directly target
if (item.throwPos(Dungeon.hero, target.pos) == target.pos) { if (item.targetingPos(Dungeon.hero, target.pos) == target.pos) {
return target.pos; return target.pos;
} }