From 18282ae649b0c2d54deaba32132171cbf56a1868 Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 13 Nov 2006 14:35:43 +0000 Subject: - Volcano/Deluge/Violent Gale are now interchangeable, in the sense that as long as one of these is out, casting any of the three will not consume gems, and will use the remaining time of the previous one. In turn, Land Protector will now always consume gems on every cast. - Small cleanup in the Land protector code which may fix it not blocking AoE skills. - Fixed the interpretation of "head_dir". Removed setting head_dir to match character direction in the whole code. Now it is only reset to 0 (look forward) when unit_setpos is invoked, or when a character begins walking. Thanks to FlavioJS for figuring out how the client parses the head direction. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9206 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 12 ++++++------ src/map/map.h | 2 +- src/map/skill.c | 23 ++++++++++++++++------- src/map/unit.c | 11 ++++------- 4 files changed, 27 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 4a9dab5ed..e79b7f78e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -919,7 +919,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch WBUFW(buf,28)=vd->head_mid; WBUFW(buf,30)=vd->hair_color; WBUFW(buf,32)=vd->cloth_color; - WBUFW(buf,34)=sd?sd->head_dir:dir; + WBUFW(buf,34)=sd?sd->head_dir:0; WBUFL(buf,36)=guild_id; WBUFW(buf,40)=emblem_id; if (sd) { @@ -954,7 +954,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch WBUFW(buf,26)=vd->head_mid; WBUFW(buf,28)=vd->hair_color; WBUFW(buf,30)=vd->cloth_color; - WBUFW(buf,32)=sd?sd->head_dir:dir; + WBUFW(buf,32)=sd?sd->head_dir:0; WBUFL(buf,34)=guild_id; WBUFW(buf,38)=emblem_id; if (sd) { @@ -989,7 +989,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch WBUFW(buf,26)=vd->head_mid; WBUFW(buf,28)=vd->hair_color; WBUFW(buf,30)=vd->cloth_color; - WBUFW(buf,32)=sd?sd->head_dir:dir; + WBUFW(buf,32)=sd?sd->head_dir:0; WBUFL(buf,34)=guild_id; WBUFL(buf,38)=emblem_id; if (sd) @@ -1073,7 +1073,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit WBUFW(buf,32)=vd->head_mid; WBUFW(buf,34)=vd->hair_color; WBUFW(buf,36)=vd->cloth_color; - WBUFW(buf,38)=sd?sd->head_dir:unit_getdir(bl); + WBUFW(buf,38)=sd?sd->head_dir:0; WBUFL(buf,40)=guild_id; WBUFW(buf,44)=emblem_id; if (sd) { @@ -1110,7 +1110,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit WBUFW(buf,30)=vd->head_mid; WBUFW(buf,32)=vd->hair_color; WBUFW(buf,34)=vd->cloth_color; - WBUFW(buf,36)=sd?sd->head_dir:unit_getdir(bl); + WBUFW(buf,36)=sd?sd->head_dir:0; WBUFL(buf,38)=guild_id; WBUFW(buf,42)=emblem_id; if (sd) { @@ -1147,7 +1147,7 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit WBUFW(buf,30)=vd->head_mid; WBUFW(buf,32)=vd->hair_color; WBUFW(buf,34)=vd->cloth_color; - WBUFW(buf,36)=sd?sd->head_dir:unit_getdir(bl); + WBUFW(buf,36)=sd?sd->head_dir:0; WBUFL(buf,38)=guild_id; WBUFL(buf,42)=emblem_id; if (sd) diff --git a/src/map/map.h b/src/map/map.h index 270cb549b..b9a21036f 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -623,7 +623,7 @@ struct map_session_data { int fd; unsigned short mapindex; unsigned short prev_speed,prev_adelay; - unsigned char head_dir; + unsigned char head_dir; //0: Look forward. 1: Look right, 2: Look left. unsigned int client_tick; int npc_id,areanpc_id,npc_shopid; int npc_item_flag; //Marks the npc_id with which you can use items during interactions with said npc (see script command enable_itemuse) diff --git a/src/map/skill.c b/src/map/skill.c index e11fc54f0..98f11a2dd 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6577,8 +6577,13 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid, { struct skill_unit_group *old_sg; if ((old_sg = skill_locate_element_field(src)) != NULL) - { - if (old_sg->skill_id == skillid && old_sg->limit > 0) + { //HelloKitty confirmed that these are interchangeable, + //so you can change element and not consume gemstones. + if (( + old_sg->skill_id == SA_VOLCANO || + old_sg->skill_id == SA_DELUGE || + old_sg->skill_id == SA_VIOLENTGALE + ) && old_sg->limit > 0) { //Use the previous limit (minus the elapsed time) [Skotlex] limit = old_sg->limit - DIFF_TICK(gettick(), old_sg->tick); if (limit < 0) //This can happen... @@ -8204,14 +8209,18 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t case SA_DELUGE: case SA_VOLCANO: case SA_VIOLENTGALE: - case SA_LANDPROTECTOR: { //Does not consumes if the skill is already active. [Skotlex] struct skill_unit_group *sg; - if ((sg= skill_locate_element_field(&sd->bl)) != NULL && sg->skill_id == skill) - { + if ((sg= skill_locate_element_field(&sd->bl)) != NULL && + ( + sg->skill_id == SA_VOLCANO || + sg->skill_id == SA_DELUGE || + sg->skill_id == SA_VIOLENTGALE + )) { if (sg->limit - DIFF_TICK(gettick(), sg->tick) > 0) checkitem_flag = delitem_flag = 0; - else sg->limit = 0; //Disable it. + else + sg->limit = 0; //Disable it. } break; } @@ -9940,7 +9949,7 @@ int skill_unit_timer_sub_onplace (struct block_list *bl, va_list ap) nullpo_retr(0, group=unit->group); - if (!skill_get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP) + if (!(skill_get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) && map_getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR)) return 0; //AoE skills are ineffective. [Skotlex] diff --git a/src/map/unit.c b/src/map/unit.c index 2f46a0d9c..2f908cecf 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -80,8 +80,10 @@ int unit_walktoxy_sub(struct block_list *bl) ud->state.change_walk_target=0; - if (bl->type == BL_PC) + if (bl->type == BL_PC) { + ((TBL_PC *)bl)->head_dir = 0; clif_walkok((TBL_PC*)bl); + } clif_move(bl); if(ud->walkpath.path_pos>=ud->walkpath.path_len) @@ -134,8 +136,6 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) dir = ud->walkpath.path[ud->walkpath.path_pos]; ud->dir = dir; - if (sd) - sd->head_dir = dir; dx = dirx[(int)dir]; dy = diry[(int)dir]; @@ -341,7 +341,6 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int sc = status_get_sc(bl); if (sc && sc->count && sc->data[SC_CONFUSION].timer != -1) //Randomize the target position map_random_dir(bl, &ud->to_x, &ud->to_y); - if(ud->walktimer != -1) { ud->state.change_walk_target = 1; @@ -435,7 +434,6 @@ int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkp dir = map_calc_dir(bl, dst_x,dst_y); ud->dir = dir; - if(sd) sd->head_dir = dir; dx = dst_x - bl->x; dy = dst_y - bl->y; @@ -486,7 +484,7 @@ int unit_setdir(struct block_list *bl,unsigned char dir) if (!ud) return 0; ud->dir = dir; if (bl->type == BL_PC) - ((TBL_PC *)bl)->head_dir = dir; + ((TBL_PC *)bl)->head_dir = 0; clif_changed_dir(bl, AREA); return 0; } @@ -1336,7 +1334,6 @@ static int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int t if (battle_config.attack_direction_change && (src->type&battle_config.attack_direction_change)) { ud->dir = map_calc_dir(src, target->x,target->y ); - if (sd) sd->head_dir = ud->dir; } if(ud->walktimer != -1) unit_stop_walking(src,1); -- cgit v1.2.3-60-g2f50