Skip to content

Commit

Permalink
Added corporate missions, a test random mission utility, and the Rava…
Browse files Browse the repository at this point in the history
…gers faction
  • Loading branch information
jwvhewitt committed Nov 21, 2024
1 parent 865f993 commit 4a0ee1c
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 22 deletions.
12 changes: 11 additions & 1 deletion game/combat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, combatant):
self.has_started_turn = False
self.last_weapon_used = None
self.last_program_used = None
self.extra_actions_taken = 0

@property
def mp_remaining(self):
Expand Down Expand Up @@ -106,6 +107,7 @@ def start_turn(self, chara):
self.moves_this_round = 0
self.attacks_this_round = 0
self._mp_spent = 0
self.extra_actions_taken = 0

def end_turn(self):
if self._ap_remaining > 0:
Expand Down Expand Up @@ -152,8 +154,14 @@ def get_modified_actions_and_move_percent(self, ap_to_spend=0, mp_to_spend=0):
else:
return max(self.action_points - ap_to_spend, 0), 0

def __setstate__(self, state):
# For saves from V0.974 or earlier, make sure there's an extra_actions_taken property.
if "extra_actions_taken" not in state:
self.extra_actions_taken = 0
self.__dict__.update(state)


class CombatDict(object):
class CombatDict:
def __init__(self):
self._entries = dict()

Expand Down Expand Up @@ -213,6 +221,8 @@ def _draw_clock(self, actions, leftover, frame_offset=0):
frame = min(frame, actions * 32 + 8 + frame_offset)
self.quarters.render(adest, frame)



def render(self, flash=False):
mydest = self.get_rect()
self.bg_image.render(mydest)
Expand Down
2 changes: 1 addition & 1 deletion game/content/ghplots/campfeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def custom_init(self, nart):
self.adv = pbge.plots.Adventure(name="Plot Handler")
return True

def t_START(self, camp):
def t_START(self, camp: gears.GearHeadCampaign):
# Attempt to load at least one challenge plot, then load some more plots.
tries = random.randint(2, 5)
while self.should_load_challenge(camp) and tries > 0:
Expand Down
2 changes: 1 addition & 1 deletion game/content/ghplots/randomplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def custom_init(self, nart):
npc = self.seek_element(nart, "NPC", self._is_good_npc, lock=True, scope=self.elements["METROSCENE"])
self.register_element("ALLIED_FACTION", npc.faction)
self.register_element("NPC_SCENE", npc.scene)
ef = self.register_element("ENEMY_FACTION", nart.camp.get_enemy_faction(self.elements["NPC"]))
ef = self.register_element("ENEMY_FACTION", nart.camp.get_enemy_faction(self.elements["NPC"].faction))
if ef:
self.expiration = TimeExpiration(nart.camp)

Expand Down
21 changes: 15 additions & 6 deletions gears/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class StandardDamageHandler(KeyObject, Restoreable):
# amount of damage taken exceeds its maximum capacity.
def __init__(self, **keywords):
self.hp_damage = 0
super(StandardDamageHandler, self).__init__(**keywords)
super().__init__(**keywords)

base_health = 1

Expand Down Expand Up @@ -460,6 +460,9 @@ def get_pilot(self):
"""Return the combatant itself."""
return self

def get_bonus_action_cost_mod(self):
return 100


class HasPower(KeyObject):
# This is a gear that has, and can use, power sources.
Expand Down Expand Up @@ -498,7 +501,7 @@ class MakesPower(KeyObject, Restoreable):
# method.
def __init__(self, **keywords):
self.spent = 0
super(MakesPower, self).__init__(**keywords)
super().__init__(**keywords)

def max_power(self):
return self.scale.scale_power(1)
Expand Down Expand Up @@ -1028,7 +1031,7 @@ def volume(self):
# to their full names
class SizeClassedComponent(Component):
def __init__(self, **keywords):
super(SizeClassedComponent, self).__init__(**keywords)
super().__init__(**keywords)

def get_full_name(self):
basename = super(SizeClassedComponent, self).get_full_name()
Expand Down Expand Up @@ -1070,7 +1073,7 @@ def __init__(self, size=1, **keywords):
elif size > self.MAX_SIZE:
size = self.MAX_SIZE
self.size = size
super(Armor, self).__init__(**keywords)
super().__init__(**keywords)

@property
def base_mass(self):
Expand Down Expand Up @@ -3882,8 +3885,14 @@ def __init__(self, form=MT_Battroid,
self.shop_tags.append(tags.ST_MECHA)
self.pilot = None

def _material_matches(self, part):
if self.material is materials.Biotech:
return part.material is materials.Biotech
else:
return part.material is not materials.Biotech

def is_legal_sub_com(self, part):
return self.form.is_legal_sub_com(part)
return self.form.is_legal_sub_com(part) and self._material_matches(part)

def is_legal_inv_com(self, part):
return not isinstance(part, (Mover, Combatant))
Expand Down Expand Up @@ -4395,7 +4404,7 @@ def get_max_stamina(self):
, self.get_stat(stats.Athletics)
)
# Give the character a minimum stamina of 1.
return max(1, base - self.current_trauma)
return max(1, base - self.current_trauma//2)

def get_current_mental(self):
return max(self.get_max_mental() - self.mp_spent, 0)
Expand Down
35 changes: 26 additions & 9 deletions gears/factions.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class BoneDevils(Faction):
mecha_colors = (color.Black, color.Cream, color.BrightRed, color.Avocado, color.Terracotta)
CAREERS = {
tags.Trooper: ("Bandit", "Thief"),
tags.Commander: ("Commander", "Scavenger"),
tags.Commander: ("Commander", "Scavenger", "Crimelord", "Kingpin"),
tags.Support: ("Mecha Pilot", "Tekno"),
}
LOCATIONS = (personality.DeadZone,)
Expand Down Expand Up @@ -285,6 +285,20 @@ class ProDuelistAssociation(Faction):
NOUNS = ("Club", "League")


class Ravagers(Faction):
name = "the Ravagers"
factags = (tags.Adventurer, tags.Criminal)
mecha_colors = (color.DesertYellow, color.Sandstone, color.FlourescentGreen, color.Ebony, color.DeepSeaBlue)
CAREERS = {
tags.Trooper: ("Bandit", "Scavenger", "Mercenary"),
tags.Commander: ("Gladiator", "Assassin", "Warlord"),
tags.Support: ("Explorer", "Technoshaman", "Neodruid"),
}
LOCATIONS = (personality.DeadZone,)
ADJECTIVES = ("Ashen", "Forsaken", "Apocalypse")
NOUNS = ("Nomads", "Survivors", "Caravan")


class Circle(object):
def __init__(self, camp, parent_faction=None, mecha_colors=None, name="", careers=None, factags=(), locations=(),
uniform_colors=None, active=True, allies=(), enemies=()):
Expand Down Expand Up @@ -442,15 +456,15 @@ def __setstate__(self, state):
),
Guardians: FactionRelations(
allies=(TerranFederation, DeadzoneFederation),
enemies=(BoneDevils, BladesOfCrihna)
enemies=(BoneDevils, BladesOfCrihna, Ravagers)
),
DeadzoneFederation: FactionRelations(
allies=(Guardians,),
enemies=(BoneDevils, ClanIronwind),
allies=(Guardians, TerranFederation),
enemies=(BoneDevils, ClanIronwind, Ravagers),
),
ClanIronwind: FactionRelations(
allies=(),
enemies=(TerranFederation, TerranDefenseForce, DeadzoneFederation)
enemies=(TerranFederation, TerranDefenseForce, DeadzoneFederation, Ravagers)
),
TheSilverKnights: FactionRelations(
allies=(TheSolarNavy,),
Expand All @@ -466,18 +480,21 @@ def __setstate__(self, state):
enemies=(Guardians,)
),
KettelIndustries: FactionRelations(
enemies=(RegExCorporation, BioCorp, BoneDevils, BladesOfCrihna),
enemies=(RegExCorporation, BioCorp, BoneDevils, Ravagers, BladesOfCrihna),
allies=(Guardians,)
),
BioCorp: FactionRelations(
enemies=(RegExCorporation, KettelIndustries, BoneDevils, TreasureHunters),
enemies=(RegExCorporation, KettelIndustries, BoneDevils, Ravagers, TreasureHunters),
allies=(Guardians,)
),
RegExCorporation: FactionRelations(
enemies=(KettelIndustries, BioCorp, BoneDevils, ClanIronwind),
enemies=(KettelIndustries, BioCorp, BoneDevils, Ravagers, ClanIronwind),
allies=(Guardians,)
),
Ravagers: FactionRelations(
enemies=(DeadzoneFederation, ClanIronwind, BoneDevils, KettelIndustries, BioCorp, RegExCorporation),
allies=()
)



}
8 changes: 4 additions & 4 deletions history.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
* Added Ravagers faction
* Biotech mecha can only mount biotech modules; non-biotech mecha may not mount biotech modules
* Reduced Stamina loss from cyberware
* Rebalanced monster dodge skill
* Corporate factions now have allies and enemies
* FieldHQ name buttons now use labels and can resize text if name is too long
* New MissionText generated if no MissionGrammar provided to BuildAMissionSeed
* Random MissionText added

v0.974 November 14, 2024

* Added "Road of No Return" quest to DeadZone Drifter
* Fixed unloadable save file if PC killed during combat bug
* Incapacitated PCs may need lifesaving cybersurgery
Expand All @@ -13,7 +16,6 @@ v0.974 November 14, 2024
* Most missions names now include faction being fought

v0.973 November 6, 2024

* Used cyberware is resold at a lower price
* Refactored cyberdoc unit to use current widget system
* Fixed crashing bug in cyberdoc unit
Expand All @@ -23,11 +25,9 @@ v0.973 November 6, 2024
* Sales menu will be properly reactivated after selling something

v0.972 November 3, 2024

* Fixed a bug in the Label widget

v0.971 November 3, 2024

* You can now access your inventory from the shop interface
* You can now switch characters in shop interface
* Added named boss monsters
Expand Down

0 comments on commit 4a0ee1c

Please sign in to comment.