Merge pull request #197 from Sakimori/indev

Indev
This commit is contained in:
Sakimori 2021-02-22 19:35:03 -05:00 committed by GitHub
commit baff2f713e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -225,25 +225,6 @@ class Drizzle(Weather):
state["update_emoji"] = self.emoji state["update_emoji"] = self.emoji
state["update_text"] += f' Due to inclement weather, {placed_player.name} is placed on second base.' state["update_text"] += f' Due to inclement weather, {placed_player.name} is placed on second base.'
class Sun2(Weather):
def __init__(self, game):
self.name = "Sun 2"
def activate(self, game):
for teamtype in game.teams:
team = game.teams[teamtype]
if team.score >= 10:
team.score -= 10
# no win counting yet :(
result.clear()
result.update({
"text": "The {} collect 10! Sun 2 smiles.".format(team.name),
"text_only": True,
"weather_message": True
})
class Breezy(Weather): class Breezy(Weather):
def __init__(self, game): def __init__(self, game):
self.name = "Breezy" self.name = "Breezy"
@ -269,60 +250,17 @@ class Breezy(Weather):
last_letter = player.name[-1] last_letter = player.name[-1]
player.name = last_letter + player.name[1:-1] + last_letter player.name = last_letter + player.name[1:-1] + last_letter
book_adjectives = ["action-packed", "historical", "friendly", "rude", "mystery", "thriller", "horror", "sci-fi", "fantasy", "spooky","romantic"] book_adjectives = ["action-packed", "historical", "mystery", "thriller", "horror", "sci-fi", "fantasy", "spooky","romantic"]
book_types = ["novel","novella","poem","anthology","fan fiction","tablet","carving", "autobiography"] book_types = ["novel", "novella", "poem", "anthology", "fan fiction", "autobiography"]
book = "{} {}".format(random.choice(book_adjectives),random.choice(book_types)) book = "{} {}".format(random.choice(book_adjectives),random.choice(book_types))
result.clear() result.clear()
result.update({ result.update({
"text": "{} stopped to read a {} and became Literate! {} is now {}!".format(old_player_name, book, old_player_name, player.name), "text": "{} stopped to enjoy a {} in the nice breeze! {} is now {}!".format(old_player_name, book, old_player_name, player.name),
"text_only": True, "text_only": True,
"weather_message": True "weather_message": True
}) })
class Feedback(Weather):
def __init__(self, game):
self.name = "Feedback"
self.emoji = "🎤"
self.activation_chance = 0.02
self.swap_batter_vs_pitcher_chance = 0.8
def activate(self, game, result):
if random.random() < self.activation_chance:
# feedback time
player1 = None
player2 = None
team1 = game.teams["home"]
team2 = game.teams["away"]
if random.random() < self.swap_batter_vs_pitcher_chance:
# swapping batters
# theoretically this could swap players already on base :(
team1 = game.teams["home"]
team2 = game.teams["away"]
homePlayerIndex = random.randint(0,len(team1.lineup)-1)
awayPlayerIndex = random.randint(0,len(team2.lineup)-1)
player1 = team1.lineup[homePlayerIndex]
player2 = team2.lineup[awayPlayerIndex]
team1.lineup[homePlayerIndex] = player2
team2.lineup[awayPlayerIndex] = player1
else:
# swapping pitchers
player1 = team1.pitcher
player2 = team2.pitcher
team1.pitcher = player2
team2.pitcher = player1
result.clear()
result.update({
"text": "{} and {} switched teams in the feedback!".format(player1.name,player2.name),
"text_only": True,
"weather_message": True,
})
def all_weathers(): def all_weathers():
weathers_dic = { weathers_dic = {
"Supernova" : Supernova, "Supernova" : Supernova,
@ -333,9 +271,7 @@ def all_weathers():
"Thinned Veil" : ThinnedVeil, "Thinned Veil" : ThinnedVeil,
"Heat Wave" : HeatWave, "Heat Wave" : HeatWave,
"Drizzle" : Drizzle, "Drizzle" : Drizzle,
# "Sun 2": Sun2, "Breezy": Breezy
"Feedback": Feedback,
"Breezy": Breezy,
} }
return weathers_dic return weathers_dic