Skip to content

Commit

Permalink
[Xedra Evolved] fix spells, that give temp limbs, take two (#69464)
Browse files Browse the repository at this point in the history
* fix unobtainable alchemy 5

* fix limb spells, take two

* Apply code by @andrei8l

* and by using code wizardry, we make spells free and instant if you have no trait

* also you can turn them off by mutations now

* no free mana for you now

* don't know why this enchantments was not able to inline itself properly but okay

* fixing checking the wrong trait for spell effect

* fix odd math turning 100 into `1 move`
  • Loading branch information
GuardianDll authored Nov 17, 2023
1 parent 56f4059 commit abd89ee
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 95 deletions.
44 changes: 0 additions & 44 deletions data/mods/Xedra_Evolved/effects/effects.json
Original file line number Diff line number Diff line change
Expand Up @@ -1032,50 +1032,6 @@
"//": "Empty name and description to hide effect. This is just a tracker to make learning gossamer recipes take time.",
"rating": "mixed"
},
{
"type": "effect_type",
"id": "spell_karma_arms_eff",
"name": [ "Karma" ],
"desc": [ "Ethereal hands appear behind your back, making you looks like an ancient god." ],
"apply_message": "Ethereal, transparent arms grow from your shoulders and <color_cyan>glow</color>.",
"remove_message": "The cyan arms grow dim and finally disappear.",
"rating": "good",
"enchantments": [
{
"condition": "ALWAYS",
"modified_bodyparts": [
{ "gain": "karma_arm_up_r" },
{ "gain": "karma_arm_up_l" },
{ "gain": "karma_arm_lw_r" },
{ "gain": "karma_arm_lw_l" }
]
}
]
},
{
"type": "effect_type",
"id": "stalker_eyes_eff",
"name": [ "Stalker's Vision" ],
"desc": [ "Your eyes transform into the orbits of an unknown creature.  You now see much better in the light and dark." ],
"apply_message": "Your vision gets dark for a moment, and in a second, a whole new world is revealed under your eyes.",
"remove_message": "A great new world under your eyes disappears.",
"blocks_effects": [ "glare" ],
"rating": "good",
"//": "not actual replacement yet, because i'm afraid of how wearing stuff may interact with it",
"enchantments": [ { "condition": "ALWAYS", "modified_bodyparts": [ { "gain": "stalker_eyes" } ] } ]
},
{
"type": "effect_type",
"id": "devil_tail_eff",
"name": [ "Devil's Tail" ],
"desc": [
"While not actually a devil's, this long, triangular pointed tail can stretch very far, allowing it to easily kill someone nearby."
],
"apply_message": "You feel like your spine stretched enormously.",
"remove_message": "Your devil tail disappear in the air.",
"rating": "good",
"enchantments": [ { "condition": "ALWAYS", "modified_bodyparts": [ { "gain": "devil_tail" } ] } ]
},
{
"type": "effect_type",
"id": "mutagen_plantkin",
Expand Down
53 changes: 53 additions & 0 deletions data/mods/Xedra_Evolved/mutations/temporary.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,58 @@
"id": "ench_giant_growth_size_bonuses",
"condition": "ALWAYS",
"values": [ { "value": "MAX_HP", "multiply": 0.4 } ]
},
{
"type": "mutation",
"id": "karma_arms",
"name": { "str": "Karma" },
"active": true,
"points": 1,
"visibility": 10,
"description": "Ethereal hands appear behind your back, making you looks like an ancient god.",
"valid": false,
"starting_trait": false,
"purifiable": false,
"activated_eocs": [ "EOC_KARMA_ARMS_INITIATE" ],
"enchantments": [
{
"condition": "ALWAYS",
"modified_bodyparts": [
{ "gain": "karma_arm_up_r" },
{ "gain": "karma_arm_up_l" },
{ "gain": "karma_arm_lw_r" },
{ "gain": "karma_arm_lw_l" }
]
}
]
},
{
"type": "mutation",
"id": "devil_tail",
"name": { "str": "Devil's Tail" },
"active": true,
"points": 1,
"visibility": 6,
"description": "While not actually a devil's, this long, triangular pointed tail can stretch very far, allowing it to easily kill someone nearby.",
"valid": false,
"starting_trait": false,
"purifiable": false,
"activated_eocs": [ "EOC_DEVIL_TAIL_INITIATE" ],
"enchantments": [ { "condition": "ALWAYS", "modified_bodyparts": [ { "gain": "devil_tail" } ] } ]
},
{
"type": "mutation",
"id": "stalker_eyes",
"name": { "str": "Stalker's Vision" },
"active": true,
"points": 1,
"visibility": 1,
"description": "Your eyes transform into the orbits of an unknown creature.  You now see much better in the light and dark.",
"//": "not actual replacement yet, because i'm afraid of how wearing stuff may interact with it",
"valid": false,
"starting_trait": false,
"purifiable": false,
"activated_eocs": [ "EOC_STALKER_EYES_INITIATE" ],
"enchantments": [ { "condition": "ALWAYS", "modified_bodyparts": [ { "gain": "stalker_eyes" } ] } ]
}
]
20 changes: 20 additions & 0 deletions data/mods/Xedra_Evolved/obsoletion_and_migration/effects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"type": "effect_type",
"id": "spell_karma_arms_eff",
"name": [ "" ],
"desc": [ "" ]
},
{
"type": "effect_type",
"id": "stalker_eyes_eff",
"name": [ "" ],
"desc": [ "" ]
},
{
"type": "effect_type",
"id": "devil_tail_eff",
"name": [ "" ],
"desc": [ "" ]
}
]
17 changes: 0 additions & 17 deletions data/mods/Xedra_Evolved/obsoletion_and_migration/mutations.json

This file was deleted.

59 changes: 25 additions & 34 deletions data/mods/Xedra_Evolved/spells/dreamer_spells.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,73 +562,64 @@
"id": "spell_karma_arms",
"type": "SPELL",
"name": "Karma Arms",
"description": "Four transparent arms grow out of your body. You have full control over them, and who knows what power they contain.",
"description": "Four transparent arms emit out of your body indefinitely, until you toggle them off. They work as a so desirable additional pair of arms, and who knows what power they contain.",
"teachable": false,
"//": "obvious reference for 'Submachine' by Mateusz Skutnik, albeit no portals",
"//": "obvious reference for 'Submachine' by Mateusz Skutnik, albeit no portals; maybe should actually make it a single arm, that can draw portals.",
"valid_targets": [ "self" ],
"effect": "attack",
"effect_str": "spell_karma_arms_eff",
"effect": "effect_on_condition",
"effect_str": "EOC_KARMA_ARMS_INITIATE",
"shape": "blast",
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX" ],
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX", "NO_FAIL" ],
"skill": "deduction",
"spell_class": "DREAMER",
"energy_source": "MANA",
"difficulty": 10,
"base_casting_time": 2000,
"base_energy_cost": 1800,
"final_energy_cost": 600,
"energy_increment": -50,
"base_casting_time": { "math": [ "u_has_trait('karma_arms') ? 0 : 200000" ] },
"base_energy_cost": { "math": [ "u_has_trait('karma_arms') ? 0 : 200" ] },
"max_level": { "math": [ "dreamer_level(1)" ] },
"min_duration": { "math": [ "spell_time(u_val('time: 15 m'))" ] },
"max_duration": { "math": [ "spell_time(u_val('time: 24 h'))" ] },
"duration_increment": { "math": [ "spell_time(u_val('time: 15 m'))" ] }
"min_duration": { "math": [ "((u_spell_level('spell_karma_arms')+1)*500)*100" ] },
"max_duration": { "math": [ "((u_spell_level('spell_karma_arms')+1)*500)*100" ] }
},
{
"id": "spell_stalker_eyes",
"type": "SPELL",
"name": "Stalker's Oculars",
"description": "Your own eyes are replaced with the eyeballs of an unknown creature. Compound from billions of red crosses inside void dark sclera, they can see much more clearly than any natural creature.",
"description": "Your own eyes are replaced with the eyeballs of an unknown creature, indefinitely, until you toggle them off. Compound from billions of red crosses inside void dark sclera, they can see much more clearly than any natural creature.",
"teachable": false,
"valid_targets": [ "self" ],
"effect": "attack",
"effect_str": "stalker_eyes_eff",
"effect": "effect_on_condition",
"effect_str": "EOC_STALKER_EYES_INITIATE",
"shape": "blast",
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX" ],
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX", "NO_FAIL" ],
"skill": "deduction",
"spell_class": "DREAMER",
"energy_source": "MANA",
"difficulty": 7,
"base_casting_time": 1000,
"base_energy_cost": 700,
"final_energy_cost": 400,
"energy_increment": -50,
"base_casting_time": { "math": [ "u_has_trait('stalker_eyes') ? 0 : 100000" ] },
"base_energy_cost": { "math": [ "u_has_trait('stalker_eyes') ? 0 : 200" ] },
"max_level": { "math": [ "dreamer_level(1)" ] },
"min_duration": { "math": [ "spell_time(u_val('time: 15 m'))" ] },
"max_duration": { "math": [ "spell_time(u_val('time: 24 h'))" ] },
"duration_increment": { "math": [ "spell_time(u_val('time: 15 m'))" ] }
"min_duration": { "math": [ "((u_spell_level('spell_stalker_eyes')+1)*1300)*100" ] },
"max_duration": { "math": [ "((u_spell_level('spell_stalker_eyes')+1)*1300)*100" ] }
},
{
"id": "spell_devil_tail",
"type": "SPELL",
"name": "Devil's Tail",
"description": "A stretchy tail appears from the base of your spine, instinctively aiding you in battle or moving to defend you.",
"description": "A stretchy tail appears from the base of your spine, instinctively aiding you in battle or moving to defend you indefinitely, until you toggle them off.",
"teachable": false,
"valid_targets": [ "self" ],
"effect": "attack",
"effect_str": "devil_tail_eff",
"effect": "effect_on_condition",
"effect_str": "EOC_DEVIL_TAIL_INITIATE",
"shape": "blast",
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX" ],
"flags": [ "NO_LEGS", "NO_HANDS", "SILENT", "NO_EXPLOSION_SFX", "NO_FAIL" ],
"skill": "deduction",
"spell_class": "DREAMER",
"energy_source": "MANA",
"difficulty": 8,
"base_casting_time": 1500,
"base_energy_cost": 1100,
"final_energy_cost": 500,
"energy_increment": -50,
"base_casting_time": { "math": [ "u_has_trait('devil_tail') ? 0 : 150000" ] },
"base_energy_cost": { "math": [ "u_has_trait('devil_tail') ? 0 : 100" ] },
"max_level": { "math": [ "dreamer_level(1)" ] },
"min_duration": { "math": [ "spell_time(u_val('time: 15 m'))" ] },
"max_duration": { "math": [ "spell_time(u_val('time: 24 h'))" ] },
"duration_increment": { "math": [ "spell_time(u_val('time: 15 m'))" ] }
"min_duration": { "math": [ "((u_spell_level('spell_devil_tail')+1)*900)*100" ] },
"max_duration": { "math": [ "((u_spell_level('spell_devil_tail')+1)*900)*100" ] }
}
]
99 changes: 99 additions & 0 deletions data/mods/Xedra_Evolved/spells/spell_eocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,104 @@
"type": "effect_on_condition",
"id": "EOC_EATER_DROSS_FUN_3",
"effect": [ { "u_add_morale": "morale_ate_dross", "bonus": 100, "max_bonus": 200, "duration": "120 h", "decay_start": "60 h" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_KARMA_ARMS_INITIATE",
"condition": { "not": { "u_has_trait": "karma_arms" } },
"effect": [
{ "u_message": "Ethereal, transparent arms appear behind your shoulders and <color_cyan>glow</color>.", "type": "good" },
{ "u_add_trait": "karma_arms" },
{
"queue_eocs": "EOC_KARMA_ARMS_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_karma_arms')+1)*500)" ] }
}
],
"false_effect": [
{ "u_lose_trait": "karma_arms" },
{ "u_message": "The cyan arms grow dim and finally disappear.", "type": "neutral" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_KARMA_ARMS_CONTINUE",
"condition": { "and": [ { "u_has_trait": "karma_arms" }, { "math": [ "u_val('mana')", ">=", "200" ] } ] },
"effect": [
{ "math": [ "u_val('mana')", "-=", "200" ] },
{ "u_message": "Floating arms behind you flicker a bit, but still glow.", "type": "good" },
{
"queue_eocs": "EOC_KARMA_ARMS_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_karma_arms')+1)*500)" ] }
}
],
"false_effect": [
{ "u_lose_trait": "karma_arms" },
{ "u_message": "The cyan arms grow dim and finally disappear.", "type": "neutral" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_DEVIL_TAIL_INITIATE",
"condition": { "not": { "u_has_trait": "devil_tail" } },
"effect": [
{ "u_message": "You feel like your spine stretched enormously.", "type": "good" },
{ "u_add_trait": "devil_tail" },
{
"queue_eocs": "EOC_DEVIL_TAIL_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_devil_tail')+1)*900)" ] }
}
],
"false_effect": [ { "u_lose_trait": "devil_tail" }, { "u_message": "Your devil tail disappear in the air.", "type": "neutral" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_DEVIL_TAIL_CONTINUE",
"condition": { "and": [ { "u_has_trait": "devil_tail" }, { "math": [ "u_val('mana')", ">=", "100" ] } ] },
"effect": [
{ "math": [ "u_val('mana')", "-=", "100" ] },
{ "u_message": "Your devilish tail stretches and twist playfully.", "type": "good" },
{
"queue_eocs": "EOC_DEVIL_TAIL_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_devil_tail')+1)*900)" ] }
}
],
"false_effect": [ { "u_lose_trait": "devil_tail" }, { "u_message": "Your devil tail disappear in the air.", "type": "neutral" } ]
},
{
"type": "effect_on_condition",
"id": "EOC_STALKER_EYES_INITIATE",
"condition": { "not": { "u_has_trait": "stalker_eyes" } },
"effect": [
{
"u_message": "Your vision gets dark for a moment, and in a second, a whole new world is revealed under your eyes.",
"type": "good"
},
{ "u_add_trait": "stalker_eyes" },
{
"queue_eocs": "EOC_STALKER_EYES_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_stalker_eyes')+1)*1300)" ] }
}
],
"false_effect": [
{ "u_lose_trait": "stalker_eyes" },
{ "u_message": "A great new world under your eyes disappears.", "type": "neutral" }
]
},
{
"type": "effect_on_condition",
"id": "EOC_STALKER_EYES_CONTINUE",
"condition": { "and": [ { "u_has_trait": "stalker_eyes" }, { "math": [ "u_val('mana')", ">=", "200" ] } ] },
"effect": [
{ "math": [ "u_val('mana')", "-=", "200" ] },
{ "u_message": "Your sight darkens for a second, but then turn back.", "type": "good" },
{
"queue_eocs": "EOC_STALKER_EYES_CONTINUE",
"time_in_future": { "math": [ "((u_spell_level('spell_stalker_eyes')+1)*1300)" ] }
}
],
"false_effect": [
{ "u_lose_trait": "stalker_eyes" },
{ "u_message": "A great new world under your eyes disappears.", "type": "neutral" }
]
}
]
1 change: 1 addition & 0 deletions doc/NPCs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,7 @@ _function arguments are `d`oubles (or sub-expressions), `s`trings, or `v`[ariabl
| effect_intensity(`s`/`v`,...) ||| u, n | Return the characters intensity of effect.<br/> Variable is effect ID.<br/><br/> Optional kwargs:<br/>`bodypart`: `s`/`v` - Specify the bodypart to get/set intensity of effect.<br/><br/> Example:<br/>`"condition": { "math": [ "u_effect_intensity('bite', 'bodypart': 'torso')", ">", "1"] }`|
| encumbrance(`s`/`v`) ||| u, n | Return the characters total encumbrance of a body part.<br/> Variable is bodypart ID. <br/> For items, returns typical encumbrance of the item. <br/><br/> Example:<br/>`"condition": { "math": [ "u_encumbrance('torso')", ">", "0"] }`|
| field_strength(`s`/`v`) ||| u, n, global | Return the strength of a field on the tile.<br/> Variable is field ID.<br/><br/> Optional kwargs:<br/> `location`: `v` - center search on this location<br/><br/>The `location` kwarg is mandatory in the global scope.<br/><br/>Examples:<br/>`"condition": { "math": [ "u_field_strength('fd_blood')", ">", "5" ] }`<br/><br/>`"condition": { "math": [ "field_strength('fd_blood_insect', 'location': u_search_loc)", ">", "5" ] }`|
| has_trait(`s`/`v`) ||| u, n | Check whether the actor has a trait. Meant to be used as condition for ternaries. Arguemnt is trait ID.<br/><br/> Example:<br/>`"condition": { "math": [ "u_blorg", "=", "u_has_trait('FEEBLE') ? 100 : 15" ] }`|
| hp(`s`/`v`) ||| u, n | Return or set the characters hp.<br/> Variable is bodypart ID. If omitted, get sum of all bodypart or set all bodypart.<br/> For items, returns current amount of damage required to destroy item. Variable is not required.<br/><br/> Example:<br/>`"condition": { "math": [ "hp('torso')", ">", "100"] }`|
| hp_max(`s`/`v`) ||| u, n | Return the characters max amount of hp on a body part.<br/> Variable is bodypart ID.<br/> For items, returns max amount of damage required to destroy item. Variable is not required. <br/> Example:<br/>`"condition": { "math": [ "u_hp_max('torso')", ">=", "100"] }`|
| game_option(`s`/`v`) ||| N/A<br/>(global) | Return the numerical value of a game option<br/> Example:<br/>`"condition": { "math": [ "game_option('NPC_SPAWNTIME')", ">=", "5"] }`|
Expand Down
8 changes: 8 additions & 0 deletions src/math_parser_diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ std::function<double( dialogue & )> field_strength_eval( char scope,
};
}

std::function<double( dialogue & )> has_trait_eval( char scope,
std::vector<diag_value> const &params, diag_kwargs const &/* kwargs */ )
{
return [beta = is_beta( scope ), tid = params[0] ]( dialogue const & d ) {
return d.actor( beta )->has_trait( trait_id( tid.str( d ) ) );
};
}

std::function<double( dialogue & )> hp_eval( char scope,
std::vector<diag_value> const &params, diag_kwargs const &/* kwargs */ )
{
Expand Down
2 changes: 2 additions & 0 deletions src/math_parser_diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ decl_diag_eval dodge_eval;
decl_diag_eval effect_intensity_eval;
decl_diag_eval encumbrance_eval;
decl_diag_eval field_strength_eval;
decl_diag_eval has_trait_eval;
decl_diag_eval hp_eval;
decl_diag_ass hp_ass;
decl_diag_eval hp_max_eval;
Expand Down Expand Up @@ -155,6 +156,7 @@ inline std::map<std::string_view, dialogue_func_eval> const dialogue_eval_f{
{ "encumbrance", { "un", 1, encumbrance_eval } },
{ "field_strength", { "ung", 1, field_strength_eval } },
{ "game_option", { "g", 1, option_eval } },
{ "has_trait", { "un", 1, has_trait_eval } },
{ "hp", { "un", -1, hp_eval } },
{ "hp_max", { "un", 1, hp_max_eval } },
{ "item_count", { "un", 1, item_count_eval } },
Expand Down

0 comments on commit abd89ee

Please sign in to comment.