Only trigger spectral on melee (kingbuddyboy)
authorNicholas Feinberg <pleasingfung@gmail.com>
Fri, 30 Apr 2021 22:15:41 +0000 (15:15 -0700)
committerNicholas Feinberg <pleasingfung@gmail.com>
Fri, 30 Apr 2021 22:15:41 +0000 (15:15 -0700)
Don't allow ranged attacks to re-trigger existing spectral weapons.

crawl-ref/source/attack.cc
crawl-ref/source/melee-attack.cc

index 04f0c7a..5ffe1ef 100644 (file)
@@ -43,8 +43,6 @@
 #include "transform.h"
 #include "xom.h"
 
-static void _handle_spectral_brand(const actor &attacker, const actor &defender);
-
 /*
  **************************************************
  *             BEGIN PUBLIC FUNCTIONS             *
@@ -142,15 +140,6 @@ bool attack::handle_phase_killed()
 
 bool attack::handle_phase_end()
 {
-    if (attacker->is_player() && defender)
-    {
-        if (damage_brand == SPWPN_SPECTRAL)
-            _handle_spectral_brand(*attacker, *defender);
-        // Use the Nessos hack to give the player glaive of the guard spectral too
-        if (weapon && is_unrandom_artefact(*weapon, UNRAND_GUARD))
-            _handle_spectral_brand(*attacker, *defender);
-    }
-
     return true;
 }
 
@@ -561,14 +550,6 @@ void attack::antimagic_affects_defender(int pow)
         enchant_actor_with_flavour(defender, nullptr, BEAM_DRAIN_MAGIC, pow);
 }
 
-static void _handle_spectral_brand(const actor &attacker, const actor &defender)
-{
-    if (you.triggered_spectral || !defender.alive())
-        return;
-    you.triggered_spectral = true;
-    spectral_weapon_fineff::schedule(attacker, defender);
-}
-
 /// Whose skill should be used for a pain-weapon effect?
 static actor* _pain_weapon_user(actor* attacker)
 {
index 9808ccb..ce809ba 100644 (file)
@@ -707,6 +707,14 @@ bool melee_attack::handle_phase_killed()
     return attack::handle_phase_killed();
 }
 
+static void _handle_spectral_brand(const actor &attacker, const actor &defender)
+{
+    if (you.triggered_spectral || !defender.alive())
+        return;
+    you.triggered_spectral = true;
+    spectral_weapon_fineff::schedule(attacker, defender);
+}
+
 bool melee_attack::handle_phase_end()
 {
     if (!cleave_targets.empty() && !simu)
@@ -730,6 +738,15 @@ bool melee_attack::handle_phase_end()
         attacker->as_monster()->del_ench(ENCH_ROLLING);
     }
 
+    if (attacker->is_player() && defender)
+    {
+        if (damage_brand == SPWPN_SPECTRAL)
+            _handle_spectral_brand(*attacker, *defender);
+        // Use the Nessos hack to give the player glaive of the guard spectral too
+        if (weapon && is_unrandom_artefact(*weapon, UNRAND_GUARD))
+            _handle_spectral_brand(*attacker, *defender);
+    }
+
     return attack::handle_phase_end();
 }