Skip to content

Commit

Permalink
Challenge start - hunted forever (#73227)
Browse files Browse the repository at this point in the history
* Recurring nemesis scenario

* Nemesis hits the gym everytime you hit them

* Evaluate conditions inside enchantment

* Oops, catch some linting

* Add effect name to dictionary
  • Loading branch information
RenechCDDA committed Apr 30, 2024
1 parent bbc90f0 commit 24ab07a
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 5 deletions.
20 changes: 20 additions & 0 deletions data/json/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -4666,6 +4666,26 @@
}
]
},
{
"id": "nemesis_buff",
"type": "effect_type",
"max_duration": "1000 s",
"name": [ "SWOLE" ],
"desc": [ "If you see this description it is a bug." ],
"rating": "bad",
"show_intensity": false,
"enchantments": [
{
"condition": "ALWAYS",
"values": [
{ "value": "SPEED", "multiply": { "math": [ "Nemesis_iteration * 0.01" ] } },
{ "value": "ARMOR_BASH", "add": { "math": [ "Nemesis_iteration * -1" ] } },
{ "value": "ARMOR_STAB", "add": { "math": [ "Nemesis_iteration * -1" ] } },
{ "value": "ARMOR_CUT", "add": { "math": [ "Nemesis_iteration * -1" ] } }
]
}
]
},
{
"type": "effect_type",
"id": "molting",
Expand Down
6 changes: 6 additions & 0 deletions data/json/monsters/zed_misc.json
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@
"special_attacks": [ { "id": "grab", "cooldown": 7 }, { "id": "scratch_humanoid" }, { "id": "smash" } ],
"death_drops": "mon_zombie_hulk_death_drops",
"regenerates": 15,
"death_function": { "eoc": "EOC_NEMESIS_DIED" },
"upgrades": false,
"armor": { "bash": 15, "cut": 15, "bullet": 15, "electric": 6 },
"extend": {
Expand All @@ -790,6 +791,11 @@
"families": [ "prof_wp_hulk" ]
}
},
{
"type": "effect_on_condition",
"id": "EOC_NEMESIS_DIED",
"effect": [ { "math": [ "Nemesis_iteration", "+=", "1" ] } ]
},
{
"id": "mon_zombie_grabber",
"type": "MONSTER",
Expand Down
53 changes: 53 additions & 0 deletions data/json/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,59 @@
"flags": [ "CHALLENGE", "LONE_START" ],
"missions": [ "MISSION_KILL_NEMESIS" ]
},
{
"type": "scenario",
"id": "hunted_forever_start",
"name": "Challenge - Hunted Forever",
"points": -5,
"forced_traits": [ "HAS_NEMESIS" ],
"description": "Since the start of the Cataclysm, something has been hunting you relentlessly. You can try to fight it, but each time it falls it will rise again. The only escape is for you to die.",
"allowed_locs": [
"sloc_house",
"sloc_house_boarded",
"sloc_school",
"sloc_grocery_store",
"sloc_gun_store",
"sloc_garage",
"sloc_pawn_shop",
"sloc_bank",
"sloc_military_surplus",
"sloc_furniture_store",
"sloc_library",
"sloc_bookstore",
"sloc_zoo_giftshop",
"sloc_zoo_cages",
"sloc_golfcourse_mid_course",
"sloc_golfcourse_clubhouse",
"sloc_church",
"sloc_cemetery",
"sloc_apartments_rooftop",
"sloc_apartments_rooftop2",
"sloc_hospital",
"sloc_fire_station",
"sloc_police",
"sloc_town_hall",
"sloc_pharm",
"sloc_hardware",
"sloc_dojo",
"sloc_gym",
"sloc_clothes",
"sloc_restaurant",
"sloc_bar",
"sloc_electronics",
"sloc_arcade",
"sloc_animalshelter",
"sloc_laundromat",
"sloc_stripclub",
"sloc_sexshop",
"sloc_candyshop",
"sloc_bikeshop",
"sloc_petstore"
],
"start_name": "In Town",
"flags": [ "CHALLENGE", "LONE_START" ],
"missions": [ "MISSION_SURVIVE_NEMESIS" ]
},
{
"type": "scenario",
"id": "fungal_start",
Expand Down
13 changes: 13 additions & 0 deletions data/json/starting_missions.json
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,21 @@
"goal": "MGOAL_KILL_NEMESIS",
"difficulty": 5,
"value": 0,
"//": "monster_kill_goal MUST be 1 or else the mission will spawn a new nemesis on its death.",
"monster_kill_goal": 1,
"start": "kill_nemesis",
"end": { "effect": [ { "u_lose_trait": "HAS_NEMESIS" } ] },
"origins": [ "ORIGIN_GAME_START" ]
},
{
"id": "MISSION_SURVIVE_NEMESIS",
"type": "mission_definition",
"name": { "str": "Survive your pursuer" },
"description": "Since the start of the Cataclysm, something has been hunting you relentlessly. You can fight it but never truly kill it. It won't end until you die.",
"goal": "MGOAL_KILL_NEMESIS",
"difficulty": 10,
"value": 0,
"start": "kill_nemesis",
"origins": [ "ORIGIN_GAME_START" ]
}
]
53 changes: 53 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,59 @@ void enchant_cache::force_add( const enchantment &rhs, const Character &guy )
details.emplace_back( rhs.name.translated(), rhs.description.translated() );
}

void enchant_cache::force_add( const enchantment &rhs, const monster &mon )
{
dialogue d( get_talker_for( mon ), nullptr );
for( const std::pair<const enchant_vals::mod, dbl_or_var> &pair_values :
rhs.values_add ) {
values_add[pair_values.first] += pair_values.second.evaluate( d );
}
for( const std::pair<const enchant_vals::mod, dbl_or_var> &pair_values :
rhs.values_multiply ) {
// values do not multiply against each other, they add.
// so +10% and -10% will add to 0%
values_multiply[pair_values.first] += pair_values.second.evaluate( d );
}

for( const std::pair<const skill_id, dbl_or_var> &pair_values :
rhs.skill_values_add ) {
skill_values_add[pair_values.first] += pair_values.second.evaluate( d );
}
for( const std::pair<const skill_id, dbl_or_var> &pair_values :
rhs.skill_values_multiply ) {
// values do not multiply against each other, they add.
// so +10% and -10% will add to 0%
skill_values_multiply[pair_values.first] += pair_values.second.evaluate( d );
}

hit_me_effect.insert( hit_me_effect.end(), rhs.hit_me_effect.begin(), rhs.hit_me_effect.end() );

hit_you_effect.insert( hit_you_effect.end(), rhs.hit_you_effect.begin(), rhs.hit_you_effect.end() );

ench_effects.insert( rhs.ench_effects.begin(), rhs.ench_effects.end() );

if( rhs.emitter ) {
emitter = rhs.emitter;
}

for( const bodypart_changes &bp : rhs.modified_bodyparts ) {
modified_bodyparts.emplace_back( bp );
}

for( const trait_id &branch : rhs.mutations ) {
mutations.emplace( branch );
}

for( const std::pair<const time_duration, std::vector<fake_spell>> &act_pair :
rhs.intermittent_activation ) {
for( const fake_spell &fake : act_pair.second ) {
intermittent_activation[act_pair.first].emplace_back( fake );
}
}

details.emplace_back( rhs.name.translated(), rhs.description.translated() );
}

void enchant_cache::force_add( const enchantment &rhs )
{
for( const std::pair<const enchant_vals::mod, dbl_or_var> &pair_values :
Expand Down
1 change: 1 addition & 0 deletions src/magic_enchantment.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class enchant_cache : public enchantment
time_duration modify_value( enchant_vals::mod mod_val, time_duration value ) const;
// adds two enchantments together and ignores their conditions
void force_add( const enchantment &rhs, const Character &guy );
void force_add( const enchantment &rhs, const monster &mon );
void force_add( const enchantment &rhs );
void force_add( const enchant_cache &rhs );

Expand Down
12 changes: 8 additions & 4 deletions src/mission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,14 @@ void mission::on_creature_death( Creature &poor_dead_dude )
avatar &player_character = get_avatar();
for( std::pair<const int, mission> &e : world_missions ) {
mission &i = e.second;

if( i.type->goal == MGOAL_KILL_NEMESIS && player_character.getID() == i.player_id ) {
i.step_complete( 1 );
return;
if( i.type->monster_kill_goal == 1 ) {
if( i.type->goal == MGOAL_KILL_NEMESIS && player_character.getID() == i.player_id ) {
i.step_complete( 1 );
return;
}
} else {
// Recurring nemesis!!
mission_start::kill_nemesis( &i );
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ static const efftype_id effect_maimed_arm( "maimed_arm" );
static const efftype_id effect_monster_armor( "monster_armor" );
static const efftype_id effect_monster_saddled( "monster_saddled" );
static const efftype_id effect_natures_commune( "natures_commune" );
static const efftype_id effect_nemesis_buff( "nemesis_buff" );
static const efftype_id effect_no_sight( "no_sight" );
static const efftype_id effect_onfire( "onfire" );
static const efftype_id effect_pacified( "pacified" );
Expand Down Expand Up @@ -3191,7 +3192,7 @@ void monster::process_one_effect( effect &it, bool is_new )
for( const enchantment_id &ench_id : elem.first->enchantments ) {
const enchantment &ench = ench_id.obj();
if( ench.is_active( *this ) && ench.is_monster_relevant() ) {
enchantment_cache->force_add( ench );
enchantment_cache->force_add( ench, *this );
}
}
}
Expand Down Expand Up @@ -3337,6 +3338,10 @@ void monster::process_effects()
}
}

if( is_nemesis() ) {
add_effect( effect_nemesis_buff, 1000_turns, true );
}

if( has_flag( mon_flag_PHOTOPHOBIC ) && get_map().ambient_light_at( pos() ) >= 30.0f ) {
add_msg_if_player_sees( *this, m_good, _( "The shadow withers in the light!" ), name() );
add_effect( effect_photophobia, 5_turns, true );
Expand Down
1 change: 1 addition & 0 deletions tools/spell_checker/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5949,6 +5949,7 @@ SWD
Swedish
sweety
Swiss
swole
swordfighting
swording
swordsmith
Expand Down

0 comments on commit 24ab07a

Please sign in to comment.