Guard
A guard the other side must attack first; an attack each way at once
count(enemies having TAG)lettemplate archetypeA guard the other side must attack first, lifted from the card slice's content\guard.ledger (Guarding) and the board's attack from content\rules.ledger (Ready, Attack, Mortal and the Body template). A unit attacks once a turn, from the turn after it is played, each of the two dealing its attack to the other at once; while the other side has a guard, only a guard may be attacked. A spell isn't held by it. The guard's tag is held by an effect, not the card, so the hero keeping the card in its hand is no guard; here the units stand on the board.
1
# A guard the other side must attack first, lifted from the card slice's content\guard.ledger (Guarding) and the2
# board's attack from content\rules.ledger (Ready, Attack, Mortal and the Body template). A unit attacks once a turn,3
# from the turn after it is played, each of the two dealing its attack to the other at once; while the other side has4
# a guard, only a guard may be attacked. A spell isn't held by it. The guard's tag is held by an effect, not the card,5
# so the hero keeping the card in its hand is no guard; here the units stand on the board.7
rate 108
link team owner9
allegiance team11
stat MaxHealth12
stat Attack13
pool Health max MaxHealth whole14
pool Attacks max 1 whole15
damage Health17
tags Body Unit Hero Guard18
event TurnStarted Attacking Died19
turn TurnStarted21
effect Mortal22
dies at no Health raising Died24
effect Ready25
after TurnStarted of holder26
set Attacks 128
ability Attack29
target one enemy having Body30
requires has(target, Guard) or count(enemies having Guard) == 0 else "a guard is in the way"31
cost Attacks 132
raise Attacking of target by holder33
if holder.Health > 034
let mine = holder.Attack35
let theirs = target.Attack36
deal mine to target from holder37
deal theirs to holder from target39
template archetype Body(attack, health)40
tags Body Unit41
base MaxHealth health42
base Attack attack43
full Health44
pools Attacks45
has Mortal46
has Ready47
grants Attack49
effect Guarding50
tags Guard52
archetype Side54
archetype Hero55
tags Body Hero56
base MaxHealth 3057
base Attack 058
full Health60
archetype Recruit from Body(1, 2)62
archetype Shieldbearer from Body(1, 4)63
has Guarding1
catalog guard.ledger3
# The guard's numbers, from Attack and the bodies: a recruit 1/2, a shieldbearer 1/4 that guards, a hero of 30.5
play "a unit attacks from its first turn on; a guard must be attacked first: the hero and the recruit behind it are refused; the guard takes 1 and gives 1"6
make a Side7
make b Side8
make e Hero with team = b9
make u Recruit with team = a10
make g Shieldbearer with team = b11
make r Recruit with team = b12
act u Attack at g13
expect refused CannotAfford14
raise TurnStarted of u15
act u Attack at e16
expect refused Requirement "a guard is in the way"17
act u Attack at r18
expect refused Requirement "a guard is in the way"19
act u Attack at g20
expect done21
expect g.Health = 3 from content: 4 less the recruit's 122
expect u.Health = 1 from content: 2 less the guard's 123
act u Attack at g24
expect refused CannotAfford26
play "with the guard gone, the hero may be attacked"27
make a Side28
make b Side29
make e Hero with team = b30
make u Recruit with team = a31
make g Shieldbearer with team = b32
deal 4 to g33
expect g gone34
raise TurnStarted of u35
act u Attack at e36
expect done37
expect e.Health = 29 from content: 30 less the recruit's 138
expect u.Health = 2 from content: the hero's Attack 0 backRun it yourself
ledger check content/cookbook/mechanics/guard.ledger content/cookbook/mechanics/guard.play
ledger play content/cookbook/mechanics/guard.play