Class ActionService
Namespace: DiceRolling.Services
Assembly: dice-rolling.dll
Provides helper methods for managing and validating character actions.
public static class ActionService
Inheritance
Inherited Members
Show/Hide Inherited Members
Methods
CanAffordAction(CharacterType, ActionType)
Checks if a character has enough available energy to pay the cost of an action.
public static bool CanAffordAction(CharacterType character, ActionType action)
Parameters
character
CharacterType
The character attempting the action.
action
ActionType
The action being attempted.
Returns
True if the character can afford the action, false otherwise.
ConsumeEnergy(CharacterType, ActionType)
Consumes the required energy for an action from a character's available energy pool. Assumes CanAffordAction was already checked and returned true.
public static void ConsumeEnergy(CharacterType character, ActionType action)
Parameters
character
CharacterType
The character spending the energy.
action
ActionType
The action whose energy cost is being spent.
GetValidTargets(CharacterType, ActionType, List<CharacterType>)
Determines the valid targets for a given action based on the attacker's position and the action's target configuration.
public static List<CharacterType> GetValidTargets(CharacterType attacker, ActionType action, List<CharacterType> potentialTargets)
Parameters
attacker
CharacterType
The character performing the action.
action
ActionType
The action being performed.
potentialTargets
List<CharacterType>
A list of all characters who could potentially be targeted.
Returns
A list of characters who are valid targets for the action.