diff options
author | shennetsind <ind@henn.et> | 2013-04-17 03:18:21 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-04-17 03:18:21 -0300 |
commit | 904caf6f8c77f50f7d89725cec7b8bc200406ae5 (patch) | |
tree | 27e5abbb9f1fde91a4b8304ecdcf9ddc1ff93d19 /src/map/skill.c | |
parent | 2e909cf1f7ad5ab6f5c05cffba4744b132f280cd (diff) | |
download | hercules-904caf6f8c77f50f7d89725cec7b8bc200406ae5.tar.gz hercules-904caf6f8c77f50f7d89725cec7b8bc200406ae5.tar.bz2 hercules-904caf6f8c77f50f7d89725cec7b8bc200406ae5.tar.xz hercules-904caf6f8c77f50f7d89725cec7b8bc200406ae5.zip |
Fixed Bug #7060
Magical Reflection behavior is finally 100% official (or so we hope)
http://hercules.ws/board/tracker/issue-7060-bmagicdamagereturn/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index f4bee2934..c183fc0cb 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2234,9 +2234,28 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds **/ #if MAGIC_REFLECTION_TYPE if( dmg.dmg_lv != ATK_MISS ){ //Wiz SL cancelled and consumed fragment - battle->isMagicReflect = true; - dmg = battle->calc_attack(BF_MAGIC,bl,bl,skill_id,skill_lv,flag&0xFFF); - battle->isMagicReflect = false; + short s_ele = skill->get_ele(skill_id, skill_lv); + + if (s_ele == -1) // the skill takes the weapon's element + s_ele = sstatus->rhw.ele; + else if (s_ele == -2) //Use status element + s_ele = status_get_attack_sc_element(src,status_get_sc(src)); + else if( s_ele == -3 ) //Use random element + s_ele = rnd()%ELE_MAX; + + dmg.damage = battle->attr_fix(bl, bl, dmg.damage, s_ele, status_get_element(bl), status_get_element_level(bl)); + + if( sc && sc->data[SC_ENERGYCOAT] ) { + struct status_data *status = status_get_status_data(bl); + int per = 100*status->sp / status->max_sp -1; //100% should be counted as the 80~99% interval + per /=20; //Uses 20% SP intervals. + //SP Cost: 1% + 0.5% per every 20% SP + if (!status_charge(bl, 0, (10+5*per)*status->max_sp/1000)) + status_change_end(bl, SC_ENERGYCOAT, INVALID_TIMER); + //Reduction: 6% + 6% every 20% + dmg.damage -= dmg.damage * (6 * (1+per)) / 100; + } + } #endif } |