From efecaa7b0fb55f1a6df8f1463029c1603500d3ae Mon Sep 17 00:00:00 2001 From: Inkfish Date: Mon, 8 Jun 2009 12:30:42 +0000 Subject: * Added a configuration for whether damage of EarthQuake with single target can be reflected. * Fixed Wizard Spirit can block reflected magical damage other than Kaite's.(bugreport:3161) * Fixed Kaite works against bosses.(follow up to r13857) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13860 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf/battle/skill.conf | 3 +++ src/map/battle.c | 1 + src/map/battle.h | 2 ++ src/map/skill.c | 64 +++++++++++++++++++++++++++----------------------- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/conf/battle/skill.conf b/conf/battle/skill.conf index 42b9a8366..709efbb8c 100644 --- a/conf/battle/skill.conf +++ b/conf/battle/skill.conf @@ -261,3 +261,6 @@ sg_angel_skill_ratio: 10 // Skills that bHealPower has effect on // 1: Heal, 2: Sanctuary, 4: Potion Pitcher, 8: Slim Pitcher, 16: Apple of Idun skill_add_heal_rate: 7 + +// Whether the damage of EarthQuake with a single target on screen is able to be reflected. +eq_single_target_reflectable: yes \ No newline at end of file diff --git a/src/map/battle.c b/src/map/battle.c index 17f12741b..d55c53bba 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3822,6 +3822,7 @@ static const struct _battle_data { { "homunculus_auto_vapor", &battle_config.homunculus_auto_vapor, 0, 0, 1, }, { "display_status_timers", &battle_config.display_status_timers, 1, 0, 1, }, { "skill_add_heal_rate", &battle_config.skill_add_heal_rate, 7, 0, INT_MAX, }, + { "eq_single_target_reflectable", &battle_config.eq_single_target_reflectable, 1, 0, 1, }, // BattleGround Settings { "bg_update_interval", &battle_config.bg_update_interval, 1000, 100, INT_MAX, }, { "bg_short_attack_damage_rate", &battle_config.bg_short_damage_rate, 80, 0, INT_MAX, }, diff --git a/src/map/battle.h b/src/map/battle.h index b09041ef4..c559c0ba5 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -465,6 +465,8 @@ extern struct Battle_Config int homunculus_auto_vapor; //Keep Homunculus from Vaporizing when master dies. [L0ne_W0lf] int display_status_timers; //Show or hide skill buff/delay timers in recent clients [Sara] int skill_add_heal_rate; //skills that bHealPower has effect on [Inkfish] + int eq_single_target_reflectable; + // [BattleGround Settings] int bg_update_interval; int bg_short_damage_rate; diff --git a/src/map/skill.c b/src/map/skill.c index 56e90fd9e..880e03fd3 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1539,6 +1539,9 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in if( sd && sd->magic_damage_return && type && rand()%100 < sd->magic_damage_return ) return 1; + if( is_boss(src) ) + return 0; + // status-based reflection if( !sc || sc->count == 0 ) return 0; @@ -1551,7 +1554,7 @@ static int skill_magic_reflect(struct block_list* src, struct block_list* bl, in clif_specialeffect(bl, 438, AREA); if( --sc->data[SC_KAITE]->val2 <= 0 ) status_change_end(bl, SC_KAITE, -1); - return 1; + return 2; } return 0; @@ -1630,40 +1633,41 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } } - if( dmg.flag&BF_MAGIC && ( skillid != NPC_EARTHQUAKE || (flag&0xFFF) == 1 ) ) + if( dmg.flag&BF_MAGIC && ( skillid != NPC_EARTHQUAKE || (battle_config.eq_single_target_reflectable && (flag&0xFFF) == 1) ) ) { // Earthquake on multiple targets is not counted as a target skill. [Inkfish] - if( (dmg.damage || dmg.damage2) && skill_magic_reflect(src, bl, src==dsrc) ) + if( (dmg.damage || dmg.damage2) && (type = skill_magic_reflect(src, bl, src==dsrc)) ) { //Magic reflection, switch caster/target struct block_list *tbl = bl; bl = src; src = tbl; - sd = BL_CAST(BL_PC, src); - tsd = BL_CAST(BL_PC, bl); - sc = status_get_sc(bl); - if (sc && !sc->count) - sc = NULL; //Don't need it. - //Spirit of Wizard blocks bounced back spells. - if (sc && sc->data[SC_SPIRIT] && - sc->data[SC_SPIRIT]->val2 == SL_WIZARD) - { - //It should only consume once per skill casted. Val3 is the skill - //id and val4 is the ID of the damage src, this should account for - //ground spells (and single target spells will be completed on - //castend_id) [Skotlex] - if (tsd && !( - sc->data[SC_SPIRIT]->val3 == skillid && - sc->data[SC_SPIRIT]->val4 == dsrc->id) - ) { //Check if you have stone to consume. - type = pc_search_inventory (tsd, 7321); - if (type >= 0) - pc_delitem(tsd, type, 1, 0); - } else - type = 0; - if (type >= 0) { - dmg.damage = dmg.damage2 = 0; - dmg.dmg_lv = ATK_MISS; - sc->data[SC_SPIRIT]->val3 = skillid; - sc->data[SC_SPIRIT]->val4 = dsrc->id; + + if( type == 2 ) + { // Kaite + sd = BL_CAST(BL_PC, src); + tsd = BL_CAST(BL_PC, bl); + + sc = status_get_sc(bl); + if (sc && !sc->count) + sc = NULL; //Don't need it. + + //Spirit of Wizard blocks Kaite's reflection + if( sc && sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_WIZARD ) + { //It should only consume once per skill casted. Val3 is the skill id and val4 is the ID of the damage src. + //This should account for ground spells (and single target spells will be completed on castend_id) [Skotlex] + if (tsd && !(sc->data[SC_SPIRIT]->val3 == skillid && sc->data[SC_SPIRIT]->val4 == dsrc->id) ) + { //Check if you have stone to consume. + type = pc_search_inventory (tsd, 7321); + if (type >= 0) + pc_delitem(tsd, type, 1, 0); + } else + type = 0; + + if (type >= 0) { + dmg.damage = dmg.damage2 = 0; + dmg.dmg_lv = ATK_MISS; + sc->data[SC_SPIRIT]->val3 = skillid; + sc->data[SC_SPIRIT]->val4 = dsrc->id; + } } } } -- cgit v1.2.3-60-g2f50