Skip to content

Commit

Permalink
Added IMMOVABLE property for placeable things
Browse files Browse the repository at this point in the history
  • Loading branch information
jwvhewitt committed Jun 26, 2024
1 parent 354e293 commit c7c1950
Show file tree
Hide file tree
Showing 15 changed files with 354 additions and 14 deletions.
29 changes: 29 additions & 0 deletions data/stc_majornpcs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,33 @@ Character
mecha_colors=(Charcoal, Saffron, OrangeRed, SlateGrey, HeavyPurple)
mecha_pref="SAN-D1 Daum"

Character
name = "Buma Yolos"
mnpcid = "BumaYolos"
statline = {Reflexes=22, Body=16, Speed=24, Perception=18, Knowledge=12, Craft=11, Ego=18, Charm=16}
colors = (HeavyPurple, MediumSkin, Beige, Saffron, PirateSunrise)
personality=[Shy, Easygoing, Glory, GreenZone]
portrait='card_m_jjangbogo.png'
gender=Female
job=MechaPilot
renown=80
birth_year=128
combatant=True
mecha_colors=(Charcoal, Saffron, OrangeRed, SlateGrey, HeavyPurple)
mecha_pref="SAN-D1 Daum"

Character
name = "Carnelio"
mnpcid = "Carnelio"
statline = {Reflexes=15, Body=16, Speed=17, Perception=12, Knowledge=14, Craft=6, Ego=13, Charm=13}
colors = (HeavyPurple, MediumSkin, Beige, Saffron, PirateSunrise)
personality=[Cheerful, Sociable, Glory, L5DustyRing]
portrait='card_m_jjangbogo.png'
gender=Nonbinary
job=Pirate
renown=45
birth_year=128
combatant=True
mecha_colors=(Charcoal, Saffron, OrangeRed, SlateGrey, HeavyPurple)
mecha_pref="SAN-D1 Daum"

3 changes: 1 addition & 2 deletions game/content/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@

import collections
from pbge.plots import PlotError
import pbge
import gears
from .. import exploration

from . import ghterrain
from . import ghwaypoints
from . import ghcutscene
import uuid
from . import backstory
from . import ghrooms
from . import ghchallenges
from . import megaprops


# The list of plots will be stored as a dictionary based on label.
Expand Down
117 changes: 117 additions & 0 deletions game/content/ghplots/mission_bigobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

BAMO_BREAK_THROUGH = "BAMO_BREAK_THROUGH"
BAMO_DEFEND_FORTRESS = "BAMO_DEFEND_FORTRESS"
BAMO_ESCORT_SHIP = "BAMO_ESCORT_SHIP"

class BAM_ToTheOtherSide(Plot):
LABEL = BAMO_BREAK_THROUGH
Expand Down Expand Up @@ -316,3 +317,119 @@ def t_ENDCOMBAT(self, camp):
if len(myteam.get_members_in_play(camp)) < 1:
self.round_counter += 1
self._add_reinforcements(camp)


class BAM_EscortShip(Plot):
LABEL = BAMO_ESCORT_SHIP
active = True
scope = "LOCALE"

def custom_init(self, nart):
myscene = self.elements["LOCALE"]
allyfac = self.elements.get("ALLIED_FACTION")
myfac = self.elements.get("ENEMY_FACTION")
entry_room: pbge.randmaps.rooms.Room = self.elements.get("ENTRANCE_ROOM")
entry_anchor = entry_room.anchor

self.reinforcement_rooms = list()
for t, anc in enumerate(pbge.randmaps.anchors.EDGES):
if anc is not entry_anchor:
roomtype = self.elements["ARCHITECTURE"].get_a_room()
myroom = self.register_element("CORNER_ROOM_{}".format(t), roomtype(10, 10, anchor=anc), dident="LOCALE")
self.reinforcement_rooms.append(myroom)


team2: teams.Team = self.register_element("_eteam", teams.Team(faction=myfac, enemies=(myscene.player_team,)))

myroom = self.register_element("CENTER_ROOM",
ghrooms.IndicatedRoom(16, 16, anchor=pbge.randmaps.anchors.middle),
dident="LOCALE")

myroom2 = self.register_element("URBAN_ROOM",
ghrooms.MechaScaleResidentialArea(12, 12, anchor=pbge.randmaps.anchors.middle),
dident="CENTER_ROOM")

bunker_team = self.register_element("_bunkerteam", teams.Team(faction=allyfac, enemies=(team2,), allies=(myscene.player_team,)), dident="URBAN_ROOM")
myfort = self.register_element("_bunker", gears.selector.generate_fortification(self.rank, myfac, myscene.environment))
bunker_team.contents.append(myfort)

self.round_counter = 0
self.round_target = max(5, self.rank//10 + 2)

self.obj0 = adventureseed.MissionObjective("Proceed to indicated area", 1)
self.adv.objectives.append(self.obj0)
self.obj = adventureseed.MissionObjective("Defend buildings for {} rounds".format(self.round_target), MAIN_OBJECTIVE_VALUE * 3)
self.adv.objectives.append(self.obj)

self.init_ready = True
self.combat_started = False

return True

def t_START(self, camp: gears.GearHeadCampaign):
if self.init_ready:
myroom = self.elements["CENTER_ROOM"]
for x in range(myroom.area.x, myroom.area.x + myroom.area.width):
for y in range(myroom.area.y, myroom.area.y + myroom.area.height):
camp.scene.set_visible(x, y, True)

self.init_ready = False

def t_PCMOVE(self, camp: gears.GearHeadCampaign):
if not self.combat_started:
in_dest_zone = list()
outta_dest_zone = list()
dest_zone: pygame.Rect = self.elements["CENTER_ROOM"].area
for pc in camp.get_active_party():
if dest_zone.collidepoint(*pc.pos):
in_dest_zone.append(pc)
else:
outta_dest_zone.append(pc)
# Remove mobility kills from the list of mecha that haven't made it to the end zone. They aren't making it.
# Because this check is expensive, only do it if at least some mecha are in the end zone.
if in_dest_zone:
for pc in list(outta_dest_zone):
if pc.get_current_speed() < 10:
pc.gear_up(camp.scene)
if pc.get_current_speed() < 10:
outta_dest_zone.remove(pc)

if in_dest_zone and not outta_dest_zone:
self.obj0.win(camp, 100)
self.combat_started = True
self._add_reinforcements(camp)

def _add_reinforcements(self, camp: gears.GearHeadCampaign):
myunit = gears.selector.RandomMechaUnit(self.rank, 75, self.elements.get("ENEMY_FACTION"),
camp.scene.environment, add_commander=False)
team2 = self.elements["_eteam"]
#print(myunit.mecha_list)
mek1 = myunit.mecha_list[0]
camp.scene.deploy_team(myunit.mecha_list, team2, random.choice(self.reinforcement_rooms).area)
game.combat.enter_combat(camp, mek1)
game.combat.enter_combat(camp, self.elements["_bunker"])

def t_COMBATROUND(self, camp):
if self.combat_started:
myteam = self.elements["_bunkerteam"]
if len(myteam.get_members_in_play(camp)) < 1:
pbge.alert("Buildings Destroyed".format(self.round_counter), font=pbge.HUGEFONT, justify=0)
self.obj.failed = True
camp.check_trigger("FORCE_EXIT")

else:
self.round_counter += 1
pbge.alert("Survived Round {}".format(self.round_counter), font=pbge.HUGEFONT, justify=0)
if self.round_counter >= self.round_target:
# Victory!
self.obj.win(camp, 100)
camp.check_trigger("FORCE_EXIT")
else:
self._add_reinforcements(camp)

def t_ENDCOMBAT(self, camp):
if self.combat_started:
myteam = self.elements["_eteam"]
if len(myteam.get_members_in_play(camp)) < 1:
self.round_counter += 1
self._add_reinforcements(camp)
113 changes: 110 additions & 3 deletions game/content/ghplots/ropp_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def custom_init(self, nart):
WM_IMAGE_FILE="wm_map_piratespoint.png",
WM_IDENTIFIER="WORLDMAP_6"))
nart.camp.campdata['lets_get_tattoos'] = 0
nart.camp.campdata['hero_points'] = 0
#:scenario_init
self.build_world(nart)
unique_id = "ropp"
Expand Down Expand Up @@ -1042,6 +1043,14 @@ def build_world(self, nart):

the_world['00000075'] = the_world['00000071'].entry_level
the_world['00000078'] = the_world['00000071'].goal_level

the_world['000000A2'] = pbge.randmaps.rooms.FuzzyRoom(
name='Engineering Room', anchor=None, decorate=None)
the_world['00000078'].contents.append(the_world['000000A2'])

the_world['000000A3'] = ghwaypoints.OldMainframe(
name='Fusion Control Core', desc='', anchor=None)
the_world['000000A2'].contents.append(the_world['000000A3'])
# Build the city here, store it in the_world
team1 = teams.Team(name="Player Team")
team2 = teams.Team(name="Civilian Team", allies=(team1, ))
Expand Down Expand Up @@ -1435,12 +1444,15 @@ def build_world(self, nart):
faction=None,
attributes=[
gears.tags.SCENE_OUTDOORS, gears.tags.City,
personality.GreenZone, gears.tags.SCENE_PUBLIC
personality.GreenZone, gears.tags.SCENE_PUBLIC,
gears.tags.CITY_NAUTICAL
],
exploration_music='Anthem of Rain - Adaptation (Instrumental).ogg',
combat_music='HoliznaCC0 - Punk.ogg')
# Create a scene generator
myroom = pbge.randmaps.rooms.Room(40, 25, anchor=pbge.randmaps.anchors.north)
myroom = pbge.randmaps.rooms.Room(40,
25,
anchor=pbge.randmaps.anchors.north)
myscenegen = pbge.randmaps.PartlyUrbanGenerator(
myscene,
game.content.gharchitecture.HumanScaleGreenzone(
Expand Down Expand Up @@ -1528,6 +1540,31 @@ def build_world(self, nart):
faction=None,
combatant=True)
the_world['00000084'].contents.append(the_world['00000089'])
splot = self.add_sub_plot(
nart,
"EMPTY_BUILDING",
elements=dict(
LOCALE=the_world['00000011'],
METROSCENE=the_world['00000011'],
METRO=the_world['00000011'].metrodat,
MISSION_GATE=the_world['00000013'],
CITY_COLORS=(gears.color.Burlywood, gears.color.FreedomBlue,
gears.color.LunarGrey, gears.color.Cobalt,
gears.color.OrangeRed),
INTERIOR_NAME='The House of Blades',
INTERIOR_TAGS=[
gears.tags.SCENE_PUBLIC, gears.tags.SCENE_GARAGE,
gears.tags.SCENE_SHOP
],
DOOR_SIGN=(ghterrain.BladesOfCrihnaSignEast,
ghterrain.BladesOfCrihnaSignSouth),
DOOR_TYPE=ghwaypoints.ScrapIronDoor,
INTERIOR_FACTION=gears.factions.BladesOfCrihna,
EXTERIOR_TERRSET=ghterrain.ScrapIronBuilding,
INTERIOR_ARCHITECTURE=gharchitecture.FortressBuilding,
INTERIOR_DECOR=gharchitecture.FactoryDecor()))
the_world['000000A7'] = splot.elements["INTERIOR"]
the_world['000000A8'] = splot.elements["FOYER"]
# Build the city here, store it in the_world
team1 = teams.Team(name="Player Team")
team2 = teams.Team(name="Civilian Team", allies=(team1, ))
Expand Down Expand Up @@ -3827,6 +3864,52 @@ def custom_init(self, nart):
self.elements['LOCALE'] = nart.camp.campdata[THE_WORLD]['00000078']
element_alias_list = [('PARENT_SCENE', 'LOCALE')]

#: plot_init
#: plot_actions

self.add_sub_plot(nart,
'ROOM_ropp_177',
elements=dict([(a, self.elements[b])
for a, b in element_alias_list]),
ident="")
return True

#: plot_methods


class Room_ropp_177(Plot):
LABEL = "ROOM_ropp_177"
active = True
scope = "LOCALE"

#: plot_properties
def custom_init(self, nart):
self.elements['ROOM'] = nart.camp.campdata[THE_WORLD]['000000A2']
element_alias_list = []

#: plot_init
#: plot_actions

self.add_sub_plot(nart,
'WAYPOINT_ropp_178',
elements=dict([(a, self.elements[b])
for a, b in element_alias_list]),
ident="")
return True

#: plot_methods


class Waypoint_ropp_178(Plot):
LABEL = "WAYPOINT_ropp_178"
active = True
scope = "LOCALE"

#: plot_properties
def custom_init(self, nart):
self.elements['WAYPOINT'] = nart.camp.campdata[THE_WORLD]['000000A3']
element_alias_list = []

#: plot_init
#: plot_actions
#: plot_subplots
Expand Down Expand Up @@ -4396,8 +4479,14 @@ def custom_init(self, nart):
elements=dict([(a, self.elements[b])
for a, b in element_alias_list]),
ident="")
self.add_sub_plot(nart,
'EMPTYBUILDING_ropp_180',
elements=dict([(a, self.elements[b])
for a, b in element_alias_list]),
ident="")
#: plot_actions
#: plot_subplots

self.add_sub_plot(nart, 'ROPP_DOCKYARDS_PLOT')
self.add_sub_plot(nart,
'CF_METROSCENE_RECOVERY_HANDLER',
elements=dict([(a, self.elements[b])
Expand Down Expand Up @@ -4545,6 +4634,24 @@ def NPC_offers(self, camp):
return mylist


class EmptyBuilding_ropp_180(Plot):
LABEL = "EMPTYBUILDING_ropp_180"
active = True
scope = "LOCALE"

#: plot_properties
def custom_init(self, nart):
self.elements['ROOM'] = nart.camp.campdata[THE_WORLD]['000000A8']
self.elements['LOCALE'] = nart.camp.campdata[THE_WORLD]['000000A7']
element_alias_list = [('PARENT_SCENE', 'LOCALE')]

#: plot_init
#: plot_actions
#: plot_subplots
return True


#: plot_methods
class City_ropp_14(Plot):
LABEL = "CITY_ropp_14"
active = True
Expand Down
38 changes: 38 additions & 0 deletions game/content/ghplots/ropp_metroplots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# City plots for Raid on Pirate's Point, since I am still working on the scenario editor.

import random
from game import content, services, teams, ghdialogue
import gears
import pbge
from game.content import gharchitecture, plotutility, dungeonmaker, ghwaypoints, adventureseed, ghcutscene, ghterrain, \
ghchallenges, ghrooms
from game.ghdialogue import context
from pbge.dialogue import Offer, ContextTag
from pbge.plots import Plot, Rumor, PlotState
from pbge.memos import Memo
from . import missionbuilder, rwme_objectives, campfeatures, worldmapwar, wmw_occupation
from pbge.challenges import Challenge, AutoOffer
from .shops_plus import get_building
import collections


class DockyardsPlot(Plot):
LABEL = "ROPP_DOCKYARDS_PLOT"
scope = "METRO"
active = True

def custom_init(self, nart):
self.add_sub_plot(nart, "ROPP_DOCKYARDS_HOUSEOFBLADES")
return True

class RoppDockHouseOfBlades(Plot):
LABEL = "ROPP_DOCKYARDS_HOUSEOFBLADES"
scope = "METRO"
active = True

def custom_init(self, nart):
locale = self.register_element("LOCALE", nart.camp.campdata["SCENARIO_ELEMENT_UIDS"]['000000A7'])
room = self.register_element("_ROOM", nart.camp.campdata["SCENARIO_ELEMENT_UIDS"]['000000A8'])


return True
Loading

0 comments on commit c7c1950

Please sign in to comment.