Skip to content

Commit

Permalink
The great squeeze; too many files, too much circular logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RPINerd committed Aug 27, 2024
1 parent 5bfe544 commit bb49d76
Show file tree
Hide file tree
Showing 17 changed files with 1,848 additions and 1,967 deletions.
69 changes: 4 additions & 65 deletions src/commander.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,69 +8,8 @@

import random

from .constants import INSURANCE_RATE, INTEREST_RATE, MAXSKILL, MERCENARYNAMES, Skills


class CriminalRecord:
PSYCHOPATH = 0
VILLAIN = 1
CRIMINAL = 2
CROOK = 3
DUBIOUS = 4
CLEAN = 5
LAWFUL = 6
TRUSTED = 7
LIKED = 8
HERO = 9
ERRNO = 10

NAMES = {
PSYCHOPATH: "Psychopath",
VILLAIN: "Villain",
CRIMINAL: "Criminal",
CROOK: "Crook",
DUBIOUS: "Dubious",
CLEAN: "Clean",
LAWFUL: "Lawful",
TRUSTED: "Trusted",
LIKED: "Liked",
HERO: "Hero",
ERRNO: "ERRNO",
}

@staticmethod
def get_record_string(record: int) -> str:
return CriminalRecord.NAMES[record]


class CombatReputation:
HARMLESS = 0
MOSTLY_HARMLESS = 1
POOR = 2
AVERAGE = 3
ABOVE_AVERAGE = 4
COMPETENT = 5
DANGEROUS = 6
DEADLY = 7
ELITE = 8
BORG = 9

NAMES = {
HARMLESS: "Harmless",
MOSTLY_HARMLESS: "Mostly Harmless",
POOR: "Poor",
AVERAGE: "Average",
ABOVE_AVERAGE: "Above Average",
COMPETENT: "Competent",
DANGEROUS: "Dangerous",
DEADLY: "Deadly",
ELITE: "Elite",
BORG: "Borg",
}

@staticmethod
def get_reputation_string(reputation: int) -> str:
return CombatReputation.NAMES[reputation]
from .constants import INSURANCE_RATE, INTEREST_RATE, MAXSKILL, MERCENARYNAMES, CombatReputation, CriminalRecord, Skills
from .economy import SHIPS, Ship


class Commander:
Expand All @@ -83,7 +22,7 @@ def __init__(self, name, pilot_skill, fighter_skill, trader_skill, engineer_skil
self.engineerSkill = engineer_skill
self.credits = 1000
self.debt = 0
self.ship = 1
self.ship = SHIPS[Ship.GNAT]
self.kills = 0
self.reputation = 0
self.policeRecord = 0
Expand All @@ -98,7 +37,7 @@ def pprint(self) -> str:
Skills: {self.pilotSkill}/{self.fighterSkill}/{self.traderSkill}/{self.engineerSkill}\n \
Credits: {self.credits}\n \
Debt: {self.debt}\n \
Ship: {self.ship}\n \
Ship: {self.ship.name}\n \
Kills: {self.kills}\n \
Reputation: {self.reputation}\n \
Police Record: {self.policeRecord}\n \
Expand Down
108 changes: 87 additions & 21 deletions src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,27 +269,93 @@ def name(cls, difficulty: int) -> str:
return cls.NAMES[difficulty]


# Gamestate codes
class GameStateID:
SPLASH = 0
CHAR_CREATE = 1
SYSTEM_INFO = 2
B_CARGO = 3
S_CARGO = 4
Y_SHIPYARD = 5
W_SHORTRANGE = 6
BUY_SHIP = 7
BUY_EQUIPMENT = 8
SELL_EQUIPMENT = 9
PERSONNEL = 10
BANK = 11
STATUS = 12
QUESTS = 13
SHIP_INFO = 14
SPECIAL_CARGO = 15
GALACTIC_CHART = 16
TARGET_SYSTEM = 17
AVG_PRICES = 18
class CriminalRecord:
PSYCHOPATH = 0
VILLAIN = 1
CRIMINAL = 2
CROOK = 3
DUBIOUS = 4
CLEAN = 5
LAWFUL = 6
TRUSTED = 7
LIKED = 8
HERO = 9
ERRNO = 10

NAMES = {
PSYCHOPATH: "Psychopath",
VILLAIN: "Villain",
CRIMINAL: "Criminal",
CROOK: "Crook",
DUBIOUS: "Dubious",
CLEAN: "Clean",
LAWFUL: "Lawful",
TRUSTED: "Trusted",
LIKED: "Liked",
HERO: "Hero",
ERRNO: "ERRNO",
}

SCORES = {
PSYCHOPATH: -100,
VILLAIN: -70,
CRIMINAL: -30,
CROOK: -10,
DUBIOUS: -5,
CLEAN: 0,
LAWFUL: 5,
TRUSTED: 10,
LIKED: 25,
HERO: 75,
ERRNO: 100,
}

@staticmethod
def get_record_string(record: int) -> str:
return CriminalRecord.NAMES[record]


class CombatReputation:
HARMLESS = 0
MOSTLY_HARMLESS = 1
POOR = 2
AVERAGE = 3
ABOVE_AVERAGE = 4
COMPETENT = 5
DANGEROUS = 6
DEADLY = 7
ELITE = 8
BORG = 9

NAMES = {
HARMLESS: "Harmless",
MOSTLY_HARMLESS: "Mostly Harmless",
POOR: "Poor",
AVERAGE: "Average",
ABOVE_AVERAGE: "Above Average",
COMPETENT: "Competent",
DANGEROUS: "Dangerous",
DEADLY: "Deadly",
ELITE: "Elite",
BORG: "Borg",
}

SCORES = {
HARMLESS: 0,
MOSTLY_HARMLESS: 10,
POOR: 20,
AVERAGE: 40,
ABOVE_AVERAGE: 80,
COMPETENT: 150,
DANGEROUS: 300,
DEADLY: 600,
ELITE: 1500,
BORG: 3000,
}

@staticmethod
def get_reputation_string(reputation: int) -> str:
return CombatReputation.NAMES[reputation]


# TODO Unknown values/usage
Expand Down
Loading

0 comments on commit bb49d76

Please sign in to comment.