Skip to content

Commit a249d54

Browse files
Merge pull request #82723 from Standing-Storm/new-myopia-flag-for-goblins
[Mods] Add MYOPIC_SUPERNATURAL and MYOPIC_IN_LIGHT_SUPERNATURAL flags
1 parent 7dfb115 commit a249d54

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

data/json/flags.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,16 @@
488488
"type": "json_flag",
489489
"info": "This gear <good>corrects nearsightedness</good>."
490490
},
491+
{
492+
"id": "MYOPIC_SUPERNATURAL",
493+
"type": "json_flag",
494+
"//": "Like MYOPIC, but can't be fixed by glasses."
495+
},
496+
{
497+
"id": "MYOPIC_IN_LIGHT_SUPERNATURAL",
498+
"type": "json_flag",
499+
"//": "Like MYOPIC_IN_LIGHT, but can't be fixed by glasses."
500+
},
491501
{
492502
"id": "FILTHY",
493503
"type": "json_flag",

data/mods/Magiclysm/mutations/mutation_paths/fantasy_species.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@
577577
"description": "Your people have always had an easier time operating at night, away from the hated light of the sun.",
578578
"mixed_effect": true,
579579
"valid": false,
580-
"flags": [ "MYOPIC_IN_LIGHT" ],
580+
"flags": [ "MYOPIC_IN_LIGHT_SUPERNATURAL" ],
581581
"category": [ "SPECIES_GOBLIN" ],
582582
"enchantments": [
583583
{

data/mods/MindOverMatter/effects/effects_nether_attunement.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
"remove_message": "Your vision finally clears.",
8282
"rating": "bad",
8383
"limb_score_mods": [ { "limb_score": "night_vis", "modifier": 0.1 }, { "limb_score": "vision", "modifier": 0.2 } ],
84-
"flags": [ "EFFECT_LIMB_SCORE_MOD", "HYPEROPIC", "MYOPIC", "MYOPIC_IN_LIGHT" ]
84+
"flags": [ "EFFECT_LIMB_SCORE_MOD", "HYPEROPIC", "MYOPIC_SUPERNATURAL" ]
8585
},
8686
{
8787
"type": "effect_type",

data/mods/MindOverMatter/effects/effects_penalty.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@
357357
"show_in_info": true,
358358
"limb_score_mods": [ { "limb_score": "vision", "modifier": 0.5 }, { "limb_score": "night_vis", "modifier": 0.5 } ],
359359
"base_mods": { "hit_mod": [ -2 ] },
360-
"flags": [ "MYOPIC_IN_LIGHT", "EFFECT_LIMB_SCORE_MOD" ]
360+
"flags": [ "MYOPIC_SUPERNATURAL", "EFFECT_LIMB_SCORE_MOD" ]
361361
},
362362
{
363363
"type": "effect_type",

doc/JSON/JSON_FLAGS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ Character flags can be `trait_id`, `json_flag_id` or `flag_id`. Some of these a
406406
- ```MYCUS_IMMUNE``` Critter is immune to fungal hase field (`fd_fungal_haze`)
407407
- ```MYOPIC``` You are nearsighted: vision range is severely reduced without glasses.
408408
- ```MYOPIC_IN_LIGHT``` You are nearsighted in light, but can see normally in low-light conditions.
409+
- ```MYOPIC_SUPERNATURAL``` You are nearsighted in such a way that glasses cannot fix it, such as by magic.
410+
- ```MYOPIC_IN_LIGHT_SUPERNATURAL``` You are nearsighted in light in such a way that glasses cannot fix it, such as by magic.
409411
- ```NIGHT_VISION``` You can see in the dark.
410412
- ```NO_DISEASE``` This mutation grants immunity to diseases.
411413
- ```NO_RADIATION``` This mutation grants immunity to radiations.

src/character.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ static const json_character_flag json_flag_INVERTEBRATEBLOOD( "INVERTEBRATEBLOOD
330330
static const json_character_flag json_flag_INVISIBLE( "INVISIBLE" );
331331
static const json_character_flag json_flag_MYOPIC( "MYOPIC" );
332332
static const json_character_flag json_flag_MYOPIC_IN_LIGHT( "MYOPIC_IN_LIGHT" );
333+
static const json_character_flag
334+
json_flag_MYOPIC_IN_LIGHT_SUPERNATURAL( "MYOPIC_IN_LIGHT_SUPERNATURAL" );
335+
static const json_character_flag json_flag_MYOPIC_SUPERNATURAL( "MYOPIC_SUPERNATURAL" );
333336
static const json_character_flag json_flag_NIGHT_VISION( "NIGHT_VISION" );
334337
static const json_character_flag json_flag_NON_THRESH( "NON_THRESH" );
335338
static const json_character_flag json_flag_NO_RADIATION( "NO_RADIATION" );
@@ -1473,6 +1476,8 @@ bool Character::sight_impaired() const
14731476
!has_effect( effect_contacts ) &&
14741477
!has_effect( effect_transition_contacts ) &&
14751478
!has_flag( json_flag_ENHANCED_VISION ) ) ||
1479+
( in_light && has_flag( json_flag_MYOPIC_IN_LIGHT_SUPERNATURAL ) ) ||
1480+
has_flag( json_flag_MYOPIC_SUPERNATURAL ) ||
14761481
has_trait( trait_PER_SLIME ) || is_blind();
14771482
}
14781483

@@ -2685,10 +2690,13 @@ void Character::recalc_sight_limits()
26852690
sight_max = 2;
26862691
} else if( has_trait( trait_PER_SLIME ) ) {
26872692
sight_max = 8;
2688-
} else if( ( has_flag( json_flag_MYOPIC ) || ( in_light &&
2689-
has_flag( json_flag_MYOPIC_IN_LIGHT ) ) ) &&
2690-
!worn_with_flag( flag_FIX_NEARSIGHT ) && !has_effect( effect_contacts ) &&
2691-
!has_effect( effect_transition_contacts ) ) {
2693+
} else if( ( ( has_flag( json_flag_MYOPIC ) || ( in_light &&
2694+
has_flag( json_flag_MYOPIC_IN_LIGHT ) ) ) &&
2695+
!worn_with_flag( flag_FIX_NEARSIGHT ) && !has_effect( effect_contacts ) &&
2696+
!has_effect( effect_transition_contacts ) ) ||
2697+
( in_light && has_flag( json_flag_MYOPIC_IN_LIGHT_SUPERNATURAL ) ) ||
2698+
has_flag( json_flag_MYOPIC_SUPERNATURAL )
2699+
) {
26922700
sight_max = 12;
26932701
} else if( has_effect( effect_darkness ) ) {
26942702
vision_mode_cache.set( DARKNESS );

0 commit comments

Comments
 (0)