Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Magiclysm] Move bulk of spellcasting proficiency processing to dedicated EoCs and out of spell JSON (Animist/biomancer edition) #76160

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
395 changes: 198 additions & 197 deletions data/mods/Magiclysm/Spells/animist.json

Large diffs are not rendered by default.

288 changes: 144 additions & 144 deletions data/mods/Magiclysm/Spells/biomancer.json

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions data/mods/Magiclysm/Spells/classless.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,27 @@
"base_casting_time": 0,
"final_casting_time": 0
},
{
"id": "eoc_enervation_setup",
"type": "SPELL",
"name": "Set Up Proficiency: Enervation",
"description": "Sets up proficiency gain. This is a bug if you have it.",
"valid_targets": [ "self" ],
"spell_class": "NONE",
"flags": [ "NO_LEGS" ],
"difficulty": 0,
"min_damage": 1,
"max_damage": 1,
"duration_increment": 1,
"effect": "effect_on_condition",
"effect_str": "EOC_SPELLCASTING_ENERVATION_PROFICIENCY_ADD",
"shape": "blast",
"energy_source": "NONE",
"base_energy_cost": 0,
"final_energy_cost": 0,
"base_casting_time": 0,
"final_casting_time": 0
},
{
"id": "eoc_conveyance_setup",
"type": "SPELL",
Expand Down
163 changes: 163 additions & 0 deletions data/mods/Magiclysm/eoc_spell_casting_proficiencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,44 @@
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_SPELLCASTING_ENERVATION_PROFICIENCY_ADD",
"global": false,
"eoc_type": "ACTIVATION",
"effect": [
{ "math": [ "u_prof_lowest", "=", "4" ] },
{
"if": { "math": [ "u_proficiency('prof_magic_enervation_beginner', 'format': 'percent')", ">=", "100" ] },
"then": [
{
"if": { "math": [ "u_proficiency('prof_magic_enervation_apprentice', 'format': 'percent')", ">=", "100" ] },
"then": [
{
"if": { "math": [ "u_proficiency('prof_magic_enervation_master', 'format': 'percent')", ">=", "100" ] },
"then": [ { "math": [ "u_prof_level", "=", "3" ] }, { "math": [ "u_prof_lowest", "=", "min(u_prof_level, u_prof_lowest)" ] } ],
"else": [
{ "math": [ "u_proficiency('prof_magic_enervation_master', 'format': 'percent')", "+=", "rand(4) / 64" ] },
{ "math": [ "u_prof_level", "=", "2" ] },
{ "math": [ "u_prof_lowest", "=", "min(u_prof_level, u_prof_lowest)" ] }
]
}
],
"else": [
{ "math": [ "u_proficiency('prof_magic_enervation_apprentice', 'format': 'percent')", "+=", "rand(4) / 32" ] },
{ "math": [ "u_prof_level", "=", "1" ] },
{ "math": [ "u_prof_lowest", "=", "min(u_prof_level, u_prof_lowest)" ] }
]
}
],
"else": [
{ "math": [ "u_proficiency('prof_magic_enervation_beginner', 'format': 'percent')", "+=", "rand(4) / 16" ] },
{ "math": [ "u_prof_level", "=", "0" ] },
{ "math": [ "u_prof_lowest", "=", "min(u_prof_level, u_prof_lowest)" ] }
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_SPELLCASTING_CONVEYANCE_PROFICIENCY_ADD",
Expand Down Expand Up @@ -188,5 +226,130 @@
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_EVOCATION_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('damage', 'flag_whitelist': 'EVOCATION_SPELL')",
"=",
"( (u_proficiency('prof_magic_evocation_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_evocation_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_evocation_master', 'format': 'percent') / 1000) )"
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_CHANNELING_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('casting_time', 'flag_whitelist': 'CHANNELING_SPELL')",
"=",
"( (u_proficiency('prof_magic_channel_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_channel_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_channel_master', 'format': 'percent') / 1000) ) * -1"
]
},
{
"math": [
"u_spellcasting_adjustment('cost', 'flag_whitelist': 'CHANNELING_SPELL')",
"=",
"( (u_proficiency('prof_magic_channel_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_channel_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_channel_master', 'format': 'percent') / 1000) ) * -1"
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_CONJURATION_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('duration', 'flag_whitelist': 'CONJURATION_SPELL')",
"=",
"( (u_proficiency('prof_magic_summon_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_master', 'format': 'percent') / 1000) )"
]
},
{
"math": [
"u_spellcasting_adjustment('cost', 'flag_whitelist': 'CONJURATION_SPELL')",
"=",
"( (u_proficiency('prof_magic_summon_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_master', 'format': 'percent') / 1000) ) * -1"
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_ENHANCEMENT_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('duration', 'flag_whitelist': 'ENHANCEMENT_SPELL')",
"=",
"( (u_proficiency('prof_magic_enhancement_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_master', 'format': 'percent') / 1000) )"
]
},
{
"math": [
"u_spellcasting_adjustment('casting_time', 'flag_whitelist': 'ENHANCEMENT_SPELL')",
"=",
"( (u_proficiency('prof_magic_enhancement_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_master', 'format': 'percent') / 1000) ) * -1"
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_ENERVATION_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('duration', 'flag_whitelist': 'ENERVATION_SPELL')",
"=",
"( (u_proficiency('prof_magic_enervation_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enervation_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enervation_master', 'format': 'percent') / 1000) )"
]
},
{
"math": [
"u_spellcasting_adjustment('aoe', 'flag_whitelist': 'ENERVATION_SPELL')",
"=",
"( (u_proficiency('prof_magic_enervation_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enervation_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enervation_master', 'format': 'percent') / 1000) )"
]
}
]
},
{
"type": "effect_on_condition",
"id": "EOC_CONVEYANCE_SPELLS_PROFICIENCY_BONUSES",
"eoc_type": "EVENT",
"required_event": "opens_spellbook",
"effect": [
{
"math": [
"u_spellcasting_adjustment('cost', 'flag_whitelist': 'CONVEYANCE_SPELL')",
"=",
"( (u_proficiency('prof_magic_conveyance_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_conveyance_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_conveyance_master', 'format': 'percent') / 1000) ) * -1"
]
},
{
"math": [
"u_spellcasting_adjustment('range', 'flag_whitelist': 'CONVEYANCE_SPELL')",
"=",
"( (u_proficiency('prof_magic_conveyance_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_conveyance_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_conveyance_master', 'format': 'percent') / 1000) )"
]
}
]
}
]
12 changes: 12 additions & 0 deletions data/mods/Magiclysm/jmath.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,24 @@
"num_args": 2,
"return": "_0 - (((((u_proficiency('prof_magic_summon_beginner', 'format': 'percent') * 1) / 10) + ((u_proficiency('prof_magic_summon_apprentice', 'format': 'percent') * 1) / 10) + ((u_proficiency('prof_magic_summon_master', 'format': 'percent') * 1) / 10))) * _1 )"
},
{
"type": "jmath_function",
"id": "summoning_proficiency_modifier",
"num_args": 0,
"return": "1 + ( (u_proficiency('prof_magic_summon_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_summon_master', 'format': 'percent') / 1000) )"
},
{
"type": "jmath_function",
"id": "enhancement_proficiency_bonus_calculate",
"num_args": 2,
"return": "_0 + (((((u_proficiency('prof_magic_enhancement_beginner', 'format': 'percent') * 1) / 10) + ((u_proficiency('prof_magic_enhancement_apprentice', 'format': 'percent') * 1) / 10) + ((u_proficiency('prof_magic_enhancement_master', 'format': 'percent') * 1) / 10))) * _1 )"
},
{
"type": "jmath_function",
"id": "enhancement_proficiency_modifier",
"num_args": 0,
"return": "1 + ( (u_proficiency('prof_magic_enhancement_beginner', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_apprentice', 'format': 'percent') / 1000) + (u_proficiency('prof_magic_enhancement_master', 'format': 'percent') / 1000) )"
},
{
"type": "jmath_function",
"id": "enhancement_proficiency_negate_calculate",
Expand Down
7 changes: 5 additions & 2 deletions data/mods/Magiclysm/magic_balance.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ Channeling covers spells that require the caster to focus for long periods of ti
Conjuration encompasses spells that summon something or someone, usually for a set period of time. Most Golemancy is covered by this, along with the Animist's Summon Undead, Ignus Fattus, or the Druid's Nature's Bow. Conjuration specializes in spells that temporarily summon something, rather than permanently creating something, which would be a bit more suited to Channeling. Proficiency in Conjuration will lower the mana cost of spells and improve the duration times of summoned creatures/objects.

### Enhancement
Enhancement covers spells that improve the target in some way, mentally, physically, or emotionally. While there are many spells in this class, some of them are Cat's Grace, Ogre's Strength, Eagle's Sight, or Feral Form. Note that spells which exclusively heal are not included, as they are fixing something which is damaged, while Enhancement covers spells which improve on the whole. However, if a spell both heals and buffs something, then it should be included in this. Any spells which exclusively debuff or hinder something should also not be included. Proficiency in Enhancement will lower the casting time of spells and improve the duration of enhancement.
Enhancement covers spells that improve the target in some way, mentally, physically, or emotionally. While there are many spells in this class, some of them are Cat's Grace, Ogre's Strength, Eagle's Sight, or Feral Form. Note that spells which exclusively heal are not included, as they are fixing something which is damaged, while Enhancement covers spells which improve on the whole. However, if a spell both heals and buffs something, then it should be included in this. Any spells which exclusively debuff or hinder something should also not be included; see below. Proficiency in Enhancement will lower the casting time of spells and improve the duration of enhancement.

### Enervation
Enervation spells are the opposite of Enhancement, being spells that reduce the capabilities of the target in some way, such as Slow, A Shadow in the Crowd, or Faerie Fire. This includes spells such as Domination or Beguiling the Savage Beast that take control of the target's mind or actions. Spells that do damage as their primary effect but have some debuffing power as an additional ability are not Enervation spells. Proficiency in Enervation will improve the duration of the spell and increase its area of effect.

### Conveyance
Conveyance encompasses spells which involve translocating, teleporting, or moving the caster/target. Some spells covered are Phase Door, Magus's Mark, Shocking Dash, or Translocate Self. Proficiency in Conveyance will extend the range of the spell (if applicable), or lower the casting time if not, and lower the mana cost of the incantation.
Conveyance encompasses spells which involve translocating, teleporting, or moving the caster/target. Some spells covered are Phase Door, Magus's Mark, Shocking Dash, or Translocate Self. Proficiency in Conveyance will extend the range of the spell and lower the mana cost of the incantation.

#### How The JMATH Works
The JMATH behind spellcasting proficiencies is fairly simple, this is how it works:
Expand Down
36 changes: 36 additions & 0 deletions data/mods/Magiclysm/proficiencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,42 @@
"time_to_learn": "32 h",
"required_proficiencies": [ "prof_magic_enhancement_apprentice" ]
},
{
"type": "proficiency",
"id": "prof_magic_enervation_beginner",
"category": "prof_magic_casting",
"name": { "str": "Novice Enervation" },
"//": "This covers anything that debilitates a target, such as slowing them, silencing them, reducing their regeneration, and so on.",
"description": "You're familiar with debilitating your enemies through magic.",
"can_learn": true,
"default_time_multiplier": 1.5,
"default_skill_penalty": 0.2,
"time_to_learn": "8 h"
},
{
"type": "proficiency",
"id": "prof_magic_enervation_apprentice",
"category": "prof_magic_casting",
"name": { "str": "Apprentice Enervation" },
"description": "You're proficient in debilitating your enemies through magic.",
"can_learn": true,
"default_time_multiplier": 1.5,
"default_skill_penalty": 0.2,
"time_to_learn": "16 h",
"required_proficiencies": [ "prof_magic_enhancement_beginner" ]
},
{
"type": "proficiency",
"id": "prof_magic_enervation_master",
"category": "prof_magic_casting",
"name": { "str": "Master Enervation" },
"description": "You've mastered the art of debilitating your enemies with the power of magical incantations.",
"can_learn": true,
"default_time_multiplier": 1.5,
"default_skill_penalty": 0.2,
"time_to_learn": "32 h",
"required_proficiencies": [ "prof_magic_enhancement_apprentice" ]
},
{
"type": "proficiency",
"id": "prof_magic_conveyance_beginner",
Expand Down
24 changes: 24 additions & 0 deletions src/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ std::string enum_to_string<spell_flag>( spell_flag data )
case spell_flag::NON_MAGICAL: return "NON_MAGICAL";
case spell_flag::PSIONIC: return "PSIONIC";
case spell_flag::RECHARM: return "RECHARM";
case spell_flag::EVOCATION_SPELL: return "EVOCATION_SPELL";
case spell_flag::CHANNELING_SPELL: return "CHANNELING_SPELL";
case spell_flag::CONJURATION_SPELL: return "CONJURATION_SPELL";
case spell_flag::ENHANCEMENT_SPELL: return "ENHANCEMENT_SPELL";
case spell_flag::ENERVATION_SPELL: return "ENERVATION_SPELL";
case spell_flag::CONVEYANCE_SPELL: return "CONVEYANCE_SPELL";
case spell_flag::LAST: break;
}
cata_fatal( "Invalid spell_flag" );
Expand Down Expand Up @@ -2505,6 +2511,24 @@ std::string spell::enumerate_spell_data( const Character &guy ) const
if( has_flag( spell_flag::PSIONIC ) ) {
spell_data.emplace_back( _( "is a psionic power" ) );
}
if( has_flag( spell_flag::EVOCATION_SPELL ) ) {
spell_data.emplace_back( _( "is an evocation spell" ) );
}
if( has_flag( spell_flag::CHANNELING_SPELL ) ) {
spell_data.emplace_back( _( "is a channeling spell" ) );
}
if( has_flag( spell_flag::CONJURATION_SPELL ) ) {
spell_data.emplace_back( _( "is a conjuration spell" ) );
}
if( has_flag( spell_flag::ENHANCEMENT_SPELL ) ) {
spell_data.emplace_back( _( "is an enhancement spell" ) );
}
if( has_flag( spell_flag::ENERVATION_SPELL ) ) {
spell_data.emplace_back( _( "is an enervation spell" ) );
}
if( has_flag( spell_flag::CONVEYANCE_SPELL ) ) {
spell_data.emplace_back( _( "is a conveyance spell" ) );
}
if( has_flag( spell_flag::CONCENTRATE ) && !has_flag( spell_flag::PSIONIC ) &&
temp_concentration_difficulty_multiplyer > 0 ) {
spell_data.emplace_back( _( "requires concentration" ) );
Expand Down
6 changes: 6 additions & 0 deletions src/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ enum class spell_flag : int {
NON_MAGICAL, // ignores spell resistance
PSIONIC, // psychic powers instead of traditional magic
RECHARM, // charm_monster spell adds to duration of existing charm_monster effect
EVOCATION_SPELL, // Evocation spell category, used for Magiclysm proficiencies
CHANNELING_SPELL, // Channeling spell category, used for Magiclysm proficiencies
CONJURATION_SPELL, // Conjuration spell category, used for Magiclysm proficiencies
ENHANCEMENT_SPELL, // Enhancement spell category, used for Magiclysm proficiencies
ENERVATION_SPELL, // Enervation spell category, used for Magiclysm proficiencies
CONVEYANCE_SPELL, // Conveyance spell category, used for Magiclysm proficiencies
LAST
};

Expand Down
Loading