diff options
Diffstat (limited to 'src/map/skill.c')
-rw-r--r-- | src/map/skill.c | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/src/map/skill.c b/src/map/skill.c index 3e9817faf..3541f9f45 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -520,7 +520,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case AL_WARP: case RETURN_TO_ELDICASTES: case ALL_GUARDIAN_RECALL: - if(map[m].flag.nowarp) { + if(maplist[m].flag.nowarp) { clif->skill_mapinfomessage(sd,0); return 1; } @@ -528,7 +528,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case AL_TELEPORT: case SC_FATALMENACE: case SC_DIMENSIONDOOR: - if(map[m].flag.noteleport) { + if(maplist[m].flag.noteleport) { clif->skill_mapinfomessage(sd,0); return 1; } @@ -536,7 +536,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) case WE_CALLPARTNER: case WE_CALLPARENT: case WE_CALLBABY: - if (map[m].flag.nomemo) { + if (maplist[m].flag.nomemo) { clif->skill_mapinfomessage(sd,1); return 1; } @@ -555,7 +555,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) return 0; // always allowed case WZ_ICEWALL: // noicewall flag [Valaris] - if (map[m].flag.noicewall) { + if (maplist[m].flag.noicewall) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } @@ -567,11 +567,10 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) } break; case GD_EMERGENCYCALL: - if ( - !(battle_config.emergency_call&((iMap->agit_flag || iMap->agit2_flag)?2:1)) || - !(battle_config.emergency_call&(map[m].flag.gvg || map[m].flag.gvg_castle?8:4)) || - (battle_config.emergency_call&16 && map[m].flag.nowarpto && !map[m].flag.gvg_castle) - ) { + if( !(battle_config.emergency_call&((iMap->agit_flag || iMap->agit2_flag)?2:1)) + || !(battle_config.emergency_call&(maplist[m].flag.gvg || maplist[m].flag.gvg_castle?8:4)) + || (battle_config.emergency_call&16 && maplist[m].flag.nowarpto && !maplist[m].flag.gvg_castle) + ) { clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); return 1; } @@ -606,7 +605,7 @@ int skillnotok (uint16 skill_id, struct map_session_data *sd) break; } - return (map[m].flag.noskill); + return (maplist[m].flag.noskill); } int skillnotok_hom(uint16 skill_id, struct homun_data *hd) @@ -2064,7 +2063,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in nullpo_ret(src); - if (src != target && map[src->m].flag.noknockback) + if (src != target && maplist[src->m].flag.noknockback) return 0; //No knocking if (count == 0) return 0; //Actual knockback distance is 0. @@ -3577,7 +3576,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint uint8 dir = iMap->calc_dir(bl, src->x, src->y); // teleport to target (if not on WoE grounds) - if( !map_flag_gvg2(src->m) && !map[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 0, 1) ) + if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 0, 1) ) clif->slide(src, bl->x, bl->y); // cause damage and knockback if the path to target was a straight one @@ -3688,8 +3687,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint if( dir > 2 && dir < 6 ) y = -i; else if( dir == 7 || dir < 2 ) y = i; else y = 0; - if( (mbl == src || (!map_flag_gvg2(src->m) && !map[src->m].flag.battleground) ) && // only NJ_ISSEN don't have slide effect in GVG - unit->movepos(src, mbl->x+x, mbl->y+y, 1, 1) ) { + if( (mbl == src || (!map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground) ) // only NJ_ISSEN don't have slide effect in GVG + && unit->movepos(src, mbl->x+x, mbl->y+y, 1, 1) + ) { clif->slide(src, src->x, src->y); clif->fixpos(src); clif->spiritball(src); @@ -4064,8 +4064,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint sc_start(src,SC_HIDING,100,skill_lv,skill->get_time(skill_id,skill_lv)); break; case NJ_KIRIKAGE: - if( !map_flag_gvg2(src->m) && !map[src->m].flag.battleground ) - { //You don't move on GVG grounds. + if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground ) { + //You don't move on GVG grounds. short x, y; iMap->search_freecell(bl, 0, &x, &y, 1, 1, 0); if (unit->movepos(src, x, y, 0, 0)) @@ -4345,7 +4345,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint } break; case LG_PINPOINTATTACK: - if( !map_flag_gvg2(src->m) && !map[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 1, 1) ) + if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 1, 1) ) clif->slide(src,bl->x,bl->y); skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); break; @@ -4370,7 +4370,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint break; case SR_KNUCKLEARROW: - if( !map_flag_gvg2(src->m) && !map[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 1, 1) ) { + if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground && unit->movepos(src, bl->x, bl->y, 1, 1) ) { clif->slide(src,bl->x,bl->y); clif->fixpos(src); // Aegis send this packet too. } @@ -5104,7 +5104,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; } skill_area_temp[0] = 5 - skill_area_temp[0]; // The actual penalty... - if (skill_area_temp[0] > 0 && !map[src->m].flag.noexppenalty) { //Apply penalty + if (skill_area_temp[0] > 0 && !maplist[src->m].flag.noexppenalty) { //Apply penalty sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * skill_area_temp[0] * 2/1000); //0.2% penalty per each. sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * skill_area_temp[0] * 2/1000); clif->updatestatus(sd,SP_BASEEXP); @@ -5120,8 +5120,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case ALL_RESURRECTION: - if(sd && (map_flag_gvg2(bl->m) || map[bl->m].flag.battleground)) - { //No reviving in WoE grounds! + if(sd && (map_flag_gvg2(bl->m) || maplist[bl->m].flag.battleground)) { + //No reviving in WoE grounds! clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); break; } @@ -5132,7 +5132,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui if (tsc && tsc->data[SC_HELLPOWER]) break; - if (map[bl->m].flag.pvp && dstsd && dstsd->pvp_point < 0) + if (maplist[bl->m].flag.pvp && dstsd && dstsd->pvp_point < 0) break; switch(skill_lv){ @@ -6332,9 +6332,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui break; case AL_TELEPORT: - if(sd) - { - if (map[bl->m].flag.noteleport && skill_lv <= 2) { + if(sd) { + if (maplist[bl->m].flag.noteleport && skill_lv <= 2) { clif->skill_mapinfomessage(sd,0); break; } @@ -6707,8 +6706,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui int x,y, dir = unit->getdir(src); //Fails on noteleport maps, except for GvG and BG maps [Skotlex] - if( map[src->m].flag.noteleport && - !(map[src->m].flag.battleground || map_flag_gvg2(src->m) ) + if( maplist[src->m].flag.noteleport + && !(maplist[src->m].flag.battleground || map_flag_gvg2(src->m)) ) { x = src->x; y = src->y; @@ -7526,7 +7525,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui for(i = 0; i < g->max_member; i++, j++) { if (j>8) j=0; if ((dstsd = g->member[i].sd) != NULL && sd != dstsd && !dstsd->state.autotrade && !pc_isdead(dstsd)) { - if (map[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m)) + if (maplist[dstsd->bl.m].flag.nowarp && !map_flag_gvg2(dstsd->bl.m)) continue; if(iMap->getcell(src->m,src->x+dx[j],src->y+dy[j],CELL_CHKNOREACH)) dx[j] = dy[j] = 0; @@ -8541,7 +8540,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui } break; case LG_INSPIRATION: - if( sd && !map[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) { + if( sd && !maplist[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) { sd->status.base_exp -= min(sd->status.base_exp, pc->nextbaseexp(sd) * 1 / 100); // 1% penalty. sd->status.job_exp -= min(sd->status.job_exp, pc->nextjobexp(sd) * 1 / 100); clif->updatestatus(sd,SP_BASEEXP); @@ -9546,8 +9545,7 @@ static int skill_count_wos(struct block_list *bl,va_list ap) { /*========================================== * *------------------------------------------*/ -int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *map) -{ +int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char *mapname) { nullpo_ret(sd); //Simplify skill_failed code. @@ -9588,16 +9586,16 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char pc_stop_walking(sd,0); if(battle_config.skill_log && battle_config.skill_log&BL_PC) - ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,map); + ShowInfo("PC %d skill castend skill =%d map=%s\n",sd->bl.id,skill_id,mapname); - if(strcmp(map,"cancel")==0) { + if(strcmp(mapname,"cancel")==0) { skill_failed(sd); return 0; } switch(skill_id) { case AL_TELEPORT: - if(strcmp(map,"Random")==0) + if(strcmp(mapname,"Random")==0) pc->randomwarp(sd,CLR_TELEPORT); else if (sd->menuskill_val > 1) //Need lv2 to be able to warp here. pc->setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT); @@ -9612,7 +9610,7 @@ int skill_castend_map (struct map_session_data *sd, uint16 skill_id, const char int x,y; unsigned short mapindex; - mapindex = mapindex_name2id((char*)map); + mapindex = mapindex_name2id(mapname); if(!mapindex) { //Given map not found? clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0); skill_failed(sd); @@ -9975,7 +9973,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui } break; case NJ_SHADOWJUMP: - if( !map_flag_gvg2(src->m) && !map[src->m].flag.battleground ) { //You don't move on GVG grounds. + if( !map_flag_gvg2(src->m) && !maplist[src->m].flag.battleground ) { //You don't move on GVG grounds. unit->movepos(src, x, y, 1, 0); clif->slide(src,x,y); } @@ -10515,11 +10513,11 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ unit_flag = skill->get_unit_flag(skill_id); layout = skill->get_unit_layout(skill_id,skill_lv,src,x,y); - if( map[src->m].unit_count ) { - ARR_FIND(0, map[src->m].unit_count, i, map[src->m].units[i]->skill_id == skill_id ); + if( maplist[src->m].unit_count ) { + ARR_FIND(0, maplist[src->m].unit_count, i, maplist[src->m].units[i]->skill_id == skill_id ); - if( i < map[src->m].unit_count ) { - limit = limit * map[src->m].units[i]->modifier / 100; + if( i < maplist[src->m].unit_count ) { + limit = limit * maplist[src->m].units[i]->modifier / 100; } } @@ -10616,7 +10614,7 @@ struct skill_unit_group* skill_unitsetting(struct block_list *src, uint16 skill_ ARR_FIND(0, MAX_SKILL_ITEM_REQUIRE, i, req.itemid[i] && (req.itemid[i] == ITEMID_TRAP || req.itemid[i] == ITEMID_TRAP_ALLOY)); if( req.itemid[i] ) req_item = req.itemid[i]; - if( map_flag_gvg2(src->m) || map[src->m].flag.battleground ) + if( map_flag_gvg2(src->m) || maplist[src->m].flag.battleground ) limit *= 4; // longer trap times in WOE [celest] if( battle_config.vs_traps_bctall && map_flag_vs(src->m) && (src->type&battle_config.vs_traps_bctall) ) target = BCT_ALL; @@ -11711,7 +11709,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns break; case UNT_DIMENSIONDOOR: - if( tsd && !map[bl->m].flag.noteleport ) + if( tsd && !maplist[bl->m].flag.noteleport ) pc->randomwarp(tsd,3); else if( bl->type == BL_MOB && battle_config.mob_warp&8 ) unit->warp(bl,-1,-1,-1,3); @@ -14026,7 +14024,7 @@ int skill_delay_fix (struct block_list *bl, uint16 skill_id, uint16 skill_lv) time /= 2; break; case AS_SONICBLOW: - if (!map_flag_gvg2(bl->m) && !map[bl->m].flag.battleground && sc->data[SC_SOULLINK]->val2 == SL_ASSASIN) + if (!map_flag_gvg2(bl->m) && !maplist[bl->m].flag.battleground && sc->data[SC_SOULLINK]->val2 == SL_ASSASIN) time /= 2; break; } @@ -14554,7 +14552,7 @@ void skill_unitsetmapcell (struct skill_unit *src, uint16 skill_id, uint16 skill for( y = src->bl.y - range; y <= src->bl.y + range; ++y ) for( x = src->bl.x - range; x <= src->bl.x + range; ++x ) - map[src->bl.m].setcell(src->bl.m, x, y, cell, flag); + maplist[src->bl.m].setcell(src->bl.m, x, y, cell, flag); } /*========================================== @@ -15109,7 +15107,7 @@ struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,5); clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,5,AREA); skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true); - map[su->bl.m].icewall_num++; + maplist[su->bl.m].icewall_num++; break; case SA_LANDPROTECTOR: skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,true); @@ -15163,7 +15161,7 @@ int skill_delunit (struct skill_unit* su) { iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,su->val2); clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,su->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false); - map[su->bl.m].icewall_num--; + maplist[su->bl.m].icewall_num--; break; case SA_LANDPROTECTOR: skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,false); @@ -15596,13 +15594,13 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) { if(group->val1) { sd = iMap->charid2sd(group->val1); group->val1 = 0; - if (sd && !map[sd->bl.m].flag.nowarp) + if (sd && !maplist[sd->bl.m].flag.nowarp) pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT); } if(group->val2) { sd = iMap->charid2sd(group->val2); group->val2 = 0; - if (sd && !map[sd->bl.m].flag.nowarp) + if (sd && !maplist[sd->bl.m].flag.nowarp) pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT); } skill->delunit(su); @@ -17021,7 +17019,7 @@ int skill_blockpc_start_(struct map_session_data *sd, uint16 skill_id, int tick, struct skill_cd* cd = NULL; int i; - if( !(cd = idb_get(skill->cd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage + if( !(cd = idb_get(skill->cd_db,sd->status.char_id)) ) {// create a new skill cooldown object for map storage cd = ers_alloc(skill->cd_ers, struct skill_cd); cd->cursor = 0; |