Include expansion and complexity in spirit choice list.

main
Daniel Perelman 1 year ago
parent a450f55af5
commit 0213931a8b

@ -6,7 +6,7 @@ from .models import Game, Player
class PlayerForm(forms.Form):
name = forms.CharField(max_length=80, label="Name", required=False)
spirit = forms.TypedChoiceField(label="Spirit",
choices=enumerate(Player.SPIRIT_NAMES),
choices=Player.enumerate_spirit_names(),
empty_value=None, coerce=int)

@ -249,40 +249,40 @@ class Player(models.Model):
SPIRIT_NAMES = [
# From https://spiritislandwiki.com/index.php?title=List_of_Spirits
# Base game
"Lightning's Swift Strike",
"River Surges in Sunlight",
"Vital Strength of the Earth",
"Shadows Flicker Like Flame",
"Thunderspeaker",
"A Spread of Rampant Green",
"Ocean's Hungry Grasp",
"Bringer of Dreams and Nightmares",
("Lightning's Swift Strike", "SI", "L"),
("River Surges in Sunlight", "SI", "L"),
("Vital Strength of the Earth", "SI", "L"),
("Shadows Flicker Like Flame", "SI", "L"),
("Thunderspeaker", "SI", "M"),
("A Spread of Rampant Green", "SI", "M"),
("Ocean's Hungry Grasp", "SI", "H"),
("Bringer of Dreams and Nightmares", "SI", "H"),
# Branch and Claw
"Keeper of the Forbidden Wilds",
"Sharp Fangs Behind the Leaves",
("Keeper of the Forbidden Wilds", "BC", "M"),
("Sharp Fangs Behind the Leaves", "BC", "M"),
# Promo Pack 1
"Serpent Slumbering Beneath the Island",
"Heart of the Wildfire",
("Serpent Slumbering Beneath the Island", "P1", "H"),
("Heart of the Wildfire", "P1", "H"),
# Jagged Earth
"Stone's Unyielding Defiance",
"Shifting Memory of Ages",
"Grinning Trickster Stirs Up Trouble",
"Lure of the Deep Wilderness",
"Many Minds Move as One",
"Volcano Looming High",
"Shroud of Silent Mist",
"Vengeance as a Burning Plague",
"Starlight Seeks Its Form",
"Fractured Days Split the Sky",
("Stone's Unyielding Defiance", "JE", "M"),
("Shifting Memory of Ages", "JE", "M"),
("Grinning Trickster Stirs Up Trouble", "JE", "M"),
("Lure of the Deep Wilderness", "JE", "M"),
("Many Minds Move as One", "JE", "M"),
("Volcano Looming High", "JE", "M"),
("Shroud of Silent Mist", "JE", "H"),
("Vengeance as a Burning Plague", "JE", "H"),
("Starlight Seeks Its Form", "JE", "V"),
("Fractured Days Split the Sky", "JE", "V"),
# Promo Pack 2
"Downpour Drenches the World",
"Finder of Paths Unseen",
("Downpour Drenches the World", "P2", "H"),
("Finder of Paths Unseen", "P2", "V"),
# Horizons of Spirit Island
"Devouring Teeth Lurk Underfoot",
"Eyes Watch From the Trees",
"Fathomless Mud of the Swamp",
"Rising Heat of Stone and Sand",
"Sun-Bright Whirlwind",
("Devouring Teeth Lurk Underfoot", "HS", "L"),
("Eyes Watch From the Trees", "HS", "L"),
("Fathomless Mud of the Swamp", "HS", "L"),
("Rising Heat of Stone and Sand", "HS", "L"),
("Sun-Bright Whirlwind", "HS", "L"),
]
spirit = models.IntegerField()
order = models.IntegerField()
@ -291,7 +291,12 @@ class Player(models.Model):
unique_together = (("game", "name"), ("game", "order"))
def get_spirit_name(self):
return Player.SPIRIT_NAMES[self.spirit]
return Player.SPIRIT_NAMES[self.spirit][0]
@staticmethod
def enumerate_spirit_names():
return [(i, f"[{spirit[1]},{spirit[2]}] {spirit[0]}") for (i, spirit)
in enumerate(Player.SPIRIT_NAMES)]
class Phase(models.Model):

@ -81,7 +81,7 @@ def new_game(request):
form = NewGameForm()
initial_player_data = [{'spirit': i}
for i in enumerate(Player.SPIRIT_NAMES)]
for (i, _) in Player.enumerate_spirit_names()]
formset = PlayerFormSet(initial=initial_player_data)
for player_form in formset:
player_form.player_id = int(player_form.prefix[5:]) + 1

Loading…
Cancel
Save