flow package
Submodules
models.flow.combat_system module
- class models.flow.combat_system.CombatSystem(player, enemy)
Bases:
object
Handles the flow of combat between a player and an enemy.
- Parameters:
- fight()
Handle combat actions, turn-by-turn.
This method alternates turns between the player and the enemy until one is defeated.
- start_combat()
Initiate combat between the player and the enemy.
This method announces the start of combat and begins the fight loop.
models.flow.skill_check module
- class models.flow.skill_check.SkillCheck(skill_name, dc, auto_pass=False, auto_fail=False)
Bases:
object
Represents a skill check in a DnD-like system.
- Parameters:
skill_name (str) – The name of the skill (e.g., “perception”, “athletics”).
dc (int) – The difficulty class to beat.
auto_pass (bool, optional) – If True, the check automatically succeeds.
auto_fail (bool, optional) – If True, the check automatically fails.
- attempt(character_stats, advantage=False, disadvantage=False)
Attempt the skill check.
- Parameters:
character_stats (dict) – Dictionary mapping skill names to modifiers.
advantage (bool, optional) – If True, roll with advantage.
disadvantage (bool, optional) – If True, roll with disadvantage.
- Returns:
True if the check succeeds, False otherwise.
- Return type:
bool
models.flow.turn_system module
- class models.flow.turn_system.TurnSystem(entities)
Bases:
object
Manages the turn order and round progression for a set of entities.
- entities
The list of entities participating in the turn system.
- Type:
list
- current_turn
The index of the entity whose turn it is.
- Type:
int
- round_number
The current round number.
- Type:
int
- _scheduled
Internal queue of scheduled callbacks.
- Type:
list
- end_turn()
End the current entity’s turn and advance to the next turn.
- execute_turn()
Execute the current entity’s turn, including action validation, event emission, and reaction resolution.
- next_turn()
Advance to the next entity’s turn.
- schedule_in(turns: int, callback, data=None)
Schedule a callback to run after a certain number of turns.
- Parameters:
turns (int) – Number of turns to wait before firing the callback. If 0, fires at the end of the current turn.
callback (callable) – The function to call.
data (any, optional) – Data to pass to the callback.
- start_round()
Start a new round, dispatching any scheduled events for this round.