summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-04-16 00:20:56 -0300
committershennetsind <ind@henn.et>2013-04-16 00:20:56 -0300
commitf3e20da4be387c0e49da58a8be676c9878818ebb (patch)
tree6fcb047ca4d0e5cc39638d205e5260561a17d5b7 /src
parent1e21ff7d621ca19f341318c67756d7b39baa7d7b (diff)
downloadhercules-f3e20da4be387c0e49da58a8be676c9878818ebb.tar.gz
hercules-f3e20da4be387c0e49da58a8be676c9878818ebb.tar.bz2
hercules-f3e20da4be387c0e49da58a8be676c9878818ebb.tar.xz
hercules-f3e20da4be387c0e49da58a8be676c9878818ebb.zip
Fixed Bug #7060
When using official magical reflection, the damage is no longer reduceable by mdef items or cards (elemental armors work), assumption doesnt reduce either when used in pre-re mode and energy coat is capable of reducing the damage. http://hercules.ws/board/tracker/issue-7060-bmagicdamagereturn/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c12
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/skill.c5
3 files changed, 13 insertions, 6 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index b6180328a..ac386f890 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -433,6 +433,8 @@ int battle_calc_cardfix(int attack_type, struct block_list *src, struct block_li
switch(attack_type){
case BF_MAGIC:
+ if( battle->isMagicReflect )
+ nk |= NK_NO_CARDFIX_ATK;
if ( sd && !(nk&NK_NO_CARDFIX_ATK) ) {
cardfix=cardfix*(100+sd->magic_addrace[tstatus->race])/100;
if (!(nk&NK_NO_ELEFIX))
@@ -988,11 +990,10 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
status_change_end(bl,SC_VOICEOFSIREN,INVALID_TIMER);
}
-
//Finally damage reductions....
// Assumptio doubles the def & mdef on RE mode, otherwise gives a reduction on the final damage. [Igniz]
#ifndef RENEWAL
- if( sc->data[SC_ASSUMPTIO] ) {
+ if( sc->data[SC_ASSUMPTIO] && !battle->isMagicReflect ) {
if( map_flag_vs(bl->m) )
damage = damage*2/3; //Receive 66% damage
else
@@ -1037,9 +1038,9 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
damage -= damage * sc->data[SC_ARMOR]->val2 / 100;
#ifdef RENEWAL
- if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION)
+ if(sc->data[SC_ENERGYCOAT] && (battle->isMagicReflect || ((flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION)))
#else
- if(sc->data[SC_ENERGYCOAT] && flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)
+ if(sc->data[SC_ENERGYCOAT] && (battle->isMagicReflect || (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)))
#endif
{
struct status_data *status = status_get_status_data(bl);
@@ -4078,7 +4079,8 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list
if (!flag.imdef && (
sd->bonus.ignore_mdef_ele & ( 1 << tstatus->def_ele ) ||
sd->bonus.ignore_mdef_race & ( 1 << tstatus->race ) ||
- sd->bonus.ignore_mdef_race & ( is_boss(target) ? 1 << RC_BOSS : 1 << RC_NONBOSS )
+ sd->bonus.ignore_mdef_race & ( is_boss(target) ? 1 << RC_BOSS : 1 << RC_NONBOSS ) ||
+ battle->isMagicReflect
))
flag.imdef = 1;
}
diff --git a/src/map/battle.h b/src/map/battle.h
index 8b1f757f5..bea224b1c 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -462,6 +462,8 @@ extern int attr_fix_table[4][10][10];
* Battle.c Interface
**/
struct battle_interface {
+ /* vars */
+ bool isMagicReflect;/* maybe better as a flag atlho the system isnt threaded so there isn't any bug by using it like this */
/* init */
void (*init) (void);
/* final */
diff --git a/src/map/skill.c b/src/map/skill.c
index 14bb7a4cb..f4bee2934 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -2233,8 +2233,11 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
* Official Magic Reflection Behavior : damage reflected depends on gears caster wears, not target
**/
#if MAGIC_REFLECTION_TYPE
- if( dmg.dmg_lv != ATK_MISS )//Wiz SL cancelled and consumed fragment
+ 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;
+ }
#endif
}
if(sc && sc->data[SC_MAGICROD] && src == dsrc) {