v0.9.1b: fixed imp. projectiles targeting chars spawned by throw an item

This commit is contained in:
Evan Debenham 2020-12-31 22:35:13 -05:00
parent 4f4174c7b9
commit bd8fed898c

View File

@ -547,14 +547,14 @@ public class Item implements Bundlable {
@Override
public void call() {
curUser = user;
Item.this.detach(user.belongings.backpack).onThrow(cell);
Item i = Item.this.detach(user.belongings.backpack);
if (i != null) i.onThrow(cell);
if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES)
&& !(Item.this instanceof MissileWeapon)
&& curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){
Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment != curUser.alignment){
if (enemy != null && enemy.alignment != curUser.alignment){
Sample.INSTANCE.play(Assets.Sounds.HIT);
Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES));
Buff.affect(enemy, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES));
Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f);
}
}
@ -572,16 +572,6 @@ public class Item implements Bundlable {
curUser = user;
Item i = Item.this.detach(user.belongings.backpack);
if (i != null) i.onThrow(cell);
if (curUser.hasTalent(Talent.IMPROVISED_PROJECTILES)
&& !(Item.this instanceof MissileWeapon)
&& curUser.buff(Talent.ImprovisedProjectileCooldown.class) == null){
Char ch = Actor.findChar(cell);
if (ch != null && ch.alignment != curUser.alignment){
Sample.INSTANCE.play(Assets.Sounds.HIT);
Buff.affect(ch, Blindness.class, 1f + curUser.pointsInTalent(Talent.IMPROVISED_PROJECTILES));
Buff.affect(curUser, Talent.ImprovisedProjectileCooldown.class, 30f);
}
}
user.spendAndNext(delay);
}
});