Skip to content

Commit

Permalink
[XEDRA][MAGICLYSM] Create and use READ_IN_DARKNESS and distribute CRA…
Browse files Browse the repository at this point in the history
…FT_IN_DARKNESS to magic night vision sources (#76697)

* Expand craft in darkness flag

* Add reads in darkness flag and applies to active magical effects (and attunement)

* body part definitions still are a bit strange when combined with mutations, enchantments, etc

* fix mistake

* Adds reads_in_darkness to potion fruit

* remove mom addition

* Split attunement benefits between artificer / void mage and remove other sources

* gate vampire craft in darkness by tier 4

* lint
  • Loading branch information
b3brodie authored Sep 29, 2024
1 parent c7570f6 commit 26de5a1
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 9 deletions.
4 changes: 2 additions & 2 deletions data/mods/Magiclysm/traits/attunements.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"VULCANIST",
"SOULFIRE"
],
"flags": [ "ATTUNEMENT", "EMP_IMMUNE" ]
"flags": [ "ATTUNEMENT", "EMP_IMMUNE", "CRAFT_IN_DARKNESS" ]
},
{
"id": "ALCHEMIST",
Expand Down Expand Up @@ -1128,7 +1128,7 @@
"SOULFIRE",
"WITHER_MAGE"
],
"flags": [ "ATTUNEMENT" ]
"flags": [ "ATTUNEMENT", "READ_IN_DARKNESS" ]
},
{
"id": "VULCANIST",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Xedra_Evolved/body_parts.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"side": "both",
"base_hp": 60,
"drench_capacity": 0,
"flags": [ "IGNORE_TEMP", "LIMB_UPPER", "BIONIC_LIMB" ],
"flags": [ "IGNORE_TEMP", "LIMB_UPPER", "BIONIC_LIMB", "CRAFT_IN_DARKNESS" ],
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
"sub_parts": [ "stalker_eye", "stalker_eye" ]
},
Expand Down
8 changes: 7 additions & 1 deletion data/mods/Xedra_Evolved/effects/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"apply_message": "Your sight adjusts to the darkness.",
"remove_message": "The darkness loses its shape and your eyes return to their usual hue.",
"rating": "good",
"flags": [ "EFFECT_LIMB_SCORE_MOD" ],
"flags": [ "EFFECT_LIMB_SCORE_MOD", "CRAFT_IN_DARKNESS", "READ_IN_DARKNESS" ],
"limb_score_mods": [ { "limb_score": "night_vis", "modifier": 10 } ]
},
{
Expand Down Expand Up @@ -518,6 +518,12 @@
}
]
},
{
"type": "effect_type",
"id": "eyegleam_craft_in_darkness",
"rating": "good",
"flags": [ "CRAFT_IN_DARKNESS" ]
},
{
"type": "effect_type",
"id": "effect_vampiric_strength",
Expand Down
2 changes: 1 addition & 1 deletion data/mods/Xedra_Evolved/effects/goblin_fruit_effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"remove_message": "The darkness of the night rushes in again.",
"rating": "good",
"limb_score_mods": [ { "limb_score": "night_vis", "modifier": 6 } ],
"flags": [ "EFFECT_LIMB_SCORE_MOD" ]
"flags": [ "EFFECT_LIMB_SCORE_MOD", "CRAFT_IN_DARKNESS" ]
},
{
"type": "effect_type",
Expand Down
28 changes: 27 additions & 1 deletion data/mods/Xedra_Evolved/mutations/vampire_trait_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,30 @@
"rng(0.75,1.25) * (1000 + (vampire_total_tier_one_traits() * 100) + (vampire_total_tier_two_traits() * 225) + (vampire_total_tier_three_traits() * 350) + (vampire_total_tier_four_traits_plus_potence() * 500) + (vampire_total_tier_five_traits() * 750))"
]
}
},
{
"run_eocs": [
{
"id": "EOC_EYEGLEAM_activated_3",
"condition": {
"or": [
{
"and": [
{ "u_has_effect": "vampire_virus_ascendant", "intensity": 1 },
{ "math": [ "u_effect_intensity('vampire_virus_ascendant')", "==", "1" ] }
]
},
{
"and": [
{ "u_has_effect": "vampire_virus_post_mortal", "intensity": 1 },
{ "math": [ "u_effect_intensity('vampire_virus_post_mortal')", "==", "1" ] }
]
}
]
},
"effect": [ { "u_add_effect": "eyegleam_craft_in_darkness", "duration": "PERMANENT" } ]
}
]
}
],
"false_effect": [
Expand All @@ -110,7 +134,8 @@
"condition": { "u_has_effect": "eyegleam" },
"effect": [
{ "u_message": "Your eyes lose their reddish glint as the darkness rolls back in.", "type": "neutral" },
{ "u_lose_effect": "eyegleam" }
{ "u_lose_effect": "eyegleam" },
{ "u_lose_effect": "eyegleam_craft_in_darkness" }
]
}
]
Expand Down Expand Up @@ -151,6 +176,7 @@
"false_effect": [
{ "u_message": "You don't have enough blood to maintain your gleaming eyes.", "type": "bad" },
{ "u_lose_effect": "eyegleam" },
{ "u_lose_effect": "eyegleam_craft_in_darkness" },
{ "u_deactivate_trait": "EYEGLEAM" }
]
}
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a
- ```PRED3``` Learn combat skills with double catchup modifier. Resist skill rust on combat skills. Medium morale bonus from foods with the `PREDATOR_FUN` flag. Immune to the guilt mondeath effect.
- ```PRED4``` Learn combat skills with triple catchup modifier. Learn combat skills without spending focus. Resist skill rust on combat skills. Large morale bonus from foods with the `PREDATOR_FUN` flag. Immune to the `guilt` mondeath effect.
- ```PSYCHOPATH``` Butcher humans without a morale penalty.
- ```READ_IN_DARKNESS``` You can read regardless of light level.
- ```ROOTS2``` Gain enhanced effects from the Mycorrhizal Communion mutation.
- ```ROOTS3``` Gain enhanced effects from the Mycorrhizal Communion mutation (slightly faster than `ROOTS2`).
- ```SAPIOVORE``` Butcher humans without a morale penalty.
Expand Down
3 changes: 2 additions & 1 deletion src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ static const itype_id itype_stick_long( "stick_long" );
static const itype_id itype_water( "water" );
static const itype_id itype_water_clean( "water_clean" );

static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
static const json_character_flag json_flag_SAFECRACK_NO_TOOL( "SAFECRACK_NO_TOOL" );

static const morale_type morale_book( "morale_book" );
Expand Down Expand Up @@ -1876,7 +1877,7 @@ void read_activity_actor::do_turn( player_activity &act, Character &who )
book_type::martial_art : book_type::normal;
}

if( who.fine_detail_vision_mod() > 4 ) {
if( who.fine_detail_vision_mod() > 4 && !who.has_flag( json_flag_READ_IN_DARKNESS ) ) {
// It got too dark during the process of reading, bail out.
act.set_to_null();
who.add_msg_if_player( m_bad, _( "It's too dark to read!" ) );
Expand Down
4 changes: 3 additions & 1 deletion src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ static const json_character_flag json_flag_PLANTBLOOD( "PLANTBLOOD" );
static const json_character_flag json_flag_PRED2( "PRED2" );
static const json_character_flag json_flag_PRED3( "PRED3" );
static const json_character_flag json_flag_PRED4( "PRED4" );
static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
static const json_character_flag json_flag_SEESLEEP( "SEESLEEP" );
static const json_character_flag json_flag_STEADY( "STEADY" );
static const json_character_flag json_flag_STOP_SLEEP_DEPRIVATION( "STOP_SLEEP_DEPRIVATION" );
Expand Down Expand Up @@ -12030,7 +12031,8 @@ const Character *Character::get_book_reader( const item &book,
} else if( condition & read_condition_result::NEED_GLASSES ) {
reasons.emplace_back( is_avatar() ? _( "Your eyes won't focus without reading glasses." ) :
string_format( _( "%s's eyes won't focus without reading glasses." ), disp_name() ) );
} else if( condition & read_condition_result::TOO_DARK ) {
} else if( condition & read_condition_result::TOO_DARK &&
!has_flag( json_flag_READ_IN_DARKNESS ) ) {
// Too dark to read only applies if the player can read to himself
reasons.emplace_back( _( "It's too dark to read!" ) );
return nullptr;
Expand Down
4 changes: 3 additions & 1 deletion src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ static const item_group_id Item_spawn_data_survivor_stabbing( "survivor_stabbing

static const json_character_flag json_flag_CANNIBAL( "CANNIBAL" );
static const json_character_flag json_flag_PSYCHOPATH( "PSYCHOPATH" );
static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
static const json_character_flag json_flag_SAPIOVORE( "SAPIOVORE" );
static const json_character_flag json_flag_SPIRITUAL( "SPIRITUAL" );

Expand Down Expand Up @@ -1178,7 +1179,8 @@ bool npc::can_read( const item &book, std::vector<std::string> &fail_reasons )
fail_reasons.emplace_back( _( "I can't read!" ) );
} else if( condition & read_condition_result::NEED_GLASSES ) {
fail_reasons.emplace_back( _( "I can't read without my glasses." ) );
} else if( condition & read_condition_result::TOO_DARK ) {
} else if( condition & read_condition_result::TOO_DARK &&
!has_flag( json_flag_READ_IN_DARKNESS ) ) {
// Too dark to read only applies if the player can read to himself
fail_reasons.emplace_back( _( "It's too dark to read!" ) );
return false;
Expand Down

0 comments on commit 26de5a1

Please sign in to comment.