mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 16:56:32 +01:00
Options for turn timeout and actions per turn
This commit is contained in:
parent
f576005772
commit
30eea75ad7
3 changed files with 36 additions and 12 deletions
|
|
@ -48,10 +48,18 @@ from evennia.commands.default.help import CmdHelp
|
|||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
OPTIONS
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
TURN_TIMEOUT = 30 # Time before turns automatically end, in seconds
|
||||
ACTIONS_PER_TURN = 1 # Number of actions allowed per turn
|
||||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
def roll_init(character):
|
||||
"""
|
||||
|
|
@ -386,7 +394,7 @@ class TBBasicTurnHandler(DefaultScript):
|
|||
|
||||
# Set up the current turn and turn timeout delay.
|
||||
self.db.turn = 0
|
||||
self.db.timer = 30 # 30 seconds
|
||||
self.db.timer = TURN_TIMEOUT # Set timer to turn timeout specified in options
|
||||
|
||||
def at_stop(self):
|
||||
"""
|
||||
|
|
@ -440,7 +448,7 @@ class TBBasicTurnHandler(DefaultScript):
|
|||
separated for movement, by adding "character.db.combat_movesleft = 3" or
|
||||
something similar.
|
||||
"""
|
||||
character.db.combat_actionsleft = 1 # 1 action per turn.
|
||||
character.db.combat_actionsleft = ACTIONS_PER_TURN # Replenish actions
|
||||
# Prompt the character for their turn and give some information.
|
||||
character.msg("|wIt's your turn! You have %i HP remaining.|n" % character.db.hp)
|
||||
|
||||
|
|
@ -478,7 +486,7 @@ class TBBasicTurnHandler(DefaultScript):
|
|||
if self.db.turn > len(self.db.fighters) - 1:
|
||||
self.db.turn = 0 # Go back to the first in the turn order once you reach the end.
|
||||
newchar = self.db.fighters[self.db.turn] # Note the new character
|
||||
self.db.timer = 30 + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timer = TURN_TIMEOUT + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timeout_warning_given = False # Reset the timeout warning.
|
||||
self.obj.msg_contents("%s's turn ends - %s's turn begins!" % (currentchar, newchar))
|
||||
self.start_turn(newchar) # Start the new character's turn.
|
||||
|
|
|
|||
|
|
@ -60,10 +60,18 @@ from evennia.commands.default.help import CmdHelp
|
|||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
OPTIONS
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
TURN_TIMEOUT = 30 # Time before turns automatically end, in seconds
|
||||
ACTIONS_PER_TURN = 1 # Number of actions allowed per turn
|
||||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
def roll_init(character):
|
||||
"""
|
||||
|
|
@ -377,7 +385,7 @@ class TBEquipTurnHandler(DefaultScript):
|
|||
|
||||
# Set up the current turn and turn timeout delay.
|
||||
self.db.turn = 0
|
||||
self.db.timer = 30 # 30 seconds
|
||||
self.db.timer = TURN_TIMEOUT # Set timer to turn timeout specified in options
|
||||
|
||||
def at_stop(self):
|
||||
"""
|
||||
|
|
@ -431,7 +439,7 @@ class TBEquipTurnHandler(DefaultScript):
|
|||
separated for movement, by adding "character.db.combat_movesleft = 3" or
|
||||
something similar.
|
||||
"""
|
||||
character.db.combat_actionsleft = 1 # 1 action per turn.
|
||||
character.db.combat_actionsleft = ACTIONS_PER_TURN # Replenish actions
|
||||
# Prompt the character for their turn and give some information.
|
||||
character.msg("|wIt's your turn! You have %i HP remaining.|n" % character.db.hp)
|
||||
|
||||
|
|
@ -469,7 +477,7 @@ class TBEquipTurnHandler(DefaultScript):
|
|||
if self.db.turn > len(self.db.fighters) - 1:
|
||||
self.db.turn = 0 # Go back to the first in the turn order once you reach the end.
|
||||
newchar = self.db.fighters[self.db.turn] # Note the new character
|
||||
self.db.timer = 30 + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timer = TURN_TIMEOUT + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timeout_warning_given = False # Reset the timeout warning.
|
||||
self.obj.msg_contents("%s's turn ends - %s's turn begins!" % (currentchar, newchar))
|
||||
self.start_turn(newchar) # Start the new character's turn.
|
||||
|
|
|
|||
|
|
@ -101,10 +101,18 @@ from evennia.commands.default.help import CmdHelp
|
|||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
OPTIONS
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
TURN_TIMEOUT = 30 # Time before turns automatically end, in seconds
|
||||
ACTIONS_PER_TURN = 1 # Number of actions allowed per turn
|
||||
|
||||
"""
|
||||
----------------------------------------------------------------------------
|
||||
COMBAT FUNCTIONS START HERE
|
||||
----------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
def roll_init(character):
|
||||
"""
|
||||
|
|
@ -548,7 +556,7 @@ class TBRangeTurnHandler(DefaultScript):
|
|||
|
||||
# Set up the current turn and turn timeout delay.
|
||||
self.db.turn = 0
|
||||
self.db.timer = 30 # 30 seconds
|
||||
self.db.timer = TURN_TIMEOUT # Set timer to turn timeout specified in options
|
||||
|
||||
def at_stop(self):
|
||||
"""
|
||||
|
|
@ -653,7 +661,7 @@ class TBRangeTurnHandler(DefaultScript):
|
|||
characters to both move and attack in the same turn (or, alternately,
|
||||
move twice or attack twice).
|
||||
"""
|
||||
character.db.combat_actionsleft = 2 # 2 actions per turn.
|
||||
character.db.combat_actionsleft = ACTIONS_PER_TURN # Replenish actions
|
||||
# Prompt the character for their turn and give some information.
|
||||
character.msg("|wIt's your turn!|n")
|
||||
combat_status_message(character)
|
||||
|
|
@ -692,7 +700,7 @@ class TBRangeTurnHandler(DefaultScript):
|
|||
if self.db.turn > len(self.db.fighters) - 1:
|
||||
self.db.turn = 0 # Go back to the first in the turn order once you reach the end.
|
||||
newchar = self.db.fighters[self.db.turn] # Note the new character
|
||||
self.db.timer = 30 + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timer = TURN_TIMEOUT + self.time_until_next_repeat() # Reset the timer.
|
||||
self.db.timeout_warning_given = False # Reset the timeout warning.
|
||||
self.obj.msg_contents("%s's turn ends - %s's turn begins!" % (currentchar, newchar))
|
||||
self.start_turn(newchar) # Start the new character's turn.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue