mirror of
https://github.com/evennia/evennia.git
synced 2026-04-04 06:57:16 +02:00
Properly implemented joining a fight in progress
Some of the code for joining a fight in progress was imported from my project, The World of Cool Battles, but was not implemented completely. The turn handler script now properly puts a reference to itself in the current fight's room, and joining a combat in progress that one isn't already a part of now works properly.
This commit is contained in:
parent
4b113cb6c8
commit
4e2a927bb4
1 changed files with 4 additions and 0 deletions
|
|
@ -204,6 +204,7 @@ def combat_cleanup(character):
|
|||
for attr in character.attributes.all():
|
||||
if attr.key[:7] == "combat_": # If the attribute name starts with 'combat_'...
|
||||
character.attributes.remove(key=attr.key) # ...then delete it!
|
||||
character.location.db.Combat_TurnHandler = None # Remove reference to turn handler in location
|
||||
|
||||
def is_in_combat(character):
|
||||
"""
|
||||
|
|
@ -648,6 +649,9 @@ class TurnHandler(DefaultScript):
|
|||
# Initialize each fighter for combat
|
||||
for fighter in self.db.fighters:
|
||||
self.initialize_for_combat(fighter)
|
||||
|
||||
# Add a reference to this script to the room
|
||||
self.obj.db.Combat_TurnHandler = self
|
||||
|
||||
# Roll initiative and sort the list of fighters depending on who rolls highest to determine turn order.
|
||||
# The initiative roll is determined by the roll_init function and can be customized easily.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue