summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/unit.c13
3 files changed, 14 insertions, 9 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index d06e02f6c..c8af6badc 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1143,7 +1143,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag
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.
+ if( !s_bl || s_bl->m != bl->m ) { // If the shadow form target is not present remove the sc.
status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER);
} 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, INVALID_TIMER);
@@ -1833,7 +1833,7 @@ struct Damage battle_calc_weapon_attack(struct block_list *src,struct block_list
wd.div_ = skill->get_num(GS_CHAINACTION,skill_lv);
wd.type = 0x08;
}
- else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW
+ else if(sc && sc->data[SC_FEARBREEZE] && sd->weapontype1==W_BOW
&& (i = sd->equip_index[EQI_AMMO]) >= 0 && sd->inventory_data[i] && sd->status.inventory[i].amount > 1){
int chance = rand()%100;
wd.type = 0x08;
@@ -6166,4 +6166,4 @@ void battle_defaults(void) {
battle->config_adjust = battle_adjust_conf;
battle->get_enemy_area = battle_getenemyarea;
battle->damage_area = battle_damage_area;
-} \ No newline at end of file
+}
diff --git a/src/map/map.c b/src/map/map.c
index 779070f0e..dbff42fa3 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -413,7 +413,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( bl->type == BL_PC && ((TBL_PC*)bl)->shadowform_id ) {//Shadow Form Target Moving
struct block_list *d_bl;
- if( (d_bl = map_id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || bl->m != d_bl->m || !check_distance_bl(bl,d_bl,10) ) {
+ if( (d_bl = map_id2bl(((TBL_PC*)bl)->shadowform_id)) == NULL || !check_distance_bl(bl,d_bl,10) ) {
if( d_bl )
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
((TBL_PC*)bl)->shadowform_id = 0;
@@ -438,7 +438,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick)
if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving
struct block_list *d_bl;
- if( (d_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || bl->m != d_bl->m || !check_distance_bl(bl,d_bl,10) )
+ if( (d_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || !check_distance_bl(bl,d_bl,10) )
status_change_end(bl,SC__SHADOWFORM,INVALID_TIMER);
}
diff --git a/src/map/unit.c b/src/map/unit.c
index 4732b89dd..798a6ef6f 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -406,7 +406,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
ud = unit_bl2ud(bl);
if( ud == NULL) return 0;
-
+
if (!(status_get_mode(bl)&MD_CANMOVE))
return 0;
@@ -416,13 +416,13 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
ud->target_to = 0;
return 0;
}
-
+
ud->state.walk_easy = flag&1;
ud->target_to = tbl->id;
ud->chaserange = range; //Note that if flag&2, this SHOULD be attack-range
ud->state.attack_continue = flag&2?1:0; //Chase to attack.
unit_set_target(ud, 0);
-
+
sc = status_get_sc(bl);
if (sc && sc->data[SC_CONFUSION]) //Randomize the target position
map_random_dir(bl, &ud->to_x, &ud->to_y);
@@ -432,7 +432,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
set_mobstate(bl, flag&2);
return 1;
}
-
+
if(DIFF_TICK(ud->canmove_tick, gettick()) > 0)
{ //Can't move, wait a bit before invoking the movement.
add_timer(ud->canmove_tick+1, unit_walktobl_sub, bl->id, ud->target);
@@ -2089,6 +2089,11 @@ int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file,
case BL_PC: {
struct map_session_data *sd = (struct map_session_data*)bl;
+ if(sd->shadowform_id){
+ struct block_list *d_bl = map_id2bl(sd->shadowform_id);
+ if( d_bl )
+ status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
+ }
//Leave/reject all invitations.
if(sd->chatID)
chat_leavechat(sd,0);