Originally I spend some time trying to make the "Build" turn work with the "on_interaction" button flow but it was getting really messy quickly. The discord.py team suggested doing this all with views, so now that is the flow for the turns. The main changes in this branch are the addition of the "TurnButtons", "BuildButtons", and "UpgradeButtons" files which each contain all of the logic needed to take that action. Across the board the messages could be made to look better but that is for later once we decide on the style we want to keep consistency.
TurnButtons File
Serve as the basis for the start of a players turn. Currently only Build and Upgrade actions are functional.
Besides the other action buildouts, this needs some functionality to change buttons show after a player is passed to reactions only. Should be an easy change
BuildButtons File
Contains all logic for player to take their build action
Protected buttons with "author" checks to make sure other players cannot click these buttons
Player can only build as much as their build_apt allows
Player cannot build unless they are able to fully pay for their choices
Logic added to handle paying directly with materials or converting science/money at the players conversion rate
Easy reset logic built in, gamestate is only saved once the flow is completed and valid. Adjusts influence discs and ship stock once finished
TODO: Currently does not check to make sure player has the ship stock to build. It's possible they could build into negative numbers. This is not difficult to add as a check in Build class
UpgradeButtons File
Contains all logic for player to take their upgrade action
Protected buttons as well
Player can only upgrade as much as upgrade_apt allows
Let's players pick which parts to change and allows them to pick from their researched techs
Fully handles ancient ship parts
Prevents player from building ships that are not valid (not enough energy supply, no drive on ships)
TODO: Might be nice to show the player the part upgrade tiles, otherwise they have to know the stats by name. Could create a new drawing to show these as an ephemeral message.
TODO: We have no easy way right now of handling the base ship parts, its possible a player could remove them to an empty space which is not allowed. Also, due to how we build the ship view if the base tile is removed, it still shows through in the picture underneath but the stats are gone. I think we will have to leave this up to the players to police themselves for now.
GamestateHelper
add_units and remove_units now adjust ship stock
added a get_next_player function
ShipHelper
New class that takes in a player dict and ship name and generates a Ship object
Easy check to see if a ship is valid with a function
I think this class will make the combat phase extremely simple. By building out functions for rolling, damage, checking if ship is destroyed, etc...we have everything we need in the object to run combat. We could iterate over the player_ships stat in a tile, build the ship objects, and then create CombatButtons to create the battle logic.
Bot Host Problems
Tried hosting the bot and ran into issues I need to investigate, mainly that Pillow does not seem to function on that server.
Also, the host requires that ALL f-strings that contain quotes inside must have a different quote type ( " vs ' ) than what starts the f-string. I was not doing that and had to go line by line and change every instance where I had that problem. Mostly a me issue from what I saw.
Originally I spend some time trying to make the "Build" turn work with the "on_interaction" button flow but it was getting really messy quickly. The discord.py team suggested doing this all with views, so now that is the flow for the turns. The main changes in this branch are the addition of the "TurnButtons", "BuildButtons", and "UpgradeButtons" files which each contain all of the logic needed to take that action. Across the board the messages could be made to look better but that is for later once we decide on the style we want to keep consistency.
TurnButtons File
BuildButtons File
UpgradeButtons File
GamestateHelper
ShipHelper
Bot Host Problems