Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into elemental-magic-penalties
  • Loading branch information
Standing-Storm committed May 24, 2024
2 parents 4bc1e5c + b59ee88 commit 308e493
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 20 deletions.
17 changes: 0 additions & 17 deletions data/json/recipes/recipe_food.json
Original file line number Diff line number Diff line change
Expand Up @@ -8095,23 +8095,6 @@
"//": "https://www.simplyrecipes.com/recipes/caramel_sauce/ minimum heavy cream is 250ml so double recipe. Minimum 28u to caramelize the sugar, plus 14 for the milkfat",
"components": [ [ [ "sugar", 84 ] ], [ [ "any_butter", 12, "LIST" ] ], [ [ "milk_cream", 1 ] ], [ [ "salt", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
"result": "meat_tainted",
"category": "CC_FOOD",
"subcategory": "CSC_FOOD_MEAT",
"skill_used": "cooking",
"difficulty": 5,
"time": "1 h 30 m",
"book_learn": [ [ "recipe_creepy", 5 ], [ "recipe_serum", 6 ] ],
"qualities": [ { "id": "CONTAIN", "level": 1 }, { "id": "CUT", "level": 2 } ],
"components": [
[ [ "meat", 1 ], [ "mutant_meat", 1 ], [ "human_meat", 1, "LIST" ], [ "rehydrated_meat", 1 ] ],
[ [ "slime_scrap", 2 ] ],
[ [ "water", 1 ] ]
]
},
{
"type": "recipe",
"activity_level": "LIGHT_EXERCISE",
Expand Down
16 changes: 16 additions & 0 deletions data/json/recipes/tools/lights.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,22 @@
[ [ "clay_teapot", 1 ], [ "jug_clay", 1 ], [ "can_food", 1 ], [ "can_drink", 1 ], [ "canister_empty", 1 ] ]
]
},
{
"type": "recipe",
"activity_level": "MODERATE_EXERCISE",
"result": "propane_lantern",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_TOOLS",
"skill_used": "fabrication",
"skills_required": [ [ "mechanics", 3 ] ],
"difficulty": 6,
"time": "2 h",
"book_learn": [ [ "textbook_fabrication", 6 ] ],
"qualities": [ { "id": "WRENCH", "level": 1 }, { "id": "SAW_M", "level": 1 }, { "id": "HAMMER", "level": 2 } ],
"using": [ [ "welding_standard", 50 ] ],
"proficiencies": [ { "proficiency": "prof_welding_basic" }, { "proficiency": "prof_welding" } ],
"components": [ [ [ "scrap", 2 ] ], [ [ "pipe", 2 ] ], [ [ "pipe_fittings", 4 ] ], [ [ "pilot_light", 1 ] ] ]
},
{
"type": "recipe",
"activity_level": "ACTIVE_EXERCISE",
Expand Down
30 changes: 27 additions & 3 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ static const json_character_flag json_flag_NO_SPELLCASTING( "NO_SPELLCASTING" );
static const json_character_flag json_flag_SILENT_SPELL( "SILENT_SPELL" );
static const json_character_flag json_flag_SUBTLE_SPELL( "SUBTLE_SPELL" );

static const proficiency_id proficiency_prof_concentration_basic( "prof_concentration_basic" );
static const proficiency_id
proficiency_prof_concentration_intermediate( "prof_concentration_intermediate" );
static const proficiency_id proficiency_prof_concentration_master( "prof_concentration_master" );

static const skill_id skill_spellcraft( "spellcraft" );

static const trait_id trait_NONE( "NONE" );
Expand Down Expand Up @@ -1245,9 +1250,28 @@ float spell::spell_fail( const Character &guy ) const
const float two_thirds_power_level = static_cast<float>( get_effective_level() ) /
static_cast<float>
( 1.5 );

const float psi_effective_skill = 2 * ( ( guy.get_skill_level( skill() ) * 2 ) - get_difficulty(
guy ) ) + ( guy.get_int() * 1.5 ) + two_thirds_power_level;
float psi_effective_skill = 0;
if( is_psi ) {
const float psi_effective_skill_initial = 2 * ( ( guy.get_skill_level(
skill() ) * 2 ) - get_difficulty(
guy ) ) + ( guy.get_int() * 1.5 ) + two_thirds_power_level;

if( !guy.has_proficiency( proficiency_prof_concentration_basic ) ) {
psi_effective_skill = clamp( psi_effective_skill_initial, static_cast<float>( 0 ),
static_cast<float>( 24 ) );
} else if( guy.has_proficiency( proficiency_prof_concentration_basic ) &&
!guy.has_proficiency( proficiency_prof_concentration_intermediate ) ) {
psi_effective_skill = clamp( psi_effective_skill_initial, static_cast<float>( 0 ),
static_cast<float>( 31 ) );
} else if( guy.has_proficiency( proficiency_prof_concentration_intermediate ) &&
!guy.has_proficiency( proficiency_prof_concentration_master ) ) {
psi_effective_skill = clamp( psi_effective_skill_initial, static_cast<float>( 0 ),
static_cast<float>( 37 ) );
} else {
psi_effective_skill = clamp( psi_effective_skill_initial, static_cast<float>( 0 ),
static_cast<float>( 45 ) );
}
}
// add an if statement in here because sufficiently large numbers will definitely overflow because of exponents
if( ( effective_skill > 30.0f && !is_psi ) || ( psi_effective_skill > 40.0f && is_psi ) ) {
return 0.0f;
Expand Down

0 comments on commit 308e493

Please sign in to comment.