From e21d4978f2c1117ff6c0ec0434d761efa8fea538 Mon Sep 17 00:00:00 2001 From: John Candlebury Date: Tue, 17 Dec 2019 11:40:17 -0600 Subject: [PATCH] Light Manipulation Spellbook, and new relic effect "BONUS_DODGE" (#35925) * Magiclysm- Light Manipulation Spellbook * Add spell scroll * Implement BONUS_DODGE * Modify dodging bonus * Lint Json * Rework Bonus Dodge to add dodge attempts Also adds two new rings with this effect * minor adjustment --- data/mods/Magiclysm/Spells/classless.json | 19 +++++++++++++++++++ .../Magiclysm/enchanted/enchanted_rings.json | 16 ++++++++++++++++ .../mods/Magiclysm/itemgroups/itemgroups.json | 2 ++ .../mods/Magiclysm/itemgroups/spellbooks.json | 2 ++ data/mods/Magiclysm/items/ethereal_items.json | 14 ++++++++++++++ data/mods/Magiclysm/items/spell_scrolls.json | 8 ++++++++ data/mods/Magiclysm/items/spellbooks.json | 15 +++++++++++++++ src/creature.cpp | 8 ++++++-- src/creature.h | 3 ++- src/magic_enchantment.cpp | 3 +++ src/martialarts.cpp | 2 +- 11 files changed, 88 insertions(+), 4 deletions(-) diff --git a/data/mods/Magiclysm/Spells/classless.json b/data/mods/Magiclysm/Spells/classless.json index d900ec1a74a4e..2c44d083014d2 100644 --- a/data/mods/Magiclysm/Spells/classless.json +++ b/data/mods/Magiclysm/Spells/classless.json @@ -126,6 +126,25 @@ "difficulty": 3, "damage_type": "bash" }, + { + "id": "obfuscated_body", + "type": "SPELL", + "name": "Obfuscated Body", + "description": "A magical aura distorts light around your body, increasing the amount of attacks you might dodge in a given turn.", + "valid_targets": [ "self" ], + "effect": "spawn_item", + "effect_str": "obfuscating_aura", + "energy_source": "MANA", + "spell_class": "NONE", + "flags": [ "CONCENTRATE", "NO_LEGS" ], + "difficulty": 4, + "max_level": 15, + "base_casting_time": 200, + "base_energy_cost": 400, + "min_duration": 21000, + "max_duration": 90000, + "duration_increment": 4500 + }, { "id": "protection_aura", "type": "SPELL", diff --git a/data/mods/Magiclysm/enchanted/enchanted_rings.json b/data/mods/Magiclysm/enchanted/enchanted_rings.json index 016d95249481c..b35b5f5db9066 100644 --- a/data/mods/Magiclysm/enchanted/enchanted_rings.json +++ b/data/mods/Magiclysm/enchanted/enchanted_rings.json @@ -76,6 +76,22 @@ "charges_per_use": 1, "artifact_data": { "charge_type": "ARTC_TIME" } }, + { + "copy-from": "mring_silver", + "type": "TOOL_ARMOR", + "id": "mring_dodge_bonus_1", + "name": "eel ring", + "description": "A thin silver band ring, depicting an eel coiled on itself. Allows you to dodge an extra attack per turn.", + "relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "BONUS_DODGE", "add": 1 } ] } ] } + }, + { + "copy-from": "mring_gold", + "type": "TOOL_ARMOR", + "id": "mring_dodge_bonus_2", + "name": "bicephalous eel ring", + "description": "A thin gold band ring, depicting a bicephalous eel coiled on itself. Allows you to dodge two extra attacks per turn.", + "relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "BONUS_DODGE", "add": 2 } ] } ] } + }, { "copy-from": "mring_copper", "type": "TOOL_ARMOR", diff --git a/data/mods/Magiclysm/itemgroups/itemgroups.json b/data/mods/Magiclysm/itemgroups/itemgroups.json index 69f8f718e9b8a..bce0390918afd 100644 --- a/data/mods/Magiclysm/itemgroups/itemgroups.json +++ b/data/mods/Magiclysm/itemgroups/itemgroups.json @@ -310,6 +310,7 @@ { "item": "mring_strength_2", "prob": 10 }, { "item": "mring_dexterity_2", "prob": 10 }, { "item": "mring_intelligence_2", "prob": 10 }, + { "item": "mring_dodge_bonus_1", "prob": 10 }, { "item": "mring_perception_2", "prob": 10 }, { "item": "mring_speed_5", "prob": 10 }, { "item": "mring_protection_4", "prob": 10 } @@ -323,6 +324,7 @@ "items": [ { "item": "mring_strength_3", "prob": 10 }, { "item": "mring_dexterity_3", "prob": 10 }, + { "item": "mring_dodge_bonus_2", "prob": 10 }, { "item": "mring_intelligence_3", "prob": 10 }, { "item": "mring_perception_3", "prob": 10 }, { "item": "mring_speed_7", "prob": 10 }, diff --git a/data/mods/Magiclysm/itemgroups/spellbooks.json b/data/mods/Magiclysm/itemgroups/spellbooks.json index 481f973a214ff..a31b1c587008c 100644 --- a/data/mods/Magiclysm/itemgroups/spellbooks.json +++ b/data/mods/Magiclysm/itemgroups/spellbooks.json @@ -101,6 +101,7 @@ [ "spell_scroll_magus_mana_blast", 50 ], [ "lightning_storm_scroll", 50 ], [ "spell_scroll_invisibility", 10 ], + [ "spell_scroll_obfuscated_body", 10 ], [ "spell_scroll_lava_bomb", 5 ] ] }, @@ -137,6 +138,7 @@ [ "magus_spellbook", 15 ], [ "magus_spellbook_move", 30 ], [ "translocate_spellbook", 20 ], + [ "light_manipulation_spellbook", 5 ], [ "recovery_spellbook", 30 ] ] }, diff --git a/data/mods/Magiclysm/items/ethereal_items.json b/data/mods/Magiclysm/items/ethereal_items.json index 452f0fabbc9e2..0ca0f899feeae 100644 --- a/data/mods/Magiclysm/items/ethereal_items.json +++ b/data/mods/Magiclysm/items/ethereal_items.json @@ -344,6 +344,20 @@ "max_charges": 15, "use_action": "WATER_PURIFIER" }, + { + "id": "obfuscating_aura", + "type": "ARMOR", + "name": "obfuscating aura", + "description": "An all-encompassing, invisible layer of magic distorts light around your body. Allows you to dodge two extra attacks in a given turn.", + "weight": "1g", + "volume": "1ml", + "price": 3646, + "symbol": "o", + "color": "white", + "covers": [ "LEGS", "TORSO", "ARMS", "HANDS", "HEAD", "FEET", "MOUTH", "EYES" ], + "flags": [ "AURA", "SEMITANGIBLE", "OVERSIZE", "ONLY_ONE", "TRADER_AVOID", "NO_TAKEOFF", "NONCONDUCTIVE" ], + "relic_data": { "passive_effects": [ { "has": "WORN", "condition": "ALWAYS", "values": [ { "value": "BONUS_DODGE", "add": 2 } ] } ] } + }, { "id": "acid_res_aura", "type": "ARMOR", diff --git a/data/mods/Magiclysm/items/spell_scrolls.json b/data/mods/Magiclysm/items/spell_scrolls.json index ed0a638fcd4a3..2378810c02625 100644 --- a/data/mods/Magiclysm/items/spell_scrolls.json +++ b/data/mods/Magiclysm/items/spell_scrolls.json @@ -26,6 +26,14 @@ "description": "The light can not interact with you unless you want it to. Become invisible!", "use_action": { "type": "learn_spell", "spells": [ "invisibility" ] } }, + { + "type": "GENERIC", + "copy-from": "spell_scroll", + "id": "spell_scroll_obfuscated_body", + "name": "Scroll of Obfuscated Body", + "description": "A magical aura distorts light around your body, making it easier to dodge enemy attacks.", + "use_action": { "type": "learn_spell", "spells": [ "obfuscated_body" ] } + }, { "type": "GENERIC", "copy-from": "spell_scroll", diff --git a/data/mods/Magiclysm/items/spellbooks.json b/data/mods/Magiclysm/items/spellbooks.json index 19b470d8d0a9c..ca15d05b4cfcb 100644 --- a/data/mods/Magiclysm/items/spellbooks.json +++ b/data/mods/Magiclysm/items/spellbooks.json @@ -148,6 +148,21 @@ "color": "magenta", "use_action": { "type": "learn_spell", "spells": [ "seismic_stomp", "create_atomic_lamp", "ethereal_grasp" ] } }, + { + "id": "light_manipulation_spellbook", + "type": "GENERIC", + "name": "Of Light and Falsehoods", + "description": "A small white book, it subtly amplifies the ambient light around it.", + "weight": "430 g", + "volume": "750 ml", + "price": 5000, + "symbol": "?", + "color": "light_gray", + "use_action": { + "type": "learn_spell", + "spells": [ "dark_sight", "blinding_flash", "obfuscated_body", "create_atomic_light", "mirror_image", "invisibility" ] + } + }, { "id": "biomancer_spellbook", "type": "GENERIC", diff --git a/src/creature.cpp b/src/creature.cpp index 27e5b43504156..c3f49a6c13aad 100644 --- a/src/creature.cpp +++ b/src/creature.cpp @@ -1338,6 +1338,10 @@ int Creature::get_num_dodges_bonus() const { return num_dodges_bonus; } +int Creature::get_num_dodges_base() const +{ + return num_dodges; +} // currently this is expected to be overridden to actually have use int Creature::get_env_resist( body_part ) const @@ -1461,9 +1465,9 @@ void Creature::set_num_blocks_bonus( int nblocks ) { num_blocks_bonus = nblocks; } -void Creature::set_num_dodges_bonus( int ndodges ) +void Creature::mod_num_dodges_bonus( int ndodges ) { - num_dodges_bonus = ndodges; + num_dodges_bonus += ndodges; } void Creature::set_armor_bash_bonus( int nbasharm ) diff --git a/src/creature.h b/src/creature.h index 4179d9b8be2f2..3e09417665f10 100644 --- a/src/creature.h +++ b/src/creature.h @@ -402,6 +402,7 @@ class Creature virtual int get_num_dodges() const; virtual int get_num_blocks_bonus() const; virtual int get_num_dodges_bonus() const; + virtual int get_num_dodges_base() const; virtual int get_env_resist( body_part bp ) const; @@ -474,7 +475,7 @@ class Creature virtual void mod_stat( const std::string &stat, float modifier ); virtual void set_num_blocks_bonus( int nblocks ); - virtual void set_num_dodges_bonus( int ndodges ); + virtual void mod_num_dodges_bonus( int ndodges ); virtual void set_armor_bash_bonus( int nbasharm ); virtual void set_armor_cut_bonus( int ncutarm ); diff --git a/src/magic_enchantment.cpp b/src/magic_enchantment.cpp index 107dcb6489422..e654109134787 100644 --- a/src/magic_enchantment.cpp +++ b/src/magic_enchantment.cpp @@ -370,6 +370,9 @@ void enchantment::activate_passive( Character &guy ) const guy.mod_speed_bonus( get_value_add( mod::SPEED ) ); guy.mod_speed_bonus( mult_bonus( mod::SPEED, guy.get_speed_base() ) ); + + guy.mod_num_dodges_bonus( get_value_add( mod::BONUS_DODGE ) ); + guy.mod_num_dodges_bonus( mult_bonus( mod::BONUS_DODGE, guy.get_num_dodges_base() ) ); } void enchantment::cast_hit_you( Character &caster, const tripoint &target ) const diff --git a/src/martialarts.cpp b/src/martialarts.cpp index 3f44e216075b9..7dfc9e283c702 100644 --- a/src/martialarts.cpp +++ b/src/martialarts.cpp @@ -626,7 +626,7 @@ bool ma_buff::is_valid_character( const Character &u ) const void ma_buff::apply_character( Character &u ) const { - u.set_num_dodges_bonus( u.get_num_dodges_bonus() + dodges_bonus ); + u.mod_num_dodges_bonus( dodges_bonus ); u.set_num_blocks_bonus( u.get_num_blocks_bonus() + blocks_bonus ); }