From c3ee6602842e60509342869a92eadf8cb4d0dc9e Mon Sep 17 00:00:00 2001
From: Led Mitz <smoothshifter@tuta.io>
Date: Mon, 28 Aug 2023 23:45:06 +0000
Subject: Revert magic attack delay to original behaviour

---
 src/map/pc.cpp | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'src')

diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 63c7614..d496c5f 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -1106,10 +1106,11 @@ void pc_set_weapon_look(dumb_ptr<map_session_data> sd)
  * Actively changed parameters should be send on their own
  *
  * First is a bitmask
- * &1 = ?
- * &2 = ?
- * &4 = ?
- * &8 = magic override
+ * &0 = Status Recalculation | ステータス再計算
+ * &1 = Status initial calculation, etc.| ステータス初期計算など
+ * &2 = Recalculate item bonus (used in pc_checkitem but not handled in this function atm, so if function is called with first = 2 its basically first = 0 only)
+ * &4 = Status Recalculation but don't use any clif_updatestatus to send status to client (used by map_quit)
+ * &8 = magic override (used in pc_set_attack_info)
  *------------------------------------------
  */
 int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
@@ -1556,14 +1557,13 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
         sd->speed_cap = interval_t::zero();
     if (sd->speed < sd->speed_cap)
         sd->speed = sd->speed_cap;
+    if (aspd_rate != 100)
+        sd->aspd = sd->aspd * aspd_rate / 100;
 
     /* Magic speed */
     if (sd->attack_spell_override || first & 8)
         sd->aspd = sd->attack_spell_delay;
 
-    if (aspd_rate != 100)
-        sd->aspd = sd->aspd * aspd_rate / 100;
-
     /* Red Threshold Calculation (TODO) */
     if (sd->aspd < 300_ms) {
         sd->aspd = 300_ms + ((sd->aspd - 300_ms) * 20 / 20);
@@ -1581,12 +1581,12 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first)
 
     if (first & 4)
         return 0;
-    if (first & 3)
+    if (first & 3) // never executed atm
     {
         clif_updatestatus(sd, SP::SPEED);
         clif_updatestatus(sd, SP::MAXHP);
         clif_updatestatus(sd, SP::MAXSP);
-        if (first & 1)
+        if (first & 1) // its always 1 here if first is 3 so this if is not needed normally
         {
             clif_updatestatus(sd, SP::HP);
             clif_updatestatus(sd, SP::SP);
-- 
cgit v1.2.3-70-g09d2