Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions Buttons/Turn.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ async def passForRound(player, game: GamestateHelper, interaction: discord.Inter
game.update_player(player_helper)
nextPlayer = game.get_next_player(player)
game.addToPassOrder(player["player_name"])
sendPermaPassButton = False
if nextPlayer is not None and not game.is_everyone_passed():
view = TurnButtons.getStartTurnButtons(game, nextPlayer, player["color"])
game.initilizeKey("activePlayerColor")
Expand All @@ -134,12 +135,8 @@ async def passForRound(player, game: GamestateHelper, interaction: discord.Inter
await interaction.channel.send("## " + game.getPlayerEmoji(nextPlayer) + " started their turn")
await interaction.channel.send(nextPlayer["player_name"] + " use buttons to do your turn"
+ game.displayPlayerStats(nextPlayer), view=view)

view2 = View()
view2.add_item(Button(label="Pass Unless Someone Attacks You",
style=discord.ButtonStyle.green, custom_id="permanentlyPass"))
await interaction.followup.send(interaction.user.mention + " you may use this button to pass on reactions"
" unless someone invades your systems.", view=view2, ephemeral=True)
sendPermaPassButton = True

else:
view = View()
role = discord.utils.get(interaction.guild.roles, name=game.game_id)
Expand Down Expand Up @@ -167,6 +164,12 @@ async def passForRound(player, game: GamestateHelper, interaction: discord.Inter
thread = discord.utils.get(interaction.channel.threads, name=thread_name)
if thread is not None:
asyncio.create_task(game.showGame(thread, msg2))
if sendPermaPassButton:
view2 = View()
view2.add_item(Button(label="Pass Unless Someone Attacks You",
style=discord.ButtonStyle.green, custom_id="permanentlyPass"))
await interaction.followup.send(interaction.user.mention + " you may use this button to pass on reactions"
" unless someone invades your systems.", view=view2, ephemeral=True)

@staticmethod
async def permanentlyPass(player, game: GamestateHelper, interaction:
Expand Down Expand Up @@ -462,7 +465,8 @@ async def checkTraitor(game: GamestateHelper, player, interaction: discord.Inter
if player['color'] in ship:
playerPresent = True
if playerPresent:
for tile in player["reputation_track"]:
repTrack = player["reputation_track"][:]
for tile in repTrack:
if isinstance(tile, str) and "-" in tile and "minor" not in tile:
color = tile.split("-")[2]
p2 = game.getPlayerObjectFromColor(color)
Expand All @@ -481,7 +485,7 @@ async def checkTraitor(game: GamestateHelper, player, interaction: discord.Inter
game.update_player(player_helper)
await interaction.channel.send(f"{player['player_name']}, you broke relations with {color}"
" and now are the Traitor.")
return




Expand Down
2 changes: 2 additions & 0 deletions commands/search_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ async def stats(self, interaction: discord.Interaction, tourney_only:bool=False)
highestVP = drawing.get_public_points(game.gamestate["players"][player], True)
for player in game.gamestate["players"]:
username = game.gamestate["players"][player]["username"]
if "(" in username:
username = username.split("(")[0]
vp_count[username] += int(100*drawing.get_public_points(game.gamestate["players"][player], True)/highestVP)
if game.gamestate["roundNum"] == 9:
finished_tourney_games[username] += 1
Expand Down
10 changes: 5 additions & 5 deletions helpers/CombatHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,9 @@ async def rollDice(game: GamestateHelper, buttonID: str, interaction: discord.In
dice = shipModel.dice
missiles = ""
nonMissiles = " on initiative " + str(speed)
if speed > 98 and speed < 1000:
if speed > 90 and speed < 1000:
dice = shipModel.missile
if len(shipModel.missile) <1 and speed > 98 and speed < 1000:
if len(shipModel.missile) <1 and speed > 90 and speed < 1000:
continue
missiles = "missiles on initiative " + str(speed-99)+" "
nonMissiles = ""
Expand Down Expand Up @@ -1043,7 +1043,7 @@ async def promptNextSpeed(game: GamestateHelper, pos: str, channel, update: bool
if nextSpeed == -20:
await Combat.checkForMorphShield(game, pos, channel, ships, [attacker, defender])
for speed, owner in sortedSpeeds:
if speed < 99:
if speed < 90:
nextSpeed = speed
nextOwner = owner
break
Expand All @@ -1056,8 +1056,8 @@ async def promptNextSpeed(game: GamestateHelper, pos: str, channel, update: bool
game.setCurrentRoller(nextOwner, pos)
game.setCurrentSpeed(nextSpeed, pos)
initiative = f"Initiative {nextSpeed}"
if nextSpeed > 98:
initiative = "Initiative" + str(nextSpeed-99)+" missiles"
if nextSpeed > 90:
initiative = "Initiative " + str(nextSpeed-99)+" missiles"

if [nextSpeed, nextOwner] in game.getRetreatingUnits(pos):
checker = "FCID" + nextOwner + "_"
Expand Down