boseiju/ability_tree/terminals/
counter.rs

1use crate::ability_tree::AbilityTreeNode;
2use crate::ability_tree::MAX_CHILDREN_PER_NODE;
3use crate::lexer::IntoToken;
4
5#[derive(serde::Serialize, serde::Deserialize)]
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct Counter {
8    pub kind: CounterKind,
9    #[cfg(feature = "spanned_tree")]
10    pub span: crate::ability_tree::span::TreeSpan,
11}
12
13impl Counter {
14    pub fn all() -> impl Iterator<Item = Self> {
15        CounterKind::all().map(|kind| Self {
16            kind,
17            #[cfg(feature = "spanned_tree")]
18            span: Default::default(),
19        })
20    }
21}
22
23impl AbilityTreeNode for Counter {
24    fn node_id(&self) -> usize {
25        use crate::ability_tree::NodeKind;
26        use crate::ability_tree::tree_node::TerminalNodeKind;
27        use idris::Idris;
28
29        NodeKind::Terminal(TerminalNodeKind::CounterIdMarker).id()
30    }
31
32    fn children(&self) -> arrayvec::ArrayVec<&dyn AbilityTreeNode, MAX_CHILDREN_PER_NODE> {
33        use crate::ability_tree::NodeKind;
34        use crate::ability_tree::tree_node::TerminalNodeKind;
35        use idris::Idris;
36
37        let mut children = arrayvec::ArrayVec::new_const();
38        let child_id = NodeKind::Terminal(TerminalNodeKind::Counter(self.kind)).id();
39        let child = crate::ability_tree::dummy_terminal::TreeNodeDummyTerminal::new(child_id);
40        children.push(child as &dyn AbilityTreeNode);
41        children
42    }
43
44    fn display(&self, out: &mut crate::utils::TreeFormatter<'_>) -> std::io::Result<()> {
45        use std::io::Write;
46        write!(out, "{}", self.kind)
47    }
48
49    fn node_tag(&self) -> &'static str {
50        "counter"
51    }
52
53    #[cfg(feature = "spanned_tree")]
54    fn node_span(&self) -> crate::ability_tree::span::TreeSpan {
55        self.span
56    }
57}
58
59#[cfg(feature = "lexer")]
60impl IntoToken for Counter {
61    fn try_from_span(span: &crate::lexer::Span) -> Option<Self> {
62        let kind = match span.text {
63            "+1/+1 counter" | "+1/+1 counters" => Some(CounterKind::PlusOnePlusOne),
64            "-1/-1 counter" | "-1/-1 counters" => Some(CounterKind::MinusOneMinusOne),
65            "+0/+1 counter" | "+0/+1 counters" => Some(CounterKind::PlusZeroPlusOne),
66            "+0/+2 counter" | "+0/+2 counters" => Some(CounterKind::PlusZeroPlusTwo),
67            "+1/+0 counter" | "+1/+0 counters" => Some(CounterKind::PlusOnePlusZero),
68            "+1/+2 counter" | "+1/+2 counters" => Some(CounterKind::PlusOnePlusTwo),
69            "+2/+0 counter" | "+2/+0 counters" => Some(CounterKind::PlusTwoPlusZero),
70            "+2/+2 counter" | "+2/+2 counters" => Some(CounterKind::PlusTwoPlusTwo),
71            "-0/-1 counter" | "-0/-1 counters" => Some(CounterKind::MinusZeroMinusOne),
72            "-0/-2 counter" | "-0/-2 counters" => Some(CounterKind::MinusZeroMinusTwo),
73            "-1/-0 counter" | "-1/-0 counters" => Some(CounterKind::MinusOneMinusZero),
74            "-2/-1 counter" | "-2/-1 counters" => Some(CounterKind::MinusTwoMinusOne),
75            "-2/-2 counter" | "-2/-2 counters" => Some(CounterKind::MinusTwoMinusTwo),
76            "charge counter" | "charge counters" => Some(CounterKind::Charge),
77            "defense counter" | "defense counters" => Some(CounterKind::Defense),
78            "energy counter" | "energy counters" => Some(CounterKind::Energy),
79            "finality counter" | "finality counters" => Some(CounterKind::Finality),
80            "lore counter" | "lore counters" => Some(CounterKind::Lore),
81            "loyalty counter" | "loyalty counters" => Some(CounterKind::Loyalty),
82            "oil counter" | "oil counters" => Some(CounterKind::Oil),
83            "poison counter" | "poison counters" => Some(CounterKind::Poison),
84            "stun counter" | "stun counters" => Some(CounterKind::Stun),
85            "time counter" | "time counters" => Some(CounterKind::Time),
86            "deathtouch counter" | "deathtouch counters" => Some(CounterKind::Deathtouch),
87            "double strike counter" | "double strike counters" => Some(CounterKind::DoubleStrike),
88            "first strike counter" | "first strike counters" => Some(CounterKind::FirstStrike),
89            "flying counter" | "flying counters" => Some(CounterKind::Flying),
90            "haste counter" | "haste counters" => Some(CounterKind::Haste),
91            "hexproof counter" | "hexproof counters" => Some(CounterKind::Hexproof),
92            "indestructible counter" | "indestructible counters" => Some(CounterKind::Indestructible),
93            "lifelink counter" | "lifelink counters" => Some(CounterKind::Lifelink),
94            "menace counter" | "menace counters" => Some(CounterKind::Menace),
95            "reach counter" | "reach counters" => Some(CounterKind::Reach),
96            "shadow counter" | "shadow counters" => Some(CounterKind::Shadow),
97            "trample counter" | "trample counters" => Some(CounterKind::Trample),
98            "vigilance counter" | "vigilance counters" => Some(CounterKind::Vigilance),
99            "age counter" | "age counters" => Some(CounterKind::Age),
100            "crank counter" | "crank counters" => Some(CounterKind::Crank),
101            "divinity counter" | "divinity counters" => Some(CounterKind::Divinity),
102            "fade counter" | "fade counters" => Some(CounterKind::Fade),
103            "ki counter" | "ki counters" => Some(CounterKind::Ki),
104            "level counter" | "level counters" => Some(CounterKind::Level),
105            "rad counter" | "rad counters" => Some(CounterKind::Rad),
106            "shield counter" | "shield counters" => Some(CounterKind::Shield),
107            "spore counter" | "spore counters" => Some(CounterKind::Spore),
108            "ticket counter" | "ticket counters" => Some(CounterKind::Ticket),
109            "brick counter" | "brick counters" => Some(CounterKind::Brick),
110            "depletion counter" | "depletion counters" => Some(CounterKind::Depletion),
111            "experience counter" | "experience counters" => Some(CounterKind::Experience),
112            "quest counter" | "quest counters" => Some(CounterKind::Quest),
113            "storage counter" | "storage counters" => Some(CounterKind::Storage),
114            "verse counter" | "verse counters" => Some(CounterKind::Verse),
115            "acorn counter" | "acorn counters" => Some(CounterKind::Acorn),
116            "aim counter" | "aim counters" => Some(CounterKind::Aim),
117            "blaze counter" | "blaze counters" => Some(CounterKind::Blaze),
118            "blood counter" | "blood counters" => Some(CounterKind::Blood),
119            "bounty counter" | "bounty counters" => Some(CounterKind::Bounty),
120            "coin counter" | "coin counters" => Some(CounterKind::Coin),
121            "collection counter" | "collection counters" => Some(CounterKind::Collection),
122            "corpse counter" | "corpse counters" => Some(CounterKind::Corpse),
123            "delay counter" | "delay counters" => Some(CounterKind::Delay),
124            "devotion counter" | "devotion counters" => Some(CounterKind::Devotion),
125            "doom counter" | "doom counters" => Some(CounterKind::Doom),
126            "dream counter" | "dream counters" => Some(CounterKind::Dream),
127            "egg counter" | "egg counters" => Some(CounterKind::Egg),
128            "eon counter" | "eon counters" => Some(CounterKind::Eon),
129            "fate counter" | "fate counters" => Some(CounterKind::Fate),
130            "feather counter" | "feather counters" => Some(CounterKind::Feather),
131            "fetch counter" | "fetch counters" => Some(CounterKind::Fetch),
132            "flame counter" | "flame counters" => Some(CounterKind::Flame),
133            "flood counter" | "flood counters" => Some(CounterKind::Flood),
134            "fungus counter" | "fungus counters" => Some(CounterKind::Fungus),
135            "fuse counter" | "fuse counters" => Some(CounterKind::Fuse),
136            "gold counter" | "gold counters" => Some(CounterKind::Gold),
137            "growth counter" | "growth counters" => Some(CounterKind::Growth),
138            "hatchling counter" | "hatchling counters" => Some(CounterKind::Hatchling),
139            "healing counter" | "healing counters" => Some(CounterKind::Healing),
140            "hit counter" | "hit counters" => Some(CounterKind::Hit),
141            "hour counter" | "hour counters" => Some(CounterKind::Hour),
142            "ice counter" | "ice counters" => Some(CounterKind::Ice),
143            "infection counter" | "infection counters" => Some(CounterKind::Infection),
144            "judgment counter" | "judgment counters" => Some(CounterKind::Judgment),
145            "landmark counter" | "landmark counters" => Some(CounterKind::Landmark),
146            "luck counter" | "luck counters" => Some(CounterKind::Luck),
147            "net counter" | "net counters" => Some(CounterKind::Net),
148            "omen counter" | "omen counters" => Some(CounterKind::Omen),
149            "page counter" | "page counters" => Some(CounterKind::Page),
150            "plague counter" | "plague counters" => Some(CounterKind::Plague),
151            "point counter" | "point counters" => Some(CounterKind::Point),
152            "pressure counter" | "pressure counters" => Some(CounterKind::Pressure),
153            "prey counter" | "prey counters" => Some(CounterKind::Prey),
154            "pupa counter" | "pupa counters" => Some(CounterKind::Pupa),
155            "polyp counter" | "polyp counters" => Some(CounterKind::Polyp),
156            "scream counter" | "scream counters" => Some(CounterKind::Scream),
157            "scroll counter" | "scroll counters" => Some(CounterKind::Scroll),
158            "slime counter" | "slime counters" => Some(CounterKind::Slime),
159            "soul counter" | "soul counters" => Some(CounterKind::Soul),
160            "spark counter" | "spark counters" => Some(CounterKind::Spark),
161            "spite counter" | "spite counters" => Some(CounterKind::Spite),
162            "stash counter" | "stash counters" => Some(CounterKind::Stash),
163            "story counter" | "story counters" => Some(CounterKind::Story),
164            "strife counter" | "strife counters" => Some(CounterKind::Strife),
165            "study counter" | "study counters" => Some(CounterKind::Study),
166            "supply counter" | "supply counters" => Some(CounterKind::Supply),
167            "suspect counter" | "suspect counters" => Some(CounterKind::Suspect),
168            "takeover counter" | "takeover counters" => Some(CounterKind::Takeover),
169            "task counter" | "task counters" => Some(CounterKind::Task),
170            "theft counter" | "theft counters" => Some(CounterKind::Theft),
171            "tide counter" | "tide counters" => Some(CounterKind::Tide),
172            "tower counter" | "tower counters" => Some(CounterKind::Tower),
173            "training counter" | "training counters" => Some(CounterKind::Training),
174            "trap counter" | "trap counters" => Some(CounterKind::Trap),
175            "treasure counter" | "treasure counters" => Some(CounterKind::Treasure),
176            "unity counter" | "unity counters" => Some(CounterKind::Unity),
177            "unlock counter" | "unlock counters" => Some(CounterKind::Unlock),
178            "valor counter" | "valor counters" => Some(CounterKind::Valor),
179            "velocity counter" | "velocity counters" => Some(CounterKind::Velocity),
180            "vow counter" | "vow counters" => Some(CounterKind::Vow),
181            "voyage counter" | "voyage counters" => Some(CounterKind::Voyage),
182            "wage counter" | "wage counters" => Some(CounterKind::Wage),
183            "winch counter" | "winch counters" => Some(CounterKind::Winch),
184            "wind counter" | "wind counters" => Some(CounterKind::Wind),
185            "wish counter" | "wish counters" => Some(CounterKind::Wish),
186            "aegis counter" | "aegis counters" => Some(CounterKind::Aegis),
187            "arrow counter" | "arrow counters" => Some(CounterKind::Arrow),
188            "arrowhead counter" | "arrowhead counters" => Some(CounterKind::Arrowhead),
189            "awakening counter" | "awakening counters" => Some(CounterKind::Awakening),
190            "bait counter" | "bait counters" => Some(CounterKind::Bait),
191            "blessing counter" | "blessing counters" => Some(CounterKind::Blessing),
192            "blight counter" | "blight counters" => Some(CounterKind::Blight),
193            "bloodline counter" | "bloodline counters" => Some(CounterKind::Bloodline),
194            "bloodstain counter" | "bloodstain counters" => Some(CounterKind::Bloodstain),
195            "book counter" | "book counters" => Some(CounterKind::Book),
196            "bore counter" | "bore counters" => Some(CounterKind::Bore),
197            "brain counter" | "brain counters" => Some(CounterKind::Brain),
198            "bribery counter" | "bribery counters" => Some(CounterKind::Bribery),
199            "burden counter" | "burden counters" => Some(CounterKind::Burden),
200            "cage counter" | "cage counters" => Some(CounterKind::Cage),
201            "carrion counter" | "carrion counters" => Some(CounterKind::Carrion),
202            "chip counter" | "chip counters" => Some(CounterKind::Chip),
203            "chorus counter" | "chorus counters" => Some(CounterKind::Chorus),
204            "contested counter" | "contested counters" => Some(CounterKind::Contested),
205            "credit counter" | "credit counters" => Some(CounterKind::Credit),
206            "croak counter" | "croak counters" => Some(CounterKind::Croak),
207            "crystal counter" | "crystal counters" => Some(CounterKind::Crystal),
208            "cube counter" | "cube counters" => Some(CounterKind::Cube),
209            "component counter" | "component counters" => Some(CounterKind::Component),
210            "corruption counter" | "corruption counters" => Some(CounterKind::Corruption),
211            "currency counter" | "currency counters" => Some(CounterKind::Currency),
212            "death counter" | "death counters" => Some(CounterKind::Death),
213            "descent counter" | "descent counters" => Some(CounterKind::Descent),
214            "despair counter" | "despair counters" => Some(CounterKind::Despair),
215            "discovery counter" | "discovery counters" => Some(CounterKind::Discovery),
216            "dread counter" | "dread counters" => Some(CounterKind::Dread),
217            "duty counter" | "duty counters" => Some(CounterKind::Duty),
218            "echo counter" | "echo counters" => Some(CounterKind::Echo),
219            "elixir counter" | "elixir counters" => Some(CounterKind::Elixir),
220            "ember counter" | "ember counters" => Some(CounterKind::Ember),
221            "enlightened counter" | "enlightened counters" => Some(CounterKind::Enlightened),
222            "eruption counter" | "eruption counters" => Some(CounterKind::Eruption),
223            "everything counter" | "everything counters" => Some(CounterKind::Everything),
224            "eyeball counter" | "eyeball counters" => Some(CounterKind::Eyeball),
225            "eyestalk counter" | "eyestalk counters" => Some(CounterKind::Eyestalk),
226            "feeding counter" | "feeding counters" => Some(CounterKind::Feeding),
227            "fellowship counter" | "fellowship counters" => Some(CounterKind::Fellowship),
228            "filibuster counter" | "filibuster counters" => Some(CounterKind::Filibuster),
229            "foreshadow counter" | "foreshadow counters" => Some(CounterKind::Foreshadow),
230            "funk counter" | "funk counters" => Some(CounterKind::Funk),
231            "fury counter" | "fury counters" => Some(CounterKind::Fury),
232            "gem counter" | "gem counters" => Some(CounterKind::Gem),
233            "ghostform counter" | "ghostform counters" => Some(CounterKind::Ghostform),
234            "globe counter" | "globe counters" => Some(CounterKind::Globe),
235            "glyph counter" | "glyph counters" => Some(CounterKind::Glyph),
236            "hack counter" | "hack counters" => Some(CounterKind::Hack),
237            "harmony counter" | "harmony counters" => Some(CounterKind::Harmony),
238            "hatching counter" | "hatching counters" => Some(CounterKind::Hatching),
239            "hone counter" | "hone counters" => Some(CounterKind::Hone),
240            "hoofprint counter" | "hoofprint counters" => Some(CounterKind::Hoofprint),
241            "hope counter" | "hope counters" => Some(CounterKind::Hope),
242            "hourglass counter" | "hourglass counters" => Some(CounterKind::Hourglass),
243            "hunger counter" | "hunger counters" => Some(CounterKind::Hunger),
244            "husk counter" | "husk counters" => Some(CounterKind::Husk),
245            "impostor counter" | "impostor counters" => Some(CounterKind::Impostor),
246            "incarnation counter" | "incarnation counters" => Some(CounterKind::Incarnation),
247            "incubation counter" | "incubation counters" => Some(CounterKind::Incubation),
248            "influence counter" | "influence counters" => Some(CounterKind::Influence),
249            "ingenuity counter" | "ingenuity counters" => Some(CounterKind::Ingenuity),
250            "intel counter" | "intel counters" => Some(CounterKind::Intel),
251            "intervention counter" | "intervention counters" => Some(CounterKind::Intervention),
252            "isolation counter" | "isolation counters" => Some(CounterKind::Isolation),
253            "invitation counter" | "invitation counters" => Some(CounterKind::Invitation),
254            "javelin counter" | "javelin counters" => Some(CounterKind::Javelin),
255            "kick counter" | "kick counters" => Some(CounterKind::Kick),
256            "knickknack counter" | "knickknack counters" => Some(CounterKind::Knickknack),
257            "knowledge counter" | "knowledge counters" => Some(CounterKind::Knowledge),
258            "loot counter" | "loot counters" => Some(CounterKind::Loot),
259            "magnet counter" | "magnet counters" => Some(CounterKind::Magnet),
260            "manifestation counter" | "manifestation counters" => Some(CounterKind::Manifestation),
261            "mannequin counter" | "mannequin counters" => Some(CounterKind::Mannequin),
262            "matrix counter" | "matrix counters" => Some(CounterKind::Matrix),
263            "memory counter" | "memory counters" => Some(CounterKind::Memory),
264            "midway counter" | "midway counters" => Some(CounterKind::Midway),
265            "mine counter" | "mine counters" => Some(CounterKind::Mine),
266            "mining counter" | "mining counters" => Some(CounterKind::Mining),
267            "mire counter" | "mire counters" => Some(CounterKind::Mire),
268            "music counter" | "music counters" => Some(CounterKind::Music),
269            "muster counter" | "muster counters" => Some(CounterKind::Muster),
270            "necrodermis counter" | "necrodermis counters" => Some(CounterKind::Necrodermis),
271            "nest counter" | "nest counters" => Some(CounterKind::Nest),
272            "night counter" | "night counters" => Some(CounterKind::Night),
273            "ore counter" | "ore counters" => Some(CounterKind::Ore),
274            "pain counter" | "pain counters" => Some(CounterKind::Pain),
275            "palliation counter" | "palliation counters" => Some(CounterKind::Palliation),
276            "paralyzation counter" | "paralyzation counters" => Some(CounterKind::Paralyzation),
277            "pause counter" | "pause counters" => Some(CounterKind::Pause),
278            "petal counter" | "petal counters" => Some(CounterKind::Petal),
279            "petrification counter" | "petrification counters" => Some(CounterKind::Petrification),
280            "phyresis counter" | "phyresis counters" => Some(CounterKind::Phyresis),
281            "phylactery counter" | "phylactery counters" => Some(CounterKind::Phylactery),
282            "pin counter" | "pin counters" => Some(CounterKind::Pin),
283            "plot counter" | "plot counters" => Some(CounterKind::Plot),
284            "pop counter" | "pop counters" => Some(CounterKind::Pop),
285            "possession counter" | "possession counters" => Some(CounterKind::Possession),
286            "rejection counter" | "rejection counters" => Some(CounterKind::Rejection),
287            "reprieve counter" | "reprieve counters" => Some(CounterKind::Reprieve),
288            "rev counter" | "rev counters" => Some(CounterKind::Rev),
289            "revival counter" | "revival counters" => Some(CounterKind::Revival),
290            "ribbon counter" | "ribbon counters" => Some(CounterKind::Ribbon),
291            "ritual counter" | "ritual counters" => Some(CounterKind::Ritual),
292            "rope counter" | "rope counters" => Some(CounterKind::Rope),
293            "rust counter" | "rust counters" => Some(CounterKind::Rust),
294            "shell counter" | "shell counters" => Some(CounterKind::Shell),
295            "shoe counter" | "shoe counters" => Some(CounterKind::Shoe),
296            "shred counter" | "shred counters" => Some(CounterKind::Shred),
297            "skewer counter" | "skewer counters" => Some(CounterKind::Skewer),
298            "silver counter" | "silver counters" => Some(CounterKind::Silver),
299            "sleep counter" | "sleep counters" => Some(CounterKind::Sleep),
300            "sleight counter" | "sleight counters" => Some(CounterKind::Sleight),
301            "slumber counter" | "slumber counters" => Some(CounterKind::Slumber),
302            "soot counter" | "soot counters" => Some(CounterKind::Soot),
303            "third-degree-burn counter" | "third-degree-burn counters" => Some(CounterKind::ThirdDegreeBurn),
304            "vitality counter" | "vitality counters" => Some(CounterKind::Vitality),
305            "vortex counter" | "vortex counters" => Some(CounterKind::Vortex),
306            "void counter" | "void counters" => Some(CounterKind::Void),
307            "volatile counter" | "volatile counters" => Some(CounterKind::Volatile),
308            _ => return None,
309        }?;
310        Some(Self {
311            kind,
312            #[cfg(feature = "spanned_tree")]
313            span: span.into(),
314        })
315    }
316}
317
318impl idris::Idris for Counter {
319    const COUNT: usize = CounterKind::COUNT;
320    fn id(&self) -> usize {
321        self.kind.id()
322    }
323    fn name_from_id(id: usize) -> &'static str {
324        CounterKind::name_from_id(id)
325    }
326}
327
328#[cfg(feature = "parser")]
329impl crate::utils::DummyInit for Counter {
330    fn dummy_init() -> Self {
331        Self {
332            kind: CounterKind::Oil,
333            #[cfg(feature = "spanned_tree")]
334            span: Default::default(),
335        }
336    }
337}
338
339/// Fixme: doc
340#[derive(idris_derive::Idris)]
341#[derive(serde::Serialize, serde::Deserialize)]
342#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
343pub enum CounterKind {
344    PlusOnePlusOne,
345    MinusOneMinusOne,
346    PlusZeroPlusOne,
347    PlusZeroPlusTwo,
348    PlusOnePlusZero,
349    PlusOnePlusTwo,
350    PlusTwoPlusZero,
351    PlusTwoPlusTwo,
352    MinusZeroMinusOne,
353    MinusZeroMinusTwo,
354    MinusOneMinusZero,
355    MinusTwoMinusOne,
356    MinusTwoMinusTwo,
357    Charge,
358    Defense,
359    Energy,
360    Finality,
361    Lore,
362    Loyalty,
363    Oil,
364    Poison,
365    Stun,
366    Time,
367    Deathtouch,
368    DoubleStrike,
369    FirstStrike,
370    Flying,
371    Haste,
372    Hexproof,
373    Indestructible,
374    Lifelink,
375    Menace,
376    Reach,
377    Shadow,
378    Trample,
379    Vigilance,
380    Age,
381    Crank,
382    Divinity,
383    Fade,
384    Ki,
385    Level,
386    Rad,
387    Shield,
388    Spore,
389    Ticket,
390    Brick,
391    Depletion,
392    Experience,
393    Quest,
394    Storage,
395    Verse,
396    Acorn,
397    Aim,
398    Blaze,
399    Blood,
400    Bounty,
401    Coin,
402    Collection,
403    Corpse,
404    Delay,
405    Devotion,
406    Doom,
407    Dream,
408    Egg,
409    Eon,
410    Fate,
411    Feather,
412    Fetch,
413    Flame,
414    Flood,
415    Fungus,
416    Fuse,
417    Gold,
418    Growth,
419    Hatchling,
420    Healing,
421    Hit,
422    Hour,
423    Ice,
424    Infection,
425    Judgment,
426    Landmark,
427    Luck,
428    Net,
429    Omen,
430    Page,
431    Plague,
432    Point,
433    Pressure,
434    Prey,
435    Pupa,
436    Polyp,
437    Scream,
438    Scroll,
439    Slime,
440    Soul,
441    Spark,
442    Spite,
443    Stash,
444    Story,
445    Strife,
446    Study,
447    Supply,
448    Suspect,
449    Takeover,
450    Task,
451    Theft,
452    Tide,
453    Tower,
454    Training,
455    Trap,
456    Treasure,
457    Unity,
458    Unlock,
459    Valor,
460    Velocity,
461    Vow,
462    Voyage,
463    Wage,
464    Winch,
465    Wind,
466    Wish,
467    Aegis,
468    Arrow,
469    Arrowhead,
470    Awakening,
471    Bait,
472    Blessing,
473    Blight,
474    Bloodline,
475    Bloodstain,
476    Book,
477    Bore,
478    Brain,
479    Bribery,
480    Burden,
481    Cage,
482    Carrion,
483    Chip,
484    Chorus,
485    Contested,
486    Credit,
487    Croak,
488    Crystal,
489    Cube,
490    Component,
491    Corruption,
492    Currency,
493    Death,
494    Descent,
495    Despair,
496    Discovery,
497    Dread,
498    Duty,
499    Echo,
500    Elixir,
501    Ember,
502    Enlightened,
503    Eruption,
504    Everything,
505    Eyeball,
506    Eyestalk,
507    Feeding,
508    Fellowship,
509    Filibuster,
510    Foreshadow,
511    Funk,
512    Fury,
513    Gem,
514    Ghostform,
515    Globe,
516    Glyph,
517    Hack,
518    Harmony,
519    Hatching,
520    Hone,
521    Hoofprint,
522    Hope,
523    Hourglass,
524    Hunger,
525    Husk,
526    Impostor,
527    Incarnation,
528    Incubation,
529    Influence,
530    Ingenuity,
531    Intel,
532    Intervention,
533    Isolation,
534    Invitation,
535    Javelin,
536    Kick,
537    Knickknack,
538    Knowledge,
539    Loot,
540    Magnet,
541    Manifestation,
542    Mannequin,
543    Matrix,
544    Memory,
545    Midway,
546    Mine,
547    Mining,
548    Mire,
549    Music,
550    Muster,
551    Necrodermis,
552    Nest,
553    Night,
554    Ore,
555    Pain,
556    Palliation,
557    Paralyzation,
558    Pause,
559    Petal,
560    Petrification,
561    Phyresis,
562    Phylactery,
563    Pin,
564    Plot,
565    Pop,
566    Possession,
567    Rejection,
568    Reprieve,
569    Rev,
570    Revival,
571    Ribbon,
572    Ritual,
573    Rope,
574    Rust,
575    Shell,
576    Shoe,
577    Shred,
578    Skewer,
579    Silver,
580    Sleep,
581    Sleight,
582    Slumber,
583    Soot,
584    ThirdDegreeBurn,
585    Vitality,
586    Vortex,
587    Void,
588    Volatile,
589}
590
591impl CounterKind {
592    pub fn all() -> impl Iterator<Item = Self> {
593        [
594            Self::PlusOnePlusOne,
595            Self::MinusOneMinusOne,
596            Self::PlusZeroPlusOne,
597            Self::PlusZeroPlusTwo,
598            Self::PlusOnePlusZero,
599            Self::PlusOnePlusTwo,
600            Self::PlusTwoPlusZero,
601            Self::PlusTwoPlusTwo,
602            Self::MinusZeroMinusOne,
603            Self::MinusZeroMinusTwo,
604            Self::MinusOneMinusZero,
605            Self::MinusTwoMinusOne,
606            Self::MinusTwoMinusTwo,
607            Self::Charge,
608            Self::Defense,
609            Self::Energy,
610            Self::Finality,
611            Self::Lore,
612            Self::Loyalty,
613            Self::Oil,
614            Self::Poison,
615            Self::Stun,
616            Self::Time,
617            Self::Deathtouch,
618            Self::DoubleStrike,
619            Self::FirstStrike,
620            Self::Flying,
621            Self::Haste,
622            Self::Hexproof,
623            Self::Indestructible,
624            Self::Lifelink,
625            Self::Menace,
626            Self::Reach,
627            Self::Shadow,
628            Self::Trample,
629            Self::Vigilance,
630            Self::Age,
631            Self::Crank,
632            Self::Divinity,
633            Self::Fade,
634            Self::Ki,
635            Self::Level,
636            Self::Rad,
637            Self::Shield,
638            Self::Spore,
639            Self::Ticket,
640            Self::Brick,
641            Self::Depletion,
642            Self::Experience,
643            Self::Quest,
644            Self::Storage,
645            Self::Verse,
646            Self::Acorn,
647            Self::Aim,
648            Self::Blaze,
649            Self::Blood,
650            Self::Bounty,
651            Self::Coin,
652            Self::Collection,
653            Self::Corpse,
654            Self::Delay,
655            Self::Devotion,
656            Self::Doom,
657            Self::Dream,
658            Self::Egg,
659            Self::Eon,
660            Self::Fate,
661            Self::Feather,
662            Self::Fetch,
663            Self::Flame,
664            Self::Flood,
665            Self::Fungus,
666            Self::Fuse,
667            Self::Gold,
668            Self::Growth,
669            Self::Hatchling,
670            Self::Healing,
671            Self::Hit,
672            Self::Hour,
673            Self::Ice,
674            Self::Infection,
675            Self::Judgment,
676            Self::Landmark,
677            Self::Luck,
678            Self::Net,
679            Self::Omen,
680            Self::Page,
681            Self::Plague,
682            Self::Point,
683            Self::Pressure,
684            Self::Prey,
685            Self::Pupa,
686            Self::Polyp,
687            Self::Scream,
688            Self::Scroll,
689            Self::Slime,
690            Self::Soul,
691            Self::Spark,
692            Self::Spite,
693            Self::Stash,
694            Self::Story,
695            Self::Strife,
696            Self::Study,
697            Self::Supply,
698            Self::Suspect,
699            Self::Takeover,
700            Self::Task,
701            Self::Theft,
702            Self::Tide,
703            Self::Tower,
704            Self::Training,
705            Self::Trap,
706            Self::Treasure,
707            Self::Unity,
708            Self::Unlock,
709            Self::Valor,
710            Self::Velocity,
711            Self::Vow,
712            Self::Voyage,
713            Self::Wage,
714            Self::Winch,
715            Self::Wind,
716            Self::Wish,
717            Self::Aegis,
718            Self::Arrow,
719            Self::Arrowhead,
720            Self::Awakening,
721            Self::Bait,
722            Self::Blessing,
723            Self::Blight,
724            Self::Bloodline,
725            Self::Bloodstain,
726            Self::Book,
727            Self::Bore,
728            Self::Brain,
729            Self::Bribery,
730            Self::Burden,
731            Self::Cage,
732            Self::Carrion,
733            Self::Chip,
734            Self::Chorus,
735            Self::Contested,
736            Self::Credit,
737            Self::Croak,
738            Self::Crystal,
739            Self::Cube,
740            Self::Component,
741            Self::Corruption,
742            Self::Currency,
743            Self::Death,
744            Self::Descent,
745            Self::Despair,
746            Self::Discovery,
747            Self::Dread,
748            Self::Duty,
749            Self::Echo,
750            Self::Elixir,
751            Self::Ember,
752            Self::Enlightened,
753            Self::Eruption,
754            Self::Everything,
755            Self::Eyeball,
756            Self::Eyestalk,
757            Self::Feeding,
758            Self::Fellowship,
759            Self::Filibuster,
760            Self::Foreshadow,
761            Self::Funk,
762            Self::Fury,
763            Self::Gem,
764            Self::Ghostform,
765            Self::Globe,
766            Self::Glyph,
767            Self::Hack,
768            Self::Harmony,
769            Self::Hatching,
770            Self::Hone,
771            Self::Hoofprint,
772            Self::Hope,
773            Self::Hourglass,
774            Self::Hunger,
775            Self::Husk,
776            Self::Impostor,
777            Self::Incarnation,
778            Self::Incubation,
779            Self::Influence,
780            Self::Ingenuity,
781            Self::Intel,
782            Self::Intervention,
783            Self::Isolation,
784            Self::Invitation,
785            Self::Javelin,
786            Self::Kick,
787            Self::Knickknack,
788            Self::Knowledge,
789            Self::Loot,
790            Self::Magnet,
791            Self::Manifestation,
792            Self::Mannequin,
793            Self::Matrix,
794            Self::Memory,
795            Self::Midway,
796            Self::Mine,
797            Self::Mining,
798            Self::Mire,
799            Self::Music,
800            Self::Muster,
801            Self::Necrodermis,
802            Self::Nest,
803            Self::Night,
804            Self::Ore,
805            Self::Pain,
806            Self::Palliation,
807            Self::Paralyzation,
808            Self::Pause,
809            Self::Petal,
810            Self::Petrification,
811            Self::Phyresis,
812            Self::Phylactery,
813            Self::Pin,
814            Self::Plot,
815            Self::Pop,
816            Self::Possession,
817            Self::Rejection,
818            Self::Reprieve,
819            Self::Rev,
820            Self::Revival,
821            Self::Ribbon,
822            Self::Ritual,
823            Self::Rope,
824            Self::Rust,
825            Self::Shell,
826            Self::Shoe,
827            Self::Shred,
828            Self::Skewer,
829            Self::Silver,
830            Self::Sleep,
831            Self::Sleight,
832            Self::Slumber,
833            Self::Soot,
834            Self::ThirdDegreeBurn,
835            Self::Vitality,
836            Self::Vortex,
837            Self::Void,
838            Self::Volatile,
839        ]
840        .into_iter()
841    }
842}
843
844impl std::fmt::Display for CounterKind {
845    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
846        match self {
847            Self::PlusOnePlusOne => write!(f, "+1/+1 counter"),
848            Self::MinusOneMinusOne => write!(f, "-1/-1 counter"),
849            Self::PlusZeroPlusOne => write!(f, "+0/+1 counter"),
850            Self::PlusZeroPlusTwo => write!(f, "+0/+2 counter"),
851            Self::PlusOnePlusZero => write!(f, "+1/+0 counter"),
852            Self::PlusOnePlusTwo => write!(f, "+1/+2 counter"),
853            Self::PlusTwoPlusZero => write!(f, "+2/+0 counter"),
854            Self::PlusTwoPlusTwo => write!(f, "+2/+2 counter"),
855            Self::MinusZeroMinusOne => write!(f, "-0/-1 counter"),
856            Self::MinusZeroMinusTwo => write!(f, "-0/-2 counter"),
857            Self::MinusOneMinusZero => write!(f, "-1/-0 counter"),
858            Self::MinusTwoMinusOne => write!(f, "-2/-1 counter"),
859            Self::MinusTwoMinusTwo => write!(f, "-2/-2 counter"),
860            Self::Charge => write!(f, "charge counter"),
861            Self::Defense => write!(f, "defense counter"),
862            Self::Energy => write!(f, "energy counter"),
863            Self::Finality => write!(f, "finality counter"),
864            Self::Lore => write!(f, "lore counter"),
865            Self::Loyalty => write!(f, "loyalty counter"),
866            Self::Oil => write!(f, "oil counter"),
867            Self::Poison => write!(f, "poison counter"),
868            Self::Stun => write!(f, "stun counter"),
869            Self::Time => write!(f, "time counter"),
870            Self::Deathtouch => write!(f, "deathtouch counter"),
871            Self::DoubleStrike => write!(f, "double strike counter"),
872            Self::FirstStrike => write!(f, "first strike counter"),
873            Self::Flying => write!(f, "flying counter"),
874            Self::Haste => write!(f, "haste counter"),
875            Self::Hexproof => write!(f, "hexproof counter"),
876            Self::Indestructible => write!(f, "indestructible counter"),
877            Self::Lifelink => write!(f, "lifelink counter"),
878            Self::Menace => write!(f, "menace counter"),
879            Self::Reach => write!(f, "reach counter"),
880            Self::Shadow => write!(f, "shadow counter"),
881            Self::Trample => write!(f, "trample counter"),
882            Self::Vigilance => write!(f, "vigilance counter"),
883            Self::Age => write!(f, "age counter"),
884            Self::Crank => write!(f, "crank counter"),
885            Self::Divinity => write!(f, "divinity counter"),
886            Self::Fade => write!(f, "fade counter"),
887            Self::Ki => write!(f, "ki counter"),
888            Self::Level => write!(f, "level counter"),
889            Self::Rad => write!(f, "rad counter"),
890            Self::Shield => write!(f, "shield counter"),
891            Self::Spore => write!(f, "spore counter"),
892            Self::Ticket => write!(f, "ticket counter"),
893            Self::Brick => write!(f, "brick counter"),
894            Self::Depletion => write!(f, "depletion counter"),
895            Self::Experience => write!(f, "experience counter"),
896            Self::Quest => write!(f, "quest counter"),
897            Self::Storage => write!(f, "storage counter"),
898            Self::Verse => write!(f, "verse counter"),
899            Self::Acorn => write!(f, "acorn counter"),
900            Self::Aim => write!(f, "aim counter"),
901            Self::Blaze => write!(f, "blaze counter"),
902            Self::Blood => write!(f, "blood counter"),
903            Self::Bounty => write!(f, "bounty counter"),
904            Self::Coin => write!(f, "coin counter"),
905            Self::Collection => write!(f, "collection counter"),
906            Self::Corpse => write!(f, "corpse counter"),
907            Self::Delay => write!(f, "delay counter"),
908            Self::Devotion => write!(f, "devotion counter"),
909            Self::Doom => write!(f, "doom counter"),
910            Self::Dream => write!(f, "dream counter"),
911            Self::Egg => write!(f, "egg counter"),
912            Self::Eon => write!(f, "eon counter"),
913            Self::Fate => write!(f, "fate counter"),
914            Self::Feather => write!(f, "feather counter"),
915            Self::Fetch => write!(f, "fetch counter"),
916            Self::Flame => write!(f, "flame counter"),
917            Self::Flood => write!(f, "flood counter"),
918            Self::Fungus => write!(f, "fungus counter"),
919            Self::Fuse => write!(f, "fuse counter"),
920            Self::Gold => write!(f, "gold counter"),
921            Self::Growth => write!(f, "growth counter"),
922            Self::Hatchling => write!(f, "hatchling counter"),
923            Self::Healing => write!(f, "healing counter"),
924            Self::Hit => write!(f, "hit counter"),
925            Self::Hour => write!(f, "hour counter"),
926            Self::Ice => write!(f, "ice counter"),
927            Self::Infection => write!(f, "infection counter"),
928            Self::Judgment => write!(f, "judgment counter"),
929            Self::Landmark => write!(f, "landmark counter"),
930            Self::Luck => write!(f, "luck counter"),
931            Self::Net => write!(f, "net counter"),
932            Self::Omen => write!(f, "omen counter"),
933            Self::Page => write!(f, "page counter"),
934            Self::Plague => write!(f, "plague counter"),
935            Self::Point => write!(f, "point counter"),
936            Self::Pressure => write!(f, "pressure counter"),
937            Self::Prey => write!(f, "prey counter"),
938            Self::Pupa => write!(f, "pupa counter"),
939            Self::Polyp => write!(f, "polyp counter"),
940            Self::Scream => write!(f, "scream counter"),
941            Self::Scroll => write!(f, "scroll counter"),
942            Self::Slime => write!(f, "slime counter"),
943            Self::Soul => write!(f, "soul counter"),
944            Self::Spark => write!(f, "spark counter"),
945            Self::Spite => write!(f, "spite counter"),
946            Self::Stash => write!(f, "stash counter"),
947            Self::Story => write!(f, "story counter"),
948            Self::Strife => write!(f, "strife counter"),
949            Self::Study => write!(f, "study counter"),
950            Self::Supply => write!(f, "supply counter"),
951            Self::Suspect => write!(f, "suspect counter"),
952            Self::Takeover => write!(f, "takeover counter"),
953            Self::Task => write!(f, "task counter"),
954            Self::Theft => write!(f, "theft counter"),
955            Self::Tide => write!(f, "tide counter"),
956            Self::Tower => write!(f, "tower counter"),
957            Self::Training => write!(f, "training counter"),
958            Self::Trap => write!(f, "trap counter"),
959            Self::Treasure => write!(f, "treasure counter"),
960            Self::Unity => write!(f, "unity counter"),
961            Self::Unlock => write!(f, "unlock counter"),
962            Self::Valor => write!(f, "valor counter"),
963            Self::Velocity => write!(f, "velocity counter"),
964            Self::Vow => write!(f, "vow counter"),
965            Self::Voyage => write!(f, "voyage counter"),
966            Self::Wage => write!(f, "wage counter"),
967            Self::Winch => write!(f, "winch counter"),
968            Self::Wind => write!(f, "wind counter"),
969            Self::Wish => write!(f, "wish counter"),
970            Self::Aegis => write!(f, "aegis counter"),
971            Self::Arrow => write!(f, "arrow counter"),
972            Self::Arrowhead => write!(f, "arrowhead counter"),
973            Self::Awakening => write!(f, "awakening counter"),
974            Self::Bait => write!(f, "bait counter"),
975            Self::Blessing => write!(f, "blessing counter"),
976            Self::Blight => write!(f, "blight counter"),
977            Self::Bloodline => write!(f, "bloodline counter"),
978            Self::Bloodstain => write!(f, "bloodstain counter"),
979            Self::Book => write!(f, "book counter"),
980            Self::Bore => write!(f, "bore counter"),
981            Self::Brain => write!(f, "brain counter"),
982            Self::Bribery => write!(f, "bribery counter"),
983            Self::Burden => write!(f, "burden counter"),
984            Self::Cage => write!(f, "cage counter"),
985            Self::Carrion => write!(f, "carrion counter"),
986            Self::Chip => write!(f, "chip counter"),
987            Self::Chorus => write!(f, "chorus counter"),
988            Self::Contested => write!(f, "contested counter"),
989            Self::Credit => write!(f, "credit counter"),
990            Self::Croak => write!(f, "croak counter"),
991            Self::Crystal => write!(f, "crystal counter"),
992            Self::Cube => write!(f, "cube counter"),
993            Self::Component => write!(f, "component counter"),
994            Self::Corruption => write!(f, "corruption counter"),
995            Self::Currency => write!(f, "currency counter"),
996            Self::Death => write!(f, "death counter"),
997            Self::Descent => write!(f, "descent counter"),
998            Self::Despair => write!(f, "despair counter"),
999            Self::Discovery => write!(f, "discovery counter"),
1000            Self::Dread => write!(f, "dread counter"),
1001            Self::Duty => write!(f, "duty counter"),
1002            Self::Echo => write!(f, "echo counter"),
1003            Self::Elixir => write!(f, "elixir counter"),
1004            Self::Ember => write!(f, "ember counter"),
1005            Self::Enlightened => write!(f, "enlightened counter"),
1006            Self::Eruption => write!(f, "eruption counter"),
1007            Self::Everything => write!(f, "everything counter"),
1008            Self::Eyeball => write!(f, "eyeball counter"),
1009            Self::Eyestalk => write!(f, "eyestalk counter"),
1010            Self::Feeding => write!(f, "feeding counter"),
1011            Self::Fellowship => write!(f, "fellowship counter"),
1012            Self::Filibuster => write!(f, "filibuster counter"),
1013            Self::Foreshadow => write!(f, "foreshadow counter"),
1014            Self::Funk => write!(f, "funk counter"),
1015            Self::Fury => write!(f, "fury counter"),
1016            Self::Gem => write!(f, "gem counter"),
1017            Self::Ghostform => write!(f, "ghostform counter"),
1018            Self::Globe => write!(f, "globe counter"),
1019            Self::Glyph => write!(f, "glyph counter"),
1020            Self::Hack => write!(f, "hack counter"),
1021            Self::Harmony => write!(f, "harmony counter"),
1022            Self::Hatching => write!(f, "hatching counter"),
1023            Self::Hone => write!(f, "hone counter"),
1024            Self::Hoofprint => write!(f, "hoofprint counter"),
1025            Self::Hope => write!(f, "hope counter"),
1026            Self::Hourglass => write!(f, "hourglass counter"),
1027            Self::Hunger => write!(f, "hunger counter"),
1028            Self::Husk => write!(f, "husk counter"),
1029            Self::Impostor => write!(f, "impostor counter"),
1030            Self::Incarnation => write!(f, "incarnation counter"),
1031            Self::Incubation => write!(f, "incubation counter"),
1032            Self::Influence => write!(f, "influence counter"),
1033            Self::Ingenuity => write!(f, "ingenuity counter"),
1034            Self::Intel => write!(f, "intel counter"),
1035            Self::Intervention => write!(f, "intervention counter"),
1036            Self::Isolation => write!(f, "isolation counter"),
1037            Self::Invitation => write!(f, "invitation counter"),
1038            Self::Javelin => write!(f, "javelin counter"),
1039            Self::Kick => write!(f, "kick counter"),
1040            Self::Knickknack => write!(f, "knickknack counter"),
1041            Self::Knowledge => write!(f, "knowledge counter"),
1042            Self::Loot => write!(f, "loot counter"),
1043            Self::Magnet => write!(f, "magnet counter"),
1044            Self::Manifestation => write!(f, "manifestation counter"),
1045            Self::Mannequin => write!(f, "mannequin counter"),
1046            Self::Matrix => write!(f, "matrix counter"),
1047            Self::Memory => write!(f, "memory counter"),
1048            Self::Midway => write!(f, "midway counter"),
1049            Self::Mine => write!(f, "mine counter"),
1050            Self::Mining => write!(f, "mining counter"),
1051            Self::Mire => write!(f, "mire counter"),
1052            Self::Music => write!(f, "music counter"),
1053            Self::Muster => write!(f, "muster counter"),
1054            Self::Necrodermis => write!(f, "necrodermis counter"),
1055            Self::Nest => write!(f, "nest counter"),
1056            Self::Night => write!(f, "night counter"),
1057            Self::Ore => write!(f, "ore counter"),
1058            Self::Pain => write!(f, "pain counter"),
1059            Self::Palliation => write!(f, "palliation counter"),
1060            Self::Paralyzation => write!(f, "paralyzation counter"),
1061            Self::Pause => write!(f, "pause counter"),
1062            Self::Petal => write!(f, "petal counter"),
1063            Self::Petrification => write!(f, "petrification counter"),
1064            Self::Phyresis => write!(f, "phyresis counter"),
1065            Self::Phylactery => write!(f, "phylactery counter"),
1066            Self::Pin => write!(f, "pin counter"),
1067            Self::Plot => write!(f, "plot counter"),
1068            Self::Pop => write!(f, "pop counter"),
1069            Self::Possession => write!(f, "possession counter"),
1070            Self::Rejection => write!(f, "rejection counter"),
1071            Self::Reprieve => write!(f, "reprieve counter"),
1072            Self::Rev => write!(f, "rev counter"),
1073            Self::Revival => write!(f, "revival counter"),
1074            Self::Ribbon => write!(f, "ribbon counter"),
1075            Self::Ritual => write!(f, "ritual counter"),
1076            Self::Rope => write!(f, "rope counter"),
1077            Self::Rust => write!(f, "rust counter"),
1078            Self::Shell => write!(f, "shell counter"),
1079            Self::Shoe => write!(f, "shoe counter"),
1080            Self::Shred => write!(f, "shred counter"),
1081            Self::Skewer => write!(f, "skewer counter"),
1082            Self::Silver => write!(f, "silver counter"),
1083            Self::Sleep => write!(f, "sleep counter"),
1084            Self::Sleight => write!(f, "sleight counter"),
1085            Self::Slumber => write!(f, "slumber counter"),
1086            Self::Soot => write!(f, "soot counter"),
1087            Self::ThirdDegreeBurn => write!(f, "third-degree-burn counter"),
1088            Self::Vitality => write!(f, "vitality counter"),
1089            Self::Vortex => write!(f, "vortex counter"),
1090            Self::Void => write!(f, "void counter"),
1091            Self::Volatile => write!(f, "volatile counter"),
1092        }
1093    }
1094}