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){
return new Ballistica( user.pos, dst, Ballistica.PROJECTILE ).collisionPos;
}

View File

@ -107,7 +107,12 @@ 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);

View File

@ -144,6 +144,11 @@ public class SpiritBow extends Weapon {
+ (curseInfusionBonus ? 2 : 0);
}
@Override
public int targetingPos(Hero user, int dst) {
return knockArrow().targetingPos(user, dst);
}
private int targetPos;
@Override

View File

@ -233,7 +233,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
public static int autoAim(Char target, Item item){
//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;
}