Skip to content

Commit 26de5a1

Browse files
authored
[XEDRA][MAGICLYSM] Create and use READ_IN_DARKNESS and distribute CRAFT_IN_DARKNESS to magic night vision sources (CleverRaven#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
1 parent c7570f6 commit 26de5a1

File tree

9 files changed

+47
-9
lines changed

9 files changed

+47
-9
lines changed

data/mods/Magiclysm/traits/attunements.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"VULCANIST",
3939
"SOULFIRE"
4040
],
41-
"flags": [ "ATTUNEMENT", "EMP_IMMUNE" ]
41+
"flags": [ "ATTUNEMENT", "EMP_IMMUNE", "CRAFT_IN_DARKNESS" ]
4242
},
4343
{
4444
"id": "ALCHEMIST",
@@ -1128,7 +1128,7 @@
11281128
"SOULFIRE",
11291129
"WITHER_MAGE"
11301130
],
1131-
"flags": [ "ATTUNEMENT" ]
1131+
"flags": [ "ATTUNEMENT", "READ_IN_DARKNESS" ]
11321132
},
11331133
{
11341134
"id": "VULCANIST",

data/mods/Xedra_Evolved/body_parts.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
"side": "both",
122122
"base_hp": 60,
123123
"drench_capacity": 0,
124-
"flags": [ "IGNORE_TEMP", "LIMB_UPPER", "BIONIC_LIMB" ],
124+
"flags": [ "IGNORE_TEMP", "LIMB_UPPER", "BIONIC_LIMB", "CRAFT_IN_DARKNESS" ],
125125
"smash_message": "You use your flippin' face to smash the %s. EXTREME.",
126126
"sub_parts": [ "stalker_eye", "stalker_eye" ]
127127
},

data/mods/Xedra_Evolved/effects/effects.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@
217217
"apply_message": "Your sight adjusts to the darkness.",
218218
"remove_message": "The darkness loses its shape and your eyes return to their usual hue.",
219219
"rating": "good",
220-
"flags": [ "EFFECT_LIMB_SCORE_MOD" ],
220+
"flags": [ "EFFECT_LIMB_SCORE_MOD", "CRAFT_IN_DARKNESS", "READ_IN_DARKNESS" ],
221221
"limb_score_mods": [ { "limb_score": "night_vis", "modifier": 10 } ]
222222
},
223223
{
@@ -518,6 +518,12 @@
518518
}
519519
]
520520
},
521+
{
522+
"type": "effect_type",
523+
"id": "eyegleam_craft_in_darkness",
524+
"rating": "good",
525+
"flags": [ "CRAFT_IN_DARKNESS" ]
526+
},
521527
{
522528
"type": "effect_type",
523529
"id": "effect_vampiric_strength",

data/mods/Xedra_Evolved/effects/goblin_fruit_effects.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"remove_message": "The darkness of the night rushes in again.",
139139
"rating": "good",
140140
"limb_score_mods": [ { "limb_score": "night_vis", "modifier": 6 } ],
141-
"flags": [ "EFFECT_LIMB_SCORE_MOD" ]
141+
"flags": [ "EFFECT_LIMB_SCORE_MOD", "CRAFT_IN_DARKNESS" ]
142142
},
143143
{
144144
"type": "effect_type",

data/mods/Xedra_Evolved/mutations/vampire_trait_eocs.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,30 @@
9292
"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))"
9393
]
9494
}
95+
},
96+
{
97+
"run_eocs": [
98+
{
99+
"id": "EOC_EYEGLEAM_activated_3",
100+
"condition": {
101+
"or": [
102+
{
103+
"and": [
104+
{ "u_has_effect": "vampire_virus_ascendant", "intensity": 1 },
105+
{ "math": [ "u_effect_intensity('vampire_virus_ascendant')", "==", "1" ] }
106+
]
107+
},
108+
{
109+
"and": [
110+
{ "u_has_effect": "vampire_virus_post_mortal", "intensity": 1 },
111+
{ "math": [ "u_effect_intensity('vampire_virus_post_mortal')", "==", "1" ] }
112+
]
113+
}
114+
]
115+
},
116+
"effect": [ { "u_add_effect": "eyegleam_craft_in_darkness", "duration": "PERMANENT" } ]
117+
}
118+
]
95119
}
96120
],
97121
"false_effect": [
@@ -110,7 +134,8 @@
110134
"condition": { "u_has_effect": "eyegleam" },
111135
"effect": [
112136
{ "u_message": "Your eyes lose their reddish glint as the darkness rolls back in.", "type": "neutral" },
113-
{ "u_lose_effect": "eyegleam" }
137+
{ "u_lose_effect": "eyegleam" },
138+
{ "u_lose_effect": "eyegleam_craft_in_darkness" }
114139
]
115140
}
116141
]
@@ -151,6 +176,7 @@
151176
"false_effect": [
152177
{ "u_message": "You don't have enough blood to maintain your gleaming eyes.", "type": "bad" },
153178
{ "u_lose_effect": "eyegleam" },
179+
{ "u_lose_effect": "eyegleam_craft_in_darkness" },
154180
{ "u_deactivate_trait": "EYEGLEAM" }
155181
]
156182
}

doc/JSON_FLAGS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a
410410
- ```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.
411411
- ```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.
412412
- ```PSYCHOPATH``` Butcher humans without a morale penalty.
413+
- ```READ_IN_DARKNESS``` You can read regardless of light level.
413414
- ```ROOTS2``` Gain enhanced effects from the Mycorrhizal Communion mutation.
414415
- ```ROOTS3``` Gain enhanced effects from the Mycorrhizal Communion mutation (slightly faster than `ROOTS2`).
415416
- ```SAPIOVORE``` Butcher humans without a morale penalty.

src/activity_actor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ static const itype_id itype_stick_long( "stick_long" );
233233
static const itype_id itype_water( "water" );
234234
static const itype_id itype_water_clean( "water_clean" );
235235

236+
static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
236237
static const json_character_flag json_flag_SAFECRACK_NO_TOOL( "SAFECRACK_NO_TOOL" );
237238

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

1879-
if( who.fine_detail_vision_mod() > 4 ) {
1880+
if( who.fine_detail_vision_mod() > 4 && !who.has_flag( json_flag_READ_IN_DARKNESS ) ) {
18801881
// It got too dark during the process of reading, bail out.
18811882
act.set_to_null();
18821883
who.add_msg_if_player( m_bad, _( "It's too dark to read!" ) );

src/character.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ static const json_character_flag json_flag_PLANTBLOOD( "PLANTBLOOD" );
328328
static const json_character_flag json_flag_PRED2( "PRED2" );
329329
static const json_character_flag json_flag_PRED3( "PRED3" );
330330
static const json_character_flag json_flag_PRED4( "PRED4" );
331+
static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
331332
static const json_character_flag json_flag_SEESLEEP( "SEESLEEP" );
332333
static const json_character_flag json_flag_STEADY( "STEADY" );
333334
static const json_character_flag json_flag_STOP_SLEEP_DEPRIVATION( "STOP_SLEEP_DEPRIVATION" );
@@ -12030,7 +12031,8 @@ const Character *Character::get_book_reader( const item &book,
1203012031
} else if( condition & read_condition_result::NEED_GLASSES ) {
1203112032
reasons.emplace_back( is_avatar() ? _( "Your eyes won't focus without reading glasses." ) :
1203212033
string_format( _( "%s's eyes won't focus without reading glasses." ), disp_name() ) );
12033-
} else if( condition & read_condition_result::TOO_DARK ) {
12034+
} else if( condition & read_condition_result::TOO_DARK &&
12035+
!has_flag( json_flag_READ_IN_DARKNESS ) ) {
1203412036
// Too dark to read only applies if the player can read to himself
1203512037
reasons.emplace_back( _( "It's too dark to read!" ) );
1203612038
return nullptr;

src/npc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ static const item_group_id Item_spawn_data_survivor_stabbing( "survivor_stabbing
117117

118118
static const json_character_flag json_flag_CANNIBAL( "CANNIBAL" );
119119
static const json_character_flag json_flag_PSYCHOPATH( "PSYCHOPATH" );
120+
static const json_character_flag json_flag_READ_IN_DARKNESS( "READ_IN_DARKNESS" );
120121
static const json_character_flag json_flag_SAPIOVORE( "SAPIOVORE" );
121122
static const json_character_flag json_flag_SPIRITUAL( "SPIRITUAL" );
122123

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

0 commit comments

Comments
 (0)