Skip to content

Commit

Permalink
Consistent Dirx / Diry Array Usage (#8343)
Browse files Browse the repository at this point in the history
- All skills now use the globally defined dirx/diry variables instead of defining their own
  • Loading branch information
Playtester committed May 20, 2024
1 parent 5d232db commit c83f41a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/map/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1426,11 +1426,9 @@ bool battle_status_block_damage(struct block_list *src, struct block_list *targe

// ATK_DEF Type
if ((sce = sc->getSCE(SC_LIGHTNINGWALK)) && !(flag & BF_MAGIC) && flag&BF_LONG && rnd() % 100 < sce->val1) {
const int dx[8] = { 0,-1,-1,-1,0,1,1,1 };
const int dy[8] = { 1,1,0,-1,-1,-1,0,1 };
uint8 dir = map_calc_dir(target, src->x, src->y);

if (unit_movepos(target, src->x - dx[dir], src->y - dy[dir], 1, 1)) {
if (unit_movepos(target, src->x - dirx[dir], src->y - diry[dir], 1, 1)) {
clif_blown(target);
unit_setdir(target, dir);
}
Expand Down
8 changes: 2 additions & 6 deletions src/map/skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6625,11 +6625,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
break;
case RA_WUGSTRIKE:
if( sd && pc_isridingwug(sd) ){
short x[8]={0,-1,-1,-1,0,1,1,1};
short y[8]={1,1,0,-1,-1,-1,0,1};
uint8 dir = map_calc_dir(bl, src->x, src->y);

if( unit_movepos(src, bl->x+x[dir], bl->y+y[dir], 1, 1) ) {
if( unit_movepos(src, bl->x+dirx[dir], bl->y+diry[dir], 1, 1) ) {
clif_blown(src);
skill_attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag);
}
Expand Down Expand Up @@ -17531,10 +17529,8 @@ bool skill_check_condition_castbegin( map_session_data& sd, uint16 skill_id, uin
{
if( skill_lv < 3 && ((sd.bl.type == BL_PC && battle_config.pc_cloak_check_type&1)
|| (sd.bl.type != BL_PC && battle_config.monster_cloak_check_type&1) )) { //Check for walls.
static int dx[DIR_MAX] = { 0, 1, 0, -1, -1, 1, 1, -1};
static int dy[DIR_MAX] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dir;
ARR_FIND( 0, DIR_MAX, dir, map_getcell(sd.bl.m, sd.bl.x+dx[dir], sd.bl.y+dy[dir], CELL_CHKNOPASS) != 0 );
ARR_FIND( 0, DIR_MAX, dir, map_getcell(sd.bl.m, sd.bl.x+dirx[dir], sd.bl.y+diry[dir], CELL_CHKNOPASS) != 0 );
if( dir == DIR_MAX ) {
clif_skill_fail( sd, skill_id );
return false;
Expand Down

0 comments on commit c83f41a

Please sign in to comment.