Priority
A turret that picks its own target by a priority the player sets
grants ... auto by highestif(...)takes PROPtemplate effectA turret that picks its own target by a priority the player sets, lifted from the tower-defense slice's content\towers.ledger (Aim, Prioritize and the archer's Shoot), with the lane's pools from content\td.ledger. The archer shoots on its own, every 0.8 s, at the creep within its reach that ranks highest: first along the lane (the most Progress), last, strongest (the most Health) or closest, by its Priority 0 to 3; the player sets it with an order. The slice's creeps walk the lane; these stand where the play sets them.
1
# A turret that picks its own target by a priority the player sets, lifted from the tower-defense slice's2
# content\towers.ledger (Aim, Prioritize and the archer's Shoot), with the lane's pools from content\td.ledger. The3
# archer shoots on its own, every 0.8 s, at the creep within its reach that ranks highest: first along the lane (the4
# most Progress), last, strongest (the most Health) or closest, by its Priority 0 to 3; the player sets it with an5
# order. The slice's creeps walk the lane; these stand where the play sets them.7
rate 608
link team owner9
allegiance team10
stat MaxHealth11
stat LaneEnd12
stat Pace13
stat Damage14
stat Reach15
stat Haste16
pool Health max MaxHealth17
pool Progress max LaneEnd regen Pace18
pool Priority whole max 319
damage Health20
tags Tower Creep Physical22
prop Order min 024
ability Prioritize25
takes Order26
requires event.Order <= 3 else "a priority is 0 first, 1 last, 2 strongest or 3 closest"27
set Priority event.Order29
template effect Aim(attack)30
grants attack auto by highest if(holder.Priority == 0, it.Progress, if(holder.Priority == 1, 100 - it.Progress, if(holder.Priority == 2, it.Health, 0 - distance(holder, it))))31
grants Prioritize33
effect ArcherAim from Aim(Shoot)35
ability Shoot36
target one enemy within holder.Reach37
cooldown 0.8s / holder.Haste38
deal holder.Damage Physical to target40
archetype Archer41
tags Tower42
base Damage 643
base Reach 444
base Haste 145
pools Priority46
has ArcherAim48
archetype Side50
archetype Creep51
tags Creep52
base MaxHealth 10053
base LaneEnd 10054
full Health55
pools Progress1
catalog priority.ledger3
# The archer's numbers, from Shoot and Aim: 6 a shot every 0.8 s within 4, at the creep ranking highest by its4
# Priority. Creeps of side b stand at 100 Health: c1 at 3 with Progress 50, c2 at 1 with Progress 20, c3 at 25
# with Progress 35 and 40 Health less, far at 5 with Progress 90; c2 has 10 less. The archer of side a stands at 0.7
play "built shooting first, it shoots the creep furthest along; set to last, the one least along; to strongest, the most Health; to closest, the nearest"8
make a Side9
make b Side10
make c1 Creep with team = b at 311
make c2 Creep with team = b at 112
make c3 Creep with team = b at 213
make far Creep with team = b at 514
set c1.Progress = 5015
set c2.Progress = 2016
set c3.Progress = 3517
set far.Progress = 9018
deal 40 to c319
deal 10 to c220
make ar Archer with team = a at 021
expect c1.Health = 94 from content: Priority 0, first: c1's Progress 50 the most within 4 (far's 90 stands at 5, past the reach): 100 - 622
expect far.Health = 100 from content: past the reach of 423
act ar Prioritize with Order = 124
expect done25
advance 0.8s26
expect c2.Health = 84 from content: Priority 1, last: c2's Progress 20 the least: 90 - 627
act ar Prioritize with Order = 228
expect done29
save30
advance 0.8s31
expect c1.Health = 88 from content: Priority 2, strongest: c1 at 94 against c2's 84 and c3's 60: 94 - 632
act ar Prioritize with Order = 333
expect done34
advance 0.8s35
expect c2.Health = 78 from content: Priority 3, closest: c2 at 1: 84 - 637
play "a priority past 3 is refused in its words"38
make a Side39
make ar Archer with team = a at 040
act ar Prioritize with Order = 441
expect refused Requirement "a priority is 0 first, 1 last, 2 strongest or 3 closest"Run it yourself
ledger check content/cookbook/mechanics/priority.ledger content/cookbook/mechanics/priority.play
ledger play content/cookbook/mechanics/priority.play