summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-22 16:08:24 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-22 16:08:24 +0000
commitf65bf4bd28cd9240c889bfd2a1f4650d91760a2d (patch)
tree6730a4d5ca802cc2c4cdb128dca07f1e95cac0fb /src/map/skill.c
parent6b0b62a5b2a9d85f60afe4fe048403101bd8f39d (diff)
downloadhercules-f65bf4bd28cd9240c889bfd2a1f4650d91760a2d.tar.gz
hercules-f65bf4bd28cd9240c889bfd2a1f4650d91760a2d.tar.bz2
hercules-f65bf4bd28cd9240c889bfd2a1f4650d91760a2d.tar.xz
hercules-f65bf4bd28cd9240c889bfd2a1f4650d91760a2d.zip
* Corrected Spiral Pierce's hits in the skill_db
* Moved /common/*.o into a obj folder when compiling * Updated core and map server to jA 1094~1115 git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1162 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c2820
1 files changed, 1135 insertions, 1685 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 9ae3e2ba4..3d3411b16 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -556,6 +556,12 @@ int skill_get_mhp( int id ,int lv ){ skill_get (skill_db[id].mhp[lv-1], id, lv);
int skill_get_castnodex( int id ,int lv ){ skill_get (skill_db[id].castnodex[lv-1], id, lv); }
int skill_get_delaynodex( int id ,int lv ){ skill_get (skill_db[id].delaynodex[lv-1], id, lv); }
int skill_get_nocast ( int id ){ skill_get (skill_db[id].nocast, id, 1); }
+int skill_get_unit_id ( int id, int flag ){ skill_get (skill_db[id].unit_id[flag], id, 1); }
+int skill_get_unit_layout_type( int id ,int lv ){ skill_get (skill_db[id].unit_layout_type[lv-1], id, lv); }
+int skill_get_unit_interval( int id ){ skill_get (skill_db[id].unit_interval, id, 1); }
+int skill_get_unit_range( int id ){ skill_get (skill_db[id].unit_range, id, 1); }
+int skill_get_unit_target( int id ){ skill_get (skill_db[id].unit_target, id, 1); }
+int skill_get_unit_flag( int id ){ skill_get (skill_db[id].unit_flag, id, 1); }
int skill_tree_get_max(int id, int b_class){
struct pc_base_job s_class = pc_calc_base_job(b_class);
@@ -577,6 +583,9 @@ int skill_clear_element_field(struct block_list *bl);
int skill_landprotector(struct block_list *bl, va_list ap );
int skill_trap_splash(struct block_list *bl, va_list ap );
int skill_count_target(struct block_list *bl, va_list ap );
+struct skill_unit_group_tickset *skill_unitgrouptickset_search(struct block_list *bl,struct skill_unit_group *sg,int tick);
+int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int tick);
+int skill_unit_effect(struct block_list *bl,va_list ap);
// [MouseJstr] - skill ok to cast? and when?
int skillnotok(int skillid, struct map_session_data *sd)
@@ -635,96 +644,53 @@ static int distance(int x0,int y0,int x1,int y1)
return dx>dy ? dx : dy;
}
-/* スキルユニットIDを返す(これもデ?タベ?スに入れたいな) */
-int skill_get_unit_id(int id,int flag)
+/* スキルユニットの配置情報を返す */
+struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT];
+int firewall_unit_pos;
+int icewall_unit_pos;
+
+struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct block_list *src,int x,int y)
{
+
+ int pos = skill_get_unit_layout_type(skillid,skilllv);
+ int dir;
- switch(id){
- case MG_SAFETYWALL: return 0x7e; /* セイフティウォ?ル */
- case MG_FIREWALL: return 0x7f; /* ファイア?ウォ?ル */
- case AL_WARP: return (flag==0)?0x81:0x80; /* ワ?プポ?タル */
- case PR_BENEDICTIO: return 0x82; /* 聖?降福 */
- case PR_SANCTUARY: return 0x83; /* サンクチュアリ */
- case PR_MAGNUS: return 0x84; /* マグヌスエクソシズム */
- case AL_PNEUMA: return 0x85; /* ニュ?マ */
- case MG_THUNDERSTORM: return 0x86; /* サンダ?スト?ム */
- case WZ_HEAVENDRIVE: return 0x86; /* ヘヴンズドライブ */
- case WZ_SIGHTRASHER: return 0x86; /* サイトラッシャ? */
- case WZ_METEOR: return 0x86; /* メテオスト?ム */
- case WZ_VERMILION: return 0x86; /* ロ?ドオブヴァ?ミリオン */
- //case WZ_FROSTNOVA: return 0x86; /* フロストノヴァ */
- case WZ_STORMGUST: return 0x86; /* スト?ムガスト(とりあえずLoVと同じで?理) */
- case CR_GRANDCROSS: return 0x86; /* グランドクロス */
- case NPC_DARKGRANDCROSS: return 0x86; /*闇グランドクロス*/
- case WZ_FIREPILLAR: return (flag==0)?0x87:0x88; /* ファイア?ピラ? */
- case HT_TALKIEBOX: return 0x99; /* ト?キ?ボックス */
- case WZ_ICEWALL: return 0x8d; /* アイスウォ?ル */
- case WZ_QUAGMIRE: return 0x8e; /* クァグマイア */
- case HT_BLASTMINE: return 0x8f; /* ブラストマイン */
- case HT_SKIDTRAP: return 0x90; /* スキッドトラップ */
- case HT_ANKLESNARE: return 0x91; /* アンクルスネア */
- case AS_VENOMDUST: return 0x92; /* ベノムダスト */
- case HT_LANDMINE: return 0x93; /* ランドマイン */
- case HT_SHOCKWAVE: return 0x94; /* ショックウェ?ブトラップ */
- case HT_SANDMAN: return 0x95; /* サンドマン */
- case HT_FLASHER: return 0x96; /* フラッシャ? */
- case HT_FREEZINGTRAP: return 0x97; /* フリ?ジングトラップ */
- case HT_CLAYMORETRAP: return 0x98; /* クレイモア?トラップ */
- case SA_VOLCANO: return 0x9a; /* ボルケ?ノ */
- case SA_DELUGE: return 0x9b; /* デリュ?ジ */
- case SA_VIOLENTGALE: return 0x9c; /* バイオレントゲイル */
- case SA_LANDPROTECTOR: return 0x9d; /* ランドプロテクタ? */
- case BD_LULLABY: return 0x9e; /* 子守歌 */
- case BD_RICHMANKIM: return 0x9f; /* ニヨルドの宴 */
- case BD_ETERNALCHAOS: return 0xa0; /* 永遠の混沌 */
- case BD_DRUMBATTLEFIELD:return 0xa1; /* ?太鼓の響き */
- case BD_RINGNIBELUNGEN: return 0xa2; /* ニ?ベルングの指輪 */
- case BD_ROKISWEIL: return 0xa3; /* ロキの叫び */
- case BD_INTOABYSS: return 0xa4; /* 深淵の中に */
- case BD_SIEGFRIED: return 0xa5; /* 不死身のジ?クフリ?ド */
- case BA_DISSONANCE: return 0xa6; /* 不協和音 */
- case BA_WHISTLE: return 0xa7; /* 口笛 */
- case BA_ASSASSINCROSS: return 0xa8; /* 夕陽のアサシンクロス */
- case BA_POEMBRAGI: return 0xa9; /* ブラギの詩 */
- case BA_APPLEIDUN: return 0xaa; /* イドゥンの林檎 */
- case DC_UGLYDANCE: return 0xab; /* 自分勝手なダンス */
- case DC_HUMMING: return 0xac; /* ハミング */
- case DC_DONTFORGETME: return 0xad; /* 私を忘れないで… */
- case DC_FORTUNEKISS: return 0xae; /* 幸運のキス */
- case DC_SERVICEFORYOU: return 0xaf; /* サ?ビスフォ?ユ? */
- case RG_GRAFFITI: return 0xb0; /* グラフィティ */
- case AM_DEMONSTRATION: return 0xb1; /* デモンストレ?ション */
- case WE_CALLPARTNER: return 0xb2; /* あなたに逢いたい */
- case PA_GOSPEL: return 0xb3; /* ゴスペル */
- case HP_BASILICA: return 0xb4; /* バジリカ */
-// case CG_MOONLIT: return 0xb5;
- case PF_FOGWALL: return 0xb6; /* フォグウォ?ル */
- case PF_SPIDERWEB: return 0xb7; /* スパイダ?ウェッブ */
- // temporary unit ID's [Celest]
- case GD_LEADERSHIP: return 0xc1;
- case GD_GLORYWOUNDS: return 0xc2;
- case GD_SOULCOLD: return 0xc3;
- case GD_HAWKEYES: return 0xc4;
- }
- return 0;
- /*
- 0x89,0x8a,0x8b 表示無し
- 0x9a 炎?性の詠唱みたいなエフェクト
- 0x9b 水?性の詠唱みたいなエフェクト
- 0x9c 風?性の詠唱みたいなエフェクト
- 0x9d 白い小さなエフェクト
- 0xb1 Alchemist Demonstration
- 0xb2 = Pink Warp Portal
- 0xb3 = Gospel For Paladin
- 0xb4 = Basilica
- 0xb5 = Empty
- 0xb6 = Fog Wall for Professor
- 0xb7 = Spider Web for Professor
- 0xb8 = Empty
- 0xb9 =
- */
+ if (pos!=-1)
+ return &skill_unit_layout[pos];
+
+ if (src->x==x && src->y==y)
+ dir = 2;
+ else
+ dir = map_calc_dir(src,x,y);
+
+ if (skillid==MG_FIREWALL)
+ return &skill_unit_layout[firewall_unit_pos+dir];
+ else if (skillid==WZ_ICEWALL)
+ return &skill_unit_layout[icewall_unit_pos+dir];
+
+ printf("unknown unit layout for skill %d, %d\n",skillid,skilllv);
+ return &skill_unit_layout[0];
}
+// case GD_LEADERSHIP: return 0xc1;
+// case GD_GLORYWOUNDS: return 0xc2;
+// case GD_SOULCOLD: return 0xc3;
+// case GD_HAWKEYES: return 0xc4;
+// 0x89,0x8a,0x8b 表示無し
+// 0x9a 炎?性の詠唱みたいなエフェクト
+// 0x9b 水?性の詠唱みたいなエフェクト
+// 0x9c 風?性の詠唱みたいなエフェクト
+// 0x9d 白い小さなエフェクト
+// 0xb1 Alchemist Demonstration
+// 0xb2 = Pink Warp Portal
+// 0xb3 = Gospel For Paladin
+// 0xb4 = Basilica
+// 0xb5 = Empty
+// 0xb6 = Fog Wall for Professor
+// 0xb7 = Spider Web for Professor
+// 0xb8 = Empty
+// 0xb9 =
+
/*==========================================
* スキル追加?果
*------------------------------------------
@@ -1162,16 +1128,16 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
nullpo_retr(0, target);
if(target->type==BL_PC){
- nullpo_retr(0, sd=(struct map_session_data *)target);
+ sd=(struct map_session_data *)target;
}else if(target->type==BL_MOB){
- nullpo_retr(0, md=(struct mob_data *)target);
+ md=(struct mob_data *)target;
}else if(target->type==BL_PET){
- nullpo_retr(0, pd=(struct pet_data *)target);
+ pd=(struct pet_data *)target;
}else if(target->type==BL_SKILL){
- nullpo_retr(0, su=(struct skill_unit *)target);
+ su=(struct skill_unit *)target;
}else return 0;
- if(!(count&0x10000 && (sd||md||pd||su))){ /* 指定なしなら位置?係から方向を求める */
+ if(!(count&0x10000)){ /* 指定なしなら位置関係から方向を求める */
dx=target->x-src->x; dx=(dx>0)?1:((dx<0)?-1: 0);
dy=target->y-src->y; dy=(dy>0)?1:((dy<0)?-1: 0);
}
@@ -1228,18 +1194,13 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
if(su){
skill_unit_move_unit_group(su->group,target->m,dx,dy);
}else{
-// struct status_change *sc_data=status_get_sc_data(target);
- if(moveblock) map_delblock(target);
- target->x=nx;
- target->y=ny;
- if(moveblock) map_addblock(target);
-/*ダンス中にエフェクトは移動しないらしい
- if(sc_data && sc_data[SC_DANCING].timer!=-1){ //?象がダンス中なのでエフェクトも移動
- struct skill_unit_group *sg=(struct skill_unit_group *)sc_data[SC_DANCING].val2;
- if(sg)
- skill_unit_move_unit_group(sg,target->m,dx,dy);
- }
-*/
+ int tick = gettick();
+ skill_unit_move(target,tick,0);
+ if(moveblock) map_delblock(target);
+ target->x=nx;
+ target->y=ny;
+ if(moveblock) map_addblock(target);
+ skill_unit_move(target,tick,1);
}
if(sd) { /* ?面?に入ってきたので表示 */
@@ -1258,8 +1219,6 @@ int skill_blown( struct block_list *src, struct block_list *target,int count)
pd->state.state = prev_state;
}
- skill_unit_move(target,gettick(),(count&0xffff)+7); /* スキルユニットの判定 */
-
return 0;
}
@@ -1480,9 +1439,6 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
//武器スキル?ここまで
switch(skillid){
- case WZ_SIGHTRASHER:
- clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, skillid, (lv!=0)?lv:skilllv, 5);
- break;
case AS_SPLASHER:
clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, skillid, -1, 5);
break;
@@ -1495,11 +1451,9 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
default:
clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion, damage, dmg.div_, skillid, (lv!=0)?lv:skilllv, (skillid==0)? 5:type );
}
- if(dmg.blewcount > 0 && !map[src->m].flag.gvg) { /* 吹き飛ばし?理とそのパケット */
- if(skillid == WZ_SIGHTRASHER)
- skill_blown(src,bl,dmg.blewcount);
- else
- skill_blown(dsrc,bl,dmg.blewcount);
+ /* 吹き飛ばし処理とそのパケット */
+ if (dmg.blewcount > 0 && bl->type!=BL_SKILL && !map[src->m].flag.gvg) {
+ skill_blown(dsrc,bl,dmg.blewcount);
if(bl->type == BL_MOB)
clif_fixmobpos((struct mob_data *)bl);
else if(bl->type == BL_PET)
@@ -1510,8 +1464,12 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
map_freeblock_lock();
/* ?際にダメ?ジ?理を行う */
- if(skillid || flag)
- battle_damage(src,bl,damage,0);
+ if (skillid || flag) {
+ if (attack_type&BF_WEAPON)
+ battle_delay_damage(tick+dmg.amotion,src,bl,damage,0);
+ else
+ battle_damage(src,bl,damage,0);
+ }
if(skillid == RG_INTIMIDATE && damage > 0 && !(status_get_mode(bl)&0x20) && !map[src->m].flag.gvg ) {
int s_lv = status_get_lv(src),t_lv = status_get_lv(bl);
int rate = 50 + skilllv * 5;
@@ -1594,8 +1552,12 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds
battle_heal(NULL,bl,0,-sp,0);
}
- if((skillid || flag) && rdamage > 0)
- battle_damage(bl,src,rdamage,0);
+ if ((skillid || flag) && rdamage>0) {
+ if (attack_type&BF_WEAPON)
+ battle_delay_damage(tick+dmg.amotion,bl,src,rdamage,0);
+ else
+ battle_damage(bl,src,rdamage,0);
+ }
if(attack_type&BF_WEAPON && sc_data && sc_data[SC_AUTOCOUNTER].timer != -1 && sc_data[SC_AUTOCOUNTER].val4 > 0) {
if(sc_data[SC_AUTOCOUNTER].val3 == dsrc->id)
@@ -1647,9 +1609,8 @@ int skill_area_sub( struct block_list *bl,va_list ap )
static int skill_check_unit_range_sub( struct block_list *bl,va_list ap )
{
struct skill_unit *unit;
- int *c,x,y,range,sx[4],sy[4];
- int t_range,tx[4],ty[4];
- int i,r_flag,skillid;
+ int *c;
+ int skillid,unit_id;
nullpo_retr(0, bl);
nullpo_retr(0, ap);
@@ -1662,57 +1623,46 @@ static int skill_check_unit_range_sub( struct block_list *bl,va_list ap )
if(!unit->alive)
return 0;
- x = va_arg(ap,int);
- y = va_arg(ap,int);
- range = va_arg(ap,int);
skillid = va_arg(ap,int);
+ unit_id = unit->group->unit_id;
- if(skillid == MG_SAFETYWALL || skillid == AL_PNEUMA) {
- if(unit->group->unit_id != 0x7e && unit->group->unit_id != 0x85)
+ if (skillid==MG_SAFETYWALL || skillid==AL_PNEUMA) {
+ if(unit_id != 0x7e && unit_id != 0x85)
return 0;
- }
- else if(skillid == AL_WARP) {
- if((unit->group->unit_id < 0x8f || unit->group->unit_id > 0x99) && unit->group->unit_id != 0x92)
+ } else if (skillid==AL_WARP) {
+ if ((unit_id<0x8f || unit_id>0x99) && unit_id!=0x92)
return 0;
- }
- else if((skillid >= HT_SKIDTRAP && skillid <= HT_CLAYMORETRAP) || skillid == HT_TALKIEBOX) {
- if((unit->group->unit_id < 0x8f || unit->group->unit_id > 0x99) && unit->group->unit_id != 0x92)
+ } else if ((skillid>=HT_SKIDTRAP && skillid<=HT_CLAYMORETRAP) || skillid==HT_TALKIEBOX) {
+ if ((unit_id<0x8f || unit_id>0x99) && unit_id!=0x92)
return 0;
- }
- else if(skillid == WZ_FIREPILLAR) {
- if(unit->group->unit_id != 0x87)
+ } else if (skillid==WZ_FIREPILLAR) {
+ if (unit_id!=0x87)
return 0;
- }
- else return 0;
- t_range=(unit->range!=0)? unit->range:unit->group->range;
- tx[0] = tx[3] = unit->bl.x - t_range;
- tx[1] = tx[2] = unit->bl.x + t_range;
- ty[0] = ty[1] = unit->bl.y - t_range;
- ty[2] = ty[3] = unit->bl.y + t_range;
- sx[0] = sx[3] = x - range;
- sx[1] = sx[2] = x + range;
- sy[0] = sy[1] = y - range;
- sy[2] = sy[3] = y + range;
- for(i=r_flag=0;i<4;i++) {
- if(sx[i] >= tx[0] && sx[i] <= tx[1] && sy[i] >= ty[0] && sy[i] <= ty[2]) {
- r_flag = 1;
- break;
- }
- if(tx[i] >= sx[0] && tx[i] <= sx[1] && ty[i] >= sy[0] && ty[i] <= sy[2]) {
- r_flag = 1;
- break;
- }
- }
- if(r_flag) (*c)++;
+ } else if (skillid==HP_BASILICA) {
+ if ((unit_id<0x8f || unit_id>0x99) && unit_id!=0x92 && unit_id!=0x83)
+ return 0;
+ } else
+ return 0;
+
+ (*c)++;
return 0;
}
-int skill_check_unit_range(int m,int x,int y,int range,int skillid)
+int skill_check_unit_range(int m,int x,int y,int skillid,int skilllv)
{
int c = 0;
+ int range = skill_get_unit_range(skillid);
+ int layout_type = skill_get_unit_layout_type(skillid,skilllv);
+ if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) {
+ printf("skill_check_unit_range: unsupported layout type %d for skill %d\n",layout_type,skillid);
+ return 0;
+ }
- map_foreachinarea(skill_check_unit_range_sub,m,x-10,y-10,x+10,y+10,BL_SKILL,&c,x,y,range,skillid);
+ // とりあえず正方形のユニットレイアウトのみ対応
+ range += layout_type;
+ map_foreachinarea(skill_check_unit_range_sub,m,
+ x-range,y-range,x+range,y+range,BL_SKILL,&c,skillid);
return c;
}
@@ -1720,6 +1670,8 @@ int skill_check_unit_range(int m,int x,int y,int range,int skillid)
static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
{
int *c;
+ int skillid;
+
nullpo_retr(0, bl);
nullpo_retr(0, ap);
@@ -1731,16 +1683,29 @@ static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap )
if(bl->type == BL_PC && pc_isdead((struct map_session_data *)bl))
return 0;
+ skillid = va_arg(ap,int);
+ if (skillid==HP_BASILICA && bl->type==BL_PC)
+ return 0;
+
(*c)++;
return 0;
}
-int skill_check_unit_range2(int m,int x,int y,int range)
+int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv)
{
int c = 0;
+ int range = skill_get_unit_range(skillid);
+ int layout_type = skill_get_unit_layout_type(skillid,skilllv);
+ if (layout_type==-1 || layout_type>MAX_SQUARE_LAYOUT) {
+ printf("skill_check_unit_range2: unsupported layout type %d for skill %d\n",layout_type,skillid);
+ return 0;
+ }
- map_foreachinarea(skill_check_unit_range2_sub,m,x-range,y-range,x+range,y+range,0,&c);
+ // とりあえず正方形のユニットレイアウトのみ対応
+ range += layout_type;
+ map_foreachinarea(skill_check_unit_range2_sub,m,
+ x-range,y-range,x+range,y+range,0,&c,skillid);
return c;
}
@@ -1758,6 +1723,27 @@ int skill_area_sub_count(struct block_list *src,struct block_list *target,int sk
return 0;
}
+int skill_count_water(struct block_list *src,int range)
+{
+ int i,x,y,cnt = 0,size = range*2+1;
+ struct skill_unit *unit;
+
+ for (i=0;i<size*size;i++) {
+ x = src->x+(i%size-range);
+ y = src->y+(i/size-range);
+ if (map_getcell(src->m,x,y,CELL_CHKWATER)) {
+ cnt++;
+ continue;
+ }
+ unit = map_find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL);
+ if (unit) {
+ cnt++;
+ skill_delunit(unit);
+ }
+ }
+ return cnt;
+}
+
/*==========================================
*
*------------------------------------------
@@ -1877,6 +1863,14 @@ static int skill_timerskill(int tid, unsigned int tick, int id,int data )
src->x+range,src->y+range,0,src,skl->skill_id,skl->skill_lv,tick);
break;
+ case WZ_WATERBALL:
+ if (skl->type>1) {
+ skl->timer = 0; // skill_addtimerskillで使用されないように
+ skill_addtimerskill(src,tick+150,target->id,0,0,skl->skill_id,skl->skill_lv,skl->type-1,skl->flag);
+ skl->timer = -1;
+ }
+ skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag);
+ break;
default:
skill_attack(skl->type,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag);
break;
@@ -2047,7 +2041,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
if(sd && pc_isdead(sd))
return 1;
- if((skillid == WZ_SIGHTRASHER || skillid == CR_GRANDCROSS || skillid == NPC_DARKGRANDCROSS) && src != bl)
+ if((skillid == CR_GRANDCROSS || skillid == NPC_DARKGRANDCROSS) && src != bl)
bl = src;
if(bl->prev == NULL)
return 1;
@@ -2445,8 +2439,17 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
case WZ_WATERBALL: /* ウォ?タ?ボ?ル */
skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag);
- if(skilllv>1)
- status_change_start(src,SC_WATERBALL,skilllv,bl->id,0,0,0,0);
+ if (skilllv>1) {
+ int cnt,range;
+ range = skilllv>5?2:skilllv/2;
+ if (sd)
+ cnt = skill_count_water(src,range)-1;
+ else
+ cnt = skill_get_num(skillid,skilllv)-1;
+ if (cnt>0)
+ skill_addtimerskill(src,tick+150,bl->id,0,0,
+ skillid,skilllv,cnt,flag);
+ }
break;
case PR_BENEDICTIO: /* 聖?降福 */
@@ -2457,6 +2460,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
/* 魔法系範?攻?スキル */
case MG_NAPALMBEAT: /* ナパ?ムビ?ト */
case MG_FIREBALL: /* ファイヤ?ボ?ル */
+ case WZ_SIGHTRASHER: /* サイトラッシャー */
if(flag&1){
/* 個別にダメ?ジを?える */
if(bl->id!=skill_area_temp[1]){
@@ -2469,27 +2473,46 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
skill_area_temp[0]| 0x0500);
}
}else{
- int ar=(skillid==MG_NAPALMBEAT)?1:2;
+ int ar;
+ skill_area_temp[0]=0;
skill_area_temp[1]=bl->id;
- if(skillid==MG_NAPALMBEAT){ /* ナパ?ムでは先に?える */
- skill_area_temp[0]=0;
- map_foreachinarea(skill_area_sub,
- bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0,
- src,skillid,skilllv,tick, flag|BCT_ENEMY ,
- skill_area_sub_count);
- }else{
- skill_area_temp[0]=0;
- skill_area_temp[2]=bl->x;
- skill_area_temp[3]=bl->y;
+ switch (skillid) {
+ case MG_NAPALMBEAT:
+ ar = 1;
+ /* ナパームビートは分散ダメージなので敵の数を数える */
+ map_foreachinarea(skill_area_sub,
+ bl->m,bl->x-ar,bl->y-ar,bl->x+ar,bl->y+ar,0,
+ src,skillid,skilllv,tick,flag|BCT_ENEMY,
+ skill_area_sub_count);
+ break;
+ case MG_FIREBALL:
+ ar = 2;
+ skill_area_temp[2]=bl->x;
+ skill_area_temp[3]=bl->y;
+ /* ターゲットに攻撃を加える(スキルエフェクト表示) */
+ skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,
+ skill_area_temp[0]);
+ break;
+ case WZ_SIGHTRASHER:
+ default:
+ ar = 3;
+ bl = src;
+ status_change_end(src,SC_SIGHT,-1);
+ break;
}
- /* まずタ?ゲットに攻?を加える */
- skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,
- skill_area_temp[0] );
- /* その後タ?ゲット以外の範??の敵全?に?理を行う */
+ if (skillid==WZ_SIGHTRASHER) {
+ /* スキルエフェクト表示 */
+ clif_skill_nodamage(src,bl,skillid,skilllv,1);
+ } else {
+ /* ターゲットに攻撃を加える(スキルエフェクト表示) */
+ skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,
+ skill_area_temp[0]);
+ }
+ /* ターゲット以外の範囲内の敵全体に処理を行う */
map_foreachinarea(skill_area_sub,
- bl->m,bl->x-ar,bl->y-ar,bl->x+ar,bl->y+ar,0,
- src,skillid,skilllv,tick, flag|BCT_ENEMY|1,
- skill_castend_damage_id);
+ bl->m,bl->x-ar,bl->y-ar,bl->x+ar,bl->y+ar,0,
+ src,skillid,skilllv,tick, flag|BCT_ENEMY|1,
+ skill_castend_damage_id);
}
break;
@@ -2528,12 +2551,6 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s
map_foreachinarea(skill_attack_area,src->m,src->x-5,bl->y-5,bl->x+5,bl->y+5,0,BF_MAGIC,src,src,skillid,skilllv,tick,flag,BCT_ENEMY);
break;
- case WZ_SIGHTRASHER:
- clif_skill_nodamage(src,bl,skillid,skilllv,1);
- skill_castend_pos2(src,bl->x,bl->y,skillid,skilllv,tick,0);
- status_change_end(src,SC_SIGHT,-1);
- break;
-
/* その他 */
case HT_BLITZBEAT: /* ブリッツビ?ト */
if(flag&1){
@@ -4688,7 +4705,6 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
nullpo_retr(0, sd=(struct map_session_data *)src);
}
if( skillid != WZ_METEOR &&
- skillid != WZ_SIGHTRASHER &&
skillid != AM_CANNIBALIZE &&
skillid != AM_SPHEREMINE)
clif_skill_poseffect(src,skillid,skilllv,x,y,tick);
@@ -4739,7 +4755,6 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil
case AL_PNEUMA: /* ニュ?マ */
case WZ_ICEWALL: /* アイスウォ?ル */
case WZ_FIREPILLAR: /* ファイアピラ? */
- case WZ_SIGHTRASHER:
case WZ_QUAGMIRE: /* クァグマイア */
case WZ_VERMILION: /* ロ?ドオブヴァ?ミリオン */
//case WZ_FROSTNOVA: /* フロストノヴァ */
@@ -5007,349 +5022,137 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma
struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,int skilllv,int x,int y,int flag)
{
struct skill_unit_group *group;
- int i,count=1,limit=10000,val1=0,val2=0;
- int target=BCT_ENEMY,interval=1000,range=0;
- int dir=0,aoe_diameter=0; // -- aoe_diameter (moonsoul) added for sage Area Of Effect skills
+ int i,limit,val1=0,val2=0,val3=0;
+ int count=0;
+ int target,interval,range,unit_flag;
+ struct skill_unit_layout *layout;
struct status_change *sc_data;
nullpo_retr(0, src);
+ limit = skill_get_time(skillid,skilllv);
+ range = skill_get_unit_range(skillid);
+ interval = skill_get_unit_interval(skillid);
+ target = skill_get_unit_target(skillid);
+ unit_flag = skill_get_unit_flag(skillid);
+ layout = skill_get_unit_layout(skillid,skilllv,src,x,y);
+
+ if (unit_flag&UF_DEFNOTENEMY && battle_config.defnotenemy)
+ target = BCT_NOENEMY;
+
sc_data = status_get_sc_data(src); // for firewall and fogwall - celest
switch(skillid){ /* 設定 */
case MG_SAFETYWALL: /* セイフティウォ?ル */
- limit=skill_get_time(skillid,skilllv);
val2=skilllv+1;
- interval = -1;
- target=(battle_config.defnotenemy)?BCT_NOENEMY:BCT_ALL;
break;
-
case MG_FIREWALL: /* ファイヤ?ウォ?ル */
- if(src->x == x && src->y == y)
- dir = 2;
- else
- dir=map_calc_dir(src,x,y);
- if(dir&1) count=5;
- else count=3;
- limit=skill_get_time(skillid,skilllv);
- if(sc_data) {
- if (sc_data[SC_VIOLENTGALE].timer!=-1) limit = limit*3/2;
- }
- // check for sc_data first - Celest
- // if (((struct map_session_data *)src)->sc_data[SC_VIOLENTGALE].timer!=-1)
- // limit *= 1.5;
+ if(sc_data && sc_data[SC_VIOLENTGALE].timer!=-1)
+ limit = limit*3/2;
val2=4+skilllv;
- interval=1;
- break;
-
- case AL_PNEUMA: /* ニュ?マ */
- limit=skill_get_time(skillid,skilllv);
- interval = -1;
- target=(battle_config.defnotenemy)?BCT_NOENEMY:BCT_ALL;
- count = 9;
break;
case AL_WARP: /* ワ?プポ?タル */
- target=BCT_ALL;
val1=skilllv+6;
if(flag==0)
limit=2000;
- else
- limit=skill_get_time(skillid,skilllv);
break;
case PR_SANCTUARY: /* サンクチュアリ */
- count=21;
- limit=skill_get_time(skillid,skilllv);
val1=(skilllv+3)*2;
val2=(skilllv>6)?777:skilllv*100;
- target=BCT_ALL;
- range=1;
- break;
-
- case PR_MAGNUS: /* マグヌスエクソシズム */
- count=33;
- limit=skill_get_time(skillid,skilllv);
- interval=3000;
+ interval += 500;
break;
case WZ_FIREPILLAR: /* ファイア?ピラ? */
- if(flag==0)
- limit=skill_get_time(skillid,skilllv);
- else
+ if(flag!=0)
limit=1000;
- interval=2000;
val1=skilllv+2;
- if(skilllv < 6)
- range=1;
- else
+ if(skilllv >= 6)
range=2;
break;
- case MG_THUNDERSTORM: /* サンダ?スト?ム */
- limit=500;
- range=1;
- break;
-
- //case WZ_FROSTNOVA: /* フロストノヴァ */
- // limit=500;
- // range=5;
- // break;
-
- case WZ_HEAVENDRIVE: /* ヘヴンズドライブ */
- limit=500;
- range=2;
- break;
-
- case WZ_METEOR: /* メテオスト?ム */
- limit=500;
- range=3;
- break;
-
- case WZ_SIGHTRASHER:
- limit=500;
- count=41;
- break;
-
- case WZ_VERMILION: /* ロ?ドオブヴァ?ミリオン */
- limit=4100;
- interval=1000;
- range=6;
- break;
-
- case WZ_ICEWALL: /* アイスウォ?ル */
- limit=skill_get_time(skillid,skilllv);
- count=5;
- break;
-
- case WZ_STORMGUST: /* スト?ムガスト */
- limit=4600;
- interval=450;
- range=5;
- break;
-
- case WZ_QUAGMIRE: /* クァグマイア */
- limit=skill_get_time(skillid,skilllv);
- interval=200;
- count=25;
- break;
-
case HT_SANDMAN: /* サンドマン */
case HT_CLAYMORETRAP: /* クレイモア?トラップ */
- limit=skill_get_time(skillid,skilllv);
- // longer trap times in WOE [celest]
- if (map[src->m].flag.gvg) limit *= 4;
- range=2;
- break;
case HT_SKIDTRAP: /* スキッドトラップ */
case HT_LANDMINE: /* ランドマイン */
case HT_ANKLESNARE: /* アンクルスネア */
- case PF_SPIDERWEB: /* スパイダ?ウェッブ */
case HT_FLASHER: /* フラッシャ? */
case HT_FREEZINGTRAP: /* フリ?ジングトラップ */
case HT_BLASTMINE: /* ブラストマイン */
- limit=skill_get_time(skillid,skilllv);
// longer trap times in WOE [celest]
- if (skillid != PF_SPIDERWEB && map[src->m].flag.gvg)
- limit *= 4;
- range=1;
- break;
-
- case HT_TALKIEBOX: /* ト?キ?ボックス */
- limit=skill_get_time(skillid,skilllv);
- range=1;
- target=BCT_ALL;
+ if (map[src->m].flag.gvg) limit *= 4;
break;
-
case HT_SHOCKWAVE: /* ショックウェ?ブトラップ */
- limit=skill_get_time(skillid,skilllv);
- range=1;
val1=skilllv*15+10;
break;
- case AS_VENOMDUST: /* ベノムダスト */
- limit=skill_get_time(skillid,skilllv);
- interval=1000;
- count=5;
- break;
-
- case CR_GRANDCROSS: /* グランドクロス */
- case NPC_DARKGRANDCROSS: /*闇グランドクロス*/
- count=29;
- limit=1000;
- interval=300;
- break;
-
- case SA_VOLCANO: /* ボルケ?ノ */
- case SA_DELUGE: /* デリュ?ジ */
- case SA_VIOLENTGALE: /* バイオレントゲイル */
- limit=skill_get_time(skillid,skilllv);
- //count=skilllv<=2?25:(skilllv<=4?49:81);
- count=49;
- target=BCT_ALL;
- break;
-
case SA_LANDPROTECTOR: /* グランドクロス */
- limit=skill_get_time(skillid,skilllv); // changed to get duration from cast_db (moonsoul)
- val1=skilllv*15+10;
- aoe_diameter=skilllv+skilllv%2+5;
- target=BCT_ALL;
- count=aoe_diameter*aoe_diameter; // -- this will not function if changed to ^2 (moonsoul)
- break;
-
- case BD_LULLABY: /* 子守唄 */
- case BD_ETERNALCHAOS: /* エタ?ナルカオス */
- case BD_ROKISWEIL: /* ロキの叫び */
- count=81;
- limit=skill_get_time(skillid,skilllv);
- range=5;
- target=(skillid==BD_ETERNALCHAOS ? BCT_ENEMY : BCT_ALL);
- break;
- case BD_RICHMANKIM:
- case BD_DRUMBATTLEFIELD: /* ?太鼓の響き */
- case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 */
- case BD_INTOABYSS: /* 深淵の中に */
- case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド */
- count=81;
- limit=skill_get_time(skillid,skilllv);
- range=5;
- target=BCT_PARTY;
+ {
+ int aoe_diameter; // -- aoe_diameter (moonsoul) added for sage Area Of Effect skills
+ val1=skilllv*15+10;
+ aoe_diameter=skilllv+skilllv%2+5;
+ count=aoe_diameter*aoe_diameter; // -- this will not function if changed to ^2 (moonsoul)
+ }
break;
case BA_WHISTLE: /* 口笛 */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON)+1)>>1;
val2 = ((status_get_agi(src)/10)&0xffff)<<16;
val2 |= (status_get_luk(src)/10)&0xffff;
break;
case DC_HUMMING: /* ハミング */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1;
val2 = status_get_dex(src)/10;
break;
-
- case BA_DISSONANCE: /* 不協和音 */
- case DC_UGLYDANCE: /* 自分勝手なダンス */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_ENEMY;
- break;
-
case DC_DONTFORGETME: /* 私を忘れないで… */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_ENEMY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1;
val2 = ((status_get_str(src)/20)&0xffff)<<16;
val2 |= (status_get_agi(src)/10)&0xffff;
break;
case BA_POEMBRAGI: /* ブラギの詩 */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON);
val2 = ((status_get_dex(src)/10)&0xffff)<<16;
val2 |= (status_get_int(src)/5)&0xffff;
break;
case BA_APPLEIDUN: /* イドゥンの林檎 */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = ((pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON))&0xffff)<<16;
- else
- val1 = 0;
- val1 |= (status_get_vit(src))&0xffff;
- val2 = 0;//回復用タイムカウンタ(6秒?に1?加)
+ val2 |= (status_get_vit(src))&0xffff;
+ val3 = 0;//回復用タイムカウンタ(6秒?に1?加)
break;
case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_PARTY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1;
val2 = status_get_int(src)/10;
break;
case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON)+1)>>1;
val2 = status_get_agi(src)/20;
break;
case DC_FORTUNEKISS: /* 幸運のキス */
- count=49;
- limit=skill_get_time(skillid,skilllv);
- range=3;
- target=BCT_NOENEMY;
if(src->type == BL_PC)
val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1;
val2 = status_get_luk(src)/10;
break;
- case AM_DEMONSTRATION: /* デモンストレ?ション */
- limit=skill_get_time(skillid,skilllv);
- interval=1000;
- range=1;
- target=BCT_ENEMY;
- break;
-
- case WE_CALLPARTNER: /* あなたに逢いたい */
- limit=skill_get_time(skillid,skilllv);
- range=-1;
- break;
-
case HP_BASILICA: /* バジリカ */
- limit=skill_get_time(skillid,skilllv);
- target=BCT_ALL;
- range=3;
//Fix to prevent the priest from walking while Basilica is up.
battle_stopwalking(src,1);
- //status_change_start(src,SC_ANKLE,skilllv,0,0,0,limit,0);
- //sd->canmove_tick = gettick() + limit; // added later [celest]
- break;
-
- case PA_GOSPEL: /* ゴスペル */
- count=49;
- target=BCT_PARTY;
- limit=skill_get_time(skillid,skilllv);
break;
-/* case CG_MOONLIT:
- range=1;
- target=BCT_ALL;
- limit=skill_get_time(skillid,skilllv);
- break;*/
-
case PF_FOGWALL: /* フォグウォ?ル */
- count=15;
- limit=skill_get_time(skillid,skilllv);
- if(sc_data) {
- if (sc_data[SC_DELUGE].timer!=-1) limit *= 2;
- }
+ if(sc_data && sc_data[SC_DELUGE].timer!=-1) limit *= 2;
break;
case RG_GRAFFITI: /* Graffiti */
count=1; // Leave this at 1 [Valaris]
- limit=600000; // Time length [Valaris]
break;
case GD_LEADERSHIP:
@@ -5360,20 +5163,16 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
target=BCT_ALL;
limit=300000;
break;
-
- default:
- if(battle_config.error_log)
- printf ("skill_unitsetting: Unknown skill id = %d\n",skillid);
- return 0;
}
- nullpo_retr(NULL, group=skill_initunitgroup(src,count,skillid,skilllv,skill_get_unit_id(skillid,flag&1)));
+ nullpo_retr(NULL, group=skill_initunitgroup(src,(count > 0 ? count : layout->count),
+ skillid,skilllv,skill_get_unit_id(skillid,flag&1)));
group->limit=limit;
group->val1=val1;
group->val2=val2;
+ group->val3=val3;
group->target_flag=target;
group->interval=interval;
- group->range=range;
if(skillid==HT_TALKIEBOX ||
skillid==RG_GRAFFITI){
group->valstr=aCallocA(80, 1);
@@ -5383,200 +5182,20 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
}
memcpy(group->valstr,talkie_mes,80);
}
- for(i=0;i<count;i++){
+ for(i=0;i<layout->count;i++){
struct skill_unit *unit;
- int ux=x,uy=y,val1=skilllv,val2=0,limit=group->limit,alive=1;
- int range=group->range;
- switch(skillid){ /* 設定 */
- case AL_PNEUMA: /* ニュ?マ */
- {
- static const int dx[9]={-1, 0, 1,-1, 0, 1,-1, 0, 1};
- static const int dy[9]={-1,-1,-1, 0, 0, 0, 1, 1, 1};
- ux+=dx[i];
- uy+=dy[i];
- }
- break;
+ int ux,uy,val1=skilllv,val2=0,limit=group->limit,alive=1;
+ ux = x + layout->dx[i];
+ uy = y + layout->dy[i];
+ switch (skillid) {
case MG_FIREWALL: /* ファイヤ?ウォ?ル */
- {
- if(dir&1){ /* 斜め配置 */
- static const int dx[][5]={
- { 1,1,0,0,-1 }, { -1,-1,0,0,1 },
- },dy[][5]={
- { 1,0,0,-1,-1 }, { 1,0,0,-1,-1 },
- };
- ux+=dx[(dir>>1)&1][i];
- uy+=dy[(dir>>1)&1][i];
- }else{ /* 上下配置 */
- if(dir%4==0) /* 上下 */
- ux+=i-1;
- else /* 左右 */
- uy+=i-1;
- }
- val2=group->val2;
- }
- break;
-
- case PR_SANCTUARY: /* サンクチュアリ */
- {
- static const int dx[]={
- -1,0,1, -2,-1,0,1,2, -2,-1,0,1,2, -2,-1,0,1,2, -1,0,1 };
- static const int dy[]={
- -2,-2,-2, -1,-1,-1,-1,-1, 0,0,0,0,0, 1,1,1,1,1, 2,2,2, };
- ux+=dx[i];
- uy+=dy[i];
- }
- break;
-
- case PR_MAGNUS: /* マグヌスエクソシズム */
- {
- static const int dx[]={ -1,0,1, -1,0,1, -3,-2,-1,0,1,2,3,
- -3,-2,-1,0,1,2,3, -3,-2,-1,0,1,2,3, -1,0,1, -1,0,1, };
- static const int dy[]={
- -3,-3,-3, -2,-2,-2, -1,-1,-1,-1,-1,-1,-1,
- 0,0,0,0,0,0,0, 1,1,1,1,1,1,1, 2,2,2, 3,3,3 };
- ux+=dx[i];
- uy+=dy[i];
- }
+ val2=group->val2;
break;
-
- case WZ_SIGHTRASHER:
- {
- static const int dx[]={
- -5, 0, 5, -4, 0, 4, -3, 0, 3, -2, 0, 2, -1, 0, 1, -5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, -1, 0, 1, -2, 0, 2, -3, 0, 3, -4, 0, 4, -5, 0, 5 };
- static const int dy[]={
- -5,-5,-5, -4,-4,-4, -3,-3,-3, -2,-2,-2, -1,-1,-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5 };
- ux+=dx[i];
- uy+=dy[i];
- }
- break;
-
case WZ_ICEWALL: /* アイスウォ?ル */
- {
- static const int dirx[8]={0,-1,-1,-1,0,1,1,1};
- static const int diry[8]={1,1,0,-1,-1,-1,0,1};
if(skilllv <= 1)
val1 = 500;
else
val1 = 200 + 200*skilllv;
- if(src->x == x && src->y == y)
- dir = 2;
- else
- dir=map_calc_dir(src,x,y);
- ux+=(2-i)*diry[dir];
- uy+=(i-2)*dirx[dir];
- }
- break;
-
- case WZ_QUAGMIRE: /* クァグマイア */
- ux+=(i%5-2);
- uy+=(i/5-2);
- if(i==12)
- range=2;
- else
- range=-1;
-
- break;
-
- case AS_VENOMDUST: /* ベノムダスト */
- {
- static const int dx[]={-1,0,0,0,1};
- static const int dy[]={0,-1,0,1,0};
- ux+=dx[i];
- uy+=dy[i];
- }
- break;
-
- case CR_GRANDCROSS: /* グランドクロス */
- case NPC_DARKGRANDCROSS: /*闇グランドクロス*/
- {
- static const int dx[]={
- 0, 0, -1,0,1, -2,-1,0,1,2, -4,-3,-2,-1,0,1,2,3,4, -2,-1,0,1,2, -1,0,1, 0, 0, };
- static const int dy[]={
- -4, -3, -2,-2,-2, -1,-1,-1,-1,-1, 0,0,0,0,0,0,0,0,0, 1,1,1,1,1, 2,2,2, 3, 4, };
- ux+=dx[i];
- uy+=dy[i];
- }
- break;
- case SA_VOLCANO: /* ボルケ?ノ */
- case SA_DELUGE: /* デリュ?ジ */
- case SA_VIOLENTGALE: /* バイオレントゲイル */
- {
- int u_range=0,central=0;
- if(skilllv<=2){
- u_range=2;
- central=12;
- }else if(skilllv<=4){
- u_range=3;
- central=24;
- }else if(skilllv>=5){
- u_range=4;
- central=40;
- }
- ux+=(i%(u_range*2+1)-u_range);
- uy+=(i/(u_range*2+1)-u_range);
-
- if(i==central)
- range=u_range;//中央のユニットの?果範?は全範?
- else
- range=-1;//中央以外のユニットは飾り
- }
- break;
- case SA_LANDPROTECTOR: /* ランドプロテクタ? */
- {
- int u_range=0;
-
- if(skilllv<=2) u_range=3;
- else if(skilllv<=4) u_range=4;
- else if(skilllv>=5) u_range=5;
-
- ux+=(i%(u_range*2+1)-u_range);
- uy+=(i/(u_range*2+1)-u_range);
-
- range=0;
- }
- break;
-
- /* ダンスなど */
- case BD_LULLABY: /* 子守歌 */
- case BD_RICHMANKIM: /* ニヨルドの宴 */
- case BD_ETERNALCHAOS: /* 永遠の混沌 */
- case BD_DRUMBATTLEFIELD:/* ?太鼓の響き */
- case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 */
- case BD_ROKISWEIL: /* ロキの叫び */
- case BD_INTOABYSS: /* 深淵の中に */
- case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド */
- ux+=(i%9-4);
- uy+=(i/9-4);
- if(i==40)
- range=4; /* 中心の場合は範?を4にオ?バ?ライド */
- else
- range=-1; /* 中心じゃない場合は範?を-1にオ?バ?ライド */
- break;
- case BA_DISSONANCE: /* 不協和音 */
- case BA_WHISTLE: /* 口笛 */
- case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス */
- case BA_POEMBRAGI: /* ブラギの詩 */
- case BA_APPLEIDUN: /* イドゥンの林檎 */
- case DC_UGLYDANCE: /* 自分勝手なダンス */
- case DC_HUMMING: /* ハミング */
- case DC_DONTFORGETME: /* 私を忘れないで… */
- case DC_FORTUNEKISS: /* 幸運のキス */
- case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? */
-// case CG_MOONLIT:
- ux+=(i%7-3);
- uy+=(i/7-3);
- if(i==40)
- range=4; /* 中心の場合は範?を4にオ?バ?ライド */
- else
- range=-1; /* 中心じゃない場合は範?を-1にオ?バ?ライド */
- break;
- case PA_GOSPEL: /* ゴスペル */
- ux+=(i%7-3);
- uy+=(i/7-3);
- break;
- case PF_FOGWALL: /* フォグウォ?ル */
- ux+=(i%5-2);
- uy+=(i/5-1);
break;
case RG_GRAFFITI: /* Graffiti [Valaris] */
ux+=(i%5-2);
@@ -5603,7 +5222,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
unit->val2=val2;
unit->limit=limit;
unit->range=range;
-
+
// [celest]
if (sc_data) {
// attach the unit's id to the caster
@@ -5642,6 +5261,10 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,
break;
}
}
+ if (range==0)
+ map_foreachinarea(skill_unit_effect,unit->bl.m
+ ,unit->bl.x,unit->bl.y,unit->bl.x,unit->bl.y
+ ,0,&unit->bl,gettick(),1);
}
}
return group;
@@ -5655,123 +5278,284 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
{
struct skill_unit_group *sg;
struct block_list *ss;
- struct skill_unit_group_tickset *ts;
- struct map_session_data *srcsd=NULL;
- int diff,goflag,splash_count=0;
+ struct skill_unit *unit2;
struct status_change *sc_data;
+ int type;
nullpo_retr(0, src);
nullpo_retr(0, bl);
- sc_data = status_get_sc_data(bl);
-
- if( bl->prev==NULL || !src->alive || (bl->type == BL_PC && pc_isdead((struct map_session_data *)bl) ) )
+
+ if(bl->prev==NULL || !src->alive ||
+ (bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)))
return 0;
nullpo_retr(0, sg=src->group);
nullpo_retr(0, ss=map_id2bl(sg->src_id));
+
+ sc_data = status_get_sc_data(bl);
+ type = SkillStatusChangeTable[sg->skill_id];
- if(ss->type == BL_PC)
- nullpo_retr(0, srcsd=(struct map_session_data *)ss);
- if(srcsd && srcsd->chatID)
+ if (battle_check_target(&src->bl,bl,sg->target_flag)<=0)
return 0;
- if( bl->type != BL_PC && bl->type != BL_MOB )
+ // 対象がLP上に居る場合は無効
+ if (map_find_skill_unit_oncell(bl,bl->x,bl->y,SA_LANDPROTECTOR,NULL))
return 0;
- nullpo_retr(0, ts = skill_unitgrouptickset_search(bl, sg));
- diff=DIFF_TICK(tick,ts->tick);
- goflag=(diff>sg->interval || diff<0);
- if (sg->skill_id == CR_GRANDCROSS && !battle_config.gx_allhit) // 重なっていたら3HITしない
- goflag = (diff>sg->interval*map_count_oncell(bl->m,bl->x,bl->y) || diff<0);
- //?象がLP上に居る場合は無?
- map_foreachinarea(skill_landprotector,bl->m,bl->x,bl->y,bl->x,bl->y,BL_SKILL,0,&goflag);
+ switch (sg->unit_id) {
+ case 0x85: /* ニューマ */
+ case 0x7e: /* セイフティウォール */
+ if (sc_data && sc_data[type].timer == -1)
+ status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0);
+ break;
- if(!goflag)
- return 0;
- ts->tick=tick;
+ case 0x80: /* ワープポータル(発動後) */
+ if(bl->type==BL_PC){
+ struct map_session_data *sd = (struct map_session_data *)bl;
+ if(sd && src->bl.m == bl->m && src->bl.x == bl->x && src->bl.y == bl->y &&
+ src->bl.x == sd->to_x && src->bl.y == sd->to_y) {
+ if( battle_config.chat_warpportal || !sd->chatID ){
+ pc_setpos(sd,sg->valstr,sg->val2>>16,sg->val2&0xffff,3);
+ if(sg->src_id == bl->id || (strcmp(map[src->bl.m].name,sg->valstr) == 0 &&
+ src->bl.x == (sg->val2>>16) && src->bl.y == (sg->val2&0xffff) ))
+ skill_delunitgroup(sg);
+ if (--sg->val1<=0)
+ skill_delunitgroup(sg);
+ }
+ }
+ } else if(bl->type==BL_MOB && battle_config.mob_warpportal){
+ int m = map_mapname2mapid(sg->valstr);
+ mob_warp((struct mob_data *)bl,m,sg->val2>>16,sg->val2&0xffff,3);
+ }
+ break;
- switch(sg->unit_id){
- case 0x83: /* サンクチュアリ */
- {
- int race=status_get_race(bl);
- int damage_flag = (battle_check_undead(race,status_get_elem_type(bl)) || race == 6)? 1:0;
+ case 0x8e: /* クァグマイア */
+ if(bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage )
+ break;
+ if(sc_data && sc_data[type].timer==-1)
+ status_change_start(bl,type,sg->skill_lv,(int)src,0,0,
+ skill_get_time2(sg->skill_id,sg->skill_lv),0);
+ break;
- if( status_get_hp(bl)>=status_get_max_hp(bl) && !damage_flag)
+ case 0x9a: /* ボルケ?ノ */
+ case 0x9b: /* デリュ?ジ */
+ case 0x9c: /* バイオレントゲイル */
+ if (sc_data && sc_data[type].timer!=-1) {
+ unit2 = (struct skill_unit *)sc_data[type].val4;
+ if (unit2 && unit2->group &&
+ (unit2==src || DIFF_TICK(sg->tick,unit2->group->tick)<=0))
break;
-
- if((sg->val1--)<=0){
- skill_delunitgroup(sg);
- return 0;
- }
- if(!damage_flag) {
- int heal=sg->val2;
- if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage)
- heal=0; /* ?金蟲カ?ド(ヒ?ル量0) */
- clif_skill_nodamage(&src->bl,bl,AL_HEAL,heal,1);
- battle_heal(NULL,bl,heal,0,0);
- }
- else {
- // reduce healing count if this was meant for damaging [celest]
- sg->val1 /= 2;
- skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
- }
}
+ status_change_start(bl,type,sg->skill_lv,(int)src,0,0,
+ skill_get_time2(sg->skill_id,sg->skill_lv),0);
break;
- case 0x84: /* マグヌスエクソシズム */
- {
- int race=status_get_race(bl);
- int damage_flag = (battle_check_undead(race,status_get_elem_type(bl)) || race == 6)? 1:0;
+ case 0x9e: /* 子守唄 */
+ case 0x9f: /* ニヨルドの宴 */
+ case 0xa0: /* 永遠の混沌 */
+ case 0xa1: /* ?太鼓の響き */
+ case 0xa2: /* ニ?ベルングの指輪 */
+ case 0xa3: /* ロキの叫び */
+ case 0xa4: /* 深淵の中に */
+ case 0xa5: /* 不死身のジ?クフリ?ド */
+ case 0xa6: /* 不協和音 */
+ case 0xa7: /* 口笛 */
+ case 0xa8: /* 夕陽のアサシンクロス */
+ case 0xa9: /* ブラギの詩 */
+ case 0xaa: /* イドゥンの林檎 */
+ case 0xab: /* 自分勝手なダンス */
+ case 0xac: /* ハミング */
+ case 0xad: /* 私を忘れないで… */
+ case 0xae: /* 幸運のキス */
+ case 0xaf: /* サ?ビスフォ?ユ? */
+ case 0xb4:
+ if (sg->src_id==bl->id)
+ break;
+ if (sc_data && sc_data[type].timer!=-1) {
+ unit2 = (struct skill_unit *)sc_data[type].val4;
+ if (unit2 && unit2->group &&
+ (unit2 == src || DIFF_TICK(sg->tick,unit2->group->tick)<=0))
+ break;
+ }
+ status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
+ (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
+ break;
- if(!damage_flag)
- return 0;
- skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ case 0xb6: /* フォグウォ?ル */
+ if (sc_data && sc_data[type].timer!=-1) {
+ unit2 = (struct skill_unit *)sc_data[type].val4;
+ if (unit2 && unit2->group &&
+ (unit2 == src || DIFF_TICK(sg->tick,unit2->group->tick)<=0))
+ break;
}
+ status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
+ (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
+ skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick);
break;
- case 0x85: /* ニュ?マ */
+ // New guild skills [Celest]
+ case 0xc1: // GD_LEADERSHIP
{
- struct skill_unit *unit2;
- int type=SC_PNEUMA;
- if(sc_data) {
- if (sc_data[type].timer==-1)
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0);
- else if((unit2 = (struct skill_unit *)sc_data[type].val2) && unit2 != src){
- if(unit2 && unit2->group && DIFF_TICK(sg->tick,unit2->group->tick) > 0)
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0);
- ts->tick-=sg->interval;
+ struct map_session_data *sd, *tsd;
+ tsd=(struct map_session_data *)ss;
+ if (tsd && (sd=(struct map_session_data *)bl) &&
+ sd->status.guild_id == tsd->status.guild_id &&
+ sd != tsd) {
+ sd->state.leadership_flag = (int)src;
+ status_calc_pc (sd, 0);
}
- }
}
break;
- case 0x7e: /* セイフティウォ?ル */
- if (sc_data) {
- status_change_start(bl,SC_SAFETYWALL,sg->skill_lv,(int)src,0,0,0,0);
- ts->tick-=sg->interval;
+ case 0xc2: // GD_GLORYWOUNDS
+ {
+ struct map_session_data *sd, *tsd;
+ tsd=(struct map_session_data *)ss;
+ if (tsd && (sd=(struct map_session_data *)bl) &&
+ sd->status.guild_id == tsd->status.guild_id &&
+ sd != tsd) {
+ sd->state.glorywounds_flag = (int)src;
+ status_calc_pc (sd, 0);
+ }
+ }
+ break;
+ case 0xc3: // GD_SOULCOLD
+ {
+ struct map_session_data *sd, *tsd;
+ tsd=(struct map_session_data *)ss;
+ if (tsd && (sd=(struct map_session_data *)bl) &&
+ sd->status.guild_id == tsd->status.guild_id &&
+ sd != tsd) {
+ sd->state.soulcold_flag = (int)src;
+ status_calc_pc (sd, 0);
+ }
+ }
+ break;
+ case 0xc4: // GD_HAWKEYES
+ {
+ struct map_session_data *sd, *tsd;
+ tsd=(struct map_session_data *)ss;
+ if (tsd && (sd=(struct map_session_data *)bl) &&
+ sd->status.guild_id == tsd->status.guild_id &&
+ sd != tsd) {
+ sd->state.hawkeyes_flag = (int)src;
+ status_calc_pc (sd, 0);
+ }
}
break;
- case 0x86: /* ロ?ドオブヴァ?ミリオン(&スト?ムガスト &グランドクロス) */
- skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ case 0xb2: /* あなたを_?いたいです */
+ case 0xb3: /* ゴスペル */
+ //case 0xb6: /* フォグウォ?ル */ - moved [celest]
+ //とりあえず何もしない
break;
+ /* default:
+ if(battle_config.error_log)
+ printf("skill_unit_onplace: Unknown skill unit id=%d block=%d\n",sg->unit_id,bl->id);
+ break;*/
+ }
+
+ return 0;
+}
+
+/*==========================================
+ * スキルユニットの発動イベント(タイマー発動)
+ *------------------------------------------
+ */
+int skill_unit_onplace_timer(struct skill_unit *src,struct block_list *bl,unsigned int tick)
+{
+ struct skill_unit_group *sg;
+ struct block_list *ss;
+ int splash_count=0;
+ struct status_change *sc_data;
+ struct skill_unit_group_tickset *ts;
+ int type;
+ int diff=0;
+
+ nullpo_retr(0, src);
+ nullpo_retr(0, bl);
+
+ if (bl->type!=BL_PC && bl->type!=BL_MOB)
+ return 0;
+
+ if (bl->prev==NULL || !src->alive ||
+ (bl->type==BL_PC && pc_isdead((struct map_session_data *)bl)))
+ return 0;
+
+ nullpo_retr(0, sg=src->group);
+ nullpo_retr(0, ss=map_id2bl(sg->src_id));
+ sc_data = status_get_sc_data(bl);
+ type = SkillStatusChangeTable[sg->skill_id];
+
+ // 対象がLP上に居る場合は無効
+ if (map_find_skill_unit_oncell(bl,bl->x,bl->y,SA_LANDPROTECTOR,NULL))
+ return 0;
+
+ // 前に影響を受けてからintervalの間は影響を受けない
+ nullpo_retr(0,ts = skill_unitgrouptickset_search(bl,sg,tick));
+ diff = DIFF_TICK(tick,ts->tick);
+ if (sg->skill_id == PR_SANCTUARY)
+ diff += 500; // 新規に回復したユニットだけカウントするための仕掛け
+ if (diff < 0)
+ return 0;
+ ts->tick = tick+sg->interval;
+ // GXは重なっていたら3HITしない
+ if (sg->skill_id==CR_GRANDCROSS && !battle_config.gx_allhit)
+ ts->tick += sg->interval*(map_count_oncell(bl->m,bl->x,bl->y)-1);
+
+ switch (sg->unit_id) {
+ case 0x83: /* サンクチュアリ */
+ {
+ int race=status_get_race(bl);
- case 0x7f: /* ファイヤ?ウォ?ル */
- if( (src->val2--)>0)
- skill_attack(BF_MAGIC,ss,&src->bl,bl,
- sg->skill_id,sg->skill_lv,tick,0);
- if( src->val2<=0 )
+ if (battle_check_undead(race,status_get_elem_type(bl)) || race==6) {
+ if (skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0)) {
+ // reduce healing count if this was meant for damaging [celest]
+ // sg->val1 /= 2;
+ sg->val1--; // チャットキャンセルに対応
+ }
+ } else {
+ int heal = sg->val2;
+ if (status_get_hp(bl)>=status_get_max_hp(bl))
+ break;
+ if(bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage)
+ heal=0; /* 黄金蟲カード(ヒール量0) */
+ clif_skill_nodamage(&src->bl,bl,AL_HEAL,heal,1);
+ battle_heal(NULL,bl,heal,0,0);
+ if (diff>=500)
+ sg->val1--; // 新規に入ったユニットだけカウント
+ }
+ if (sg->val1<=0)
+ skill_delunitgroup(sg);
+ break;
+ }
+
+ case 0x84: /* マグヌスエクソシズム */
+ {
+ int race = status_get_race(bl);
+ if (!battle_check_undead(race,status_get_elem_type(bl)) && race!=6)
+ return 0;
+ skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ src->val2++;
+ break;
+ }
+
+ case 0x7f: /* ファイヤーウォール */
+ skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ if (--src->val2<=0)
skill_delunit(src);
break;
-
- case 0x87: /* ファイア?ピラ?(?動前) */
+ case 0x86: /* ロードオブヴァーミリオン(TS,MS,FN,SG,HD,GX,闇GX) */
+ skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
+ break;
+ case 0x87: /* ファイアーピラー(発動前) */
skill_delunit(src);
skill_unitsetting(ss,sg->skill_id,sg->skill_lv,src->bl.x,src->bl.y,1);
break;
- case 0x88: /* ファイア?ピラ?(?動後) */
- if(DIFF_TICK(tick,sg->tick) < 150)
- //skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
- map_foreachinarea(skill_attack_area,bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0,BF_MAGIC,ss,&src->bl,sg->skill_id,sg->skill_lv,tick,0,BCT_ENEMY); // area damage [Celest]
+ case 0x88: /* ファイアーピラー(発動後) */
+ map_foreachinarea(skill_attack_area,bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0,
+ BF_MAGIC,ss,&src->bl,sg->skill_id,sg->skill_lv,tick,0,BCT_ENEMY); // area damage [Celest]
+ //skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
break;
case 0x90: /* スキッドトラップ */
@@ -5784,7 +5568,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
clif_changelook(&src->bl,LOOK_BASE,sg->unit_id);
sg->limit=DIFF_TICK(tick,sg->tick)+1500;
}
- break;
+ break;
case 0x93: /* ランドマイン */
skill_attack(BF_MISC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
@@ -5813,22 +5597,22 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
break;
case 0x91: /* アンクルスネア */
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- if(sg->val2==0 && sc_data && sc_data[SC_ANKLE].timer==-1){
- int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE);
- int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - status_get_agi(bl)*100;
- if(status_get_mode(bl)&0x20)
- sec = sec/5;
- if (sec < 3000) // minimum time of 3 seconds [celest]
- sec = 3000;
- battle_stopwalking(bl,1);
- status_change_start(bl,SC_ANKLE,sg->skill_lv,0,0,0,sec,0);
-
+ if(sg->val2==0 && sc_data && sc_data[SC_ANKLE].timer==-1){
+ int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE);
+ int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - status_get_agi(bl)*100;
+ if(status_get_mode(bl)&0x20)
+ sec = sec/5;
+ if (sec < 3000) // minimum time of 3 seconds [celest]
+ sec = 3000;
+ battle_stopwalking(bl,1);
+ status_change_start(bl,SC_ANKLE,sg->skill_lv,0,0,0,sec,0);
+
+ skill_unit_move(bl,tick,0);
if(moveblock) map_delblock(bl);
bl->x = src->bl.x;
bl->y = src->bl.y;
if(moveblock) map_addblock(bl);
+ skill_unit_move(bl,tick,1);
if(bl->type == BL_MOB)
clif_fixmobpos((struct mob_data *)bl);
else if(bl->type == BL_PET)
@@ -5836,156 +5620,26 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
else
clif_fixpos(bl);
clif_01ac(&src->bl);
- sg->limit=DIFF_TICK(tick,sg->tick) + sec;
+ sg->limit=DIFF_TICK(tick,sg->tick) + sec;
sg->val2=bl->id;
- }
- }
- break;
-
- case 0x80: /* ワ?プポ?タル(?動後) */
- if(bl->type==BL_PC){
- struct map_session_data *sd = (struct map_session_data *)bl;
- if(sd && src->bl.m == bl->m && src->bl.x == bl->x && src->bl.y == bl->y && src->bl.x == sd->to_x && src->bl.y == sd->to_y) {
- if( battle_config.chat_warpportal || !sd->chatID ){
- if((sg->val1--)>0){
- pc_setpos(sd,sg->valstr,sg->val2>>16,sg->val2&0xffff,3);
- if(sg->src_id == bl->id ||( strcmp(map[src->bl.m].name,sg->valstr) == 0 && src->bl.x == (sg->val2>>16) && src->bl.y == (sg->val2&0xffff) ))
- skill_delunitgroup(sg);
- }else
- skill_delunitgroup(sg);
- }
- }
- }else if(bl->type==BL_MOB && battle_config.mob_warpportal){
- int m=map_mapname2mapid(sg->valstr);
- struct mob_data *md;
- md=(struct mob_data *)bl;
- mob_warp((struct mob_data *)bl,m,sg->val2>>16,sg->val2&0xffff,3);
+ sg->interval = -1;
+ src->range = 0;
}
break;
- case 0x8e: /* クァグマイア */
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage )
- break;
- if(sc_data && sc_data[type].timer==-1)
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- }
- break;
case 0x92: /* ベノムダスト */
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if(sc_data && sc_data[type].timer==-1 )
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- }
+ if(sc_data && sc_data[type].timer==-1 )
+ status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
break;
- case 0x9a: /* ボルケ?ノ */
- case 0x9b: /* デリュ?ジ */
- case 0x9c: /* バイオレントゲイル */
- {
- struct skill_unit *unit2;
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if(sc_data) {
- if (sc_data[type].timer==-1)
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- else if((unit2=(struct skill_unit *)sc_data[type].val2) && unit2 != src ){
- if(unit2 && unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 )
- status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- ts->tick-=sg->interval;
- }
- }
- } break;
-
- case 0x9e: /* 子守唄 */
- case 0x9f: /* ニヨルドの宴 */
- case 0xa0: /* 永遠の混沌 */
- case 0xa1: /* ?太鼓の響き */
- case 0xa2: /* ニ?ベルングの指輪 */
- case 0xa3: /* ロキの叫び */
- case 0xa4: /* 深淵の中に */
- case 0xa5: /* 不死身のジ?クフリ?ド */
- case 0xa6: /* 不協和音 */
- case 0xa7: /* 口笛 */
- case 0xa8: /* 夕陽のアサシンクロス */
- case 0xa9: /* ブラギの詩 */
- case 0xab: /* 自分勝手なダンス */
- case 0xac: /* ハミング */
- case 0xad: /* 私を忘れないで… */
- case 0xae: /* 幸運のキス */
- case 0xaf: /* サ?ビスフォ?ユ? */
- case 0xb4:
-// case 0xb6: /* フォグウォ?ル */
- {
- struct skill_unit *unit2;
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if(sg->src_id == bl->id)
- break;
- if(sc_data) {
- if (sc_data[type].timer==-1)
- status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- else if( (unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){
- if(unit2 && unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 )
- status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- ts->tick-=sg->interval;
- }
- }
- } break;
-
- case 0xaa: /* イドゥンの林檎 */
- {
- struct skill_unit *unit2;
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if(sg->src_id == bl->id)
- break;
- if(sc_data) {
- if (sc_data[type].timer==-1)
- status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- else if((unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){
- if(unit2 && unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 )
- status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- ts->tick-=sg->interval;
- }
- }
- } break;
-
- case 0xb6: /* フォグウォ?ル */
- {
- struct skill_unit *unit2;
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=SkillStatusChangeTable[sg->skill_id];
- if(sc_data) {
- if (sc_data[type].timer==-1) {
- status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick);
- }
- else if( (unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){
- if(unit2 && unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) {
- status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
- (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0);
- skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick);
- }
-// ts->tick-=sg->interval;
- }
- }
- } break;
case 0xb1: /* デモンストレ?ション */
skill_attack(BF_WEAPON,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0);
if(bl->type == BL_PC && rand()%100 < sg->skill_lv && battle_config.equipment_breaking)
pc_breakweapon((struct map_session_data *)bl);
break;
- case 0x99: /* ト?キ?ボックス */
- if(sg->src_id == bl->id) //自分が踏んでも?動しない
+
+ case 0x99: /* トーキーボックス */
+ if(sg->src_id == bl->id) //自分が踏んでも発動しない
break;
if(sg->val2==0){
clif_talkiebox(&src->bl,sg->valstr);
@@ -5994,76 +5648,41 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
sg->limit=DIFF_TICK(tick,sg->tick)+5000;
sg->val2=-1; //踏んだ
}
- break;
- case 0xb2: /* あなたを_?いたいです */
- case 0xb3: /* ゴスペル */
- //case 0xb6: /* フォグウォ?ル */ - moved [celest]
- //とりあえず何もしない
- break;
+ break;
+
+ //case 0xb4: /* バジリカ */
+ /*if (battle_check_target(&src->bl,bl,BCT_ENEMY)>0 &&
+ !(status_get_mode(bl)&0x20))
+ skill_blown(&src->bl,bl,1);
+ if (sg->src_id==bl->id)
+ break;
+ if (battle_check_target(&src->bl,bl,BCT_NOENEMY)>0) {
+ type = SkillStatusChangeTable[sg->skill_id];
+ status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2,
+ (int)src,sg->interval+100,0);
+ }
+ break;*/
case 0xb7: /* スパイダ?ウェッブ */
if(sg->val2==0){
int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE);
skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick);
+ skill_unit_move(bl,tick,0);
if(moveblock) map_delblock(bl);
- bl->x = (&src->bl)->x;
- bl->y = (&src->bl)->y;
+ bl->x = src->bl.x;
+ bl->y = src->bl.y;
if(moveblock) map_addblock(bl);
- if(bl->type == BL_MOB)
- clif_fixmobpos((struct mob_data *)bl);
- else if(bl->type == BL_PET)
- clif_fixpetpos((struct pet_data *)bl);
- else
- clif_fixpos(bl);
- clif_01ac(&src->bl);
- sg->limit=DIFF_TICK(tick,sg->tick) + skill_get_time2(sg->skill_id,sg->skill_lv);
+ skill_unit_move(bl,tick,1);
+ if(bl->type == BL_MOB)
+ clif_fixmobpos((struct mob_data *)bl);
+ else if(bl->type == BL_PET)
+ clif_fixpetpos((struct pet_data *)bl);
+ else
+ clif_fixpos(bl);
+ sg->limit = DIFF_TICK(tick,sg->tick)+skill_get_time2(sg->skill_id,sg->skill_lv);
sg->val2=bl->id;
- }
- break;
-
- // New guild skills [Celest]
- case 0xc1: // GD_LEADERSHIP
- {
- struct map_session_data *sd;
- if (srcsd && bl->type == BL_PC && (sd=(struct map_session_data *)bl) &&
- sd->status.guild_id == srcsd->status.guild_id &&
- sd != srcsd) {
- sd->state.leadership_flag = (int)src;
- status_calc_pc (sd, 0);
- }
- }
- break;
- case 0xc2: // GD_GLORYWOUNDS
- {
- struct map_session_data *sd;
- if (srcsd && bl->type == BL_PC && (sd=(struct map_session_data *)bl) &&
- sd->status.guild_id == srcsd->status.guild_id &&
- sd != srcsd) {
- sd->state.glorywounds_flag = (int)src;
- status_calc_pc (sd, 0);
- }
- }
- break;
- case 0xc3: // GD_SOULCOLD
- {
- struct map_session_data *sd;
- if (srcsd && bl->type == BL_PC && (sd=(struct map_session_data *)bl) &&
- sd->status.guild_id == srcsd->status.guild_id &&
- sd != srcsd) {
- sd->state.soulcold_flag = (int)src;
- status_calc_pc (sd, 0);
- }
- }
- break;
- case 0xc4: // GD_HAWKEYES
- {
- struct map_session_data *sd;
- if (srcsd && bl->type == BL_PC && (sd=(struct map_session_data *)bl) &&
- sd->status.guild_id == srcsd->status.guild_id &&
- sd != srcsd) {
- sd->state.hawkeyes_flag = (int)src;
- status_calc_pc (sd, 0);
- }
+ sg->interval = -1;
+ src->range = 0;
}
break;
@@ -6072,6 +5691,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
printf("skill_unit_onplace: Unknown skill unit id=%d block=%d\n",sg->unit_id,bl->id);
break;*/
}
+
if(bl->type==BL_MOB && ss!=bl) /* スキル使用?件のMOBスキル */
{
if(battle_config.mob_changetarget_byskill == 1)
@@ -6095,77 +5715,41 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int
int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int tick)
{
struct skill_unit_group *sg;
+ struct status_change *sc_data;
+ int type;
nullpo_retr(0, src);
nullpo_retr(0, bl);
nullpo_retr(0, sg=src->group);
+ sc_data = status_get_sc_data(bl);
+ type = SkillStatusChangeTable[sg->skill_id];
- if( bl->prev==NULL || !src->alive )
- return 0;
-
- if( bl->type!=BL_PC && bl->type!=BL_MOB )
+ if (bl->prev==NULL || !src->alive ||
+ (bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)))
return 0;
switch(sg->unit_id){
- case 0x7e: /* セイフティウォ?ル */
- case 0x85: /* ニュ?マ */
+ case 0x7e: /* セイフティウォール */
+ case 0x85: /* ニューマ */
case 0x8e: /* クァグマイア */
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- int type=
- (sg->unit_id==0x85)?SC_PNEUMA:
- ((sg->unit_id==0x7e)?SC_SAFETYWALL:
- SC_QUAGMIRE);
- if((type != SC_QUAGMIRE || bl->type != BL_MOB) &&
- sc_data && sc_data[type].timer!=-1 && ((struct skill_unit *)sc_data[type].val2)==src){
- status_change_end(bl,type,-1);
- }
- } break;
-
- case 0x91: /* アンクルスネア */
- {
- struct block_list *target=map_id2bl(sg->val2);
- if( target && target==bl ){
- status_change_end(bl,SC_ANKLE,-1);
- sg->limit=DIFF_TICK(tick,sg->tick)+1000;
- }
+ case 0x9a: /* ボルケーノ */
+ case 0x9b: /* デリュージ */
+ case 0x9c: /* バイオレントゲイル */
+ if (type==SC_QUAGMIRE && bl->type==BL_MOB)
+ break;
+ if (sc_data && sc_data[type].timer!=-1 && sc_data[type].val2==(int)src) {
+ status_change_end(bl,type,-1);
}
break;
-// case 0xb5:
- case 0xb8:
- {
- struct block_list *target=map_id2bl(sg->val2);
- if( target==bl )
- status_change_end(bl,SC_SPIDERWEB,-1);
+ case 0x91: /* アンクルスネア */
+ {
+ struct block_list *target = map_id2bl(sg->val2);
+ if(target && target == bl){
+ status_change_end(bl,SC_ANKLE,-1);
sg->limit=DIFF_TICK(tick,sg->tick)+1000;
}
break;
- case 0xb6:
- {
- struct block_list *target=map_id2bl(sg->val2);
- struct status_change *sc_data=status_get_sc_data(bl);
- if( target==bl ) {
- status_change_end(bl,SC_FOGWALL,-1);
- if (sc_data && sc_data[SC_BLIND].timer!=-1)
- sc_data[SC_BLIND].timer = add_timer(
- gettick() + 30000, status_change_timer, bl->id, 0);
- }
- //sg->limit=DIFF_TICK(tick,sg->tick)+1000;
- }
- break;
- case 0x9a: /* ボルケ?ノ */
- case 0x9b: /* デリュ?ジ */
- case 0x9c: /* バイオレントゲイル */
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- struct skill_unit *su;
- int type=SkillStatusChangeTable[sg->skill_id];
- if( sc_data && sc_data[type].timer!=-1 && (su=((struct skill_unit *)sc_data[type].val2)) && su == src ){
- status_change_end(bl,type,-1);
- }
- }
- break;
-
+ }
case 0x9e: /* 子守唄 */
case 0x9f: /* ニヨルドの宴 */
case 0xa0: /* 永遠の混沌 */
@@ -6185,24 +5769,32 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t
case 0xae: /* 幸運のキス */
case 0xaf: /* サ?ビスフォ?ユ? */
case 0xb4:
- {
- struct status_change *sc_data=status_get_sc_data(bl);
- struct skill_unit *su;
- int type=SkillStatusChangeTable[sg->skill_id];
- if( sc_data && sc_data[type].timer!=-1 && (su=((struct skill_unit *)sc_data[type].val4)) && su == src ){
- status_change_end(bl,type,-1);
- }
+ if (sc_data[type].timer!=-1 && sc_data[type].val4==(int)src) {
+ status_change_end(bl,type,-1);
}
break;
+
+ case 0xb6:
+ {
+ struct block_list *target = map_id2bl(sg->val2);
+ if(target && target==bl) {
+ status_change_end(bl,SC_FOGWALL,-1);
+ if (sc_data && sc_data[SC_BLIND].timer!=-1)
+ sc_data[SC_BLIND].timer = add_timer(
+ gettick() + 30000, status_change_timer, bl->id, 0);
+ }
+ break;
+ }
+
case 0xb7: /* スパイダ?ウェッブ */
{
- struct block_list *target=map_id2bl(sg->val2);
- if( target && target==bl )
+ struct block_list *target = map_id2bl(sg->val2);
+ if (target && target==bl)
status_change_end(bl,SC_SPIDERWEB,-1);
- sg->limit=DIFF_TICK(tick,sg->tick)+1000;
+ sg->limit = DIFF_TICK(tick,sg->tick)+1000;
+ break;
}
- break;
- // New guild skills [Celest]
+ // New guild skills [Celest]
case 0xc1: // GD_LEADERSHIP
{
struct map_session_data *sd;
@@ -6231,73 +5823,53 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t
sd->state.hawkeyes_flag = 0;
}
break;
-
/* default:
if(battle_config.error_log)
printf("skill_unit_onout: Unknown skill unit id=%d block=%d\n",sg->unit_id,bl->id);
break;*/
}
- skill_unitgrouptickset_delete(bl,sg);
+
return 0;
}
+
/*==========================================
- * スキルユニットの削除イベント
+ * スキルユニット効果発動/離脱処理(foreachinarea)
+ * bl: ユニット(BL_PC/BL_MOB)
*------------------------------------------
*/
-int skill_unit_ondelete(struct skill_unit *src,struct block_list *bl,unsigned int tick)
+int skill_unit_effect(struct block_list *bl,va_list ap)
{
- struct skill_unit_group *sg;
+ struct skill_unit *unit;
+ struct skill_unit_group *group;
+ int flag;
+ unsigned int tick;
- nullpo_retr(0, src);
nullpo_retr(0, bl);
- nullpo_retr(0, sg = src->group);
+ nullpo_retr(0, ap);
+ nullpo_retr(0, unit=va_arg(ap,struct skill_unit*));
+ tick = va_arg(ap,unsigned int);
+ flag = va_arg(ap,unsigned int);
- if( bl->prev==NULL || !src->alive )
+ if (bl->type!=BL_PC && bl->type!=BL_MOB)
return 0;
- if( bl->type!=BL_PC && bl->type!=BL_MOB )
+ if (!unit->alive || bl->prev==NULL)
return 0;
- switch(sg->unit_id){
- case 0x85: /* ニュ?マ */
- case 0x7e: /* セイフティウォ?ル */
- case 0x8e: /* クァグマイヤ */
- case 0x9a: /* ボルケ?ノ */
- case 0x9b: /* デリュ?ジ */
- case 0x9c: /* バイオレントゲイル */
- case 0x9e: /* 子守唄 */
- case 0x9f: /* ニヨルドの宴 */
- case 0xa0: /* 永遠の混沌 */
- case 0xa1: /* ?太鼓の響き */
- case 0xa2: /* ニ?ベルングの指輪 */
- case 0xa3: /* ロキの叫び */
- case 0xa4: /* 深淵の中に */
- case 0xa5: /* 不死身のジ?クフリ?ド */
- case 0xa6: /* 不協和音 */
- case 0xa7: /* 口笛 */
- case 0xa8: /* 夕陽のアサシンクロス */
- case 0xa9: /* ブラギの詩 */
- case 0xaa: /* イドゥンの林檎 */
- case 0xab: /* 自分勝手なダンス */
- case 0xac: /* ハミング */
- case 0xad: /* 私を忘れないで… */
- case 0xae: /* 幸運のキス */
- case 0xaf: /* サ?ビスフォ?ユ? */
- case 0xb4:
- case 0xc1:
- case 0xc2:
- case 0xc3:
- case 0xc4:
- return skill_unit_onout(src,bl,tick);
+ nullpo_retr(0, group=unit->group);
-/* default:
- if(battle_config.error_log)
- printf("skill_unit_ondelete: Unknown skill unit id=%d block=%d\n",sg->unit_id,bl->id);
- break;*/
+ if (flag)
+ skill_unit_onplace(unit,bl,tick);
+ else {
+ skill_unit_onout(unit,bl,tick);
+ unit = map_find_skill_unit_oncell(bl,bl->x,bl->y,group->skill_id,unit);
+ if (unit)
+ skill_unit_onplace(unit,bl,tick);
}
- skill_unitgrouptickset_delete(bl,sg);
+
return 0;
}
+
/*==========================================
* スキルユニットの限界イベント
*------------------------------------------
@@ -6435,10 +6007,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
return 0;
}
- if(battle_config.pc_skill_reiteration == 0) {
- range = -1;
- switch(sd->skillid) {
- case MG_SAFETYWALL:
+ /*case MG_SAFETYWALL:
case WZ_FIREPILLAR:
case HT_SKIDTRAP:
case HT_LANDMINE:
@@ -6451,28 +6020,23 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
case HT_CLAYMORETRAP:
case HT_TALKIEBOX:
case AL_WARP:
- case PF_SPIDERWEB: /* スパイダ?ウェッブ */
- case RG_GRAFFITI: /* グラフィティ */
+ case PF_SPIDERWEB:
+ case RG_GRAFFITI:
range = 0;
break;
case AL_PNEUMA:
range = 1;
- break;
- }
- if(range >= 0) {
- if(skill_check_unit_range(sd->bl.m,sd->skillx,sd->skilly,range,sd->skillid) > 0) {
- clif_skill_fail(sd,sd->skillid,0,0);
- sd->canact_tick = tick;
- sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
- return 0;
- }
- }
+ break;*/
+ if (!battle_config.pc_skill_reiteration &&
+ skill_get_unit_flag(sd->skillid)&UF_NOREITERATION &&
+ skill_check_unit_range(sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) {
+ clif_skill_fail(sd,sd->skillid,0,0);
+ sd->canact_tick = tick;
+ sd->canmove_tick = tick;
+ sd->skillitem = sd->skillitemlv = -1;
+ return 0;
}
- if(battle_config.pc_skill_nofootset) {
- range = -1;
- switch(sd->skillid) {
- case WZ_FIREPILLAR:
+ /*case WZ_FIREPILLAR:
case HT_SKIDTRAP:
case HT_LANDMINE:
case HT_ANKLESNARE:
@@ -6483,25 +6047,22 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data )
case HT_BLASTMINE:
case HT_CLAYMORETRAP:
case HT_TALKIEBOX:
- case PF_SPIDERWEB: /* スパイダ?ウェッブ */
+ case PF_SPIDERWEB:
case WZ_ICEWALL:
range = 2;
break;
case AL_WARP:
range = 0;
- break;
- }
- if(range >= 0) {
- if(skill_check_unit_range2(sd->bl.m,sd->skillx,sd->skilly,range) > 0) {
- clif_skill_fail(sd,sd->skillid,0,0);
- sd->canact_tick = tick;
- sd->canmove_tick = tick;
- sd->skillitem = sd->skillitemlv = -1;
- return 0;
- }
- }
+ break;*/
+ if (battle_config.pc_skill_nofootset &&
+ skill_get_unit_flag(sd->skillid)&UF_NOFOOTSET &&
+ skill_check_unit_range2(sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) {
+ clif_skill_fail(sd,sd->skillid,0,0);
+ sd->canact_tick = tick;
+ sd->canmove_tick = tick;
+ sd->skillitem = sd->skillitemlv = -1;
+ return 0;
}
-
if(battle_config.pc_land_skill_limit) {
maxcount = skill_get_maxcount(sd->skillid);
if(maxcount > 0) {
@@ -7523,22 +7084,22 @@ int skill_use_id( struct map_session_data *sd, int target_id,
return 0;
}
break;
- // removed on 12/14's patch [celest]
- //case AS_SPLASHER: /* ベナムスプラッシャ? */
- /* {
- struct status_change *t_sc_data = status_get_sc_data(bl);
- if(t_sc_data && t_sc_data[SC_POISON].timer==-1){
- clif_skill_fail(sd,skill_num,0,10);
- return 0;
- }
- }
- break;*/
case PF_MEMORIZE: /* メモライズ */
casttime = 12000;
break;
case HW_MAGICPOWER:
casttime = 700;
break;
+ case HP_BASILICA: /* バジリカ */
+ if (skill_check_unit_range(sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) {
+ clif_skill_fail(sd,sd->skillid,0,0);
+ return 0;
+ }
+ if (skill_check_unit_range2(sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) {
+ clif_skill_fail(sd,sd->skillid,0,0);
+ return 0;
+ }
+ break;
case GD_BATTLEORDER:
case GD_REGENERATION:
case GD_RESTORE:
@@ -7991,13 +7552,14 @@ int skill_devotion3(struct block_list *bl,int target)
int n,r=0;
nullpo_retr(1, bl);
+ md = (struct map_session_data *)bl;
- if( (md = (struct map_session_data *)bl) == NULL || (sd = map_id2sd(target)) == NULL )
+ if ((sd = map_id2sd(target))==NULL)
return 1;
else
r = distance(bl->x,bl->y,sd->bl.x,sd->bl.y);
- if(pc_checkskill(sd,CR_DEVOTION)+6 < r){ // 許容範?を超えてた
+ if(pc_checkskill(md,CR_DEVOTION)+6 < r){ // 許容範?を超えてた
for(n=0;n<5;n++)
if(md->dev.val1[n]==target)
md->dev.val2[n]=0; // 離れた時は、?を切るだけ
@@ -8249,12 +7811,28 @@ int skill_abra_dataset(int skilllv)
//NPCスキルはダメ
if(skill >= NPC_PIERCINGATT && skill <= NPC_SUMMONMONSTER) return 0;
//演奏スキルはダメ
- if(skill_is_danceskill(skill)) return 0;
+ if (skill_get_unit_flag(skill)&UF_DANCE) return 0;
return skill;
}
/*==========================================
+ * バジリカのセルを設定する
+ *------------------------------------------
+ */
+void skill_basilica_cell(struct skill_unit *unit,int flag)
+{
+ int i,x,y,range = skill_get_unit_range(HP_BASILICA);
+ int size = range*2+1;
+
+ for (i=0;i<size*size;i++) {
+ x = unit->bl.x+(i%size-range);
+ y = unit->bl.y+(i/size-range);
+ map_setcell(unit->bl.m,x,y,flag);
+ }
+}
+
+/*==========================================
*
*------------------------------------------
*/
@@ -8293,16 +7871,20 @@ int skill_clear_element_field(struct block_list *bl)
{
struct mob_data *md=NULL;
struct map_session_data *sd=NULL;
- int i,skillid;
+ int i,max,skillid;
nullpo_retr(0, bl);
- if(bl->type==BL_MOB)
- md=(struct mob_data *)bl;
- if(bl->type==BL_PC)
- sd=(struct map_session_data *)bl;
+ if (bl->type==BL_MOB) {
+ max = MAX_MOBSKILLUNITGROUP;
+ md = (struct mob_data *)bl;
+ } else if(bl->type==BL_PC) {
+ max = MAX_SKILLUNITGROUP;
+ sd = (struct map_session_data *)bl;
+ } else
+ return 0;
- for(i=0;i<MAX_MOBSKILLUNITGROUP;i++){
+ 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)
@@ -8372,7 +7954,8 @@ int skill_idun_heal(struct block_list *bl, va_list ap )
* 指定範??でsrcに?して有?なタ?ゲットのblの?を?える(foreachinarea)
*------------------------------------------
*/
-int skill_count_target(struct block_list *bl, va_list ap ){
+int skill_count_target(struct block_list *bl, va_list ap)
+{
struct block_list *src;
int *c;
@@ -8528,48 +8111,6 @@ int skill_type_cloaking(struct block_list *bl)
*/
/*==========================================
- * 演奏/ダンススキルかどうか判定
- * 引? スキルID
- * ?り ダンスじゃない=0 合奏=2 それ以外のダンス=1
- *------------------------------------------
- */
-int skill_is_danceskill(int id)
-{
- int i;
- switch(id){
- case BD_LULLABY: /* 子守歌 */
- case BD_RICHMANKIM: /* ニヨルドの宴 */
- case BD_ETERNALCHAOS: /* 永遠の混沌 */
- case BD_DRUMBATTLEFIELD: /* ?太鼓の響き */
- case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 */
- case BD_ROKISWEIL: /* ロキの叫び */
- case BD_INTOABYSS: /* 深淵の中に */
- case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド */
- case BD_RAGNAROK: /* 神?の?昏 */
- case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
- i=2;
- break;
- case BA_DISSONANCE: /* 不協和音 */
- case BA_FROSTJOKE: /* 寒いジョ?ク */
- case BA_WHISTLE: /* 口笛 */
- case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス */
- case BA_POEMBRAGI: /* ブラギの詩 */
- case BA_APPLEIDUN: /* イドゥンの林檎 */
- case DC_UGLYDANCE: /* 自分勝手なダンス */
- case DC_SCREAM: /* スクリ?ム */
- case DC_HUMMING: /* ハミング */
- case DC_DONTFORGETME: /* 私を忘れないで… */
- case DC_FORTUNEKISS: /* 幸運のキス */
- case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? */
- i=1;
- break;
- default:
- i=0;
- }
- return i;
-}
-
-/*==========================================
* 演奏/ダンスをやめる
* flag 1で合奏中なら相方にユニットを任せる
*
@@ -8650,10 +8191,13 @@ struct skill_unit *skill_initunit(struct skill_unit_group *group,int idx,int x,i
map_addblock(&unit->bl);
clif_skill_setunit(unit);
+
+// if (group->skill_id==HP_BASILICA)
+// skill_basilica_cell(unit,CELL_SETBASILICA);
+
return unit;
}
-int skill_unit_timer_sub_ondelete( struct block_list *bl, va_list ap );
/*==========================================
* スキルユニット削除
*------------------------------------------
@@ -8661,7 +8205,6 @@ int skill_unit_timer_sub_ondelete( struct block_list *bl, va_list ap );
int skill_delunit(struct skill_unit *unit)
{
struct skill_unit_group *group;
- int range;
nullpo_retr(0, unit);
if(!unit->alive)
@@ -8671,11 +8214,15 @@ int skill_delunit(struct skill_unit *unit)
/* onlimitイベント呼び出し */
skill_unit_onlimit( unit,gettick() );
- /* ondeleteイベント呼び出し */
- range=group->range;
- map_foreachinarea( skill_unit_timer_sub_ondelete, unit->bl.m,
- unit->bl.x-range,unit->bl.y-range,unit->bl.x+range,unit->bl.y+range,0,
- &unit->bl,gettick() );
+ /* onoutイベント呼び出し */
+ if (!unit->range) {
+ map_foreachinarea(skill_unit_effect,unit->bl.m,
+ unit->bl.x,unit->bl.y,unit->bl.x,unit->bl.y,0,
+ &unit->bl,gettick(),0);
+ }
+
+// if (group->skill_id==HP_BASILICA)
+// skill_basilica_cell(unit,CELL_CLRBASILICA);
clif_skill_delunit(unit);
@@ -8691,7 +8238,7 @@ int skill_delunit(struct skill_unit *unit)
* スキルユニットグル?プ初期化
*------------------------------------------
*/
-static int skill_unit_group_newid=10;
+static int skill_unit_group_newid = MAX_SKILL_DB;
struct skill_unit_group *skill_initunitgroup(struct block_list *src,
int count,int skillid,int skilllv,int unit_id)
{
@@ -8743,7 +8290,7 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src,
group->guild_id=status_get_guild_id(src);
group->group_id=skill_unit_group_newid++;
if(skill_unit_group_newid<=0)
- skill_unit_group_newid=10;
+ skill_unit_group_newid = MAX_SKILL_DB;
group->unit=(struct skill_unit *)aCalloc(count,sizeof(struct skill_unit));
group->unit_count=count;
group->val1=group->val2=0;
@@ -8751,39 +8298,23 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src,
group->skill_lv=skilllv;
group->unit_id=unit_id;
group->map=src->m;
- group->range=0;
group->limit=10000;
group->interval=1000;
group->tick=gettick();
group->valstr=NULL;
- if( skill_is_danceskill(skillid) ){
+ if (skill_get_unit_flag(skillid)&UF_DANCE) {
struct map_session_data *sd = NULL;
if(src->type==BL_PC && (sd=(struct map_session_data *)src) ){
sd->skillid_dance=skillid;
sd->skilllv_dance=skilllv;
}
status_change_start(src,SC_DANCING,skillid,(int)group,0,0,skill_get_time(skillid,skilllv)+1000,0);
- switch(skillid){ //合奏スキルは相方をダンス?態にする
- case BD_LULLABY: /* 子守歌 */
- case BD_RICHMANKIM: /* ニヨルドの宴 */
- case BD_ETERNALCHAOS: /* 永遠の混沌 */
- case BD_DRUMBATTLEFIELD: /* ?太鼓の響き */
- case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 */
- case BD_ROKISWEIL: /* ロキの叫び */
- case BD_INTOABYSS: /* 深淵の中に */
- case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド */
- case BD_RAGNAROK: /* 神?の?昏 */
- case CG_MOONLIT: /* 月明りの泉に落ちる花びら */
- {
- int range=1;
- int c=0;
- if(sd){
- map_foreachinarea(skill_check_condition_use_sub,sd->bl.m,
- sd->bl.x-range,sd->bl.y-range,
- sd->bl.x+range,sd->bl.y+range,BL_PC,&sd->bl,&c);
- }
- }
+ //合奏スキルは相方をダンス状態にする
+ if (sd && skill_get_unit_flag(skillid)&UF_ENSEMBLE) {
+ int c=0;
+ map_foreachinarea(skill_check_condition_use_sub,sd->bl.m,
+ sd->bl.x-1,sd->bl.y-1,sd->bl.x+1,sd->bl.y+1,BL_PC,&sd->bl,&c);
}
}
return group;
@@ -8803,7 +8334,8 @@ int skill_delunitgroup(struct skill_unit_group *group)
return 0;
src=map_id2bl(group->src_id);
- if( skill_is_danceskill(group->skill_id) ){ //ダンススキルはダンス?態を解除する
+ //ダンススキルはダンス状態を解除する
+ if (skill_get_unit_flag(group->skill_id)&UF_DANCE) {
if(src)
status_change_end(src,SC_DANCING,-1);
}
@@ -8841,13 +8373,14 @@ int skill_clear_unitgroup(struct block_list *src)
if(src->type==BL_PC){
group=((struct map_session_data *)src)->skillunit;
maxsug=MAX_SKILLUNITGROUP;
- }else if(src->type==BL_MOB){
+ } else if(src->type==BL_MOB){
group=((struct mob_data *)src)->skillunit;
maxsug=MAX_MOBSKILLUNITGROUP;
- }else if(src->type==BL_PET){ // [Valaris]
+ } else if(src->type==BL_PET){ // [Valaris]
group=((struct pet_data *)src)->skillunit;
maxsug=MAX_MOBSKILLUNITGROUP;
- }
+ } else
+ return 0;
if(group){
int i;
for(i=0;i<maxsug;i++)
@@ -8857,31 +8390,19 @@ int skill_clear_unitgroup(struct block_list *src)
return 0;
}
-/*
- * 珞ヌォケォュォェェヘヌェュェキェゾェホヤムツ
- */
-int skill_unit_overlap_type(int skill_id)
-{
- switch (skill_id) {
- case WZ_STORMGUST:
- case WZ_VERMILION:
- return 1; // ェノェチェ鬪ォ鰥ーェォェ鬮タォ?ォクェ磑ェアェ
- default:
- return 0; // ?ローェォェ鬮タォ?ォクェ磑ェアェ
- }
-}
-
/*==========================================
* スキルユニットグル?プの被影響tick?索
*------------------------------------------
*/
struct skill_unit_group_tickset *skill_unitgrouptickset_search(
- struct block_list *bl, struct skill_unit_group *sg)
+ struct block_list *bl,struct skill_unit_group *group,int tick)
{
int i,j=-1,k,s,id;
struct skill_unit_group_tickset *set;
nullpo_retr(0, bl);
+ if (group->interval==-1)
+ return NULL;
if (bl->type == BL_PC)
set = ((struct map_session_data *)bl)->skillunittick;
@@ -8890,16 +8411,16 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(
else
return 0;
- if (skill_unit_overlap_type(sg->skill_id))
- id = s = sg->skill_id;
+ if (skill_get_unit_flag(group->skill_id)&UF_NOOVERLAP)
+ id = s = group->skill_id;
else
- id = s = sg->group_id;
+ id = s = group->group_id;
for (i=0; i<MAX_SKILLUNITGROUPTICKSET; i++) {
k = (i+s) % MAX_SKILLUNITGROUPTICKSET;
if (set[k].id == id)
return &set[k];
- else if (j == -1 && set[k].id == 0)
+ else if (j==-1 && (DIFF_TICK(tick,set[k].tick)>0 || set[k].id==0))
j=k;
}
@@ -8908,101 +8429,41 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search(
sprintf (tmp_output, "skill_unitgrouptickset_search: tickset is full\n");
ShowWarning (tmp_output);
}
- for (i = 0; i<MAX_SKILLUNITGROUPTICKSET; i++)
- set[k].id = 0;
j = id % MAX_SKILLUNITGROUPTICKSET;
}
set[j].id = id;
+ set[j].tick = tick;
return &set[j];
}
/*==========================================
- * スキルユニットグル?プの被影響tick削除
- *------------------------------------------
- */
-int skill_unitgrouptickset_delete(
- struct block_list *bl, struct skill_unit_group *sg)
-{
- int i, k, s, id;
- struct skill_unit_group_tickset *set=NULL;
-
- nullpo_retr(0, bl);
- if (bl->type == BL_PC)
- set=((struct map_session_data *)bl)->skillunittick;
- else if (bl->type == BL_MOB)
- set=((struct mob_data *)bl)->skillunittick;
- else
- return 0;
-
- if (skill_unit_overlap_type(sg->skill_id))
- id = s = sg->skill_id;
- else
- id = s = sg->group_id;
-
- for(i=0; i<MAX_SKILLUNITGROUPTICKSET; i++) {
- k = (i+s) % MAX_SKILLUNITGROUPTICKSET;
- if (set[k].id == id) {
- set[k].id = 0;
- break;
- }
- }
-// if (i == MAX_SKILLUNITGROUPTICKSET && battle_config.error_log) {
-// printf("skill_unitgrouptickset_delete: tickset not found\n");
-// }
-
- return 0;
-}
-
-/*==========================================
* スキルユニットタイマ??動?理用(foreachinarea)
*------------------------------------------
*/
int skill_unit_timer_sub_onplace( struct block_list *bl, va_list ap )
{
- struct block_list *src;
- struct skill_unit *su;
+ struct skill_unit *unit;
+ struct skill_unit_group *group;
unsigned int tick;
nullpo_retr(0, bl);
nullpo_retr(0, ap);
- src=va_arg(ap,struct block_list*);
+ unit = va_arg(ap,struct skill_unit *);
+ tick = va_arg(ap,unsigned int);
- tick=va_arg(ap,unsigned int);
- su = (struct skill_unit *)src;
-
- if( su && su->alive ) {
- struct skill_unit_group *sg;
- sg = su->group;
- if(sg && battle_check_target(src,bl,sg->target_flag )>0)
- skill_unit_onplace( su, bl, tick );
- }
- return 0;
-}
+ if (bl->type!=BL_PC && bl->type!=BL_MOB)
+ return 0;
+ if (!unit->alive || bl->prev==NULL)
+ return 0;
-/*==========================================
- * スキルユニットタイマ?削除?理用(foreachinarea)
- *------------------------------------------
- */
-int skill_unit_timer_sub_ondelete( struct block_list *bl, va_list ap )
-{
- struct block_list *src;
- struct skill_unit *su;
- unsigned int tick;
+ nullpo_retr(0, group=unit->group);
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
- src=va_arg(ap,struct block_list*);
+ if (battle_check_target(&unit->bl,bl,group->target_flag)<=0)
+ return 0;
- tick=va_arg(ap,unsigned int);
- su = (struct skill_unit *)src;
+ skill_unit_onplace_timer(unit,bl,tick);
- if( su && su->alive ){
- struct skill_unit_group *sg;
- sg = su->group;
- if( sg && battle_check_target(src,bl,sg->target_flag )>0 )
- skill_unit_ondelete( su, bl, tick );
- }
return 0;
}
@@ -9020,28 +8481,37 @@ int skill_unit_timer_sub( struct block_list *bl, va_list ap )
nullpo_retr(0, bl);
nullpo_retr(0, ap);
nullpo_retr(0, unit=(struct skill_unit *)bl);
- nullpo_retr(0, group=unit->group);
tick=va_arg(ap,unsigned int);
if(!unit->alive)
return 0;
- range=(unit->range!=0)?unit->range:group->range;
+ nullpo_retr(0, group=unit->group);
+ range = unit->range;
- /* onplaceイベント呼び出し */
- if(unit->alive && unit->range>=0){
- map_foreachinarea( skill_unit_timer_sub_onplace, bl->m,
- bl->x-range,bl->y-range,bl->x+range,bl->y+range,0,
- bl,tick);
- if(group->unit_id == 0xaa && DIFF_TICK(tick,group->tick)>=6000*group->val2){
- map_foreachinarea( skill_idun_heal, bl->m,
- bl->x-range,bl->y-range,bl->x+range,bl->y+range,0,unit);
- group->val2++;
+ /* onplace_timerイベント呼び出し */
+ if (range>=0 && group->interval!=-1) {
+ map_foreachinarea(skill_unit_timer_sub_onplace, bl->m,
+ bl->x-range,bl->y-range,bl->x+range,bl->y+range,0,bl,tick);
+ if (!unit->alive)
+ return 0;
+ // マグヌスは発動したユニットは削除する
+ if (group->skill_id==PR_MAGNUS && unit->val2) {
+ skill_delunit(unit);
+ return 0;
}
}
+ // イドゥンの林檎による回復
+ if (group->unit_id==0xaa && DIFF_TICK(tick,group->tick)>=6000*group->val3) {
+ struct block_list *src = map_id2bl(group->src_id);
+ int range = skill_get_unit_layout_type(group->skill_id,group->skill_lv);
+ nullpo_retr(0, src);
+ map_foreachinarea(skill_idun_heal,src->m,
+ src->x-range,src->y-range,src->x+range,src->y+range,0,unit);
+ group->val3++;
+ }
/* 時間切れ削除 */
- if(unit->alive &&
- (DIFF_TICK(tick,group->tick)>=group->limit || DIFF_TICK(tick,group->tick)>=unit->limit) ){
+ if((DIFF_TICK(tick,group->tick)>=group->limit || DIFF_TICK(tick,group->tick)>=unit->limit)){
switch(group->unit_id){
case 0x8f: /* ブラストマイン */
group->unit_id = 0x8c;
@@ -9117,92 +8587,33 @@ int skill_unit_timer( int tid,unsigned int tick,int id,int data)
* スキルユニット移動時?理用(foreachinarea)
*------------------------------------------
*/
-int skill_unit_out_all_sub( struct block_list *bl, va_list ap )
-{
- struct skill_unit *unit;
- struct skill_unit_group *group;
- struct block_list *src;
- int range;
- unsigned int tick;
-
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
- nullpo_retr(0, src=va_arg(ap,struct block_list*));
- nullpo_retr(0, unit=(struct skill_unit *)bl);
- nullpo_retr(0, group=unit->group);
-
- tick=va_arg(ap,unsigned int);
-
- if(!unit->alive || src->prev==NULL)
- return 0;
-
- range=(unit->range!=0)?unit->range:group->range;
-
- if( range<0 || battle_check_target(bl,src,group->target_flag )<=0 )
- return 0;
-
- if( src->x >= bl->x-range && src->x <= bl->x+range &&
- src->y >= bl->y-range && src->y <= bl->y+range )
- skill_unit_onout( unit, src, tick );
-
- return 0;
-}
-
-
-/*==========================================
- * スキルユニット移動時?理
- *------------------------------------------
- */
-int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range)
-{
- nullpo_retr(0, bl);
-
- if( bl->prev==NULL )
- return 0;
-
- if(range<7)
- range=7;
- map_foreachinarea( skill_unit_out_all_sub,
- bl->m,bl->x-range,bl->y-range,bl->x+range,bl->y+range,BL_SKILL,
- bl,tick );
-
- return 0;
-}
-
-/*==========================================
- * スキルユニット移動時?理用(foreachinarea)
- *------------------------------------------
- */
int skill_unit_move_sub( struct block_list *bl, va_list ap )
{
- struct skill_unit *unit;
+ struct skill_unit *unit = (struct skill_unit *)bl;
struct skill_unit_group *group;
- struct block_list *src;
- int range;
- unsigned int tick;
+ struct block_list *target;
+ unsigned int tick,flag;
nullpo_retr(0, bl);
nullpo_retr(0, ap);
- nullpo_retr(0, unit=(struct skill_unit *)bl);
- nullpo_retr(0, src=va_arg(ap,struct block_list*));
-
- tick=va_arg(ap,unsigned int);
+ nullpo_retr(0, target=va_arg(ap,struct block_list*));
+ tick = va_arg(ap,unsigned int);
+ flag = va_arg(ap,int);
- if(!unit->alive || src->prev==NULL)
+ if (target->type!=BL_PC && target->type!=BL_MOB)
return 0;
- if((group=unit->group) == NULL)
+ nullpo_retr(0, group=unit->group);
+ if (group->interval!=-1)
return 0;
- range=(unit->range!=0)?unit->range:group->range;
- if( range<0 || battle_check_target(bl,src,group->target_flag )<=0 )
+ if (!unit->alive || target->prev==NULL)
return 0;
- if( src->x >= bl->x-range && src->x <= bl->x+range &&
- src->y >= bl->y-range && src->y <= bl->y+range )
- skill_unit_onplace( unit, src, tick );
+ if (flag)
+ skill_unit_onplace(unit,target,tick);
else
- skill_unit_onout( unit, src, tick );
+ skill_unit_onout(unit,target,tick);
return 0;
}
@@ -9211,54 +8622,16 @@ int skill_unit_move_sub( struct block_list *bl, va_list ap )
* スキルユニット移動時?理
*------------------------------------------
*/
-int skill_unit_move( struct block_list *bl,unsigned int tick,int range)
+int skill_unit_move(struct block_list *bl,unsigned int tick,int flag)
{
nullpo_retr(0, bl);
- if( bl->prev==NULL )
+ if(bl->prev==NULL )
return 0;
- if(range<7)
- range=7;
- map_foreachinarea( skill_unit_move_sub,
- bl->m,bl->x-range,bl->y-range,bl->x+range,bl->y+range,BL_SKILL,
- bl,tick );
-
- return 0;
-}
+ map_foreachinarea(skill_unit_move_sub,
+ bl->m,bl->x,bl->y,bl->x,bl->y,BL_SKILL,bl,tick,flag);
-/*==========================================
- * スキルユニット自?の移動時?理(foreachinarea)
- *------------------------------------------
- */
-int skill_unit_move_unit_group_sub( struct block_list *bl, va_list ap )
-{
- struct skill_unit *unit;
- struct skill_unit_group *group;
- struct block_list *src;
- int range;
- unsigned int tick;
-
- nullpo_retr(0, bl);
- nullpo_retr(0, ap);
- nullpo_retr(0, src=va_arg(ap,struct block_list*));
- nullpo_retr(0, unit=(struct skill_unit *)src);
- nullpo_retr(0, group=unit->group);
-
- tick=va_arg(ap,unsigned int);
-
- if(!unit->alive || bl->prev==NULL)
- return 0;
-
- range=(unit->range!=0)?unit->range:group->range;
-
- if( range<0 || battle_check_target(src,bl,group->target_flag )<=0 )
- return 0;
- if( bl->x >= src->x-range && bl->x <= src->x+range &&
- bl->y >= src->y-range && bl->y <= src->y+range )
- skill_unit_onplace( unit, bl, tick );
- else
- skill_unit_onout( unit, bl, tick );
return 0;
}
@@ -9269,115 +8642,97 @@ int skill_unit_move_unit_group_sub( struct block_list *bl, va_list ap )
*/
int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int dy)
{
+ int i,j;
+ int tick = gettick();
+ int *m_flag;
+ struct skill_unit *unit1;
+ struct skill_unit *unit2;
+
nullpo_retr(0, group);
+ if (group->unit_count<=0)
+ return 0;
+ if (group->unit==NULL)
+ return 0;
- if( group->unit_count<=0)
+ // 移動可能なスキルはダンス系と、ブラストマイン、クレイモアートラップのみ
+ if (!(skill_get_unit_flag(group->skill_id)&UF_DANCE) &&
+ group->skill_id!=HT_CLAYMORETRAP && group->skill_id!=HT_BLASTMINE)
return 0;
- if(group->unit!=NULL){
- if(!battle_config.unit_movement_type){
- int i;
- for(i=0;i<group->unit_count;i++){
- struct skill_unit *unit=&group->unit[i];
- if(unit->alive && !(m==unit->bl.m && dx==0 && dy==0)){
- int range=unit->range;
- map_delblock(&unit->bl);
- unit->bl.m = m;
- unit->bl.x += dx;
- unit->bl.y += dy;
- map_addblock(&unit->bl);
- clif_skill_setunit(unit);
- if(range>0){
- if(range<7)
- range=7;
- map_foreachinarea( skill_unit_move_unit_group_sub, unit->bl.m,
- unit->bl.x-range,unit->bl.y-range,unit->bl.x+range,unit->bl.y+range,0,
- &unit->bl,gettick() );
- }
- }
+ m_flag = malloc(sizeof(int)*group->unit_count);
+ memset(m_flag,0,sizeof(int)*group->unit_count);// 移動フラグ
+ // 先にフラグを全部決める
+ // m_flag
+ // 0: 単純移動
+ // 1: ユニットを移動する(現位置からユニットがなくなる)
+ // 2: 残留&新位置が移動先となる(移動先にユニットが存在しない)
+ // 3: 残留
+ for(i=0;i<group->unit_count;i++){
+ unit1=&group->unit[i];
+ if (!unit1->alive || unit1->bl.m!=m)
+ continue;
+ for(j=0;j<group->unit_count;j++){
+ unit2=&group->unit[j];
+ if (!unit2->alive)
+ continue;
+ if (unit1->bl.x+dx==unit2->bl.x && unit1->bl.y+dy==unit2->bl.y){
+ // 移動先にユニットがかぶっている
+ m_flag[i] |= 0x1;
}
- }else{
- int i,j, *r_flag, *s_flag, *m_flag;
- struct skill_unit *unit1;
- struct skill_unit *unit2;
- r_flag = (int *) aMallocA(sizeof(int) * group->unit_count);
- s_flag = (int *) aMallocA(sizeof(int) * group->unit_count);
- m_flag = (int *) aMallocA(sizeof(int) * group->unit_count);
- memset(r_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
- memset(s_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
- memset(m_flag,0, sizeof(int) * group->unit_count);// ?承フラグ
-
- //先にフラグを全部決める
- for(i=0;i<group->unit_count;i++){
- int move_check=0;// かぶりフラグ
- unit1=&group->unit[i];
- for(j=0;j<group->unit_count;j++){
- unit2=&group->unit[j];
- if(unit1->bl.m==m && unit1->bl.x+dx==unit2->bl.x && unit1->bl.y+dy==unit2->bl.y){
- //移動先にユニットがかぶってたら
- s_flag[i]=1;// 移動前のユニットナンバ?の?承フラグon
- r_flag[j]=1;// かぶるユニットナンバ?の?留フラグon
- move_check=1;//ユニットがかぶった。
- break;
- }
- }
- if(!move_check)// ユニットがかぶってなかったら
- m_flag[i]=1;// 移動前ユニットナンバ?の移動フラグon
- }
-
- //フラグに基づいてユニット移動
- for(i=0;i<group->unit_count;i++){
- unit1=&group->unit[i];
- if(m_flag[i]){// 移動フラグがonで
- if(!r_flag[i]){// ?留フラグがoffなら
- //?純移動(rangeも?承の必要無し)
- int range=unit1->range;
- map_delblock(&unit1->bl);
- unit1->bl.m = m;
- unit1->bl.x += dx;
- unit1->bl.y += dy;
- map_addblock(&unit1->bl);
- clif_skill_setunit(unit1);
- if(range > 0){
- if(range < 7)
- range = 7;
- map_foreachinarea( skill_unit_move_unit_group_sub, unit1->bl.m,
- unit1->bl.x-range,unit1->bl.y-range,unit1->bl.x+range,unit1->bl.y+range,0,
- &unit1->bl,gettick() );
- }
- }else{// ?留フラグがonなら
- //空ユニットになるので、?承可能なユニットを探す
- for(j=0;j<group->unit_count;j++){
- unit2=&group->unit[j];
- if(s_flag[j] && !r_flag[j]){
- // ?承移動(range?承付き)
- int range=unit1->range;
- map_delblock(&unit2->bl);
- unit2->bl.m = m;
- unit2->bl.x = unit1->bl.x + dx;
- unit2->bl.y = unit1->bl.y + dy;
- unit2->range = unit1->range;
- map_addblock(&unit2->bl);
- clif_skill_setunit(unit2);
- if(range > 0){
- if(range < 7)
- range = 7;
- map_foreachinarea( skill_unit_move_unit_group_sub, unit2->bl.m,
- unit2->bl.x-range,unit2->bl.y-range,unit2->bl.x+range,unit2->bl.y+range,0,
- &unit2->bl,gettick() );
- }
- s_flag[j]=0;// ?承完了したのでoff
- break;
- }
- }
- }
+ if (unit1->bl.x-dx==unit2->bl.x && unit1->bl.y-dy==unit2->bl.y){
+ // ユニットがこの場所にやってくる
+ m_flag[i] |= 0x2;
+ }
+ }
+ }
+ // フラグに基づいてユニット移動
+ // フラグが1のunitを探し、フラグが2のunitの移動先に移す
+ j = 0;
+ for (i=0;i<group->unit_count;i++) {
+ unit1=&group->unit[i];
+ if (!unit1->alive)
+ continue;
+ if (!(m_flag[i]&0x2)) {
+ // ユニットがなくなる場所でスキルユニット影響を消す
+ map_foreachinarea(skill_unit_effect,unit1->bl.m,
+ unit1->bl.x,unit1->bl.y,unit1->bl.x,unit1->bl.y,0,
+ &unit1->bl,tick,0);
+ }
+ if (m_flag[i]==0) {
+ // 単純移動
+ map_delblock(&unit1->bl);
+ unit1->bl.m = m;
+ unit1->bl.x += dx;
+ unit1->bl.y += dy;
+ map_addblock(&unit1->bl);
+ clif_skill_setunit(unit1);
+ } else if (m_flag[i]==1) {
+ // フラグが2のものを探してそのユニットの移動先に移動
+ for(;j<group->unit_count;j++) {
+ if (m_flag[j]==2) {
+ // 継承移動
+ unit2 = &group->unit[j];
+ if (!unit2->alive)
+ continue;
+ map_delblock(&unit1->bl);
+ unit1->bl.m = m;
+ unit1->bl.x = unit2->bl.x+dx;
+ unit1->bl.y = unit2->bl.y+dy;
+ map_addblock(&unit1->bl);
+ clif_skill_setunit(unit1);
+ j++;
+ break;
}
}
- aFree(r_flag);
- aFree(s_flag);
- aFree(m_flag);
+ }
+ if (!(m_flag[i]&0x2)) {
+ // 移動後の場所でスキルユニットを発動
+ map_foreachinarea(skill_unit_effect,unit1->bl.m,
+ unit1->bl.x,unit1->bl.y,unit1->bl.x,unit1->bl.y,0,
+ &unit1->bl,tick,1);
}
}
+ free(m_flag);
return 0;
}
@@ -9505,25 +8860,29 @@ int skill_produce_mix( struct map_session_data *sd,
if(!equip) {
// Corrected rates [DracoRPG] --------------------------//
if(skill_produce_db[idx].req_skill==AM_PHARMACY) {
+ make_per = pc_checkskill(sd,AM_LEARNINGPOTION)*100
+ + pc_checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ + sd->status.dex*10+sd->status.int_*5;
+
if(nameid >= 501 && nameid <= 505) // Normal potions
- make_per = 2000 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_POTIONPITCHER)*100;
- if(nameid >= 605 && nameid <= 606) // Anodyne & Aloevera (not sure of the formula, I put the same base value as normal pots but without the Aid Potion bonus since they are not throwable pots ^^)
- make_per = 2000 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300;
+ make_per += 2000 + pc_checkskill(sd,AM_POTIONPITCHER)*100;
+ else if(nameid >= 605 && nameid <= 606) // Anodyne & Aloevera (not sure of the formula, I put the same base value as normal pots but without the Aid Potion bonus since they are not throwable pots ^^)
+ make_per += 2000;
else if(nameid >= 545 && nameid <= 547) // Concentrated potions
- make_per = sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300;
+ ;
else if(nameid == 970) // Alcohol
- make_per = 1000 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300;
+ make_per += 1000;
else if(nameid == 7135) // Bottle Grenade
- make_per = 500 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_DEMONSTRATION)*100;
+ make_per += 500 + pc_checkskill(sd,AM_DEMONSTRATION)*100;
else if(nameid == 7136) // Acid Bottle
- make_per = 500 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_ACIDTERROR)*100;
+ make_per += 500 + pc_checkskill(sd,AM_ACIDTERROR)*100;
else if(nameid == 7137) // Plant Bottle
- make_per = 500 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_CANNIBALIZE)*100;
+ make_per += 500 + pc_checkskill(sd,AM_CANNIBALIZE)*100;
else if(nameid == 7138) // Marine Sphere Bottle
- make_per = 500 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_SPHEREMINE)*100;
+ make_per += 500 + pc_checkskill(sd,AM_SPHEREMINE)*100;
else if(nameid == 7139) // Glistening Coat
- make_per = 500 + sd->status.job_level*20 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300 + pc_checkskill(sd,AM_CP_WEAPON)*100 +
- pc_checkskill(sd,AM_CP_SHIELD)*100 + pc_checkskill(sd,AM_CP_ARMOR)*100 + pc_checkskill(sd,AM_CP_HELM)*100;
+ make_per += 500 + pc_checkskill(sd,AM_CP_WEAPON)*100 + pc_checkskill(sd,AM_CP_SHIELD)*100 +
+ pc_checkskill(sd,AM_CP_ARMOR)*100 + pc_checkskill(sd,AM_CP_HELM)*100;
else
make_per = 1000 + sd->status.base_level*30 + sd->paramc[3]*20 + sd->paramc[4]*15 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300;
} else if (skill_produce_db[idx].req_skill == ASC_CDP) {
@@ -9604,8 +8963,7 @@ int skill_produce_mix( struct map_session_data *sd,
clif_additem(sd,0,0,flag);
map_addflooritem(&tmp_item,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0);
}
- }
- else {
+ } else {
if(log_config.produce > 0)
log_produce(sd,nameid,slot1,slot2,slot3,0);
@@ -9675,6 +9033,213 @@ int skill_arrow_create( struct map_session_data *sd,int nameid)
* 初期化系
*/
+/*----------------------------------------------------------------------------
+ * 初期化系
+ */
+
+/*
+ * 文字列処理
+ * ',' で区切って val に戻す
+ */
+int skill_split_str(char *str,char **val,int num)
+{
+ int i;
+
+ for (i=0; i<num && str; i++){
+ val[i] = str;
+ str = strchr(str,',');
+ if (str)
+ *str++=0;
+ }
+ return i;
+}
+/*
+ * 文字列処理
+ * ':' で区切ってatoiしてvalに戻す
+ */
+int skill_split_atoi(char *str,int *val)
+{
+ int i, max = 0;
+
+ for (i=0; i<MAX_SKILL_LEVEL; i++) {
+ if (str) {
+ val[i] = max = atoi(str);
+ str = strchr(str,':');
+ if (str)
+ *str++=0;
+ } else {
+ val[i] = max;
+ }
+ }
+ return i;
+}
+
+/*
+ * スキルユニットの配置情報作成
+ */
+void skill_init_unit_layout()
+{
+ int i,j,size,pos = 0;
+
+ memset(skill_unit_layout,0,sizeof(skill_unit_layout));
+ // 矩形のユニット配置を作成する
+ for (i=0; i<=MAX_SQUARE_LAYOUT; i++) {
+ size = i*2+1;
+ skill_unit_layout[i].count = size*size;
+ for (j=0; j<size*size; j++) {
+ skill_unit_layout[i].dx[j] = (j%size-i);
+ skill_unit_layout[i].dy[j] = (j/size-i);
+ }
+ }
+ pos = i;
+ // 矩形以外のユニット配置を作成する
+ for (i=0;i<MAX_SKILL_DB;i++) {
+ if (!skill_db[i].unit_id[0] || skill_db[i].unit_layout_type[0] != -1)
+ continue;
+ switch (i) {
+ case MG_FIREWALL:
+ case WZ_ICEWALL:
+ // ファイアーウォール、アイスウォールは方向で変わるので別処理
+ break;
+ case PR_SANCTUARY:
+ {
+ static const int dx[] = {
+ -1, 0, 1,-2,-1, 0, 1, 2,-2,-1,
+ 0, 1, 2,-2,-1, 0, 1, 2,-1, 0, 1};
+ static const int dy[]={
+ -2,-2,-2,-1,-1,-1,-1,-1, 0, 0,
+ 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2};
+ skill_unit_layout[pos].count = 21;
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ break;
+ }
+ case PR_MAGNUS:
+ {
+ static const int dx[] = {
+ -1, 0, 1,-1, 0, 1,-3,-2,-1, 0,
+ 1, 2, 3,-3,-2,-1, 0, 1, 2, 3,
+ -3,-2,-1, 0, 1, 2, 3,-1, 0, 1,-1, 0, 1};
+ static const int dy[] = {
+ -3,-3,-3,-2,-2,-2,-1,-1,-1,-1,
+ -1,-1,-1, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 3};
+ skill_unit_layout[pos].count = 33;
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ break;
+ }
+ case AS_VENOMDUST:
+ {
+ static const int dx[] = {-1, 0, 0, 0, 1};
+ static const int dy[] = { 0,-1, 0, 1, 0};
+ skill_unit_layout[pos].count = 5;
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ break;
+ }
+ case CR_GRANDCROSS:
+ case NPC_DARKGRANDCROSS:
+ {
+ static const int dx[] = {
+ 0, 0,-1, 0, 1,-2,-1, 0, 1, 2,
+ -4,-3,-2,-1, 0, 1, 2, 3, 4,-2,
+ -1, 0, 1, 2,-1, 0, 1, 0, 0};
+ static const int dy[] = {
+ -4,-3,-2,-2,-2,-1,-1,-1,-1,-1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ 1, 1, 1, 1, 2, 2, 2, 3, 4};
+ skill_unit_layout[pos].count = 29;
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ break;
+ }
+ case PF_FOGWALL:
+ {
+ static const int dx[] = {
+ -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2};
+ static const int dy[] = {
+ -1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
+ skill_unit_layout[pos].count = 15;
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ break;
+ }
+ default:
+ printf("unknown unit layout at skill %d\n",i);
+ break;
+ }
+ if (!skill_unit_layout[pos].count)
+ continue;
+ for (j=0;j<MAX_SKILL_LEVEL;j++)
+ skill_db[i].unit_layout_type[j] = pos;
+ pos++;
+ }
+ // ファイヤーウォール
+ firewall_unit_pos = pos;
+ for (i=0;i<8;i++) {
+ if (i&1) { /* 斜め配置 */
+ skill_unit_layout[pos].count = 5;
+ if (i&0x2) {
+ int dx[] = {-1,-1, 0, 0, 1};
+ int dy[] = { 1, 0, 0,-1,-1};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ } else {
+ int dx[] = { 1, 1 ,0, 0,-1};
+ int dy[] = { 1, 0, 0,-1,-1};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ }
+ } else { /* 縦横配置 */
+ skill_unit_layout[pos].count = 3;
+ if (i%4==0) { /* 上下 */
+ int dx[] = {-1, 0, 1};
+ int dy[] = { 0, 0, 0};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ } else { /* 左右 */
+ int dx[] = { 0, 0, 0};
+ int dy[] = {-1, 0, 1};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ }
+ }
+ pos++;
+ }
+ // アイスウォール
+ icewall_unit_pos = pos;
+ for (i=0;i<8;i++) {
+ skill_unit_layout[pos].count = 5;
+ if (i&1) { /* 斜め配置 */
+ if (i&0x2) {
+ int dx[] = {-2,-1, 0, 1, 2};
+ int dy[] = { 2,-1, 0,-1,-2};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ } else {
+ int dx[] = { 2, 1 ,0,-1,-2};
+ int dy[] = { 2, 1, 0,-1,-2};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ }
+ } else { /* 縦横配置 */
+ if (i%4==0) { /* 上下 */
+ int dx[] = {-2,-1, 0, 1, 2};
+ int dy[] = { 0, 0, 0, 0, 0};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ } else { /* 左右 */
+ int dx[] = { 0, 0, 0, 0, 0};
+ int dy[] = {-2,-1, 0, 1, 2};
+ memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx));
+ memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy));
+ }
+ }
+ pos++;
+ }
+}
+
/*==========================================
* スキル?係ファイル?み?み
* skill_db.txt スキルデ?タ
@@ -9699,14 +9264,10 @@ int skill_readdb(void)
return 1;
}
while(fgets(line,1020,fp)){
- char *split[50], *split2[MAX_SKILL_LEVEL];
+ char *split[50];
if(line[0]=='/' && line[1]=='/')
continue;
- for(j=0,p=line;j<14 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,14);
if(split[13]==NULL || j<14)
continue;
@@ -9717,28 +9278,13 @@ int skill_readdb(void)
continue;
/* printf("skill id=%d\n",i); */
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[1];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].range[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[1],skill_db[i].range);
skill_db[i].hit=atoi(split[2]);
skill_db[i].inf=atoi(split[3]);
skill_db[i].pl=atoi(split[4]);
skill_db[i].nk=atoi(split[5]);
skill_db[i].max=atoi(split[6]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[7];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].num[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[1],skill_db[i].num);
if(strcmpi(split[8],"yes") == 0)
skill_db[i].castcancel=1;
@@ -9755,14 +9301,7 @@ int skill_readdb(void)
skill_db[i].skill_type=BF_MISC;
else
skill_db[i].skill_type=0;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[13];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].blewcount[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[13],skill_db[i].blewcount);
}
fclose(fp);
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_db.txt");
@@ -9774,14 +9313,10 @@ int skill_readdb(void)
return 1;
}
while(fgets(line,1020,fp)){
- char *split[51], *split2[MAX_SKILL_LEVEL];
+ char *split[50];
if(line[0]=='/' && line[1]=='/')
continue;
- for(j=0,p=line;j<30 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,30);
if(split[29]==NULL || j<30)
continue;
@@ -9791,74 +9326,26 @@ int skill_readdb(void)
else if(i<=0 || i>MAX_SKILL_DB)
continue;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[1];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].hp[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[2];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].mhp[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[3];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].sp[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[4];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].hp_rate[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[5];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].sp_rate[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[6];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].zeny[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[7];j<32 && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<32 && split2[k];k++) {
- l = atoi(split2[k]);
- if(l == 99) {
+ skill_split_atoi(split[1],skill_db[i].hp);
+ skill_split_atoi(split[2],skill_db[i].mhp);
+ skill_split_atoi(split[3],skill_db[i].sp);
+ skill_split_atoi(split[4],skill_db[i].hp_rate);
+ skill_split_atoi(split[5],skill_db[i].sp_rate);
+ skill_split_atoi(split[6],skill_db[i].zeny);
+
+ p = split[7];
+ for(j=0;j<32;j++){
+ l = atoi(p);
+ if (l==99) {
skill_db[i].weapon = 0xffffffff;
break;
}
else
skill_db[i].weapon |= 1<<l;
+ p=strchr(p,':');
+ if(!p)
+ break;
+ p++;
}
if( strcmpi(split[8],"hiding")==0 ) skill_db[i].state=ST_HIDING;
@@ -9875,14 +9362,7 @@ int skill_readdb(void)
else if( strcmpi(split[8],"water")==0 ) skill_db[i].state=ST_WATER;
else skill_db[i].state=ST_NONE;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[9];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].spiritball[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[9],skill_db[i].spiritball);
skill_db[i].itemid[0]=atoi(split[10]);
skill_db[i].amount[0]=atoi(split[11]);
skill_db[i].itemid[1]=atoi(split[12]);
@@ -9915,15 +9395,11 @@ int skill_readdb(void)
return 1;
}
while(fgets(line,1020,fp)){
- char *split[50], *split2[MAX_SKILL_LEVEL];
+ char *split[50];
memset(split,0,sizeof(split)); // [Valaris] thanks to fov
if(line[0]=='/' && line[1]=='/')
continue;
- for(j=0,p=line;j<5 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,5);
if(split[4]==NULL || j<5)
continue;
@@ -9933,45 +9409,55 @@ int skill_readdb(void)
else if(i<=0 || i>MAX_SKILL_DB)
continue;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[1];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].cast[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[2];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].delay[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[1],skill_db[i].cast);
+ skill_split_atoi(split[2],skill_db[i].delay);
+ skill_split_atoi(split[3],skill_db[i].upkeep_time);
+ skill_split_atoi(split[4],skill_db[i].upkeep_time2);
+ }
+ fclose(fp);
+ sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_cast_db.txt");
+ ShowStatus(tmp_output);
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[3];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].upkeep_time[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ /* スキルユニットデータベース */
+ fp = fopen("db/skill_unit_db.txt","r");
+ if (fp==NULL) {
+ printf("can't read db/skill_unit_db.txt\n");
+ return 1;
+ }
+ while (fgets(line,1020,fp)) {
+ char *split[50];
+ if (line[0]=='/' && line[1]=='/')
+ continue;
+ j = skill_split_str(line,split,8);
+ if (split[7]==NULL || j<8)
+ continue;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[4];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].upkeep_time2[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ i=atoi(split[0]);
+ if (i>=10000 && i<10015) // for guild skills [Celest]
+ i -= 9500;
+ else if(i<=0 || i>MAX_SKILL_DB)
+ continue;
+ skill_db[i].unit_id[0] = strtol(split[1],NULL,16);
+ skill_db[i].unit_id[1] = strtol(split[2],NULL,16);
+ skill_split_atoi(split[3],skill_db[i].unit_layout_type);
+ skill_db[i].unit_range = atoi(split[4]);
+ skill_db[i].unit_interval = atoi(split[5]);
+
+ if( strcmpi(split[6],"noenemy")==0 ) skill_db[i].unit_target=BCT_NOENEMY;
+ else if( strcmpi(split[6],"friend")==0 ) skill_db[i].unit_target=BCT_NOENEMY;
+ else if( strcmpi(split[6],"party")==0 ) skill_db[i].unit_target=BCT_PARTY;
+ else if( strcmpi(split[6],"all")==0 ) skill_db[i].unit_target=BCT_ALL;
+ else if( strcmpi(split[6],"enemy")==0 ) skill_db[i].unit_target=BCT_ENEMY;
+ else if( strcmpi(split[6],"self")==0 ) skill_db[i].unit_target=BCT_SELF;
+ else skill_db[i].unit_target = strtol(split[6],NULL,16);
+
+ skill_db[i].unit_flag = strtol(split[7],NULL,16);
+ k++;
}
fclose(fp);
- sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_cast_db.txt");
+ sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_unit_db.txt");
ShowStatus(tmp_output);
+ skill_init_unit_layout();
/* 製造系スキルデ?タベ?ス */
memset(skill_produce_db,0,sizeof(skill_produce_db));
@@ -9990,16 +9476,11 @@ int skill_readdb(void)
if(line[0]=='/' && line[1]=='/')
continue;
memset(split,0,sizeof(split));
- for(j=0,p=line;j<3 + MAX_PRODUCE_RESOURCE * 2 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,(3 + MAX_PRODUCE_RESOURCE * 2));
if(split[0]==0) //fixed by Lupus
continue;
i=atoi(split[0]);
- if(i<=0)
- continue;
+ if(i<=0) continue;
skill_produce_db[k].nameid=i;
skill_produce_db[k].itemlv=atoi(split[1]);
@@ -10031,11 +9512,7 @@ int skill_readdb(void)
if(line[0]=='/' && line[1]=='/')
continue;
memset(split,0,sizeof(split));
- for(j=0,p=line;j<13 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,13);
if(split[0]==0) //fixed by Lupus
continue;
i=atoi(split[0]);
@@ -10068,11 +9545,7 @@ int skill_readdb(void)
if(line[0]=='/' && line[1]=='/')
continue;
memset(split,0,sizeof(split));
- for(j=0,p=line;j<13 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,13);
if(split[0]==0) //fixed by Lupus
continue;
i=atoi(split[0]);
@@ -10096,15 +9569,11 @@ int skill_readdb(void)
return 1;
}
while(fgets(line,1020,fp)){
- char *split[50], *split2[MAX_SKILL_LEVEL];
+ char *split[50];
if(line[0]=='/' && line[1]=='/')
continue;
memset(split,0,sizeof(split));
- for(j=0,p=line;j<3 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,3);
if(split[0]==0) //fixed by Lupus
continue;
i=atoi(split[0]);
@@ -10113,25 +9582,10 @@ int skill_readdb(void)
else if(i<=0 || i>MAX_SKILL_DB)
continue;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[1];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].castnodex[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
-
+ skill_split_atoi(split[1],skill_db[i].castnodex);
if (!split[2])
continue;
- memset(split2,0,sizeof(split2));
- for(j=0,p=split[2];j<MAX_SKILL_LEVEL && p;j++){
- split2[j]=p;
- p=strchr(p,':');
- if(p) *p++=0;
- }
- for(k=0;k<MAX_SKILL_LEVEL;k++)
- skill_db[i].delaynodex[k]=(split2[k])? atoi(split2[k]):atoi(split2[0]);
+ skill_split_atoi(split[2],skill_db[i].delaynodex);
}
fclose(fp);
sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/skill_castnodex_db.txt");
@@ -10148,11 +9602,7 @@ int skill_readdb(void)
if(line[0]=='/' && line[1]=='/')
continue;
memset(split,0,sizeof(split));
- for(j=0,p=line;j<2 && p;j++){
- split[j]=p;
- p=strchr(p,',');
- if(p) *p++=0;
- }
+ j = skill_split_str(line,split,2);
if(split[0]==0) //fixed by Lupus
continue;
i=atoi(split[0]);