diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battle.c | 11 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/skill.c | 25 |
3 files changed, 26 insertions, 12 deletions
diff --git a/src/map/battle.c b/src/map/battle.c index b8ca0d92b..29b861c18 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -433,8 +433,6 @@ 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)) @@ -993,7 +991,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag //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] && !battle->isMagicReflect ) { + if( sc->data[SC_ASSUMPTIO] ) { if( map_flag_vs(bl->m) ) damage = damage*2/3; //Receive 66% damage else @@ -1038,9 +1036,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] && (battle->isMagicReflect || ((flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION))) + if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON || flag&BF_MAGIC) && skill_id != WS_CARTTERMINATION) #else - if(sc->data[SC_ENERGYCOAT] && (battle->isMagicReflect || (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION))) + if(sc->data[SC_ENERGYCOAT] && (flag&BF_WEAPON && skill_id != WS_CARTTERMINATION)) #endif { struct status_data *status = status_get_status_data(bl); @@ -4085,8 +4083,7 @@ 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 ) || - battle->isMagicReflect + sd->bonus.ignore_mdef_race & ( is_boss(target) ? 1 << RC_BOSS : 1 << RC_NONBOSS ) )) flag.imdef = 1; } diff --git a/src/map/battle.h b/src/map/battle.h index bea224b1c..8b1f757f5 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -462,8 +462,6 @@ 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 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 } |