v0.9.2: fixed projecting not working with shared enchantments talent

This commit is contained in:
Evan Debenham 2021-02-20 18:30:29 -05:00
parent 5e6eeef645
commit a933194342

View File

@ -146,8 +146,20 @@ abstract public class MissileWeapon extends Weapon {
@Override @Override
public int throwPos(Hero user, int dst) { public int throwPos(Hero user, int dst) {
if (hasEnchant(Projecting.class, user)
&& !Dungeon.level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){ boolean projecting = hasEnchant(Projecting.class, user);
if (!projecting && Random.Int(3) < user.pointsInTalent(Talent.SHARED_ENCHANTMENT)){
if (this instanceof Dart && ((Dart) this).crossbowHasEnchant(Dungeon.hero)){
//do nothing
} else {
SpiritBow bow = Dungeon.hero.belongings.getItem(SpiritBow.class);
if (bow != null && bow.hasEnchant(Projecting.class, user)) {
projecting = true;
}
}
}
if (projecting && !Dungeon.level.solid[dst] && Dungeon.level.distance(user.pos, dst) <= 4){
return dst; return dst;
} else { } else {
return super.throwPos(user, dst); return super.throwPos(user, dst);