From e532c47753c112f8168de7354d255efb95f1f0b8 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Mon, 12 Mar 2018 03:08:43 +0100 Subject: split --- internal/spells/spells.go | 77 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 internal/spells/spells.go (limited to 'internal/spells/spells.go') diff --git a/internal/spells/spells.go b/internal/spells/spells.go new file mode 100644 index 0000000..828c9e9 --- /dev/null +++ b/internal/spells/spells.go @@ -0,0 +1,77 @@ +package spells + +import "math/rand" + +var spells = []string{ + `Slime Finger`, + `Rabbit Punch`, + `Hastiness`, + `Good Move`, + `Sadness`, + `Seasick`, + `Gyp`, + `Shoelaces`, + `Innoculate`, + `Cone of Annoyance`, + `Magnetic Orb`, + `Invisible Hands`, + `Revolting Cloud`, + `Aqueous Humor`, + `Spectral Miasma`, + `Clever Fellow`, + `Lockjaw`, + `History Lesson`, + `Hydrophobia`, + `Big Sister`, + `Cone of Paste`, + `Mulligan`, + `Nestor's Bright Idea`, + `Holy Batpole`, + `Tumor (Benign)`, + `Braingate`, + `Nonplus`, + `Animate Nightstand`, + `Eye of the Troglodyte`, + `Curse Name`, + `Dropsy`, + `Vitreous Humor`, + `Roger's Grand Illusion`, + `Covet`, + `Astral Miasma`, + `Spectral Oyster`, + `Acrid Hands`, + `Angioplasty`, + `Grognor's Big Day Off`, + `Tumor (Malignant)`, + `Animate Tunic`, + `Ursine Armor`, + `Holy Roller`, + `Tonsilectomy`, + `Curse Family`, + `Infinite Confusion`, +} + +func Pick() string { + n := rand.Intn(len(spells)) + return spells[n] +} + +type SpellBook struct { + Spells []Spell +} + +type Spell struct { + Title string + Level int +} + +func (m *SpellBook) Add(title string) { + for i, v := range m.Spells { + if v.Title == title { + v.Level += 1 + m.Spells[i] = v + return + } + } + m.Spells = append(m.Spells, Spell{Title: title, Level: 1}) +} -- cgit v1.2.3