Skip to content

Commit

Permalink
Merge pull request CleverRaven#62559 from MNG-cataclysm/horde_master_…
Browse files Browse the repository at this point in the history
…jsonify

Migrate the "Kill Horde Master" mission to JSON
  • Loading branch information
Rivet-the-Zombie authored Dec 13, 2022
2 parents b758c62 + 4b14b02 commit c397de2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 49 deletions.
18 changes: 17 additions & 1 deletion data/json/npcs/missiondef.json
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,23 @@
"difficulty": 5,
"value": 250000,
"urgent": true,
"start": "kill_horde_master",
"start": {
"update_mapgen": {
"place_monster": [
{ "monster": "mon_zombie_master", "x": [ 12, 15 ], "y": [ 12, 15 ], "target": true, "name": "Demonic Soul" },
{ "group": "GROUP_ZOMBIE", "x": [ 12, 15 ], "y": [ 12, 15 ], "repeat": [ 21, 29 ] }
]
},
"effect": "follow_only",
"assign_mission_target": {
"om_terrain": "house",
"om_terrain_match_type": "CONTAINS",
"search_range": 80,
"min_distance": 10,
"random": true,
"z": 0
}
},
"end": { "effect": "stop_following" },
"origins": [ "ORIGIN_SECONDARY" ],
"followup": "MISSION_RECRUIT_TRACKER",
Expand Down
1 change: 0 additions & 1 deletion src/mission.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ struct mission_place {
struct mission_start {
static void standard( mission * ); // Standard for its goal type
static void place_zombie_mom( mission * ); // Put a zombie mom in a house!
static void kill_horde_master( mission * ); // Kill the master zombie at the center of the horde
static void kill_nemesis( mission * ); // Kill the nemesis spawned with the "hunted" trait
static void place_npc_software( mission * ); // Put NPC-type-dependent software
static void place_deposit_box( mission * ); // Place a safe deposit box in a nearby bank
Expand Down
46 changes: 0 additions & 46 deletions src/mission_start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ static const mission_type_id
mission_MISSION_GET_ZOMBIE_BLOOD_ANAL( "MISSION_GET_ZOMBIE_BLOOD_ANAL" );

static const mtype_id mon_zombie( "mon_zombie" );
static const mtype_id mon_zombie_brute( "mon_zombie_brute" );
static const mtype_id mon_zombie_dog( "mon_zombie_dog" );
static const mtype_id mon_zombie_hulk( "mon_zombie_hulk" );
static const mtype_id mon_zombie_master( "mon_zombie_master" );
static const mtype_id mon_zombie_necro( "mon_zombie_necro" );

static const overmap_special_id overmap_special_evac_center( "evac_center" );

Expand All @@ -70,47 +65,6 @@ void mission_start::place_zombie_mom( mission *miss )
zomhouse.save();
}

void mission_start::kill_horde_master( mission *miss )
{
npc *p = g->find_npc( miss->npc_id );
if( p == nullptr ) {
debugmsg( "could not find mission NPC %d", miss->npc_id.get_value() );
return;
}
// Npc joins you
p->set_attitude( NPCATT_FOLLOW );
// Pick one of the below locations for the horde to haunt
const tripoint_abs_omt center = p->global_omt_location();
tripoint_abs_omt site = overmap_buffer.find_closest( center, "office_tower_1", 0, false );
if( site == overmap::invalid_tripoint ) {
site = overmap_buffer.find_closest( center, "hotel_tower_1_8", 0, false );
}
if( site == overmap::invalid_tripoint ) {
site = overmap_buffer.find_closest( center, "school_5", 0, false );
}
if( site == overmap::invalid_tripoint ) {
site = overmap_buffer.find_closest( center, "forest_thick", 0, false );
}
miss->target = site;
overmap_buffer.reveal( site, 6 );
tinymap tile;
tile.load( project_to<coords::sm>( site ), false );
tile.add_spawn( mon_zombie_master, 1, { SEEX, SEEY, site.z() }, false, -1, miss->uid,
_( "Demonic Soul" ) );
tile.add_spawn( mon_zombie_brute, 3, { SEEX, SEEY, site.z() } );
tile.add_spawn( mon_zombie_dog, 3, { SEEX, SEEY, site.z() } );

for( int x = SEEX - 1; x <= SEEX + 1; x++ ) {
for( int y = SEEY - 1; y <= SEEY + 1; y++ ) {
tile.add_spawn( mon_zombie, rng( 3, 10 ), { x, y, site.z() } );
}
tile.add_spawn( mon_zombie_dog, rng( 0, 2 ), { SEEX, SEEY, site.z() } );
}
tile.add_spawn( mon_zombie_necro, 2, { SEEX, SEEY, site.z() } );
tile.add_spawn( mon_zombie_hulk, 1, { SEEX, SEEY, site.z() } );
tile.save();
}

void mission_start::kill_nemesis( mission * )
{
// Pick an area for the nemesis to spawn
Expand Down
1 change: 0 additions & 1 deletion src/missiondef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ static const std::map<std::string, std::function<void( mission * )>> mission_fun
// Starts
{ "standard", { } },
{ "place_zombie_mom", mission_start::place_zombie_mom },
{ "kill_horde_master", mission_start::kill_horde_master },
{ "kill_nemesis", mission_start::kill_nemesis },
{ "place_npc_software", mission_start::place_npc_software },
{ "place_deposit_box", mission_start::place_deposit_box },
Expand Down

0 comments on commit c397de2

Please sign in to comment.