added easter egg
This commit is contained in:
parent
fffcb47054
commit
f73e0590f4
20
games.py
20
games.py
|
@ -50,6 +50,8 @@ class player(object):
|
||||||
"strikeouts_taken" : 0
|
"strikeouts_taken" : 0
|
||||||
}
|
}
|
||||||
self.stat_name = self.name
|
self.stat_name = self.name
|
||||||
|
if self.name == "Tim Locastro":
|
||||||
|
self.randomize_stars()
|
||||||
|
|
||||||
def star_string(self, key):
|
def star_string(self, key):
|
||||||
str_out = ""
|
str_out = ""
|
||||||
|
@ -68,6 +70,15 @@ class player(object):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
def randomize_stars(self):
|
||||||
|
for key in ["batting_stars", "pitching_stars", "baserunning_stars", "defense_stars"]:
|
||||||
|
#random star value between 0 and 6.5
|
||||||
|
stars = random.randint(0,6)
|
||||||
|
half_star = random.random() < 0.5 #half star addition
|
||||||
|
if half_star:
|
||||||
|
stars = half_star + 0.5
|
||||||
|
self.stlats[key] = stars
|
||||||
|
|
||||||
|
|
||||||
class team(object):
|
class team(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -798,6 +809,9 @@ def get_team(name):
|
||||||
team_json.rotation.append(team_json.pitcher)
|
team_json.rotation.append(team_json.pitcher)
|
||||||
team_json.pitcher = None
|
team_json.pitcher = None
|
||||||
update_team(team_json)
|
update_team(team_json)
|
||||||
|
for player in team_json.rotation + team_json.lineup:
|
||||||
|
if player.name == "Tim Locastro":
|
||||||
|
player.randomize_stars()
|
||||||
return team_json
|
return team_json
|
||||||
return None
|
return None
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -818,6 +832,9 @@ def get_team_and_owner(name):
|
||||||
team_json.rotation.append(team_json.pitcher)
|
team_json.rotation.append(team_json.pitcher)
|
||||||
team_json.pitcher = None
|
team_json.pitcher = None
|
||||||
update_team(team_json)
|
update_team(team_json)
|
||||||
|
for player in team_json.rotation + team_json.lineup:
|
||||||
|
if player.name == "Tim Locastro":
|
||||||
|
player.randomize_stars()
|
||||||
return (team_json, owner_id)
|
return (team_json, owner_id)
|
||||||
return None
|
return None
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -864,6 +881,9 @@ def search_team(search_term):
|
||||||
team_json.rotation.append(team_json.pitcher)
|
team_json.rotation.append(team_json.pitcher)
|
||||||
team_json.pitcher = None
|
team_json.pitcher = None
|
||||||
update_team(team_json)
|
update_team(team_json)
|
||||||
|
for player in team_json.rotation + team_json.lineup:
|
||||||
|
if player.name == "Tim Locastro":
|
||||||
|
player.randomize_stars()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
team_json.rotation = []
|
team_json.rotation = []
|
||||||
team_json.rotation.append(team_json.pitcher)
|
team_json.rotation.append(team_json.pitcher)
|
||||||
|
|
|
@ -2109,6 +2109,16 @@ def build_team_embed(team):
|
||||||
def build_star_embed(player_json):
|
def build_star_embed(player_json):
|
||||||
starkeys = {"batting_stars" : "Batting", "pitching_stars" : "Pitching", "baserunning_stars" : "Baserunning", "defense_stars" : "Defense"}
|
starkeys = {"batting_stars" : "Batting", "pitching_stars" : "Pitching", "baserunning_stars" : "Baserunning", "defense_stars" : "Defense"}
|
||||||
embed = discord.Embed(color=discord.Color.purple(), title=player_json["name"])
|
embed = discord.Embed(color=discord.Color.purple(), title=player_json["name"])
|
||||||
|
|
||||||
|
if player_json["name"] == "Tim Locastro": #the tim easter egg
|
||||||
|
for key in ["batting_stars", "pitching_stars", "baserunning_stars", "defense_stars"]:
|
||||||
|
#random star value between 0 and 6.5
|
||||||
|
stars = random.randint(0,6)
|
||||||
|
half_star = random.random() < 0.5 #half star addition
|
||||||
|
if half_star:
|
||||||
|
stars = half_star + 0.5
|
||||||
|
player_json[key] = stars
|
||||||
|
|
||||||
for key in starkeys.keys():
|
for key in starkeys.keys():
|
||||||
embedstring = ""
|
embedstring = ""
|
||||||
starstring = str(player_json[key])
|
starstring = str(player_json[key])
|
||||||
|
|
Loading…
Reference in a new issue