Skip to content

Commit

Permalink
Light Manipulation Spellbook, and new relic effect "BONUS_DODGE" (#35925
Browse files Browse the repository at this point in the history
)

* 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
  • Loading branch information
John-Candlebury authored and KorGgenT committed Dec 17, 2019
1 parent 327f864 commit e21d497
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 4 deletions.
19 changes: 19 additions & 0 deletions data/mods/Magiclysm/Spells/classless.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 16 additions & 0 deletions data/mods/Magiclysm/enchanted/enchanted_rings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions data/mods/Magiclysm/itemgroups/itemgroups.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 },
Expand Down
2 changes: 2 additions & 0 deletions data/mods/Magiclysm/itemgroups/spellbooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
]
},
Expand Down Expand Up @@ -137,6 +138,7 @@
[ "magus_spellbook", 15 ],
[ "magus_spellbook_move", 30 ],
[ "translocate_spellbook", 20 ],
[ "light_manipulation_spellbook", 5 ],
[ "recovery_spellbook", 30 ]
]
},
Expand Down
14 changes: 14 additions & 0 deletions data/mods/Magiclysm/items/ethereal_items.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions data/mods/Magiclysm/items/spell_scrolls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 15 additions & 0 deletions data/mods/Magiclysm/items/spellbooks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 6 additions & 2 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 )
Expand Down
3 changes: 2 additions & 1 deletion src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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 );
Expand Down
3 changes: 3 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/martialarts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down

0 comments on commit e21d497

Please sign in to comment.