v3.2.5: fixed crossbow charged shot melee not triggering in some cases

This commit is contained in:
Evan Debenham
2025-09-25 10:35:16 -04:00
parent 958bc5ecd0
commit 093e7a6874

View File

@@ -22,12 +22,12 @@
package com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
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.items.wands.WandOfBlastWave;
import com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart;
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
@@ -86,7 +86,10 @@ public class Crossbow extends MeleeWeapon {
int dmg = super.proc(attacker, defender, damage);
//stronger elastic effect
if (attacker.buff(ChargedShot.class) != null && !(curItem instanceof Dart)){
if (attacker == Dungeon.hero
&& Dungeon.hero.buff(ChargedShot.class) != null
//not proccing from a dart
&& Dungeon.hero.belongings.attackingWeapon() == this){
//trace a ballistica to our target (which will also extend past them
Ballistica trajectory = new Ballistica(attacker.pos, defender.pos, Ballistica.STOP_TARGET);
//trim it to just be the part that goes past them