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.
This commit is contained in:
parent
2b0d657314
commit
334eaf6929
1 changed files with 3 additions and 2 deletions
|
|
@ -372,8 +372,6 @@ class CmdAttack(Command):
|
||||||
def func(self):
|
def func(self):
|
||||||
"This performs the actual command."
|
"This performs the actual command."
|
||||||
"Set the attacker to the caller and the defender to the target."
|
"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.
|
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)")
|
self.caller.msg("You can only do that in combat. (see: help fight)")
|
||||||
|
|
@ -387,6 +385,9 @@ class CmdAttack(Command):
|
||||||
self.caller.msg("You can't attack, you've been defeated.")
|
self.caller.msg("You can't attack, you've been defeated.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
attacker = self.caller
|
||||||
|
defender = self.caller.search(self.args)
|
||||||
|
|
||||||
if not defender: # No valid target given.
|
if not defender: # No valid target given.
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue