summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c21
-rw-r--r--src/map/mob.c2
-rw-r--r--src/map/pc.c7
-rw-r--r--src/map/skill.c201
-rw-r--r--src/map/status.c12
5 files changed, 101 insertions, 142 deletions
diff --git a/src/map/map.c b/src/map/map.c
index e1d97b0de..df3302313 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -501,7 +501,6 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) {
//TODO: Perhaps some outs of bounds checking should be placed here?
if (bl->type&BL_CHAR)
skill_unit_move(bl,tick,2);
-
if (moveblock) map_delblock_sub(bl,0);
#ifdef CELL_NOSTACK
else map_delblcell(bl);
@@ -512,8 +511,26 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) {
#ifdef CELL_NOSTACK
else map_addblcell(bl);
#endif
- if (bl->type&BL_CHAR)
+ if (bl->type&BL_CHAR) {
+ struct status_change *sc = status_get_sc(bl);
skill_unit_move(bl,tick,3);
+ if (sc) {
+ if (sc->option&OPTION_CLOAK)
+ skill_check_cloaking(bl);
+ if (sc->count) {
+ if (sc->data[SC_DANCING].timer != -1) {
+ if (sc->data[SC_DANCING].val1 == CG_MOONLIT) //Cancel Moonlight Petals if moved from casting position. [Skotlex]
+ skill_stop_dancing(bl);
+ else
+ skill_unit_move_unit_group((struct skill_unit_group *)sc->data[SC_DANCING].val2, bl->m, x1-x0, y1-y0);
+ }
+ if (sc->data[SC_CLOSECONFINE].timer != -1)
+ status_change_end(bl, SC_CLOSECONFINE, -1);
+ if (sc->data[SC_CLOSECONFINE2].timer != -1)
+ status_change_end(bl, SC_CLOSECONFINE2, -1);
+ }
+ }
+ }
return 0;
}
diff --git a/src/map/mob.c b/src/map/mob.c
index 590cbf323..5e0d807c7 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -570,8 +570,6 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data)
map_foreachinmovearea(clif_mobinsight,md->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,-dx,-dy,BL_PC,md);
md->state.state=MS_IDLE;
- if(md->sc.option&OPTION_CLOAK)
- skill_check_cloaking(&md->bl);
}
if((i=calc_next_walk_step(md))>0){
i = i>>1;
diff --git a/src/map/pc.c b/src/map/pc.c
index 675895449..59e1bd733 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3634,13 +3634,6 @@ static int pc_walk(int tid,unsigned int tick,int id,int data)
-dx, -dy, BL_ALL, sd);
sd->walktimer = -1; // set back so not to disturb future pc_stop_walking calls
- if (pc_iscloaking(sd)) // クロ?キングの消滅?査
- skill_check_cloaking(&sd->bl);
- /* 被ディボ?ション?査 */
- if (sd->sc.count) {
- if (sd->sc.data[SC_DANCING].timer != -1)
- skill_unit_move_unit_group((struct skill_unit_group *)sd->sc.data[SC_DANCING].val2, sd->bl.m, dx, dy);
- }
if (map_getcell(sd->bl.m,x,y,CELL_CHKNPC))
npc_touch_areanpc(sd,sd->bl.m,x,y);
else
diff --git a/src/map/skill.c b/src/map/skill.c
index 3177fa238..4b77391a2 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1427,7 +1427,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
struct mob_data *md=NULL;
struct pet_data *pd=NULL;
struct skill_unit *su=NULL;
- struct status_change* sc=NULL;
nullpo_retr(0, src);
nullpo_retr(0, target);
@@ -1451,8 +1450,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
default:
return 0;
}
- if (target->type != BL_SKILL)
- sc = status_get_sc(target);
if (count&0xf00000)
dir = (count>>20)&0xf;
@@ -1480,19 +1477,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
map_foreachinmovearea(clif_moboutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,md);
else if(pd)
map_foreachinmovearea(clif_petoutsight,target->m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,dx,dy,BL_PC,pd);
-
- if (sc && sc->count) {
- if (sc->data[SC_DANCING].timer != -1) { //Move the song/dance [Skotlex]
- if (sc->data[SC_DANCING].val1 == CG_MOONLIT) //Cancel Moonlight Petals if moved from casting position. [Skotlex]
- skill_stop_dancing(target);
- else
- skill_unit_move_unit_group((struct skill_unit_group *)sc->data[SC_DANCING].val2, target->m, dx, dy);
- }
- if (sc->data[SC_CLOSECONFINE].timer != -1)
- status_change_end(target, SC_CLOSECONFINE, -1);
- if (sc->data[SC_CLOSECONFINE2].timer != -1)
- status_change_end(target, SC_CLOSECONFINE2, -1);
- }
if(su){
skill_unit_move_unit_group(su->group,target->m,dx,dy);
@@ -2321,75 +2305,42 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
*/
int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,int skill_id,int skill_lv,int type,int flag)
{
- int i;
-
+ int i, max;
+ unsigned short *count=NULL;;
+ struct skill_timerskill *sts = NULL;
nullpo_retr(1, src);
-
- if(src->type == BL_PC) {
- struct map_session_data *sd = (struct map_session_data *)src;
- nullpo_retr(1, sd);
- for(i=0;i<MAX_SKILLTIMERSKILL;i++) {
- if(sd->skilltimerskill[i].timer == -1) {
- sd->skilltimerskill[i].timer = add_timer(tick, skill_timerskill, src->id, i);
- sd->skilltimerskill[i].src_id = src->id;
- sd->skilltimerskill[i].target_id = target;
- sd->skilltimerskill[i].skill_id = skill_id;
- sd->skilltimerskill[i].skill_lv = skill_lv;
- sd->skilltimerskill[i].map = src->m;
- sd->skilltimerskill[i].x = x;
- sd->skilltimerskill[i].y = y;
- sd->skilltimerskill[i].type = type;
- sd->skilltimerskill[i].flag = flag;
- sd->timerskill_count++;
-
- return 0;
- }
- }
- return 1;
- }
- else if(src->type == BL_MOB) {
- struct mob_data *md = (struct mob_data *)src;
- nullpo_retr(1, md);
- for(i=0;i<MAX_MOBSKILLTIMERSKILL;i++) {
- if(md->skilltimerskill[i].timer == -1) {
- md->skilltimerskill[i].timer = add_timer(tick, skill_timerskill, src->id, i);
- md->skilltimerskill[i].src_id = src->id;
- md->skilltimerskill[i].target_id = target;
- md->skilltimerskill[i].skill_id = skill_id;
- md->skilltimerskill[i].skill_lv = skill_lv;
- md->skilltimerskill[i].map = src->m;
- md->skilltimerskill[i].x = x;
- md->skilltimerskill[i].y = y;
- md->skilltimerskill[i].type = type;
- md->skilltimerskill[i].flag = flag;
-
- return 0;
- }
- }
- return 1;
- }
- else if(src->type == BL_PET) { // [Valaris]
- struct pet_data *pd = (struct pet_data *)src;
- nullpo_retr(1, pd);
- for(i=0;i<MAX_MOBSKILLTIMERSKILL;i++) {
- if(pd->skilltimerskill[i].timer == -1) {
- pd->skilltimerskill[i].timer = add_timer(tick, skill_timerskill, src->id, i);
- pd->skilltimerskill[i].src_id = src->id;
- pd->skilltimerskill[i].target_id = target;
- pd->skilltimerskill[i].skill_id = skill_id;
- pd->skilltimerskill[i].skill_lv = skill_lv;
- pd->skilltimerskill[i].map = src->m;
- pd->skilltimerskill[i].x = x;
- pd->skilltimerskill[i].y = y;
- pd->skilltimerskill[i].type = type;
- pd->skilltimerskill[i].flag = flag;
-
- return 0;
- }
- }
- return 1;
+ switch (src->type) {
+ case BL_PC:
+ sts = ((struct map_session_data *)src)->skilltimerskill;
+ max = MAX_SKILLTIMERSKILL;
+ count = &((struct map_session_data *)src)->timerskill_count;
+ break;
+ case BL_MOB:
+ sts = ((struct mob_data *)src)->skilltimerskill;
+ max = MAX_MOBSKILLTIMERSKILL;
+ break;
+ case BL_PET:
+ sts = ((struct pet_data *)src)->skilltimerskill;
+ max = MAX_MOBSKILLTIMERSKILL;
+ break;
+ default:
+ return 1;
}
- return 1;
+ for(i=0;i<max && sts[i].timer != -1;i++);
+ if (i>=max) return 1;
+
+ sts[i].timer = add_timer(tick, skill_timerskill, src->id, i);
+ sts[i].src_id = src->id;
+ sts[i].target_id = target;
+ sts[i].skill_id = skill_id;
+ sts[i].skill_lv = skill_lv;
+ sts[i].map = src->m;
+ sts[i].x = x;
+ sts[i].y = y;
+ sts[i].flag = flag;
+ if (count)
+ (*count)++;
+ return 0;
}
/*==========================================
@@ -2398,42 +2349,42 @@ int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int
*/
int skill_cleartimerskill(struct block_list *src)
{
- int i;
+ int i, max;
+ unsigned short *count=NULL;
+ struct skill_timerskill *sts = NULL;
nullpo_retr(0, src);
-
- if(src->type == BL_PC) {
- struct map_session_data *sd = (struct map_session_data *)src;
- nullpo_retr(0, sd);
-
- if (sd->timerskill_count <= 0)
+ switch (src->type) {
+ case BL_PC:
+ sts = ((struct map_session_data *)src)->skilltimerskill;
+ max = MAX_SKILLTIMERSKILL;
+ count = &((struct map_session_data *)src)->timerskill_count;
+ break;
+ case BL_MOB:
+ sts = ((struct mob_data *)src)->skilltimerskill;
+ max = MAX_MOBSKILLTIMERSKILL;
+ break;
+ case BL_PET:
+ sts = ((struct pet_data *)src)->skilltimerskill;
+ max = MAX_MOBSKILLTIMERSKILL;
+ break;
+ default:
return 0;
-
- for(i=0;i<MAX_SKILLTIMERSKILL && sd->timerskill_count > 0;i++) {
- if(sd->skilltimerskill[i].timer != -1) {
- delete_timer(sd->skilltimerskill[i].timer, skill_timerskill);
- sd->skilltimerskill[i].timer = -1;
- sd->timerskill_count--;
- }
- }
}
- else if(src->type == BL_MOB) {
- struct mob_data *md = (struct mob_data *)src;
- nullpo_retr(0, md);
- for(i=0;i<MAX_MOBSKILLTIMERSKILL;i++) {
- if(md->skilltimerskill[i].timer != -1) {
- delete_timer(md->skilltimerskill[i].timer, skill_timerskill);
- md->skilltimerskill[i].timer = -1;
+
+ if (count) {
+ for(i=0;i<max && *count > 0;i++) {
+ if(sts[i].timer != -1) {
+ delete_timer(sts[i].timer, skill_timerskill);
+ sts[i].timer = -1;
+ (*count)--;
}
}
- }
- else if(src->type == BL_PET) { // Ya forgot this one, Valaris. [Skotlex]
- struct pet_data *pd = (struct pet_data *)src;
- nullpo_retr(1, pd);
- for(i=0;i<MAX_MOBSKILLTIMERSKILL;i++) {
- if(pd->skilltimerskill[i].timer != -1) {
- delete_timer(pd->skilltimerskill[i].timer, skill_timerskill);
- pd->skilltimerskill[i].timer = -1;
+ } else {
+ for(i=0;i<max;i++) {
+ if(sts[i].timer != -1) {
+ delete_timer(sts[i].timer, skill_timerskill);
+ sts[i].timer = -1;
}
}
}
@@ -9630,31 +9581,27 @@ int skill_attack_area(struct block_list *bl,va_list ap)
*/
int skill_clear_element_field(struct block_list *bl)
{
- struct mob_data *md=NULL;
- struct map_session_data *sd=NULL;
+ struct skill_unit_group *ug=NULL;
int i,max,skillid;
nullpo_retr(0, bl);
if (bl->type==BL_MOB) {
max = MAX_MOBSKILLUNITGROUP;
- md = (struct mob_data *)bl;
+ ug = ((struct mob_data *)bl)->skillunit;
} else if(bl->type==BL_PC) {
max = MAX_SKILLUNITGROUP;
- sd = (struct map_session_data *)bl;
+ ug = ((struct map_session_data *)bl)->skillunit;
+ } else if(bl->type==BL_PET) {
+ max = MAX_MOBSKILLUNITGROUP;
+ ug = ((struct pet_data*)bl)->skillunit;
} else
return 0;
for (i=0;i<max;i++) {
- if(sd){
- skillid=sd->skillunit[i].skill_id;
- if(skillid==SA_DELUGE||skillid==SA_VOLCANO||skillid==SA_VIOLENTGALE||skillid==SA_LANDPROTECTOR)
- skill_delunitgroup(&sd->skillunit[i]);
- }else if(md){
- skillid=md->skillunit[i].skill_id;
- if(skillid==SA_DELUGE||skillid==SA_VOLCANO||skillid==SA_VIOLENTGALE||skillid==SA_LANDPROTECTOR)
- skill_delunitgroup(&md->skillunit[i]);
- }
+ skillid=ug[i].skill_id;
+ if(skillid==SA_DELUGE||skillid==SA_VOLCANO||skillid==SA_VIOLENTGALE||skillid==SA_LANDPROTECTOR)
+ skill_delunitgroup(&ug[i]);
}
return 0;
}
@@ -10274,6 +10221,8 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(
set = ((struct map_session_data *)bl)->skillunittick;
else if (bl->type == BL_MOB)
set = ((struct mob_data *)bl)->skillunittick;
+ else if (bl->type == BL_PET)
+ set = ((struct pet_data *)bl)->skillunittick;
else
return 0;
diff --git a/src/map/status.c b/src/map/status.c
index b4abbd74a..3818d5b38 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -5545,7 +5545,9 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
{
int s = 0;
int sp = 1;
- if(sd && (--sc->data[type].val3) > 0) {
+ if (--sc->data[type].val3 <= 0)
+ break;
+ if(sd) {
switch(sc->data[type].val1){
case BD_RICHMANKIM: /* ニヨルドの宴 3秒にSP1 */
case BD_DRUMBATTLEFIELD: /* ?太鼓の響き 3秒にSP1 */
@@ -5591,11 +5593,11 @@ int status_change_timer(int tid, unsigned int tick, int id, int data)
if (sd->status.sp <= 0)
break;
}
- sc->data[type].timer=add_timer( /* タイマ?再設定 */
- 1000+tick, status_change_timer,
- bl->id, data);
- return 0;
}
+ sc->data[type].timer=add_timer( /* タイマ?再設定 */
+ 1000+tick, status_change_timer,
+ bl->id, data);
+ return 0;
}
break;