From 334eaf692923f25d73b16a265949bdc6207475ae Mon Sep 17 00:00:00 2001 From: BattleJenkins Date: Fri, 7 Apr 2017 10:52:09 -0700 Subject: [PATCH] Slight tweak to CmdAttack Changed the order of the code in CmdAttack, so that it does not try to search for a target until it's established that it's a valid time to attack. This is so it doesn't raise a 'not found' error message along with the other error messages given. --- evennia/contrib/turnbattle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/evennia/contrib/turnbattle.py b/evennia/contrib/turnbattle.py index de8cdcad2f..78e443c045 100644 --- a/evennia/contrib/turnbattle.py +++ b/evennia/contrib/turnbattle.py @@ -372,8 +372,6 @@ class CmdAttack(Command): def func(self): "This performs the actual command." "Set the attacker to the caller and the defender to the target." - attacker = self.caller - defender = self.caller.search(self.args) if not is_in_combat(self.caller): # If not in combat, can't attack. self.caller.msg("You can only do that in combat. (see: help fight)") @@ -386,6 +384,9 @@ class CmdAttack(Command): if not self.caller.db.hp: # Can't attack if you have no HP. self.caller.msg("You can't attack, you've been defeated.") return + + attacker = self.caller + defender = self.caller.search(self.args) if not defender: # No valid target given. return