summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index c36c14971..2db6108aa 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1139,6 +1139,27 @@ int unit_attack(struct block_list *src,int target_id,int type)
return 0;
}
+//Cancels an ongoing combo, resets attackable time and restarts the
+//attack timer to resume attacking after amotion time. [Skotlex]
+int unit_cancel_combo(struct block_list *bl)
+{
+ struct unit_data *ud;
+
+ if (!status_change_end(bl, SC_COMBO, -1))
+ return 0; //Combo wasn't active.
+
+ ud = unit_bl2ud(bl);
+ nullpo_retr(0, ud);
+
+ ud->attackabletime = gettick() + status_get_amotion(bl);
+
+ if (ud->attacktimer == -1)
+ return 1; //Nothing more to do.
+
+ delete_timer(ud->attacktimer, unit_attack_timer);
+ ud->attacktimer=add_timer(ud->attackabletime,unit_attack_timer,bl->id,0);
+ return 1;
+}
/*==========================================
*
*------------------------------------------