Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Static targeters for playing creatures,spells,etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tikidoodlep1 committed Apr 2, 2024
1 parent f8c026c commit 28426b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const TargetType = {
Landscape: 2,
Player: 3,
DiscardPile: 4,
EffectHolder: 5
EffectHolder: 5,
BoardPos: 6,
Board: 7
}

export class Game {
Expand Down Expand Up @@ -298,7 +300,21 @@ class Targeter {
this.targetType = targetType;
}

//Selection Predicates
static ANY_PREDICATE = (lane: BoardPos) => true; //Note that the lane should be a BoardPos instance, and the predicate should be checked for each valid BoardPos instance.

//Targeters
static PLAY_CREATURE = new Targeter(PlayerTargeter.Self, LaneTargeter.SingleLane, true, 1, (lane: BoardPos) => {return lane.creature == Creatures.NULL;},
TargetType.BoardPos);

static PLAY_BUILDING = new Targeter(PlayerTargeter.Self, LaneTargeter.SingleLane, true, 1, (lane: BoardPos) => {return lane.building == Buildings.NULL;},
TargetType.BoardPos);

static PLAY_SPELL = new Targeter(PlayerTargeter.Self, LaneTargeter.None, true, 1, Targeter.ANY_PREDICATE,
TargetType.Board);

static PLAY_LANDSCAPE = new Targeter(PlayerTargeter.Self, LaneTargeter.SingleLane, true, 1, (lane: BoardPos) => {return lane.landscape == LandscapeType.NULL;},
TargetType.BoardPos);
}

class Effect { // Builder Class
Expand Down

0 comments on commit 28426b8

Please sign in to comment.