summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 34e651af8..afefe3d7e 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -647,6 +647,26 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
if( sc->data[SC__DEADLYINFECT] && damage > 0 && rand()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 )
status_change_spread(bl, src); // Deadly infect attacked side
+ if( sc && sc->data[SC__SHADOWFORM] ) {
+ struct block_list *s_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2);
+ if( !s_bl ) { // If the shadow form target is not present remove the sc.
+ status_change_end(bl, SC__SHADOWFORM, -1);
+ } else if( status_isdead(s_bl) || !battle_check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both.
+ status_change_end(bl, SC__SHADOWFORM, -1);
+ if( s_bl->type == BL_PC )
+ ((TBL_PC*)s_bl)->shadowform_id = 0;
+ } else {
+ if( (--sc->data[SC__SHADOWFORM]->val3) < 0 ) { // If you have exceded max hits supported, remove the sc in both.
+ status_change_end(bl, SC__SHADOWFORM, -1);
+ if( s_bl->type == BL_PC )
+ ((TBL_PC*)s_bl)->shadowform_id = 0;
+ } else {
+ status_damage(src, s_bl, damage, 0, clif_damage(s_bl, s_bl, gettick(), 500, 500, damage, -1, 0, 0), 0);
+ return ATK_NONE;
+ }
+ }
+ }
+
}
//SC effects from caster side.
@@ -736,25 +756,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
pc_overheat(sd,element == ELE_FIRE ? 1 : -1);
}
}
- if( sc && sc->data[SC__SHADOWFORM] ) {
- struct block_list *s_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2);
- if( !s_bl ) { // If the shadow form target is not present remove the sc.
- status_change_end(bl, SC__SHADOWFORM, -1);
- } else if( status_isdead(s_bl) || !battle_check_target(src,s_bl,BCT_ENEMY)) { // If the shadow form target is dead or not your enemy remove the sc in both.
- status_change_end(bl, SC__SHADOWFORM, -1);
- if( s_bl->type == BL_PC )
- ((TBL_PC*)s_bl)->shadowform_id = 0;
- } else {
- if( (--sc->data[SC__SHADOWFORM]->val3) < 0 ) { // If you have exceded max hits supported, remove the sc in both.
- status_change_end(bl, SC__SHADOWFORM, -1);
- if( s_bl->type == BL_PC )
- ((TBL_PC*)s_bl)->shadowform_id = 0;
- } else {
- status_damage(src, s_bl, damage, 0, clif_damage(s_bl, s_bl, gettick(), 500, 500, damage, -1, 0, 0), 0);
- return ATK_NONE;
- }
- }
- }
+
return damage;
}