From 3ae391829b493c904e9a627ac8e2d68d423516a9 Mon Sep 17 00:00:00 2001 From: Aaron Chancey Date: Tue, 30 Aug 2022 07:10:17 -0400 Subject: [PATCH] Adds Never Wander Flag (#60205) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Adds Never Wander Flag Adds a flag that will prevent monsters from being picked up in wandering hordes explicitly. Adds the flag to Frog Mother and the collapsed tower monsters that were valid for hordes. * Remove never wander from frog mother After discussing with Korg on discord, I’m letting frog mothers still wander. I’ll make a new PR in the morning that adds a new lower level frog zombie and have giant and mutant bullfrogs evolve into it to push frog mother later game. * Removed jabberwock explicit check Removed the explicit check for jabberwock as they're not zombies, so they won't be picked up anyways. went ahead and gave them the flag, however, in case anyone ever reworks hordes. * clang tidy yelled at me removed the unused variable for jabberwock --- data/json/monsters/jabberwock.json | 2 +- data/json/monsters/zed_fusion.json | 4 ++-- src/monster.cpp | 4 ++-- src/monstergenerator.cpp | 1 + src/mtype.h | 1 + src/overmap.cpp | 3 --- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/data/json/monsters/jabberwock.json b/data/json/monsters/jabberwock.json index 8404e3127a3fd..1ed75749fbb02 100644 --- a/data/json/monsters/jabberwock.json +++ b/data/json/monsters/jabberwock.json @@ -96,6 +96,6 @@ "special_attacks": [ [ "FLESH_GOLEM", 5 ] ], "harvest": "jabberwock", "dissect": "dissect_beast_sample_large", - "flags": [ "SEES", "HEARS", "SMELLS", "STUMBLES", "WARM", "BASHES", "DESTROYS", "ATTACKMON", "POISON" ] + "flags": [ "SEES", "HEARS", "SMELLS", "STUMBLES", "WARM", "BASHES", "DESTROYS", "ATTACKMON", "POISON", "NEVER_WANDER" ] } ] diff --git a/data/json/monsters/zed_fusion.json b/data/json/monsters/zed_fusion.json index 98f75ad77be50..f68fe7dfecb76 100644 --- a/data/json/monsters/zed_fusion.json +++ b/data/json/monsters/zed_fusion.json @@ -240,7 +240,7 @@ "harvest": "exempt", "special_attacks": [ { "type": "leap", "cooldown": 5, "max_range": 5, "allow_no_target": true }, [ "scratch", 5 ] ], "death_function": { "message": "A %s explodes!", "effect": { "id": "death_gas", "hit_self": true }, "corpse_type": "NO_CORPSE" }, - "flags": [ "SEES", "HEARS", "SMELLS", "WARM", "POISON", "CLIMBS", "NO_BREATHE", "CLIMBS", "HARDTOSHOOT" ] + "flags": [ "SEES", "HEARS", "SMELLS", "WARM", "POISON", "CLIMBS", "NO_BREATHE", "CLIMBS", "HARDTOSHOOT", "NEVER_WANDER" ] }, { "id": "mon_zombie_gasbag_impaler", @@ -316,7 +316,7 @@ "vision_day": 1, "special_attacks": [ { "type": "leap", "cooldown": 5, "max_range": 3, "allow_no_target": true }, [ "scratch", 5 ] ], "death_function": { "message": "A %s explodes!", "effect": { "id": "death_gas", "hit_self": true }, "corpse_type": "NO_CORPSE" }, - "flags": [ "SEES", "HEARS", "GOODHEARING", "WARM", "POISON", "CLIMBS", "NO_BREATHE", "CLIMBS", "HARDTOSHOOT" ] + "flags": [ "SEES", "HEARS", "GOODHEARING", "WARM", "POISON", "CLIMBS", "NO_BREATHE", "CLIMBS", "HARDTOSHOOT", "NEVER_WANDER" ] }, { "id": "mon_zombie_hanging_innards", diff --git a/src/monster.cpp b/src/monster.cpp index 870a0a5cdb9ae..f13e48d889f94 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -3390,8 +3390,8 @@ void monster::set_horde_attraction( monster_horde_attraction mha ) bool monster::will_join_horde( int size ) { const monster_horde_attraction mha = get_horde_attraction(); - if( this->has_flag( MF_IMMOBILE ) ) { - return false; //immobile monsters should never join a horde. + if( this->has_flag( MF_IMMOBILE ) || this->has_flag( MF_NEVER_WANDER ) ) { + return false; //immobile monsters should never join a horde. Same with Never Wander monsters. } if( mha == MHA_NEVER ) { return false; diff --git a/src/monstergenerator.cpp b/src/monstergenerator.cpp index cf9c234706f27..d13e045c77933 100644 --- a/src/monstergenerator.cpp +++ b/src/monstergenerator.cpp @@ -201,6 +201,7 @@ std::string enum_to_string( m_flag data ) case MF_ALWAYS_VISIBLE: return "ALWAYS_VISIBLE"; case MF_ALWAYS_SEES_YOU: return "ALWAYS_SEES_YOU"; case MF_ALL_SEEING: return "ALL_SEEING"; + case MF_NEVER_WANDER: return "NEVER_WANDER"; // *INDENT-ON* case m_flag::MF_MAX: break; diff --git a/src/mtype.h b/src/mtype.h index 8dd43441de085..3855115abcb9b 100644 --- a/src/mtype.h +++ b/src/mtype.h @@ -174,6 +174,7 @@ enum m_flag : int { MF_ALWAYS_VISIBLE, // This monster can always be seen regardless of los or light or anything MF_ALWAYS_SEES_YOU, // This monster always knows where the avatar is MF_ALL_SEEING, // This monster can see everything within its vision range regardless of light or obstacles + MF_NEVER_WANDER, // This monster will never join wandering hordes. MF_MAX // Sets the length of the flags - obviously must be LAST }; diff --git a/src/overmap.cpp b/src/overmap.cpp index ddf0a14f7bb7f..115038fadc785 100644 --- a/src/overmap.cpp +++ b/src/overmap.cpp @@ -72,8 +72,6 @@ static const mongroup_id GROUP_SWAMP( "GROUP_SWAMP" ); static const mongroup_id GROUP_WORM( "GROUP_WORM" ); static const mongroup_id GROUP_ZOMBIE( "GROUP_ZOMBIE" ); -static const mtype_id mon_jabberwock( "mon_jabberwock" ); - static const oter_str_id oter_central_lab( "central_lab" ); static const oter_str_id oter_central_lab_core( "central_lab_core" ); static const oter_str_id oter_central_lab_train_depot( "central_lab_train_depot" ); @@ -4033,7 +4031,6 @@ void overmap::move_hordes() const mtype &type = *this_monster.type; if( !type.species.count( species_ZOMBIE ) || // Only add zombies to hordes. - type.id == mon_jabberwock || // Jabberwockies are an exception. this_monster.get_speed() <= 30 || // So are very slow zombies, like crawling zombies. !this_monster.will_join_horde( INT_MAX ) || // So are zombies who won't join a horde of any size. !this_monster.mission_ids.empty() // We mustn't delete monsters that are related to missions.