Permalink
Browse files

[battlearena.py] Added checks for cursed and various turn-skipping st…

…atus effects.

If intimidated, paralyzed, frozen in time, bored or stunned is in the status effects, the attack turn should be skipped.
If you are cursed, or if it is a melee-only battle, then only taunting, stealing or regular attacks should be performed.
  • Loading branch information...
1 parent 147b9e3 commit 3936bcb1fca51997e63dc8498e049cb85b104fdc @FiXato committed May 13, 2013
Showing with 24 additions and 2 deletions.
  1. +24 −2 battlearena.py
View
@@ -614,15 +614,17 @@ def cb_turn_hook(data, buffer, date, tags, displayed, highlight, prefix, message
if battle_mode.lower() in ('normal', 'tracking'):
return weechat.WEECHAT_RC_OK
- if melee_only:
- weechat.hook_timer(3 * 1000, 0, 1, "cb_battlecommand", attack_cmd(select_enemy()))
+ if not can_attack():
return weechat.WEECHAT_RC_OK
if check_steal():
weechat.hook_timer(4 * 1000, 0, 1, "cb_battlecommand", steal_cmd(select_enemy()))
return weechat.WEECHAT_RC_OK
if check_taunt():
weechat.hook_timer(4 * 1000, 0, 1, "cb_battlecommand", taunt_cmd(select_enemy()))
return weechat.WEECHAT_RC_OK
+ if melee_only or check_cursed():
+ weechat.hook_timer(3 * 1000, 0, 1, "cb_battlecommand", attack_cmd(select_enemy()))
+ return weechat.WEECHAT_RC_OK
if tp_delay and tp_delay > 0:
tp_delay -= 1
weechat.prnt("", "Setting cb_battlecommand timer for attack_cmd")
@@ -637,6 +639,26 @@ def log(obj):
if DEBUG:
weechat.prnt("", obj)
+def can_attack():
+ global status_effects
+ if 'intimidated' in status_effects:
+ return False
+ elif 'paralyzed' in status_effects:
+ return False
+ elif 'frozen in time' in status_effects:
+ return False
+ elif 'bored' in status_effects:
+ return False
+ elif 'stunned' in status_effects:
+ return False
+ return True
+
+def check_cursed():
+ global status_effects
+ if 'cursed' in status_effects:
+ return True
+ return False
+
def check_steal():
global has_stolen
if has_stolen:

0 comments on commit 3936bcb

Please sign in to comment.