ActionCheckPieceCount class
Checks if at least count pieces of type pieceType are present for player. If player is null, then both players will be checked. If both players have less than count, it will be a draw. If one player has less, then it will be a win for their opponent, unless draw is true in which case it will be a draw. If drawsInvalidate is true (default), then any drawn result will invalidate the move. In other words, moves that cause both players to not have enough pieces will not be allowed.
Constructors
- ActionCheckPieceCount({required String pieceType, int count = 1, bool draw = false, bool drawsInvalidate = true, int? player, ActionEvent event = ActionEvent.afterMove, ActionCondition? precondition, ActionCondition? condition})
Properties
- action → ActionDefinition
-
A function that generates a
List<ActionEffect>
based on anActionTrigger
passed to it.finalinherited - condition → ActionCondition?
-
The condition is checked before executing the action in its sequence, i.e.
effects applied by actions occurring before this in the sequence will be
taken into account by the condition, in contrast with precondition.
finalinherited
- count → int
-
final
- draw → bool
-
final
- drawsInvalidate → bool
-
final
- event → ActionEvent
-
The type of event that will trigger this action.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- pieceType → String
-
final
- player → int?
-
final
- precondition → ActionCondition?
-
The precondition is checked before any action in the group is executed.
In other words, the precondition will act on the state of the game,
ignoring any changes that happen as a result of actions executed before
this one, that are triggered by the same event.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{ActionEvent? event, ActionCondition? precondition, ActionCondition? condition, ActionDefinition? action}) → Action -
inherited
-
forPieceType(
int type) → Action -
Copies the Action with the added condition that the piece type is
type
. Used internally when building variants, to enable convenience actions on piece type definitions.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
swapConditions(
) → Action -
Swaps precondition and condition.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited