Skip to content

Commit

Permalink
Documentation and formatting update, upgrading to Ruff and stricter r…
Browse files Browse the repository at this point in the history
…ules
  • Loading branch information
RPINerd committed Dec 10, 2024
1 parent e88a494 commit 41022d7
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 112 deletions.
3 changes: 1 addition & 2 deletions spacetrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ def _center_window(self, screen_x: int, screen_y: int) -> str:
x_adj = int((screen_x / 2) - (res / 2))
y_adj = int((screen_y / 2) - (res / 2))

return f"{str(res)}x{str(res)}+{x_adj}+{y_adj}"
return f"{res!s}x{res!s}+{x_adj}+{y_adj}"

def _load_assets(self):
"""
Loads all game assets, currently just pointers to directories
"""

# Load the configuration file
# self.config = configparser.ConfigParser()
# self.config.read(os.path.join("src/config", "config.ini"))
Expand Down
13 changes: 6 additions & 7 deletions src/commander.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""
Space Trader | RPINerd, 2024
An elite-inspired space trading RPG originally on PalmOS
Commander Module
Expand Down Expand Up @@ -67,7 +68,7 @@ def pay_interest(self):
self.debt = self.debt * 1.1

def pay_insurance(self):
#! AI generated placeholder
# ! AI generated placeholder
insurance = self.ship.get_value() * INSURANCE_RATE
if self.credits > insurance:
self.credits -= insurance
Expand Down Expand Up @@ -145,16 +146,14 @@ def mod_random_skill(self, amount: int):
param amount: The amount to modify the skill by.
"""

# Create a sublist of skills that will be within the bounds
skills = [skill for skill in self.get_skills() if 1 <= skill + amount <= MAXSKILL]

# If there are no skills that can be modified, return
if not skills:
return
else:
# Choose a random skill from the sublist
skill = random.choice(skills)
# Choose a random skill from the sublist
skill = random.choice(skills)

# Modify the skill by the given amount
skill += amount
# Modify the skill by the given amount
skill += amount
Loading

0 comments on commit 41022d7

Please sign in to comment.