mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 06:57:16 +02:00
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):
|
||||
"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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue