Преглед на файлове

Fixed some EOL issues

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1056 54d463be-8e91-2dee-dedb-b68131a5f0ec
(no author) преди 20 години
родител
ревизия
934b36ecb4
променени са 7 файла, в които са добавени 7056 реда и са изтрити 7056 реда
  1. 193 193
      conf-tmpl/mapflag/noreturn.txt
  2. 5 5
      db/item_db2.txt
  3. 1921 1921
      npc/jobs/2-2/monk.txt
  4. 15 15
      npc/sample/npc_test_npctimer2.txt
  5. 18 18
      src/common/buffer.h
  6. 4823 4823
      src/map/status.c
  7. 81 81
      src/map/status.h

+ 193 - 193
conf-tmpl/mapflag/noreturn.txt

@@ -1,194 +1,194 @@
-//===== eAthena Script =======================================
-//= Map flags that disable use of Butterfly wings
-//===== By: ==================================================
-//= eAthena Dev Team
-//= 1.0
-//===== Notes: ===============================================
-//= For disabling Fly wings use noteleport
-//===== Current Version: =====================================
-
-// Cities ========================
-ayo_in01.gat	mapflag	noreturn
-ayo_in02.gat	mapflag	noreturn
-alb_ship.gat	mapflag	noreturn
-alberta_in.gat	mapflag	noreturn
-aldeba_in.gat	mapflag	noreturn
-ama_in01.gat	mapflag	noreturn
-ama_in02.gat	mapflag	noreturn
-cmd_in01.gat	mapflag	noreturn
-cmd_in02.gat	mapflag	noreturn
-gef_tower.gat	mapflag	noreturn
-geffen_in.gat	mapflag	noreturn
-gon_test.gat	mapflag	noreturn
-gon_in.gat	mapflag	noreturn
-in_orcs01.gat	mapflag	noreturn
-izlude_in.gat	mapflag	noreturn
-jawaii_in.gat	mapflag	noreturn
-lou_in01.gat	mapflag	noreturn
-lou_in02.gat	mapflag	noreturn
-moc_castle.gat	mapflag	noreturn
-morocc_in.gat	mapflag	noreturn
-new_1-1.gat	mapflag	noreturn
-new_1-2.gat	mapflag	noreturn
-new_1-3.gat	mapflag	noreturn
-new_1-4.gat	mapflag	noreturn
-nif_in.gat	mapflag	noreturn
-payon_in01.gat	mapflag	noreturn
-payon_in02.gat	mapflag	noreturn
-payon_in03.gat	mapflag	noreturn
-prt_are_in.gat	mapflag	noreturn
-prt_are01.gat	mapflag	noreturn
-prt_castle.gat	mapflag	noreturn
-prt_church.gat	mapflag	noreturn
-prt_in.gat	mapflag	noreturn
-um_in.gat	mapflag	noreturn
-xmas_in.gat	mapflag	noreturn
-yuno_in01.gat	mapflag	noreturn
-yuno_in03.gat	mapflag	noreturn
-yuno_in04.gat	mapflag	noreturn
-yuno_in05.gat	mapflag	noreturn
-
-// Job Quests ====================
-sword_1-1.gat	mapflag	noreturn
-sword_2-1.gat	mapflag	noreturn
-sword_3-1.gat	mapflag	noreturn
-job_thief1.gat	mapflag	noreturn
-// 2-1 -----------------------
-job_hunte.gat	mapflag	noreturn
-job_knight.gat	mapflag	noreturn
-job_prist.gat	mapflag	noreturn
-job_wiz.gat	mapflag	noreturn
-in_hunter.gat	mapflag	noreturn
-in_moc_16.gat	mapflag	noreturn
-// 2-2 --------------------
-alde_alche.gat	mapflag	noreturn
-job_cru.gat	mapflag	noreturn
-job_duncer.gat	mapflag	noreturn
-job_monk.gat	mapflag	noreturn
-monk_test.gat	mapflag	noreturn
-monk_in.gat	mapflag	noreturn
-in_rogue.gat	mapflag	noreturn
-job_sage.gat	mapflag	noreturn
-
-// Special Quests Places =========
-que_god01.gat	mapflag	noreturn
-que_god02.gat	mapflag	noreturn
-
-// Guild Castles =================
-aldeg_cas01.gat	mapflag	noreturn
-aldeg_cas02.gat	mapflag	noreturn
-aldeg_cas03.gat	mapflag	noreturn
-aldeg_cas04.gat	mapflag	noreturn
-aldeg_cas05.gat	mapflag	noreturn
-gefg_cas01.gat	mapflag	noreturn
-gefg_cas02.gat	mapflag	noreturn
-gefg_cas03.gat	mapflag	noreturn
-gefg_cas04.gat	mapflag	noreturn
-gefg_cas05.gat	mapflag	noreturn
-payg_cas01.gat	mapflag	noreturn
-payg_cas02.gat	mapflag	noreturn
-payg_cas03.gat	mapflag	noreturn
-payg_cas04.gat	mapflag	noreturn
-payg_cas05.gat	mapflag	noreturn
-prtg_cas01.gat	mapflag	noreturn
-prtg_cas02.gat	mapflag	noreturn
-prtg_cas03.gat	mapflag	noreturn
-prtg_cas04.gat	mapflag	noreturn
-prtg_cas05.gat	mapflag	noreturn
-
-// GvG Arenas ===================
-guild_vs1.gat	mapflag	noreturn
-guild_vs2.gat	mapflag	noreturn
-guild_vs3.gat	mapflag	noreturn
-guild_vs4.gat	mapflag	noreturn
-guild_vs5.gat	mapflag	noreturn
-
-// Arenas =====================>\\
-arena_room.gat	mapflag	noreturn
-sec_in01.gat	mapflag	noreturn
-sec_in02.gat	mapflag	noreturn
-
-// PvP Arenas=======================
-pvp_y_room.gat	mapflag	noreturn
-pvp_y_1-1.gat	mapflag	noreturn
-pvp_y_1-2.gat	mapflag	noreturn
-pvp_y_1-3.gat	mapflag	noreturn
-pvp_y_1-4.gat	mapflag	noreturn
-pvp_y_1-5.gat	mapflag	noreturn
-pvp_y_2-1.gat	mapflag	noreturn
-pvp_y_2-2.gat	mapflag	noreturn
-pvp_y_2-3.gat	mapflag	noreturn
-pvp_y_2-4.gat	mapflag	noreturn
-pvp_y_2-5.gat	mapflag	noreturn
-pvp_y_3-1.gat	mapflag	noreturn
-pvp_y_3-2.gat	mapflag	noreturn
-pvp_y_3-3.gat	mapflag	noreturn
-pvp_y_3-4.gat	mapflag	noreturn
-pvp_y_3-5.gat	mapflag	noreturn
-pvp_y_4-1.gat	mapflag	noreturn
-pvp_y_4-2.gat	mapflag	noreturn
-pvp_y_4-3.gat	mapflag	noreturn
-pvp_y_4-4.gat	mapflag	noreturn
-pvp_y_4-5.gat	mapflag	noreturn
-pvp_y_5-1.gat	mapflag	noreturn
-pvp_y_5-2.gat	mapflag	noreturn
-pvp_y_5-3.gat	mapflag	noreturn
-pvp_y_5-4.gat	mapflag	noreturn
-pvp_y_5-5.gat	mapflag	noreturn
-pvp_y_6-1.gat	mapflag	noreturn
-pvp_y_6-2.gat	mapflag	noreturn
-pvp_y_6-3.gat	mapflag	noreturn
-pvp_y_6-4.gat	mapflag	noreturn
-pvp_y_6-5.gat	mapflag	noreturn
-pvp_y_7-1.gat	mapflag	noreturn
-pvp_y_7-2.gat	mapflag	noreturn
-pvp_y_7-3.gat	mapflag	noreturn
-pvp_y_7-4.gat	mapflag	noreturn
-pvp_y_7-5.gat	mapflag	noreturn
-pvp_y_8-1.gat	mapflag	noreturn
-pvp_y_8-2.gat	mapflag	noreturn
-pvp_y_8-3.gat	mapflag	noreturn
-pvp_y_8-4.gat	mapflag	noreturn
-pvp_y_8-5.gat	mapflag	noreturn
-pvp_n_room.gat	mapflag	noreturn
-pvp_n_1-1.gat	mapflag	noreturn
-pvp_n_1-2.gat	mapflag	noreturn
-pvp_n_1-3.gat	mapflag	noreturn
-pvp_n_1-4.gat	mapflag	noreturn
-pvp_n_1-5.gat	mapflag	noreturn
-pvp_n_2-1.gat	mapflag	noreturn
-pvp_n_2-2.gat	mapflag	noreturn
-pvp_n_2-3.gat	mapflag	noreturn
-pvp_n_2-4.gat	mapflag	noreturn
-pvp_n_2-5.gat	mapflag	noreturn
-pvp_n_3-1.gat	mapflag	noreturn
-pvp_n_3-2.gat	mapflag	noreturn
-pvp_n_3-3.gat	mapflag	noreturn
-pvp_n_3-4.gat	mapflag	noreturn
-pvp_n_3-5.gat	mapflag	noreturn
-pvp_n_4-1.gat	mapflag	noreturn
-pvp_n_4-2.gat	mapflag	noreturn
-pvp_n_4-3.gat	mapflag	noreturn
-pvp_n_4-4.gat	mapflag	noreturn
-pvp_n_4-5.gat	mapflag	noreturn
-pvp_n_5-1.gat	mapflag	noreturn
-pvp_n_5-2.gat	mapflag	noreturn
-pvp_n_5-3.gat	mapflag	noreturn
-pvp_n_5-4.gat	mapflag	noreturn
-pvp_n_5-5.gat	mapflag	noreturn
-pvp_n_6-1.gat	mapflag	noreturn
-pvp_n_6-2.gat	mapflag	noreturn
-pvp_n_6-3.gat	mapflag	noreturn
-pvp_n_6-4.gat	mapflag	noreturn
-pvp_n_6-5.gat	mapflag	noreturn
-pvp_n_7-1.gat	mapflag	noreturn
-pvp_n_7-2.gat	mapflag	noreturn
-pvp_n_7-3.gat	mapflag	noreturn
-pvp_n_7-4.gat	mapflag	noreturn
-pvp_n_7-5.gat	mapflag	noreturn
-pvp_n_8-1.gat	mapflag	noreturn
-pvp_n_8-2.gat	mapflag	noreturn
-pvp_n_8-3.gat	mapflag	noreturn
-pvp_n_8-4.gat	mapflag	noreturn
-pvp_n_8-5.gat	mapflag	noreturn
+//===== eAthena Script =======================================
+//= Map flags that disable use of Butterfly wings
+//===== By: ==================================================
+//= eAthena Dev Team
+//= 1.0
+//===== Notes: ===============================================
+//= For disabling Fly wings use noteleport
+//===== Current Version: =====================================
+
+// Cities ========================
+ayo_in01.gat	mapflag	noreturn
+ayo_in02.gat	mapflag	noreturn
+alb_ship.gat	mapflag	noreturn
+alberta_in.gat	mapflag	noreturn
+aldeba_in.gat	mapflag	noreturn
+ama_in01.gat	mapflag	noreturn
+ama_in02.gat	mapflag	noreturn
+cmd_in01.gat	mapflag	noreturn
+cmd_in02.gat	mapflag	noreturn
+gef_tower.gat	mapflag	noreturn
+geffen_in.gat	mapflag	noreturn
+gon_test.gat	mapflag	noreturn
+gon_in.gat	mapflag	noreturn
+in_orcs01.gat	mapflag	noreturn
+izlude_in.gat	mapflag	noreturn
+jawaii_in.gat	mapflag	noreturn
+lou_in01.gat	mapflag	noreturn
+lou_in02.gat	mapflag	noreturn
+moc_castle.gat	mapflag	noreturn
+morocc_in.gat	mapflag	noreturn
+new_1-1.gat	mapflag	noreturn
+new_1-2.gat	mapflag	noreturn
+new_1-3.gat	mapflag	noreturn
+new_1-4.gat	mapflag	noreturn
+nif_in.gat	mapflag	noreturn
+payon_in01.gat	mapflag	noreturn
+payon_in02.gat	mapflag	noreturn
+payon_in03.gat	mapflag	noreturn
+prt_are_in.gat	mapflag	noreturn
+prt_are01.gat	mapflag	noreturn
+prt_castle.gat	mapflag	noreturn
+prt_church.gat	mapflag	noreturn
+prt_in.gat	mapflag	noreturn
+um_in.gat	mapflag	noreturn
+xmas_in.gat	mapflag	noreturn
+yuno_in01.gat	mapflag	noreturn
+yuno_in03.gat	mapflag	noreturn
+yuno_in04.gat	mapflag	noreturn
+yuno_in05.gat	mapflag	noreturn
+
+// Job Quests ====================
+sword_1-1.gat	mapflag	noreturn
+sword_2-1.gat	mapflag	noreturn
+sword_3-1.gat	mapflag	noreturn
+job_thief1.gat	mapflag	noreturn
+// 2-1 -----------------------
+job_hunte.gat	mapflag	noreturn
+job_knight.gat	mapflag	noreturn
+job_prist.gat	mapflag	noreturn
+job_wiz.gat	mapflag	noreturn
+in_hunter.gat	mapflag	noreturn
+in_moc_16.gat	mapflag	noreturn
+// 2-2 --------------------
+alde_alche.gat	mapflag	noreturn
+job_cru.gat	mapflag	noreturn
+job_duncer.gat	mapflag	noreturn
+job_monk.gat	mapflag	noreturn
+monk_test.gat	mapflag	noreturn
+monk_in.gat	mapflag	noreturn
+in_rogue.gat	mapflag	noreturn
+job_sage.gat	mapflag	noreturn
+
+// Special Quests Places =========
+que_god01.gat	mapflag	noreturn
+que_god02.gat	mapflag	noreturn
+
+// Guild Castles =================
+aldeg_cas01.gat	mapflag	noreturn
+aldeg_cas02.gat	mapflag	noreturn
+aldeg_cas03.gat	mapflag	noreturn
+aldeg_cas04.gat	mapflag	noreturn
+aldeg_cas05.gat	mapflag	noreturn
+gefg_cas01.gat	mapflag	noreturn
+gefg_cas02.gat	mapflag	noreturn
+gefg_cas03.gat	mapflag	noreturn
+gefg_cas04.gat	mapflag	noreturn
+gefg_cas05.gat	mapflag	noreturn
+payg_cas01.gat	mapflag	noreturn
+payg_cas02.gat	mapflag	noreturn
+payg_cas03.gat	mapflag	noreturn
+payg_cas04.gat	mapflag	noreturn
+payg_cas05.gat	mapflag	noreturn
+prtg_cas01.gat	mapflag	noreturn
+prtg_cas02.gat	mapflag	noreturn
+prtg_cas03.gat	mapflag	noreturn
+prtg_cas04.gat	mapflag	noreturn
+prtg_cas05.gat	mapflag	noreturn
+
+// GvG Arenas ===================
+guild_vs1.gat	mapflag	noreturn
+guild_vs2.gat	mapflag	noreturn
+guild_vs3.gat	mapflag	noreturn
+guild_vs4.gat	mapflag	noreturn
+guild_vs5.gat	mapflag	noreturn
+
+// Arenas =====================>\\
+arena_room.gat	mapflag	noreturn
+sec_in01.gat	mapflag	noreturn
+sec_in02.gat	mapflag	noreturn
+
+// PvP Arenas=======================
+pvp_y_room.gat	mapflag	noreturn
+pvp_y_1-1.gat	mapflag	noreturn
+pvp_y_1-2.gat	mapflag	noreturn
+pvp_y_1-3.gat	mapflag	noreturn
+pvp_y_1-4.gat	mapflag	noreturn
+pvp_y_1-5.gat	mapflag	noreturn
+pvp_y_2-1.gat	mapflag	noreturn
+pvp_y_2-2.gat	mapflag	noreturn
+pvp_y_2-3.gat	mapflag	noreturn
+pvp_y_2-4.gat	mapflag	noreturn
+pvp_y_2-5.gat	mapflag	noreturn
+pvp_y_3-1.gat	mapflag	noreturn
+pvp_y_3-2.gat	mapflag	noreturn
+pvp_y_3-3.gat	mapflag	noreturn
+pvp_y_3-4.gat	mapflag	noreturn
+pvp_y_3-5.gat	mapflag	noreturn
+pvp_y_4-1.gat	mapflag	noreturn
+pvp_y_4-2.gat	mapflag	noreturn
+pvp_y_4-3.gat	mapflag	noreturn
+pvp_y_4-4.gat	mapflag	noreturn
+pvp_y_4-5.gat	mapflag	noreturn
+pvp_y_5-1.gat	mapflag	noreturn
+pvp_y_5-2.gat	mapflag	noreturn
+pvp_y_5-3.gat	mapflag	noreturn
+pvp_y_5-4.gat	mapflag	noreturn
+pvp_y_5-5.gat	mapflag	noreturn
+pvp_y_6-1.gat	mapflag	noreturn
+pvp_y_6-2.gat	mapflag	noreturn
+pvp_y_6-3.gat	mapflag	noreturn
+pvp_y_6-4.gat	mapflag	noreturn
+pvp_y_6-5.gat	mapflag	noreturn
+pvp_y_7-1.gat	mapflag	noreturn
+pvp_y_7-2.gat	mapflag	noreturn
+pvp_y_7-3.gat	mapflag	noreturn
+pvp_y_7-4.gat	mapflag	noreturn
+pvp_y_7-5.gat	mapflag	noreturn
+pvp_y_8-1.gat	mapflag	noreturn
+pvp_y_8-2.gat	mapflag	noreturn
+pvp_y_8-3.gat	mapflag	noreturn
+pvp_y_8-4.gat	mapflag	noreturn
+pvp_y_8-5.gat	mapflag	noreturn
+pvp_n_room.gat	mapflag	noreturn
+pvp_n_1-1.gat	mapflag	noreturn
+pvp_n_1-2.gat	mapflag	noreturn
+pvp_n_1-3.gat	mapflag	noreturn
+pvp_n_1-4.gat	mapflag	noreturn
+pvp_n_1-5.gat	mapflag	noreturn
+pvp_n_2-1.gat	mapflag	noreturn
+pvp_n_2-2.gat	mapflag	noreturn
+pvp_n_2-3.gat	mapflag	noreturn
+pvp_n_2-4.gat	mapflag	noreturn
+pvp_n_2-5.gat	mapflag	noreturn
+pvp_n_3-1.gat	mapflag	noreturn
+pvp_n_3-2.gat	mapflag	noreturn
+pvp_n_3-3.gat	mapflag	noreturn
+pvp_n_3-4.gat	mapflag	noreturn
+pvp_n_3-5.gat	mapflag	noreturn
+pvp_n_4-1.gat	mapflag	noreturn
+pvp_n_4-2.gat	mapflag	noreturn
+pvp_n_4-3.gat	mapflag	noreturn
+pvp_n_4-4.gat	mapflag	noreturn
+pvp_n_4-5.gat	mapflag	noreturn
+pvp_n_5-1.gat	mapflag	noreturn
+pvp_n_5-2.gat	mapflag	noreturn
+pvp_n_5-3.gat	mapflag	noreturn
+pvp_n_5-4.gat	mapflag	noreturn
+pvp_n_5-5.gat	mapflag	noreturn
+pvp_n_6-1.gat	mapflag	noreturn
+pvp_n_6-2.gat	mapflag	noreturn
+pvp_n_6-3.gat	mapflag	noreturn
+pvp_n_6-4.gat	mapflag	noreturn
+pvp_n_6-5.gat	mapflag	noreturn
+pvp_n_7-1.gat	mapflag	noreturn
+pvp_n_7-2.gat	mapflag	noreturn
+pvp_n_7-3.gat	mapflag	noreturn
+pvp_n_7-4.gat	mapflag	noreturn
+pvp_n_7-5.gat	mapflag	noreturn
+pvp_n_8-1.gat	mapflag	noreturn
+pvp_n_8-2.gat	mapflag	noreturn
+pvp_n_8-3.gat	mapflag	noreturn
+pvp_n_8-4.gat	mapflag	noreturn
+pvp_n_8-5.gat	mapflag	noreturn
 pvp_2vs2.gat	mapflag	noreturn

+ 5 - 5
db/item_db2.txt

@@ -1,6 +1,6 @@
-//ID,Name,Name,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Gender,Loc,wLV,eLV,View,{UseScript},{EquipScript}
-//Elements: 0 Nothing, 1 Water, 2 Earth ,3 Fire, 4 Wind, 5 Poison, 6 Saint, 7 Darkness, 8 Sense, 9 Immortality
-
-// Custom Items go here
-//=============================================================
+//ID,Name,Name,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Gender,Loc,wLV,eLV,View,{UseScript},{EquipScript}
+//Elements: 0 Nothing, 1 Water, 2 Earth ,3 Fire, 4 Wind, 5 Poison, 6 Saint, 7 Darkness, 8 Sense, 9 Immortality
+
+// Custom Items go here
+//=============================================================
 0,DEFAULT,Default,0,20,,10,,,,,0,2,0,0,,,{},{}

+ 1921 - 1921
npc/jobs/2-2/monk.txt

@@ -1,1921 +1,1921 @@
-//===== eAthena Script ======================================= 
-//= Monk Job Quest
-//===== By: ==================================================
-//= Dino9021, Edited / Translated by Celest
-//===== Current Version: ===================================== 
-//= 1.1+
-//===== Compatible With: ===================================== 
-//= eAthena 1.0 +
-//===== Description: ========================================= 
-//= Monk Job Quests for Athena 2004.12.30
-//===== Additional Comments: ================================= 
-// 1.1 Fixed missing '";'. Now it's loading fine [Lupus]
-// 1.1+ Edited/Translated 5% [Celest]
-//============================================================ 
-
-prt_monk.gat,55,249,4	script	Tohobu the Guarding Monk	139,0,5,{
-	mes "[Tohobu]";
-	mes "Who are you?!";
-	mes "How dare you enter this holy training place without my permission!!";
-	next;
-	mes "[Tohobu]";
-	mes "Get Out!!";
-	close;
-}
-prt_monk.gat,59,247,4	script	Master	120,{
-	if(JOB_MONK_Q == 1 ) goto Part1;
-	if(JOB_MONK_Q == 2 ) goto Part2;
-	if(Class == 15 || Class == 4016) goto IsMonk;
-	goto L_START;
-
-IsMonk:
-	mes "[Tohobu]";
-	mes "Your presence is not really welcomed at the ^00FF00St. Capitolina Abbey^000000.";
-	mes "However, welcome traveler, please do not disturb the Monks in training,";
-	mes "Even if you are a Monk!";
-	close;
-
-L_START:
-	mes "[Tohobu]";
-	mes "Hmmm...? What do you want from me?";
-	mes "Before entering the Training Area,";
-	mes "You shall have to first tell me your Name, Base Level and Job Level.";
-	next;
-	mes "[Tohobu]";
-	mes "Come! What is your name?";
-	next;
-	menu "Ignore him.",-,"Tell him.",L_MENU_1;
-
-		mes "[Tohobu]";
-		mes "You are so impolite! Get out!";
-		warp "prt_fild03.gat",357,256;
-		end;
-L_MENU_1:
-	mes "[Tohobu]";
-	mes "So... Your name is " + strcharinfo(0) + " Right?";
-	mes "...I believe it is pronounced that way.";
-	mes "Let's see... Job Level is " + joblevel;
-	next;
-	mes "[Tohobu]";
-	mes "Okay! Why have you come to see me, " + strcharinfo(0) + " ?";
-	next;
-	menu "I would like to see how Monks train themselves.",L_MENU_1_0,"I want to be a Monk.",L_MENU_1_1,"I would like to rest here.",L_MENU_1_2;
-
-	L_MENU_1_0:	
-		mes "[Tohobu]";
-		mes "Oh! I see.";
-		mes "Okay, I hope you'll learn something from our training,";
-		mes "Perhaps it might aid you in becoming a worthy Monk.";
-		set JOB_MONK_Q, 1;
-		close;
-
-	L_MENU_1_1:
-		if(Class != 4 && Class != 4005) goto IsNot4;
-		if(joblevel >= 40 ) goto SkillPointChk;
-			mes "[Tohobu]";
-			mes "Your Job Level is not high enough to be a Monk.";
-			mes "Come back when your Job Level higher then 40.";
-			next;
-			mes "[Tohobu]";
-			mes "No need to be hasty, there is so much to learn on this world,";
-			mes "Come back when you have met the requirements... Haha!";
-			close;
-
-		SkillPointChk:
-
-			if(skillpoint == 0) goto L_GO;
-			mes "[Tohobu]";
-			mes "Well... It seems that you have the ability to be a Monk,";
-			mes "But I believe there are skill needed you have yet to learn.";
-			mes "Come back when you have learnt all the skills.";
-			close;
-
-		IsNot4:
-			mes "[Tohobu]";
-			mes "Oh! Are you kidding?";
-			close;
-
-		HighMonk:
-			mes "[Tohobu]";
-			mes "Wow! You are a High Acolyte, aren't you?";
-			mes "I am sorry, but I can't let you become a Monk!";
-			mes "Please seek out the Champion, that is what you should be!";
-			set JOB_MONK_Q, 0;
-			close;
-
-		L_GO:
-			if (Class == 4005) goto HighMonk;
-			mes "[Tohobu]";
-			mes "Well... Seems you have the ability to be a Monk.";
-			mes "Very well then... Go to Wuhai the Elder, He will guide you.";
-			set JOB_MONK_Q, 2;
-			close;
-
-	L_MENU_1_2:
-		mes "[Tohobu]";
-		mes "Alright, you do look tired from your travels...";
-		mes "Perhaps it would be good to rest awhile.";
-		mes "Go ahead and rest at the Abbey before leaving!";
-		next;
-		mes "[Tohobu]";
-		mes "Persevering in order to gain more strength";
-		mes "Is the way of life of the Monks.";
-		mes "I hope that seeing our practises will";
-		mes "At least bring you some inner peace.";
-		close;
-Part1:
-	mes "[Tohobu]";
-	mes "Well? Have you changed your mind after looking around here?";
-	next;
-	menu "Nope.",L_MENU_1_0,"I want to be a Monk",L_MENU_1_1,"I need more rest.",L_MENU_1_2;
-
-Part2:
-	mes "[Tohobu]";
-	mes "Hello there! You should go to Wuhai the Elder, He will guide you.";
-	mes "He is in the Monastery Hall, South East from here";
-	close;
-}
-
-monk_in.gat,99,58,4	script	Elder Wuhai	60,{
-	if(JOB_MONK_Q == 2 ) goto L_START;
-	if(JOB_MONK_Q == 3 ) goto Part1;
-	if(JOB_MONK_Q == 4 ) goto Part2;
-	if(JOB_MONK_Q >= 5 && JOB_MONK < 10) goto Part3;
-	if(JOB_MONK_Q >= 10 && countitem(506) > 0) goto Part4;
-	if(JOB_MONK_Q == 11 && countitem(506) == 0) goto Part5;
-	if(Class == 15 || Class == 4016) goto Part6;
-	if(Class == 4 || Class == 4005) goto Part7;
-		goto IsOther;
-IsOther:
-	mes "[Elder Wuhai]";
-	mes "May you find God in the Mother Nature!!";
-	mes "Welcome traveler, why do you seek me?";
-	close;
-
-L_START:
-	mes "[Elder Wuhai]";
-	mes "Hmmm... You are the youth who wants to be a Monk, right?";
-	next;
-	menu "Yes.",L_MENU_1,"No.",-;
-		mes "[Elder Wuhai]";
-		mes "Hmmm...? Aren't you?";
-		mes "Maybe I'm getting older, I would've guessed if so.";
-		mes "Very well then... You may go, young man.";
-		close;
-L_MENU_1:
-	mes "[Elder Wuhai]";
-	mes "Oh! So young men these days still remember us Monks...";
-	mes "Welcome, my child!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "So you want to be a Monk! I'm glad to hear that!";
-	mes "But first, before you can become one,";
-	mes "There are a few things you need to know.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "As Monks, we undergo strict training";
-	mes "While protecting world peace.";
-	next;
-	mes "[Elder Wuhai]";	
-	mes "The strength is for giving aid to the weak in need,";
-	mes "And to protect them from harm.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Last but not least, control our emotions,";
-	mes "More importantly, never be too proud of yourself,";
-	mes "And be blinded by success,";
-	next;
-	mes "[Elder Wuhai]";
-	mes "It coukd be tough, even painful,";
-	mes "While undergoing this process.";
-	mes "Let's see if you're enduring enough,";
-	mes "You cannot become a Monk if you can't even bear this.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "OKay, let's start the test to see";
-	mes "If you really have the ability to become a Monk.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Firstly, here's a small exam";
-	mes "To test your will to become one of us.";
-	next;
-//~	if(joblevel == 50) goto IsJOB50;
-
-	set JOB_MONK_Q, 3;
-	set JOB_MONK_C,rand(1,6);
-L_Collect:
-	if(JOB_MONK_C == 1 ) goto L_Collect1;
-	if(JOB_MONK_C == 2 ) goto L_Collect2;
-	if(JOB_MONK_C == 3 ) goto L_Collect3;
-	if(JOB_MONK_C == 4 ) goto L_Collect4;
-	if(JOB_MONK_C == 5 ) goto L_Collect5;
-	if(JOB_MONK_C == 6 ) goto L_Collect6;
-
-	L_Collect1:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Tooth of Bat - 10";
-		mes "Bears Footskin - 5";
-		mes "Poison Spore - 20";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-
-	L_Collect2:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Porcupine Quill - 5";
-		mes "Cobweb - 20";
-		mes "Grasshopper's Leg - 10";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-
-	L_Collect3:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Stem - 30";
-		mes "Jellopy - 5";
-		mes "Worm Peeling -10";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-
-	L_Collect4:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Sticky Mucus - 5";
-		mes "Earthworm Peeling - 10";
-		mes "Green Herb - 20";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-
-	L_Collect5:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Yoyo Tail - 20";
-		mes "Iron Ore - 5";
-		mes "Blue Herb - 3";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-
-	L_Collect6:
-		mes "[Elder Wuhai]";
-		mes "Please bring these items";
-		mes "Solid Shell - 5";
-		mes "Shell - 20";
-		mes "Zargon - 5";
-		if(@collect_tmp != 1) goto L_CollectS;
-		close;
-L_CollectS:
-	mes "[Elder Wuhai]";
-	mes "To test your will, you will have to collect these items by yourself";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Come back to me when you have all of them.";
-	mes "Now go, May God's blessings be with you.";
-	close;
-
-//~IsJOB50:
-//~	mes "[Elder Wuhai]";
-//~	mes "However, I see that your Job Level is " +joblevel +" .";
-//~	mes "That could prove your ability.";
-//~	next;
-//~	mes "[Elder Wuhai]";
-//~	mes "Well done!";
-//~	mes "I think God will agree with me.";
-//~	next;
-//~	mes "[Elder Wuhai]";
-//~	mes "The next step, there is a Monk named Wutao want to see you.";
-//~	mes "He is in the Monk Grave North from here.";
-//~	set JOB_MONK_Q, 4;
-//~	close;
-
-Part1:
-//~	if(joblevel == 50) goto IsJOB50;
-	if(JOB_MONK_C == 1 && countitem(913) >= 10 && countitem(948) >= 5 && countitem(7033) >= 20) goto L_CollectS2_1;
-	if(JOB_MONK_C == 2 && countitem(1027) >= 5 && countitem(1025) >= 20 && countitem(940) >= 10) goto L_CollectS2_2;
-	if(JOB_MONK_C == 3 && countitem(905) >= 30 && countitem(909) >= 5 && countitem(955) >= 10) goto L_CollectS2_3;
-	if(JOB_MONK_C == 4 && countitem(938) >= 5 && countitem(1055) >= 10 && countitem(511) >= 20) goto L_CollectS2_4;
-	if(JOB_MONK_C == 5 && countitem(942) >= 20 && countitem(1002) >= 5 && countitem(510) >= 3) goto L_CollectS2_5;
-	if(JOB_MONK_C == 6 && countitem(943) >= 5 && countitem(935) >= 20 && countitem(912) >= 5) goto L_CollectS2_6;
-
-		mes "[Elder Wuhai]";
-		mes "Hmm... Still not ready yet?";
-		mes "Let me tell what you should bring again,";
-		mes "Listen carefully!";
-		next;
-		set @collect_tmp, 1;
-		goto L_Collect;
-
-		L_CollectS2_1:
-			delitem 913, 10;
-			delitem 948, 5;
-			delitem 7033, 20;
-			goto L_CollectS2_E;
-		L_CollectS2_2:
-			delitem 1027, 5;
-			delitem 1025, 20;
-			delitem 940, 10;
-			goto L_CollectS2_E;
-		L_CollectS2_3:
-			delitem 7012, 30;
-			delitem 909, 5;
-			delitem 955, 10;
-			goto L_CollectS2_E;
-		L_CollectS2_4:
-			delitem 938, 5;
-			delitem 1055, 10;
-			delitem 511, 20;
-			goto L_CollectS2_E;
-		L_CollectS2_5:
-			delitem 942, 20;
-			delitem 1002, 5;
-			delitem 510, 3;
-			goto L_CollectS2_E;
-		L_CollectS2_6:
-			delitem 943, 5;
-			delitem 935, 20;
-			delitem 912, 5;
-			goto L_CollectS2_E;
-	
-	L_CollectS2_E:
-		mes "[Elder Wuhai]";
-		mes "Oh! You've brought all of them!";
-		mes "Well done!";
-		mes "Your will in becoming in Monk is witnessable!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Let's see... there is a Monk named";
-		mes "Ah... Wutao who wants to see you.";
-		mes "He will be in the Ancestral Graveyard North from here.";
-		set JOB_MONK_Q, 4;
-		set JOB_MONK_C, 0;
-		close;
-
-Part2:
-	mes "[Elder Wuhai]";
-	mes "Next... should be questions regarding your job changing?";
-	mes "Go find master Wutao,";
-	mes "He will be in the Ancestral Graveyard North from here.";
-	close;
-Part3:
-	mes "[Elder Wuhai]";
-	mes "Hmm? You're still taking the test...?";
-	mes "Try to do your best in it then!";
-	close;
-Part4:
-	mes "[Elder Wuhai]";
-	mes "What? You haven't drunk that Magic Potion?";
-	mes "Then... Hurry up and finish the Green-ish potion!";
-	mes "Otherwise, you will never be able to achieve";
-	mes "The spiritual energy level of Monks!";
-	set JOB_MONK_Q, 11;
-	close;
-Part5:
-	mes "[Elder Wuhai]";
-	mes "We have done all steps... Your blood, your mind, your soul,";
-	mes "Is enough for you to become a Monk.";
-	mes "Even your spiritual energy has increased after drinking the Magic Potion.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Good... you will now be sworn in by oath";
-	mes "In which afterwards the job changing will be complete.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Are you willing to dedicate the rest of your life to serving God?";
-	next;
-	menu "Yes.",L_MONK_Q_2,"No.",-;
-
-		mes "[Elder Wuhai]";
-		mes "......What?......";
-		mes "Aren't you ready to become a Monk?";
-		mes "Perhaps you want to run around a bit more,";
-		mes "And shed some more sweat";
-		mes "To become more prepared?";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Consider carefully before coming back!";
-		mes "I do not want to make a bad Monk.";
-		close;
-L_MONK_Q_2:
-	mes "[Elder Wuhai]";
-	mes "Will you use the powers given to you for your own good?";
-	next;
-	menu "Yes.",-,"No.",L_MONK_Q_3;
-
-		mes "[Elder Wuhai]";
-		mes "...NO NO NO NO NO !! Our training is not for any self benefits!";
-		mes "How could one who protects world peace abuse this advantage";
-		mes "For their own selfish means?!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Go and think over the true purpose of a Monk.";
-		mes "Thoughts like that will only make you greedier for power";
-		mes "The corruption of your soul will only lead to loss of your ability.";
-		close;
-
-L_MONK_Q_3:
-	mes "[Elder Wuhai]";
-	mes "When judging those who have opposed the will of God,";
-	mes "Will you hesitate in punishing them?";
-	next;
-	menu "No.",L_MONK_Q_4,"Yes.",-;
-
-		mes "[Elder Wuhai]";
-		mes "What do you think Monks are?";
-		mes "No matter who they are,";
-		mes "People who harm the weak are like trash!";
-		mes "They do not have the right to live on this world!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Perhaps you should go to people who deny morals in this world,";
-		mes "Come back again when you've learnt how to hate.";
-		mes "Then you will know what to do.";
-		close;
-
-L_MONK_Q_4:
-	mes "[Elder Wuhai]";
-	mes "Will you help to eradicate those who oppose God,";
-	mes "And to sacrifice yourself for the better of others?";
-	next;
-	menu "Yes",L_MONK_Q_5,"No",-;
-
-		mes "[Elder Wuhai]";
-		mes "Oh...nonononono....";
-		mes "If sacrificing oneself would be beneficial to your peers,";
-		mes "And that more enemies can be rid of,";
-		mes "That would be a great and worthy thing to do!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "What does Sacrifice means? Come back when you've figured it out.";
-		mes "Ah.. Sacrifice can be so simple, yet so difficult!";
-		close;
-
-L_MONK_Q_5:
-	mes "[Elder Wuhai]";
-	mes "Will you train monsters behind you to help others in battle?";
-	next;
-	menu "Yes",-,"No",L_MONK_Q_6;
-
-		mes "[Elder Wuhai]";
-		mes "That is not right! Training mobs around";
-		mes "Doesn't only apply to all others";
-		mes "...";
-		// he's not making any sense =P
-		mes "Instead it is an act that violates the rights of other Monks";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Even when you've learnt the skill 'Steel Body'";
-		mes "It is only meant to be used in emergency, or when you meet a strong adversary.";
-		mes "But not in such a situation!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "It might feel that you're helping them,";
-		mes "But you are only commiting acts of unjust!";
-		mes "What is the true way of a Monk?";
-		mes "Come back when you have thought it over.";
-		close;
-
-L_MONK_Q_6:
-	mes "[Elder Wuhai]";
-	// mes "Will you spam?";
-	// "will you spam" is just so... un-monkly. ^^;
-	mes "In villages or wilderness, will you say the same words towards others repeatedly?";
-	next;
-	menu "Yes",-,"No",L_MONK_Q_7;
-
-		mes "[Elder Wuhai]";
-		mes "No! If you do so, not just Monks, even the common people,";
-		mes "No matter how loudly you've yelled no one will bother about you!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "It is the same even if you only wanted to spread the words of God.";
-		mes "Think of your behavior. What's right and wrong?";
-		mes "Although I would rather test you again, but I'll let you go this time.";
-		close;
-L_MONK_Q_7:
-	mes "[Elder Wuhai]";
-	mes "Do you feel as if you're a messenger of God, and are willing to die for God?";
-	next;
-	menu "Yes",L_MONK_Q_8,"No",-;
-
-		mes "[Elder Wuhai]";
-		mes "You cannot be a Monk with this kind of will!";
-		mes "As its said, Death is only temporary, Ever if we have to give our lives";
-		mes "to protect world peace, it would at least be a meaningful action!";
-		next;
-		mes "[Elder Wuhai]";
-		mes "Those who oppose God will be condemned,";
-		mes "While those who listen to God will live.";
-		mes "What is life and death to you?";
-		mes "Ponder that well.";
-		close;
-
-L_MONK_Q_8:
-	mes "Lastly, make an oath to swear you will keep to what you have answered.";
-	next;
-	menu "I swear.",L_MONK_Q_9,"I refuse.",-;
-
-		mes "[Elder Wuhai]";
-		mes "......";
-		next;
-		mes "[Elder Wuhai]";
-		mes "It seems like... you don't have enough training...";
-		mes "I can't let you become a Monk.";
-		next;
-		mes "[Elder Wuhai]";
-		mes "It is better for you to train more.";
-		mes "Come back when you ready.";
-		next;
-		mes "[Elder Wuhai]";
-		mes "May God be with you.";
-		close;
-
-L_MONK_Q_9:
-	mes "[Elder Wuhai]";
-	mes "Well then, we have completed the oaths";
-	mes "Gather closer now, you are already my brother!";
-//---- Progress bar ----//
-	next;
-	mes "[Elder Wuhai]";
-	mes "Your promise has transmited to all Monks throught ypur heart and my heart.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Now, let's begin the ceremony!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "I'll acupuncture your 365 acupuncture points and open up your 1129 arteries and veins";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Ahhhhhhhhh......";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Wuuu... Huuuuuu¡K";
-	next;
-	mes "[" + strcharinfo(0) + "]";
-	mes "- He take a deeply breath -";
-	next;
-	mes "[" + strcharinfo(0) + "]";
-	mes "- And begining to acupuncture -";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Ahhhh--- Dadadadadada!!!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "DaBaDaBaDadadadaKaBonTatatata!!!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Ahhhh--- Dadadadadada!!!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "WaLaChuOhhhhhhh!!!";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Wuuu... Huuuuuu¡K";
-	next;
-	mes "[Elder Wuhai]";
-	mes "WowHoooo... Okay, you are now a Monk!";
-	setoption 0;
-	jobchange 15;
-	callfunc "F_ClearJobVar";
-	next;
-	mes "[Elder Wuhai]";
-	mes "(Caught!) (Caught!)";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Am I old...? I feel so tired... (-sigh-)";
-	mes "I could clamb mountains after this before.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Very well... You are now a Monk...";
-	mes "Welcome to be one of us.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Bou never forget your promise.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Keep it in your mind, and train yourself.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Now go...";
-	mes "Here is a gift from us to congratulate you.";
-	if(joblevel <= 49) getitem 1801, 1;
-	if(joblevel == 50) getitem 1804, 1;
-	close;
-Part6:
-	mes "[Elder Wuhai]";
-	mes "May you find God in Mother Nature!";
-	mes "Welcome dear! What can I do for you?";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Is everything alright?";
-	mes "How the training?";
-	next;
-	mes "[Elder Wuhai]";
-	mes "If you don't have a strong body, you may not be able to help people when they needs you.";
-	mes "If you are weak, the Evil will come to you and leads you go into the dark side.";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Never forget it! You are the one protect weakers and world peace!";
-	mes "You should always mind the Evil. Don't let them leads you go into the dark side.";
-	close;
-
-Part7:
-	mes "[Elder Wuhai]";
-	mes "May you find God in Mother Nature!";
-	mes "Welcome dear! What can I do for you?";
-	next;
-	mes "[Elder Wuhai]";
-	mes "Oh! You are an Acolyte....";
-	mes "If you want to pray, go to Prontera Sanctuary!";
-	mes "This is the Monk training area, not for you to pray.";
-	mes "Go and find other places to stay if you are not willing to be a Monk.";
-	close;
-}
-
-prt_monk.gat,251,255,4	script	Wutao	79,{
-	if(JOB_MONK_Q == 4 ) goto L_START;
-	if(JOB_MONK_Q == 5 ) goto Part1;
-	if(JOB_MONK_Q == 6 ) goto Part2;
-	if(JOB_MONK_Q > 6 ) goto Part3;
-	goto IsOther;
-
-IsOther:
-	mes "[Wutao]";
-	mes "We are Monks!";
-	mes "We have unlimited power!";
-	mes "We have unlimited wise!";
-	mes "We use our power and wise to protect the world peace!";
-	next;
-	mes "[Wutao]";
-	mes "So...";
-	mes "Are you my enemy?";
-	mes "You block my way!!!!";
-	next;
-	mes "[Wutao]";
-	mes "If someone block me!! I'll fight!!";
-	mes "TaAhhhhhh!!!";
-	next;
-	mes "[Wutao]";
-	mes "HuHaaaaaaaa!!!";
-	next;
-	mes "[Wutao]";
-	mes "don;t be afraid, go yourway!";
-	close;
-
-L_START:
-	mes "[Wutao]";
-	mes "What can I do for you?";
-	mes "Do you want to talk about God?";
-	next;
-	mes "[Wutao]";
-	mes "Oh! you are proceeding the Monk Quest!";
-	mes "The spirits you have is like a Monk.";
-	next;
-	mes "[Wutao]";
-	mes "Seems your arteries and veins has been open.";
-	mes "You must be the one coming from Elder Wuhai, right?";
-	mes "Very well...";
-	next;
-	mes "[Wutao]";
-	mes "Let me introduce you something about the spirits of Monks and some simple rules that Monks should obey.";
-	mes "Then I'll help modifing your mental status, make your body ready for the next test.";
-	next;
-	mes "[Wutao]";
-	mes "Now, remember what I say and repeat again.";
-	mes "Clear your mind... Are you ready?";
-	next;
-	menu "Yes",L_MENU_1,"No",-;
-		mes "[Wutao]";
-		mes "Come back when you ready!";
-		close;
-L_MENU_1:
-	mes "[Wutao]";
-	mes "All right, let's begin.";
-	next;
-	set @JOB_MONK_C2, rand(1,4);
-L_Again:
-	if(@JOB_MONK_C2 == 1) goto L_ROOT_1;
-	if(@JOB_MONK_C2 == 2) goto L_ROOT_2;
-	if(@JOB_MONK_C2 == 3) goto L_ROOT_3;
-
-	L_ROOT_1:
-		set @monk_str0$,"Supported by dragon and phoenix,";
-		set @monk_str1$,"So flies he westward.";
-		set @monk_str2$,"But the phoenix shall fall to the earth.";
-		set @monk_str3$,"And the dragon shall soar to the sky;";
-		set @monk_str4$,"There shall be successes and failures,";
-		set @monk_str5$,"For such is the eternal law.";
-		set @monk_str6$,"See that ye act when occasion offers,";
-		set @monk_str7$,"Lest ye descend to the Nine Golden Springs.'";
-		goto L_MES;
-	L_ROOT_2:
-		set @monk_str0$,"He boasted not a handsome face,";
-		set @monk_str1$,"Nor was his body blessed with grace.";
-		set @monk_str2$,"His words streamed like a waterfall,";
-		set @monk_str3$,"He read a book and knew it all.";
-		set @monk_str4$,"Shu's glories could he well rehearse,";
-		set @monk_str5$,"His lore embraced the universe.";
-		set @monk_str6$,"Or text or note of scholiast";
-		set @monk_str7$,"Once read, his memory held fast.";
-		goto L_MES;
-	L_ROOT_3:
-		set @monk_str0$,"Seek ye a noble one? Then take ye the way of Jieliang,";
-		set @monk_str1$,"Watch ye how all people revere Guan Yu,";
-		set @monk_str2$,"Each excelling others to honor him,";
-		set @monk_str3$,"Him, one of the three brothers of the Peach Garden Oath,";
-		set @monk_str4$,"Who have won sacrifices, as emperor and king.";
-		set @monk_str5$,"Incomparable their aura spreads through the world;";
-		set @monk_str6$,"They are resplendent as the great lights of the firmament;";
-		set @monk_str7$,"Temples to our Lord Guan Yu abound, no village lacks one,";
-		set @monk_str8$,"Their venerable trees at sundown are the resting places for birds.";
-		goto L_MES;
-L_MES:
-	mes "[Wutao]";
-	mes "Listen carefully!";
-	next;
-	mes "[Wutao]";
-	mes @monk_str0$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str1$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str2$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str3$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str4$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str5$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str6$;
-	next;
-	mes "[Wutao]";
-	mes @monk_str7$;
-	if(@JOB_MONK_C2 < 3) goto L_MES_1;
-	next;
-	mes "[Wutao]";
-	mes @monk_str8$;
-
-L_MES_1:
-	next;
-	mes "[Wutao]";
-	mes "Now, " + strcharinfo(0) + ", it's your turn.";
-	next;
-	set @monk_q, 0;
-	if(@JOB_MONK_C2 == 1) goto L_MONK_Q1_1;
-	if(@JOB_MONK_C2 == 2) goto L_MONK_Q2_1;
-	if(@JOB_MONK_C2 == 3) goto L_MONK_Q3_1;
-
-L_MONK_Q1_1:
-
-	menu "And the dragon shall soar to the sky;",L_MONK_Q1_2,
-		"But the phoenix shall fall to the earth.",L_MONK_Q1_2,
-		"For such is the eternal law.",L_MONK_Q1_2,
-		"See that ye act when occasion offers,",L_MONK_Q1_2,
-		"There shall be successes and failures,",L_MONK_Q1_2,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_2,
-		"Supported by dragon and phoenix,",-,
-		"So flies he westward.",L_MONK_Q1_2;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_2:
-
-	menu "But the phoenix shall fall to the earth.",L_MONK_Q1_3,
-		"See that ye act when occasion offers,",L_MONK_Q1_3,
-		"Supported by dragon and phoenix,",L_MONK_Q1_3,
-		"There shall be successes and failures,",L_MONK_Q1_3,
-		"So flies he westward.",-,
-		"And the dragon shall soar to the sky;",L_MONK_Q1_3,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_3,
-		"For such is the eternal law.",L_MONK_Q1_3;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_3:
-
-	menu "There shall be successes and failures,",L_MONK_Q1_4,
-		"But the phoenix shall fall to the earth.",-,
-		"And the dragon shall soar to the sky;",L_MONK_Q1_4,
-		"So flies he westward.",L_MONK_Q1_4,
-		"For such is the eternal law.",L_MONK_Q1_4,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_4,
-		"See that ye act when occasion offers,",L_MONK_Q1_4,
-		"Supported by dragon and phoenix,",L_MONK_Q1_4;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_4:
-
-	menu "And the dragon shall soar to the sky;",-,
-		"Supported by dragon and phoenix,",L_MONK_Q1_5,
-		"But the phoenix shall fall to the earth.",L_MONK_Q1_5,
-		"So flies he westward.",L_MONK_Q1_5,
-		"For such is the eternal law.",L_MONK_Q1_5,
-		"There shall be successes and failures,",L_MONK_Q1_5,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_5,
-		"See that ye act when occasion offers,",L_MONK_Q1_5;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_5:
-
-	menu "For such is the eternal law.",L_MONK_Q1_6,
-		"And the dragon shall soar to the sky;",L_MONK_Q1_6,
-		"So flies he westward.",L_MONK_Q1_6,
-		"Supported by dragon and phoenix,",L_MONK_Q1_6,
-		"But the phoenix shall fall to the earth.",L_MONK_Q1_6,
-		"See that ye act when occasion offers,",L_MONK_Q1_6,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_6,
-		"There shall be successes and failures,",-;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_6:
-
-	menu "Supported by dragon and phoenix,",L_MONK_Q1_7,
-		"So flies he westward.",L_MONK_Q1_7,
-		"For such is the eternal law.",-,
-		"But the phoenix shall fall to the earth.",L_MONK_Q1_7,
-		"There shall be successes and failures,",L_MONK_Q1_7,
-		"And the dragon shall soar to the sky;",L_MONK_Q1_7,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_7,
-		"See that ye act when occasion offers,",L_MONK_Q1_7;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_7:
-
-	menu "So flies he westward.",L_MONK_Q1_8,
-		"Supported by dragon and phoenix,",L_MONK_Q1_8,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_8,
-		"See that ye act when occasion offers,",L_MONK_Q1_8,
-		"There shall be successes and failures,",L_MONK_Q1_8,
-		"For such is the eternal law.",L_MONK_Q1_8,
-		"But the phoenix shall fall to the earth.",L_MONK_Q1_8,
-		"And the dragon shall soar to the sky;",L_MONK_Q1_8,
-		"See that ye act when occasion offers,",-;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q1_8:
-
-	menu "Supported by dragon and phoenix,",L_MONK_QUEST_END,
-		"See that ye act when occasion offers,",L_MONK_QUEST_END,
-		"But the phoenix shall fall to the earth.",L_MONK_QUEST_END,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_QUEST_1_2,
-		"And the dragon shall soar to the sky;",L_MONK_QUEST_END,
-		"Lest ye descend to the Nine Golden Springs.",L_MONK_QUEST_END,
-		"So flies he westward.",L_MONK_QUEST_END,
-		"There shall be successes and failures,",L_MONK_QUEST_END,
-		"For such is the eternal law.",L_MONK_QUEST_END;
-
-L_MONK_Q2_1:
-
-	menu "Nor was his body blessed with grace.",L_MONK_Q2_2,
-		"He read a book and knew it all.",L_MONK_Q2_2,
-		"His words streamed like a waterfall,",L_MONK_Q2_2,
-		"He boasted not a handsome face,",-,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_2,
-		"Once read, his memory held fast.",L_MONK_Q2_2,
-		"His lore embraced the universe.",L_MONK_Q2_2,
-		"Or text or note of scholiast",L_MONK_Q2_2;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_2:
-
-	menu "His lore embraced the universe.",L_MONK_Q2_3,
-		"He boasted not a handsome face,",L_MONK_Q2_3,
-		"His words streamed like a waterfall,",L_MONK_Q2_3,
-		"He read a book and knew it all.",L_MONK_Q2_3,
-		"Or text or note of scholiast",L_MONK_Q2_3,
-		"Once read, his memory held fast.",L_MONK_Q2_3,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_3,
-		"Nor was his body blessed with grace.",-;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_3:
-
-	menu "His words streamed like a waterfall,",-,
-		"His lore embraced the universe.",L_MONK_Q2_4,
-		"He read a book and knew it all.",L_MONK_Q2_4,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_4,
-		"Nor was his body blessed with grace.",L_MONK_Q2_4,
-		"Or text or note of scholiast",L_MONK_Q2_4,
-		"He boasted not a handsome face,",L_MONK_Q2_4,
-		"Once read, his memory held fast.",L_MONK_Q2_4;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_4:
-
-	menu "Nor was his body blessed with grace.",L_MONK_Q2_5,
-		"Once read, his memory held fast.",L_MONK_Q2_5,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_5,
-		"Or text or note of scholiast",L_MONK_Q2_5,
-		"He boasted not a handsome face,",L_MONK_Q2_5,
-		"He read a book and knew it all.",-,
-		"His lore embraced the universe.",L_MONK_Q2_5,
-		"His words streamed like a waterfall,",L_MONK_Q2_5;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_5:
-
-	menu "Once read, his memory held fast.",L_MONK_Q2_6,
-		"Or text or note of scholiast",L_MONK_Q2_6,
-		"He read a book and knew it all.",L_MONK_Q2_6,
-		"His words streamed like a waterfall,",L_MONK_Q2_6,
-		"Nor was his body blessed with grace.",L_MONK_Q2_6,
-		"He boasted not a handsome face,",L_MONK_Q2_6,
-		"His lore embraced the universe.",L_MONK_Q2_6,
-		"Shu's glories could he well rehearse,",-;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_6:
-
-	menu "Or text or note of scholiast",L_MONK_Q2_7,
-		"He read a book and knew it all.",L_MONK_Q2_7,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_7,
-		"His words streamed like a waterfall,",L_MONK_Q2_7,
-		"His lore embraced the universe.",-,
-		"He boasted not a handsome face,",L_MONK_Q2_7,
-		"Nor was his body blessed with grace.",L_MONK_Q2_7,
-		"Once read, his memory held fast.",L_MONK_Q2_7;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_7:
-
-	menu "Nor was his body blessed with grace.",L_MONK_Q2_8,
-		"Or text or note of scholiast",-,
-		"His words streamed like a waterfall,",L_MONK_Q2_8,
-		"Once read, his memory held fast.",L_MONK_Q2_8,
-		"He boasted not a handsome face,",L_MONK_Q2_8,
-		"He read a book and knew it all.",L_MONK_Q2_8,
-		"Shu's glories could he well rehearse,",L_MONK_Q2_8,
-		"His lore embraced the universe.",L_MONK_Q2_8;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q2_8:
-
-	menu "He boasted not a handsome face,",L_MONK_QUEST_END,
-		"Nor was his body blessed with grace.",L_MONK_QUEST_END,
-		"Shu's glories could he well rehearse,",L_MONK_QUEST_END,
-		"Or text or note of scholiast",L_MONK_QUEST_END,
-		"His lore embraced the universe.",L_MONK_QUEST_END,
-		"He read a book and knew it all.",L_MONK_QUEST_END,
-		"His words streamed like a waterfall,",L_MONK_QUEST_END,
-		"Once read, his memory held fast.",L_MONK_QUEST_1_2;
-
-L_MONK_Q3_1:
-
-	menu "Watch ye how all people revere Guan Yu,",L_MONK_Q3_2,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",-,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_2,
-		"Each excelling others to honor him,",L_MONK_Q3_2,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_2,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_2,
-		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_2,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_2,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_2;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_2:
-
-	menu "Each excelling others to honor him,",L_MONK_Q3_3,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_3,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_3,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_3,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_3,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_3,
-		"Watch ye how all people revere Guan Yu,",-,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_3,
-		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_3;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_3:
-
-	menu "They are resplendent as the great lights of the firmament;",L_MONK_Q3_4,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_4,
-		"Each excelling others to honor him,",-,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_4,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_4,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_4,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_4,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_4,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_4;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_4:
-
-	menu "Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_5,
-		"Each excelling others to honor him,",L_MONK_Q3_5,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_5,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_5,
-		"Him, one of the three brothers of the Peach Garden Oath,",-,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_5,
-		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_5,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_5,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_5;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_5:
-
-	menu "They are resplendent as the great lights of the firmament;",L_MONK_Q3_6,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_6,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_6,
-		"Who have won sacrifices, as emperor and king.",-,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_6,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_6,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_6,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_6,
-		"Each excelling others to honor him,",L_MONK_Q3_6;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_6:
-
-	menu "Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_7,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_7,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_7,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_7,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_7,
-		"Incomparable their aura spreads through the world;",-,
-		"Each excelling others to honor him,",L_MONK_Q3_7,
-		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_7,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_7;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_7:
-
-	menu "Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_8,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_8,
-		"They are resplendent as the great lights of the firmament;",-,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_8,
-		"Each excelling others to honor him,",L_MONK_Q3_8,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_8,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_8,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_8,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_8;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_8:
-
-	menu "Temples to our Lord Guan Yu abound, no village lacks one,",-,
-		"Incomparable their aura spreads through the world;",L_MONK_Q3_9,
-		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_9,
-		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_9,
-		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_9,
-		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_9,
-		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_9,
-		"Each excelling others to honor him,",L_MONK_Q3_9,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_9;
-
-		set @monk_q, @monk_q + 1;
-L_MONK_Q3_9:
-
-	menu "Him, one of the three brothers of the Peach Garden Oath,",L_MONK_QUEST_END,
-		"Each excelling others to honor him,",L_MONK_QUEST_END,
-		"Watch ye how all people revere Guan Yu,",L_MONK_QUEST_END,
-		"Who have won sacrifices, as emperor and king.",L_MONK_QUEST_END,
-		"Incomparable their aura spreads through the world;",L_MONK_QUEST_END,
-		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_QUEST_END,
-		"They are resplendent as the great lights of the firmament;",L_MONK_QUEST_END,
-		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_QUEST_END,
-		"Their venerable trees at sundown are the resting places for birds.",-;
-
-L_MONK_QUEST_1_2:
-		set @monk_q, @monk_q + 1;
-L_MONK_QUEST_END:
-
-	if(@monk_q != 10) goto L_C2_FAIL;
-
-L_C2_DONE:
-	set @monk_q, 0;
-	next;
-	mes "[Wutao]";
-	mes "Hmmm...";
-	next;
-	mes "[Wutao]";
-	mes "...Well Done!! It's perfect!";
-	next;
-	mes "[Wutao]";
-	mes "However, don't be happy too early. There is much long way to go before you become a Monk.";
-	next;
-	mes "[Wutao]";
-	mes "DaAhaaaa...";
-	next;
-	mes "[Wutao]";
-	mes "ShuKeeee.....";
-	next;
-	mes "[Wutao]";
-	mes "SouKouuuuu....";
-	next;
-	mes "[Wutao]";
-	mes "PaYennnn....";
-	next;
-	mes "[Wutao]";
-	mes "As I promised, your mental status is now running like a Monk do.";
-	next;
-	mes "[Wutao]";
-	mes "Now go, seek ^000080Fuhai^000000 for further guidance.";
-	set JOB_MONK_Q, 6;
-	close;
-
-L_C2_FAIL:
-	mes "[" + strcharinfo(0) + "]";
-	mes "Well...? How was that? ";
-	next;
-	mes "[Wutao]";
-	mes "Hmmm...";
-	next;
-	mes "[Wutao]";
-	mes "HeNmmm...";	
-	next;
-	mes "[Wutao]";
-	mes "How was that? It's bad! You didn't memorize it all!";
-	next;
-	mes "[Wutao]";
-	mes "You should doult yourself. Are you really have the ability to be a Monk?";
-	mes "...It's really....";
-	next;
-	mes "[Wutao]";
-	mes "Well...That's fine, do you want to try it again?";
-	next;
-	mes "[Wutao]";	
-	mes "Of course! Since you did not pass this test, you can't take the next test.";
-	set JOB_MONK_Q, 5;
-	close;
-
-Part1:
-	mes "[Wutao]";
-	mes "Very well. Let's try it again.";
-	next;
-	goto L_Again;
-
-Part2:
-	mes "[Wutao]";
-	mes "What? You forget whom you should seek for?";
-	next;
-	mes "[Wutao]";
-	mes "......You are so.......";
-	next;
-	mes "[Wutao]";
-	mes "...Are you testing my patient?";
-	next;
-	mes "[Wutao]";
-	mes "...Okay, I'll tell you again...";
-	mes "Go and seek ^000080Fuhai^000000 for further guidance.";
-	close;
-Part3:
-	mes "[Wutao]";
-	mes "May God be with you.";
-	close;
-}
-
-prt_monk.gat,57,179,4	script	Fuhai	110,{
-
-	if(@Choice_mission == 1 ) goto Part1;
-	if(@Choice_mission == 2 ) goto Part2;
-	if(JOB_MONK_Q == 6 ) goto L_START;
-	goto IsOther;
-IsOther:
-	mes "[Fuhai]";
-	mes "HaAhhhhh....!!!";
-	next;
-	mes "- Seems like he is thinking something -";
-	close;
-
-L_START:
-	mes "[Fuhai]";
-	mes "...";
-	next;
-	mes "[Fuhai]";
-	mes "......";
-	next;
-	mes "[Fuhai]";
-	mes ".........";
-	next;
-	mes "[Fuhai]";
-	mes "............";
-	next;
-	menu "Hello there?",-;
-
-		mes "[Fuhai]";
-		mes "...what...WHAT?";
-		mes "How dare you interupt my training!";
-		mes "If it is not very important...";
-		next;
-		mes "[Fuhai]";
-		mes "......";
-		mes "I can't tell...if you can see the son tomorrow...";
-		next;
-		mes "[Fuhai]";
-		mes "Why are you here?";
-		mes "Explain!";
-		next;
-		menu "Some one named [Wutao] send me here.",L_MENU_1,"Well...Nothing...",-;
-			
-			mes "[Fuhai]";
-			mes "......";
-			mes "...How about dig a grave for yourself?";
-			close;
-	L_MENU_1:
-		mes "[Fuhai]";
-		mes "Hmmm...It's that so?";
-		mes "That's...";
-		next;
-		mes "[Fuhai]";
-		mes "Oh...Your mental status...";
-		mes "Ha! Very well...";
-		next;
-		mes "[Fuhai]";
-		mes "However, what did you learn from [Wutao] ?";
-		next;
-		menu "Hmmm...Well...It's...",-,
-			"I repeat what he said, and he send me here.",L_MENU_1_1,
-			"He test my mental status and send me here.",-;
-
-			mes "[Fuhai]";
-			mes "Foolish!";
-			mes "Don't bother me! Go away!";
-			close;
-	L_MENU_1_1:
-		mes "[Fuhai]";
-		mes "Well...Then?";
-		mes "Did he do anything for you?";
-		next;
-		menu "Ah...It's...I can't tell...",-,
-			"Check my body",L_MENU_1_1_1,
-			"Tell me some rules to obey",L_MENU_1_1_1,
-			"modify my mental status",L_MENU_1_1_2;
-
-			mes "[Fuhai]";
-			mes "Foolish!";
-			mes "Don't bother me! Go away!";
-			close;
-	L_MENU_1_1_1:
-		mes "[Fuhai]";
-		mes "That's quite true, but not the point.";
-		mes "Think! Use your brain!";
-		close;
-
-	L_MENU_1_1_2:
-		set JOB_MONK_Q, 7;
-		mes "[Fuhai]";
-		mes "Very well, at least you know what had been change in your body";
-		mes "Now, let's begin the next test.";
-		next;
-		mes "[Fuhai]";
-		mes "I'll give you a chance to choose what kind of test you want to take.";
-		mes "Now, make your own choise.";
-		next;
-		menu "Mushroom Collecting",L_ROOT_1,"Marathon",L_ROOT_2;
-
-	L_ROOT_1:
-		mes "[Fuhai]";
-		mes "Mushroom Collecting? Good choice!";
-		mes "That would make you appreciate the extremity of patient, realize the meaning God give you the great willpower.";
-		mes "Now go, do some prepares. Come back when you ready.";
-		set @Choice_mission, 1;
-		close;
-	L_ROOT_2:
-		mes "[Fuhai]";
-		mes "Marathon? Good choice!";
-		mes "That would make you appreciate the extremity of willpower, realize the meaning God give you the great patient.";
-		mes "Now go, do some prepares. Come back when you ready.";
-		set @Choice_mission, 2;
-		close;
-Part1:
-	mes "[Fuhai]";
-	mes "Are you ready?";
-	mes "Acturily, you don't need to prepare anything if you believe in yourself";
-	next;
-	mes "[Fuhai]";
-	mes "Mushroom Collecting is your choice.";
-	mes "It's a test for yourself.";
-	next;
-	mes "[Fuhai]";
-	mes "Now, go to the building located in the center of this training area.";
-	next;
-	mes "[Fuhai]";
-	mes "You will pass the test when you collect enough mushrooms we think.";
-	mes "Now, what are waitting for? Go ahead!";
-	close;
-Part2:
-	mes "[Fuhai]";
-	mes "Are you ready?";
-	mes "Acturily, you don't need to prepare anything if you believe in yourself";
-	next;
-	mes "[Fuhai]";
-	mes "Marathon is your choice.";
-	mes "It's a test for yourself.";
-	next;
-	mes "[Fuhai]";
-	mes "Now, go to the building located in the center of this training area.";
-	next;
-	mes "[Fuhai]";
-	mes "You will pass the test when you run enough circles we think.";
-	mes "Now, what are waitting for? Go ahead!";
-	close;
-
-}
-
-prt_monk.gat,199,169,4	script	Guard	746,{
-	if(JOB_MONK_Q == 7) goto L_START;
-	if(JOB_MONK_Q > 6) goto Part1;
-	goto IsOther;
-IsOther:
-	mes "[Guard ChaoLi]";
-	mes "This is...";
-	mes "Monk Training Area";
-	next;
-	mes "[Guard ChaoLi]";
-	mes "Please be quiet in this area.";
-	close;
-
-L_START:
-	mes "[Guard ChaoLi]";
-	mes "This is...";
-	mes "Monk Training Area";
-	next;
-	mes "[Guard ChaoLi]";
-	mes strcharinfo(0) + " ... Right?!";
-	next;
-	mes "[Guard ChaoLi]";
-	mes "Go ahead! Quickly!";
-	mes "There is another test waitting for you!";
-	close;
-
-Part1:
-	mes "[Guard ChaoLi]";
-	mes "Please be quiet in this area.";
-	close;
-}
-
-monk_test.gat,329,61,4	script	Bashu	753,{
-	if(JOB_MONK_Q == 7) goto L_START;
-	if(JOB_MONK_Q == 8) goto IsOther;
-	goto IsOther;
-IsOther:
-	mes "[Bashu]";
-	mes "Welcome to ^00FF00St. Capitolina Abbey^000000, the Monk Training Area.";
-	mes "May the light shine on your path.";
-	mes "You can find Monk Daowen who judge the grades of Monk training when you go inside";
-	next;
-	mes "[Bashu]";
-	mes "Never the less, don't touch anything inside and be quiet in front of Monk Daowen.";
-	next;
-	mes "[Bashu]";
-	mes "Then, may you have a happy conversation time with God.";
-	close;
-L_START:
-	mes "[Bashu]";
-	mes "Please select a test.";
-	next;
-	if(@Choice_mission == 0) goto L_MISSC;
-	if(@Choice_mission == 2) goto L_MISS2;
-	mes "[Bashu]";
-	mes "As I know, you choose the Mushroom Collecting as your test.";
-	goto L_MISSC;
-L_MISS2:
-	mes "[Bashu]";
-	mes "As I know, you choose the Marathon as your test.";
-L_MISSC:
-	mes "However, if you cannot complete it, you may switch to the other whenever you feel like it.";
-	next;
-	menu "Monk's patient - Mushroom Collecting",-,
-		"Monk's willpower - Marathon",L_MENU_1;
-
-	mes "[Bashu]";
-	mes "The test you choose is Monk's patient - Mushroom Collecting";
-	next;
-	warp "job_monk.gat",225,179;
-	end;
-
-L_MENU_1:
-	mes "[Bashu]";
-	mes "The test you choose is Monk's willpower - Marathon";	
-	next;
-	warp "monk_test.gat",387,345;
-	end;
-}
-
-monk_test.gat,387,347,4	script	Musha	110,{
-	mes "[Musha]";
-	mes "Wel...Welcome...!";
-	mes "This...This is the area testing the pa...patient of whom want to be a Monk.";
-	next;
-	mes "[Musha]";
-	mes "You should just...just run!";
-	mes "Before we told you to stop.";
-	mes "Run...Run! " + strcharinfo(0) + "! Run!";
-	next;
-	mes "[Musha]";
-	mes "Just Run!! Run Quickly!!";
-	next;
-	mes "[Musha]";
-	mes "One Day, I'll become a Monk!";
-	mes "I.....will......Become...a......MONK!!!";
-	next;
-	mes "[Musha]";
-	mes "Do...Do you...want to give......giveup? or...con...continue?";
-	mes "Giveup?";
-	next;
-	menu "I want to giveup!",-,"I want to run!!",L_MENU_1;
-
-		announce "Musha: " + strcharinfo(0) + " has give...giveup the test...! Giveup the Marathon test... No...No patient.....HaHaHaHa!!!...",8;
-		mes "[Musha]";
-		mes strcharinfo(0) + "...give...giveup the test...";
-		mes "Giveup the Marathon test...";
-		mes "No...No patient.....HaHaHaHa!!!...";
-		next;
-		warp "prt_monk.gat",196,168;
-		end;
-L_MENU_1:
-	next;
-	mes "[Musha]";
-	mes "Before we give you an order to stop....";
-	mes "Run...Run! " + strcharinfo(0) + "! Run!";
-	if(@runtimes == 0) set @runtimes, rand(8,10);
-	close;
-}
-
-monk_test.gat,390,387,0	script	monk_warp	45,1,1,{
-	set @run, @run + 1;
-	if(@run == (@runtimes-1)) mapannounce "monk_test.gat","Musha: cheer up! The next circle is the last!",8;
-	if(@run == @runtimes) goto L_DONE;
-	warp "monk_test.gat",388,348;
-	end;
-L_DONE:
-	mapannounce "monk_test.gat","Musha: Con....Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
-	set JOB_MONK_Q, 8;
-	warp "prt_monk.gat",196,168;
-	end;
-
-}
-monk_test.gat,0,0,0	script	monk_traps	-1,{
-	mapannounce "monk_test.gat","trap: " + strcharinfo(0)+ " , you fall into a trap! Now we warp you to the start place.",8;
-	warp "monk_test.gat",388,348;
-	end;
-}
-//---------------------
-monk_test.gat,386,164,0	script	monk1-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,386,165,0	script	monk1-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,387,164,0	script	monk1-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,387,165,0	script	monk1-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,388,164,0	script	monk1-5	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,388,165,0	script	monk1-6	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,389,164,0	script	monk1-7	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,389,165,0	script	monk1-8	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,386,42,0	script	monk2-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,386,43,0	script	monk2-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,387,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,387,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,388,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,388,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,389,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,389,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,184,11,0	script	monk3-1	139,0,3,{doevent "monk_traps";end;}
-monk_test.gat,185,11,0	script	monk3-2	139,0,3,{doevent "monk_traps";end;}
-monk_test.gat,186,11,0	script	monk3-3	139,0,3,{doevent "monk_traps";end;}
-monk_test.gat,187,11,0	script	monk3-4	139,0,3,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,70,10,0	script	monk4-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,70,11,0	script	monk4-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,70,12,0	script	monk4-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,70,13,0	script	monk4-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,71,10,0	script	monk4-5	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,71,11,0	script	monk4-6	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,71,12,0	script	monk4-7	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,71,13,0	script	monk4-8	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,8,30,0	script	monk5-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,8,31,0	script	monk5-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,9,30,0	script	monk5-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,9,31,0	script	monk5-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,10,30,0	script	monk5-5	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,10,31,0	script	monk5-6	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,11,30,0	script	monk5-7	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,11,31,0	script	monk5-8	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,12,30,0	script	monk5-9	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,12,31,0	script	monk5-10	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,13,30,0	script	monk5-11	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,13,31,0	script	monk5-12	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,14,30,0	script	monk5-13	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,14,31,0	script	monk5-14	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,15,30,0	script	monk5-15	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,15,31,0	script	monk5-16	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,10,158,0	script	monk6-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,10,159,0	script	monk6-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,11,158,0	script	monk6-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,11,159,0	script	monk6-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,12,158,0	script	monk6-5	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,12,159,0	script	monk6-6	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,13,158,0	script	monk6-7	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,13,159,0	script	monk6-8	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,38,386,0	script	monk7-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,38,387,0	script	monk7-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,38,388,0	script	monk7-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,38,389,0	script	monk7-4	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,39,386,0	script	monk7-5	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,39,387,0	script	monk7-6	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,39,388,0	script	monk7-7	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,39,389,0	script	monk7-8	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,82,390,0	script	monk8-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,82,391,0	script	monk8-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,83,390,0	script	monk8-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,83,391,0	script	monk8-4	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-monk_test.gat,82,384,0	script	monk8-1	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,82,385,0	script	monk8-2	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,83,384,0	script	monk8-3	139,0,0,{doevent "monk_traps";end;}
-monk_test.gat,83,385,0	script	monk8-4	139,0,0,{doevent "monk_traps";end;}
-//---------------------
-prt_monk.gat,225,179,4	script	XuanWu 	89,{
-	mes "[XuanWu]";
-	mes "To see the growing of crop, I deeply appreciate from the grace of God.";
-	next;
-	mes "[XuanWu]";
-	mes "Never the less, see those crop grown by the strong Monks.";
-	mes "I think it's the most beautiful picture!";
-	next;
-	mes "[XuanWu]";
-	mes "Frankly speeking, grower is the greatest people in the world.";
-	mes "The Blue Potion you drink must be made of God's will and by the grower.";
-	next;
-	mes "[XuanWu]";
-	mes "We chould always be grateful.";
-	next;
-	mes "[XuanWu]";
-	mes "God give you everything, even the grower.";
-	next;
-	mes "[XuanWu]";
-	mes "The grower is the root of world. That's quite true.";
-	close;
-}
-job_monk.gat,225,179,4	script	XuanWu	89,{
-
-	if(JOB_MONK_Q == 8 ) goto Part2;
-	if(@mission_start == 1 ) goto Part1;
-
-	mes "[XuanWu]";
-	mes "Welcome! I'm in charge here with the Mushroom Collecting.";
-	mes "My Name is XuanWu";
-	next;
-	mes "[XuanWu]";
-	mes "From now, you should take it for granted that all the suffering is training.";
-	mes "Understand?";
-	next;
-	mes "[XuanWu]";
-	mes "For Monks lives, we should always offer our efforts as a tribute";
-	mes "Grow crop is also a kind of training.";
-	next;
-	mes "[XuanWu]";
-	mes "We think it is the best way to realize the will of God.";
-	mes "Therefore, we had started growing some kind of mushrooms that smell foul";
-	next;
-	mes "[XuanWu]";
-	mes "All you have to do is destory those mushrooms and bring some thing to prove.";
-	mes "What's the thing I mean? The ^ff0000Orange GooeyMushroom and Orange Net Mushroom^000000";
-	next;
-	mes "[XuanWu]";
-	mes "If you want to increase your internal organs and become a Monk, go and destory it.";
-	mes "Bring as many as you can, I won't tell you the amount I need.";
-	mes "Now go!";
-	next;
-	mes "[XuanWu]";
-	mes "Or...You want to giveup?";
-	next;
-	menu "Start Mushroom Collecting",L_MENU_1,"I'll giveup",L_MENU_2;
-
-L_MENU_2:
-		mapannounce "monk_test.gat","XuanWu: ......Another one without willpower...",8;
-		mes "[XuanWu]";
-		mes "Another one without willpower...";
-		set @mission_start, 0;
-		getitem 1069, 1;
-		delitem 1069, 1;
-		next;
-		warp "prt_monk.gat",196,168;
-		end;		
-L_MENU_1:
-	mes "[XuanWu]";
-	mes "Then what are you waitting for? Go Go Go !!";
-	set @mission_start, 1;
-	close;
-
-Part1:
-	if(countitem(1069) >= 30 && countitem(1070) >0 ) goto L_DONE;
-	if(countitem(1070) >= 30 && countitem(1069) >0 ) goto L_DONE;
-	mes "[XuanWu]";
-	mes "Hmmm... Is that all you can do? I don't think it's enough.";
-	next;
-	mes "[XuanWu]";
-	mes "Or...You want to giveup?";
-	next;
-	menu "Continue Mushroom Collecting",-,"I'll giveup",L_MENU_2;
-		close;
-L_DONE:
-	set JOB_MONK_Q, 8;
-	mes "[XuanWu]";
-	mes "Well... I think you can do it better...";
-	mes "However, I should say you pass the test.";
-	set @mission_start, 0;
-	delitem 1069, countitem(1069);
-	delitem 1070, countitem(1070);
-	next;
-	mes "[XuanWu]";
-	mes "Now go to [Daowen], he is in the deep of the building.";
-	close;
-Part2:
-	mes "[XuanWu]";
-	mes "Are you testing my patient??";
-	mes "Now go to [Daowen], he is in the deep of the building.";
-	close;
-}
-job_monk.gat,191,172,4	script	job_monk_warp	45,1,1,{
-	warp "monk_test.gat",329,57;
-	end;
-}
-
-job_monk.gat,199,169,4	script	Guard ChaoLi 	746,{
-	mes "[Guard ChaoLi]";
-	mes "Silence! In test area!";
-	close;
-}
-
-monk_test.gat,319,139,4	script	Daowen	52,{
-	if(JOB_MONK_Q == 8) goto L_START;
-	if(JOB_MONK_Q == 9) goto Part1;
-	if(JOB_MONK_Q == 10) goto Part2;
-		goto IsOther;
-IsOther:
-	mes "[Daowen]";
-	mes "Go throught it quietly...";
-	mes "HuWuWuuuu......";
-	next;
-	mes "[Daowen]";
-	mes "This is St. Capitolina Abbey. If anything goes wrong, all we have done might become nothing.";
-	next;
-	mes "[Daowen]";
-	mes "Leave! If you don't want to die, don't bother me.";
-	close;
-L_START:
-	mes "[Daowen]";
-	mes "Oh! Finally!";
-	mes "This is the last test, and I am I'm in charge here";
-	mes "My name is 'Daowen'";
-	next;
-	mes "[Daowen]";
-	mes "Well... What should I say?";
-	mes "Who block the way? Fight him/her!";
-	next;
-	mes "[Daowen]";
-	mes "Fight! Slash! When you lost and some enemy block your way!";
-	mes "Tell them the will of God!";
-	next;
-	mes "[Daowen]";
-	mes "Don't compare with the weak priest!";
-	mes "We are always strong Monks";
-	next;
-	mes "[Daowen]";
-	mes "We are different from the weak priest that always run away!";
-	next;
-	mes "[Daowen]";
-	mes "Now! Grasp your fist! Go and fight!";
-	next;
-	mes "[Daowen]";
-	mes "Do your best!";
-	mes "HaHaHaHaHa.....!!";
-	next;
-	warp "monk_test",88,73;
-	end;
-
-Part1:
-	mes "[Daowen]";
-	mes "Well done!! HaHaHaHa....!!";
-	mes "I knew you can do it!";
-	mes "I'll give you a special potion that can increase your power";
-	next;
-	getitem 506, 1;
-	mes "[Daowen]";
-	mes "Drink it, and your internal organs will increase enough to be a Monk.";
-	mes "Okay...Then, Go to Wuhai - the first one you meet here.";
-	set JOB_MONK_Q, 10;
-	close;
-Part2:
-	mes "[Daowen]";
-	mes "Go to Wuhai - the first one you meet here.";
-	close;
-}
-
-monk_test.gat,88,91,4	script	Test Assistant	52,{
-	mes "[Test Assistant]";
-	mes "Are you ready for training of evil disperse?";
-	next;
-	mes "[Test Assistant]";
-	mes "The test area is a maze with walls invisable.";
-	mes "The exiting point is on the opposite side of the starting point.";
-	next;
-	mes "[Test Assistant]";
-	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
-	mes "Good lucy! May God be with you.";
-	next;
-	if(getareausers("monk_test.gat",126,161,165,199) > 0) goto L_WAIT;
-	killmonster "monk_test.gat","monk_mob1";
-	enablenpc "monk_mob1_1";
-	enablenpc "monk_mob1_2";
-	enablenpc "monk_mob1_3";
-	enablenpc "monk_mob1_3";
-	warp "monk_test.gat",127,179;
-	end;
-L_WAIT:
-	mes "[Test Assistant]";
-	mes "There is someone taking the test. Please wait a minute.";
-	close;
-}
-monk_test.gat,129,180,4	script	monk_mob1_1	139,0,19,{
-	monster "monk_test.gat",130,183,"--ja--",1015,1,"monk_mob1";
-	monster "monk_test.gat",130,177,"--ja--",1015,1,"monk_mob1";
-//~	disablenpc "monk_mob1_1";
-	end;
-}
-monk_test.gat,133,180,4	script	monk_mob1_2	139,0,19,{
-	monster "monk_test.gat",134,183,"--ja--",1015,1,"monk_mob1";
-	monster "monk_test.gat",134,177,"--ja--",1015,1,"monk_mob1";
-//~	disablenpc "monk_mob1_2";
-	end;
-}
-monk_test.gat,145,180,4	script	monk_mob1_3	139,0,19,{
-	monster "monk_test.gat",145,180,"--ja--",1041,1,"monk_mob1";
-//~	disablenpc "monk_mob1_3";
-	end;
-}
-monk_test.gat,155,180,4	script	monk_mob1_4	139,0,19,{
-	monster "monk_test.gat",157,183,"--ja--",1015,1,"monk_mob1";
-	monster "monk_test.gat",157,177,"--ja--",1015,1,"monk_mob1";
-//~	disablenpc "monk_mob1_4";
-	end;
-}
-monk_test.gat,165,179,4	script	monk_mob3_warp	45,1,1,{
-	set JOB_MONK_Q, 9;
-	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
-	killmonster "monk_test.gat","monk_mob1";
-	warp "monk_test.gat",317,142;
-	end;
-}
-
-monk_test.gat,1,1,1	script	monk_mob1	-1,{
-		end;
-}
-
-monk_test.gat,95,85,4	script	Test Assistant	79,{
-	mes "[Test Assistant]";
-	mes "Are you ready for training of evil disperse?";
-	next;
-	mes "[Test Assistant]";
-	mes "The test area is a maze with walls invisable.";
-	mes "The exiting point is on the opposite side of the starting point.";
-	next;
-	mes "[Test Assistant]";
-	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
-	mes "Good lucy! May God be with you.";
-	next;
-	if(getareausers("monk_test.gat",126,262,165,300) > 0) goto L_WAIT;
-	killmonster "monk_test.gat","monk_mob2";
-	enablenpc "monk_mob2_1";
-	enablenpc "monk_mob2_2";
-	enablenpc "monk_mob2_3";
-	enablenpc "monk_mob2_4";
-	warp "monk_test.gat",127,278;
-	end;
-
-L_WAIT:
-	mes "[Test Assistant]";
-	mes "There is someone taking the test. Please wait a minute.";
-	close;
-
-}
-monk_test.gat,129,281,4	script	monk_mob2_1	139,0,19,{
-	monster "monk_test.gat",130,278,"--ja--",1015,1,"monk_mob2";
-	monster "monk_test.gat",130,284,"--ja--",1015,1,"monk_mob2";
-//~	disablenpc "monk_mob2_1";
-	end;
-}
-monk_test.gat,136,281,4	script	monk_mob2_2	139,0,19,{
-	monster "monk_test.gat",139,278,"--ja--",1015,1,"monk_mob2";
-	monster "monk_test.gat",139,284,"--ja--",1015,1,"monk_mob2";
-//~	disablenpc "monk_mob2_2";
-	end;
-}
-monk_test.gat,144,281,4	script	monk_mob2_3	139,0,19,{
-	monster "monk_test.gat",145,281,"--ja--",1041,1,"monk_mob2";
-//~	disablenpc "monk_mob2_3";
-	end;
-}
-monk_test.gat,153,281,4	script	monk_mob2_4	139,0,19,{
-	monster "monk_test.gat",155,278,"--ja--",1015,1,"monk_mob2";
-	monster "monk_test.gat",155,284,"--ja--",1015,1,"monk_mob2";
-//~	disablenpc "monk_mob2_4";
-	end;
-}
-monk_test.gat,165,278,4	script	monk_mob2_warp	45,1,1,{
-	set JOB_MONK_Q, 9;
-	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
-	killmonster "monk_test.gat","monk_mob2";
-	warp "monk_test.gat",317,142;
-	end;
-}
-
-monk_test.gat,1,1,1	script	monk_mob2	-1,{
-		end;
-}
-
-monk_test.gat,82,85,4	script	Test Assistant	95,{
-	mes "[Test Assistant]";
-	mes "Are you ready for training of evil disperse?";
-	next;
-	mes "[Test Assistant]";
-	mes "The test area is a maze with walls invisable.";
-	mes "The exiting point is on the opposite side of the starting point.";
-	next;
-	mes "[Test Assistant]";
-	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
-	mes "Good lucy! May God be with you.";
-	next;
-	if(getareausers("monk_test.gat",233,262,269,300) > 0) goto L_WAIT;
-	killmonster "monk_test.gat","monk_mob3";
-	enablenpc "monk_mob3_1";
-	enablenpc "monk_mob3_2";
-	enablenpc "monk_mob3_3";
-	enablenpc "monk_mob3_4";
-	warp "monk_test.gat",231,279;
-	end;
-
-L_WAIT:
-	mes "[Test Assistant]";
-	mes "There is someone taking the test. Please wait a minute.";
-	close;
-}
-
-monk_test.gat,234,281,4	script	monk_mob3_1	139,0,19,{
-	monster "monk_test.gat",235,277,"--ja--",1015,1,"monk_mob3";
-	monster "monk_test.gat",235,284,"--ja--",1015,1,"monk_mob3";
-//~	disablenpc "monk_mob3_1";
-	end;
-}
-monk_test.gat,239,281,4	script	monk_mob3_2	139,0,19,{
-	monster "monk_test.gat",240,277,"--ja--",1015,1,"monk_mob3";
-	monster "monk_test.gat",240,284,"--ja--",1015,1,"monk_mob3";
-//~	disablenpc "monk_mob3_2";
-	end;
-}
-monk_test.gat,248,281,4	script	monk_mob3_3	139,0,19,{
-	monster "monk_test.gat",249,281,"--ja--",1041,1,"monk_mob3";
-//~	disablenpc "monk_mob3_3";
-	end;
-}
-monk_test.gat,260,281,4	script	monk_mob3_4	139,0,19,{
-	monster "monk_test.gat",261,277,"--ja--",1015,1,"monk_mob3";
-	monster "monk_test.gat",261,284,"--ja--",1015,1,"monk_mob3";
-//~	disablenpc "monk_mob3_4";
-	end;
-}
-monk_test.gat,269,279,4	script	monk_mob3_warp	45,1,1,{
-	set JOB_MONK_Q, 9;
-	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
-	killmonster "monk_test.gat","monk_mob3";
-	warp "monk_test.gat",317,142;
-	end;
-}
-
-monk_test.gat,1,1,1	script	monk_mob3	-1,{
-		end;
-}
-
-
-
-//==============================================================================
-// Monsters of Mushroom Collecting
-//==============================================================================
-job_monk.gat,0,0,0,0	monster	Thief Mushroom	1182,170,0,0,0
-job_monk.gat,0,0,0,0	monster	Thief Bug Larva	1051,120,0,0,0
-
-//==============================================================================
-// warps
-//==============================================================================
-prt_monk.gat,192,172,0	warp	monk15	1,1,monk_test.gat,329,50
-monk_test.gat,329,47,0	warp	monk16	1,1,prt_monk.gat,193,166
-monk_test.gat,329,76,0	warp	monk17	1,1,monk_test.gat,259,118
-monk_test.gat,259,115,0	warp	monk18	1,1,monk_test.gat,329,71
-monk_test.gat,272,125,0	warp	monk19	1,1,monk_test.gat,301,127
-monk_test.gat,298,127,0	warp	monk20	1,1,monk_test.gat,268,125
-
-//==============================================================================
-// mapflag
-//==============================================================================
-monk_test.gat	mapflag	nomemo	dummy
-monk_test.gat	mapflag	noteleport	dummy
-monk_test.gat	mapflag	nosave	SavePoint
-monk_test.gat	mapflag	nopenalty	dummy
-monk_test.gat	mapflag	nobranch	dummy
+//===== eAthena Script ======================================= 
+//= Monk Job Quest
+//===== By: ==================================================
+//= Dino9021, Edited / Translated by Celest
+//===== Current Version: ===================================== 
+//= 1.1+
+//===== Compatible With: ===================================== 
+//= eAthena 1.0 +
+//===== Description: ========================================= 
+//= Monk Job Quests for Athena 2004.12.30
+//===== Additional Comments: ================================= 
+// 1.1 Fixed missing '";'. Now it's loading fine [Lupus]
+// 1.1+ Edited/Translated 5% [Celest]
+//============================================================ 
+
+prt_monk.gat,55,249,4	script	Tohobu the Guarding Monk	139,0,5,{
+	mes "[Tohobu]";
+	mes "Who are you?!";
+	mes "How dare you enter this holy training place without my permission!!";
+	next;
+	mes "[Tohobu]";
+	mes "Get Out!!";
+	close;
+}
+prt_monk.gat,59,247,4	script	Master	120,{
+	if(JOB_MONK_Q == 1 ) goto Part1;
+	if(JOB_MONK_Q == 2 ) goto Part2;
+	if(Class == 15 || Class == 4016) goto IsMonk;
+	goto L_START;
+
+IsMonk:
+	mes "[Tohobu]";
+	mes "Your presence is not really welcomed at the ^00FF00St. Capitolina Abbey^000000.";
+	mes "However, welcome traveler, please do not disturb the Monks in training,";
+	mes "Even if you are a Monk!";
+	close;
+
+L_START:
+	mes "[Tohobu]";
+	mes "Hmmm...? What do you want from me?";
+	mes "Before entering the Training Area,";
+	mes "You shall have to first tell me your Name, Base Level and Job Level.";
+	next;
+	mes "[Tohobu]";
+	mes "Come! What is your name?";
+	next;
+	menu "Ignore him.",-,"Tell him.",L_MENU_1;
+
+		mes "[Tohobu]";
+		mes "You are so impolite! Get out!";
+		warp "prt_fild03.gat",357,256;
+		end;
+L_MENU_1:
+	mes "[Tohobu]";
+	mes "So... Your name is " + strcharinfo(0) + " Right?";
+	mes "...I believe it is pronounced that way.";
+	mes "Let's see... Job Level is " + joblevel;
+	next;
+	mes "[Tohobu]";
+	mes "Okay! Why have you come to see me, " + strcharinfo(0) + " ?";
+	next;
+	menu "I would like to see how Monks train themselves.",L_MENU_1_0,"I want to be a Monk.",L_MENU_1_1,"I would like to rest here.",L_MENU_1_2;
+
+	L_MENU_1_0:	
+		mes "[Tohobu]";
+		mes "Oh! I see.";
+		mes "Okay, I hope you'll learn something from our training,";
+		mes "Perhaps it might aid you in becoming a worthy Monk.";
+		set JOB_MONK_Q, 1;
+		close;
+
+	L_MENU_1_1:
+		if(Class != 4 && Class != 4005) goto IsNot4;
+		if(joblevel >= 40 ) goto SkillPointChk;
+			mes "[Tohobu]";
+			mes "Your Job Level is not high enough to be a Monk.";
+			mes "Come back when your Job Level higher then 40.";
+			next;
+			mes "[Tohobu]";
+			mes "No need to be hasty, there is so much to learn on this world,";
+			mes "Come back when you have met the requirements... Haha!";
+			close;
+
+		SkillPointChk:
+
+			if(skillpoint == 0) goto L_GO;
+			mes "[Tohobu]";
+			mes "Well... It seems that you have the ability to be a Monk,";
+			mes "But I believe there are skill needed you have yet to learn.";
+			mes "Come back when you have learnt all the skills.";
+			close;
+
+		IsNot4:
+			mes "[Tohobu]";
+			mes "Oh! Are you kidding?";
+			close;
+
+		HighMonk:
+			mes "[Tohobu]";
+			mes "Wow! You are a High Acolyte, aren't you?";
+			mes "I am sorry, but I can't let you become a Monk!";
+			mes "Please seek out the Champion, that is what you should be!";
+			set JOB_MONK_Q, 0;
+			close;
+
+		L_GO:
+			if (Class == 4005) goto HighMonk;
+			mes "[Tohobu]";
+			mes "Well... Seems you have the ability to be a Monk.";
+			mes "Very well then... Go to Wuhai the Elder, He will guide you.";
+			set JOB_MONK_Q, 2;
+			close;
+
+	L_MENU_1_2:
+		mes "[Tohobu]";
+		mes "Alright, you do look tired from your travels...";
+		mes "Perhaps it would be good to rest awhile.";
+		mes "Go ahead and rest at the Abbey before leaving!";
+		next;
+		mes "[Tohobu]";
+		mes "Persevering in order to gain more strength";
+		mes "Is the way of life of the Monks.";
+		mes "I hope that seeing our practises will";
+		mes "At least bring you some inner peace.";
+		close;
+Part1:
+	mes "[Tohobu]";
+	mes "Well? Have you changed your mind after looking around here?";
+	next;
+	menu "Nope.",L_MENU_1_0,"I want to be a Monk",L_MENU_1_1,"I need more rest.",L_MENU_1_2;
+
+Part2:
+	mes "[Tohobu]";
+	mes "Hello there! You should go to Wuhai the Elder, He will guide you.";
+	mes "He is in the Monastery Hall, South East from here";
+	close;
+}
+
+monk_in.gat,99,58,4	script	Elder Wuhai	60,{
+	if(JOB_MONK_Q == 2 ) goto L_START;
+	if(JOB_MONK_Q == 3 ) goto Part1;
+	if(JOB_MONK_Q == 4 ) goto Part2;
+	if(JOB_MONK_Q >= 5 && JOB_MONK < 10) goto Part3;
+	if(JOB_MONK_Q >= 10 && countitem(506) > 0) goto Part4;
+	if(JOB_MONK_Q == 11 && countitem(506) == 0) goto Part5;
+	if(Class == 15 || Class == 4016) goto Part6;
+	if(Class == 4 || Class == 4005) goto Part7;
+		goto IsOther;
+IsOther:
+	mes "[Elder Wuhai]";
+	mes "May you find God in the Mother Nature!!";
+	mes "Welcome traveler, why do you seek me?";
+	close;
+
+L_START:
+	mes "[Elder Wuhai]";
+	mes "Hmmm... You are the youth who wants to be a Monk, right?";
+	next;
+	menu "Yes.",L_MENU_1,"No.",-;
+		mes "[Elder Wuhai]";
+		mes "Hmmm...? Aren't you?";
+		mes "Maybe I'm getting older, I would've guessed if so.";
+		mes "Very well then... You may go, young man.";
+		close;
+L_MENU_1:
+	mes "[Elder Wuhai]";
+	mes "Oh! So young men these days still remember us Monks...";
+	mes "Welcome, my child!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "So you want to be a Monk! I'm glad to hear that!";
+	mes "But first, before you can become one,";
+	mes "There are a few things you need to know.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "As Monks, we undergo strict training";
+	mes "While protecting world peace.";
+	next;
+	mes "[Elder Wuhai]";	
+	mes "The strength is for giving aid to the weak in need,";
+	mes "And to protect them from harm.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Last but not least, control our emotions,";
+	mes "More importantly, never be too proud of yourself,";
+	mes "And be blinded by success,";
+	next;
+	mes "[Elder Wuhai]";
+	mes "It coukd be tough, even painful,";
+	mes "While undergoing this process.";
+	mes "Let's see if you're enduring enough,";
+	mes "You cannot become a Monk if you can't even bear this.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "OKay, let's start the test to see";
+	mes "If you really have the ability to become a Monk.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Firstly, here's a small exam";
+	mes "To test your will to become one of us.";
+	next;
+//~	if(joblevel == 50) goto IsJOB50;
+
+	set JOB_MONK_Q, 3;
+	set JOB_MONK_C,rand(1,6);
+L_Collect:
+	if(JOB_MONK_C == 1 ) goto L_Collect1;
+	if(JOB_MONK_C == 2 ) goto L_Collect2;
+	if(JOB_MONK_C == 3 ) goto L_Collect3;
+	if(JOB_MONK_C == 4 ) goto L_Collect4;
+	if(JOB_MONK_C == 5 ) goto L_Collect5;
+	if(JOB_MONK_C == 6 ) goto L_Collect6;
+
+	L_Collect1:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Tooth of Bat - 10";
+		mes "Bears Footskin - 5";
+		mes "Poison Spore - 20";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+
+	L_Collect2:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Porcupine Quill - 5";
+		mes "Cobweb - 20";
+		mes "Grasshopper's Leg - 10";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+
+	L_Collect3:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Stem - 30";
+		mes "Jellopy - 5";
+		mes "Worm Peeling -10";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+
+	L_Collect4:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Sticky Mucus - 5";
+		mes "Earthworm Peeling - 10";
+		mes "Green Herb - 20";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+
+	L_Collect5:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Yoyo Tail - 20";
+		mes "Iron Ore - 5";
+		mes "Blue Herb - 3";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+
+	L_Collect6:
+		mes "[Elder Wuhai]";
+		mes "Please bring these items";
+		mes "Solid Shell - 5";
+		mes "Shell - 20";
+		mes "Zargon - 5";
+		if(@collect_tmp != 1) goto L_CollectS;
+		close;
+L_CollectS:
+	mes "[Elder Wuhai]";
+	mes "To test your will, you will have to collect these items by yourself";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Come back to me when you have all of them.";
+	mes "Now go, May God's blessings be with you.";
+	close;
+
+//~IsJOB50:
+//~	mes "[Elder Wuhai]";
+//~	mes "However, I see that your Job Level is " +joblevel +" .";
+//~	mes "That could prove your ability.";
+//~	next;
+//~	mes "[Elder Wuhai]";
+//~	mes "Well done!";
+//~	mes "I think God will agree with me.";
+//~	next;
+//~	mes "[Elder Wuhai]";
+//~	mes "The next step, there is a Monk named Wutao want to see you.";
+//~	mes "He is in the Monk Grave North from here.";
+//~	set JOB_MONK_Q, 4;
+//~	close;
+
+Part1:
+//~	if(joblevel == 50) goto IsJOB50;
+	if(JOB_MONK_C == 1 && countitem(913) >= 10 && countitem(948) >= 5 && countitem(7033) >= 20) goto L_CollectS2_1;
+	if(JOB_MONK_C == 2 && countitem(1027) >= 5 && countitem(1025) >= 20 && countitem(940) >= 10) goto L_CollectS2_2;
+	if(JOB_MONK_C == 3 && countitem(905) >= 30 && countitem(909) >= 5 && countitem(955) >= 10) goto L_CollectS2_3;
+	if(JOB_MONK_C == 4 && countitem(938) >= 5 && countitem(1055) >= 10 && countitem(511) >= 20) goto L_CollectS2_4;
+	if(JOB_MONK_C == 5 && countitem(942) >= 20 && countitem(1002) >= 5 && countitem(510) >= 3) goto L_CollectS2_5;
+	if(JOB_MONK_C == 6 && countitem(943) >= 5 && countitem(935) >= 20 && countitem(912) >= 5) goto L_CollectS2_6;
+
+		mes "[Elder Wuhai]";
+		mes "Hmm... Still not ready yet?";
+		mes "Let me tell what you should bring again,";
+		mes "Listen carefully!";
+		next;
+		set @collect_tmp, 1;
+		goto L_Collect;
+
+		L_CollectS2_1:
+			delitem 913, 10;
+			delitem 948, 5;
+			delitem 7033, 20;
+			goto L_CollectS2_E;
+		L_CollectS2_2:
+			delitem 1027, 5;
+			delitem 1025, 20;
+			delitem 940, 10;
+			goto L_CollectS2_E;
+		L_CollectS2_3:
+			delitem 7012, 30;
+			delitem 909, 5;
+			delitem 955, 10;
+			goto L_CollectS2_E;
+		L_CollectS2_4:
+			delitem 938, 5;
+			delitem 1055, 10;
+			delitem 511, 20;
+			goto L_CollectS2_E;
+		L_CollectS2_5:
+			delitem 942, 20;
+			delitem 1002, 5;
+			delitem 510, 3;
+			goto L_CollectS2_E;
+		L_CollectS2_6:
+			delitem 943, 5;
+			delitem 935, 20;
+			delitem 912, 5;
+			goto L_CollectS2_E;
+	
+	L_CollectS2_E:
+		mes "[Elder Wuhai]";
+		mes "Oh! You've brought all of them!";
+		mes "Well done!";
+		mes "Your will in becoming in Monk is witnessable!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Let's see... there is a Monk named";
+		mes "Ah... Wutao who wants to see you.";
+		mes "He will be in the Ancestral Graveyard North from here.";
+		set JOB_MONK_Q, 4;
+		set JOB_MONK_C, 0;
+		close;
+
+Part2:
+	mes "[Elder Wuhai]";
+	mes "Next... should be questions regarding your job changing?";
+	mes "Go find master Wutao,";
+	mes "He will be in the Ancestral Graveyard North from here.";
+	close;
+Part3:
+	mes "[Elder Wuhai]";
+	mes "Hmm? You're still taking the test...?";
+	mes "Try to do your best in it then!";
+	close;
+Part4:
+	mes "[Elder Wuhai]";
+	mes "What? You haven't drunk that Magic Potion?";
+	mes "Then... Hurry up and finish the Green-ish potion!";
+	mes "Otherwise, you will never be able to achieve";
+	mes "The spiritual energy level of Monks!";
+	set JOB_MONK_Q, 11;
+	close;
+Part5:
+	mes "[Elder Wuhai]";
+	mes "We have done all steps... Your blood, your mind, your soul,";
+	mes "Is enough for you to become a Monk.";
+	mes "Even your spiritual energy has increased after drinking the Magic Potion.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Good... you will now be sworn in by oath";
+	mes "In which afterwards the job changing will be complete.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Are you willing to dedicate the rest of your life to serving God?";
+	next;
+	menu "Yes.",L_MONK_Q_2,"No.",-;
+
+		mes "[Elder Wuhai]";
+		mes "......What?......";
+		mes "Aren't you ready to become a Monk?";
+		mes "Perhaps you want to run around a bit more,";
+		mes "And shed some more sweat";
+		mes "To become more prepared?";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Consider carefully before coming back!";
+		mes "I do not want to make a bad Monk.";
+		close;
+L_MONK_Q_2:
+	mes "[Elder Wuhai]";
+	mes "Will you use the powers given to you for your own good?";
+	next;
+	menu "Yes.",-,"No.",L_MONK_Q_3;
+
+		mes "[Elder Wuhai]";
+		mes "...NO NO NO NO NO !! Our training is not for any self benefits!";
+		mes "How could one who protects world peace abuse this advantage";
+		mes "For their own selfish means?!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Go and think over the true purpose of a Monk.";
+		mes "Thoughts like that will only make you greedier for power";
+		mes "The corruption of your soul will only lead to loss of your ability.";
+		close;
+
+L_MONK_Q_3:
+	mes "[Elder Wuhai]";
+	mes "When judging those who have opposed the will of God,";
+	mes "Will you hesitate in punishing them?";
+	next;
+	menu "No.",L_MONK_Q_4,"Yes.",-;
+
+		mes "[Elder Wuhai]";
+		mes "What do you think Monks are?";
+		mes "No matter who they are,";
+		mes "People who harm the weak are like trash!";
+		mes "They do not have the right to live on this world!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Perhaps you should go to people who deny morals in this world,";
+		mes "Come back again when you've learnt how to hate.";
+		mes "Then you will know what to do.";
+		close;
+
+L_MONK_Q_4:
+	mes "[Elder Wuhai]";
+	mes "Will you help to eradicate those who oppose God,";
+	mes "And to sacrifice yourself for the better of others?";
+	next;
+	menu "Yes",L_MONK_Q_5,"No",-;
+
+		mes "[Elder Wuhai]";
+		mes "Oh...nonononono....";
+		mes "If sacrificing oneself would be beneficial to your peers,";
+		mes "And that more enemies can be rid of,";
+		mes "That would be a great and worthy thing to do!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "What does Sacrifice means? Come back when you've figured it out.";
+		mes "Ah.. Sacrifice can be so simple, yet so difficult!";
+		close;
+
+L_MONK_Q_5:
+	mes "[Elder Wuhai]";
+	mes "Will you train monsters behind you to help others in battle?";
+	next;
+	menu "Yes",-,"No",L_MONK_Q_6;
+
+		mes "[Elder Wuhai]";
+		mes "That is not right! Training mobs around";
+		mes "Doesn't only apply to all others";
+		mes "...";
+		// he's not making any sense =P
+		mes "Instead it is an act that violates the rights of other Monks";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Even when you've learnt the skill 'Steel Body'";
+		mes "It is only meant to be used in emergency, or when you meet a strong adversary.";
+		mes "But not in such a situation!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "It might feel that you're helping them,";
+		mes "But you are only commiting acts of unjust!";
+		mes "What is the true way of a Monk?";
+		mes "Come back when you have thought it over.";
+		close;
+
+L_MONK_Q_6:
+	mes "[Elder Wuhai]";
+	// mes "Will you spam?";
+	// "will you spam" is just so... un-monkly. ^^;
+	mes "In villages or wilderness, will you say the same words towards others repeatedly?";
+	next;
+	menu "Yes",-,"No",L_MONK_Q_7;
+
+		mes "[Elder Wuhai]";
+		mes "No! If you do so, not just Monks, even the common people,";
+		mes "No matter how loudly you've yelled no one will bother about you!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "It is the same even if you only wanted to spread the words of God.";
+		mes "Think of your behavior. What's right and wrong?";
+		mes "Although I would rather test you again, but I'll let you go this time.";
+		close;
+L_MONK_Q_7:
+	mes "[Elder Wuhai]";
+	mes "Do you feel as if you're a messenger of God, and are willing to die for God?";
+	next;
+	menu "Yes",L_MONK_Q_8,"No",-;
+
+		mes "[Elder Wuhai]";
+		mes "You cannot be a Monk with this kind of will!";
+		mes "As its said, Death is only temporary, Ever if we have to give our lives";
+		mes "to protect world peace, it would at least be a meaningful action!";
+		next;
+		mes "[Elder Wuhai]";
+		mes "Those who oppose God will be condemned,";
+		mes "While those who listen to God will live.";
+		mes "What is life and death to you?";
+		mes "Ponder that well.";
+		close;
+
+L_MONK_Q_8:
+	mes "Lastly, make an oath to swear you will keep to what you have answered.";
+	next;
+	menu "I swear.",L_MONK_Q_9,"I refuse.",-;
+
+		mes "[Elder Wuhai]";
+		mes "......";
+		next;
+		mes "[Elder Wuhai]";
+		mes "It seems like... you don't have enough training...";
+		mes "I can't let you become a Monk.";
+		next;
+		mes "[Elder Wuhai]";
+		mes "It is better for you to train more.";
+		mes "Come back when you ready.";
+		next;
+		mes "[Elder Wuhai]";
+		mes "May God be with you.";
+		close;
+
+L_MONK_Q_9:
+	mes "[Elder Wuhai]";
+	mes "Well then, we have completed the oaths";
+	mes "Gather closer now, you are already my brother!";
+//---- Progress bar ----//
+	next;
+	mes "[Elder Wuhai]";
+	mes "Your promise has transmited to all Monks throught ypur heart and my heart.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Now, let's begin the ceremony!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "I'll acupuncture your 365 acupuncture points and open up your 1129 arteries and veins";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Ahhhhhhhhh......";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Wuuu... Huuuuuu¡K";
+	next;
+	mes "[" + strcharinfo(0) + "]";
+	mes "- He take a deeply breath -";
+	next;
+	mes "[" + strcharinfo(0) + "]";
+	mes "- And begining to acupuncture -";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Ahhhh--- Dadadadadada!!!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "DaBaDaBaDadadadaKaBonTatatata!!!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Ahhhh--- Dadadadadada!!!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "WaLaChuOhhhhhhh!!!";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Wuuu... Huuuuuu¡K";
+	next;
+	mes "[Elder Wuhai]";
+	mes "WowHoooo... Okay, you are now a Monk!";
+	setoption 0;
+	jobchange 15;
+	callfunc "F_ClearJobVar";
+	next;
+	mes "[Elder Wuhai]";
+	mes "(Caught!) (Caught!)";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Am I old...? I feel so tired... (-sigh-)";
+	mes "I could clamb mountains after this before.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Very well... You are now a Monk...";
+	mes "Welcome to be one of us.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Bou never forget your promise.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Keep it in your mind, and train yourself.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Now go...";
+	mes "Here is a gift from us to congratulate you.";
+	if(joblevel <= 49) getitem 1801, 1;
+	if(joblevel == 50) getitem 1804, 1;
+	close;
+Part6:
+	mes "[Elder Wuhai]";
+	mes "May you find God in Mother Nature!";
+	mes "Welcome dear! What can I do for you?";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Is everything alright?";
+	mes "How the training?";
+	next;
+	mes "[Elder Wuhai]";
+	mes "If you don't have a strong body, you may not be able to help people when they needs you.";
+	mes "If you are weak, the Evil will come to you and leads you go into the dark side.";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Never forget it! You are the one protect weakers and world peace!";
+	mes "You should always mind the Evil. Don't let them leads you go into the dark side.";
+	close;
+
+Part7:
+	mes "[Elder Wuhai]";
+	mes "May you find God in Mother Nature!";
+	mes "Welcome dear! What can I do for you?";
+	next;
+	mes "[Elder Wuhai]";
+	mes "Oh! You are an Acolyte....";
+	mes "If you want to pray, go to Prontera Sanctuary!";
+	mes "This is the Monk training area, not for you to pray.";
+	mes "Go and find other places to stay if you are not willing to be a Monk.";
+	close;
+}
+
+prt_monk.gat,251,255,4	script	Wutao	79,{
+	if(JOB_MONK_Q == 4 ) goto L_START;
+	if(JOB_MONK_Q == 5 ) goto Part1;
+	if(JOB_MONK_Q == 6 ) goto Part2;
+	if(JOB_MONK_Q > 6 ) goto Part3;
+	goto IsOther;
+
+IsOther:
+	mes "[Wutao]";
+	mes "We are Monks!";
+	mes "We have unlimited power!";
+	mes "We have unlimited wise!";
+	mes "We use our power and wise to protect the world peace!";
+	next;
+	mes "[Wutao]";
+	mes "So...";
+	mes "Are you my enemy?";
+	mes "You block my way!!!!";
+	next;
+	mes "[Wutao]";
+	mes "If someone block me!! I'll fight!!";
+	mes "TaAhhhhhh!!!";
+	next;
+	mes "[Wutao]";
+	mes "HuHaaaaaaaa!!!";
+	next;
+	mes "[Wutao]";
+	mes "don;t be afraid, go yourway!";
+	close;
+
+L_START:
+	mes "[Wutao]";
+	mes "What can I do for you?";
+	mes "Do you want to talk about God?";
+	next;
+	mes "[Wutao]";
+	mes "Oh! you are proceeding the Monk Quest!";
+	mes "The spirits you have is like a Monk.";
+	next;
+	mes "[Wutao]";
+	mes "Seems your arteries and veins has been open.";
+	mes "You must be the one coming from Elder Wuhai, right?";
+	mes "Very well...";
+	next;
+	mes "[Wutao]";
+	mes "Let me introduce you something about the spirits of Monks and some simple rules that Monks should obey.";
+	mes "Then I'll help modifing your mental status, make your body ready for the next test.";
+	next;
+	mes "[Wutao]";
+	mes "Now, remember what I say and repeat again.";
+	mes "Clear your mind... Are you ready?";
+	next;
+	menu "Yes",L_MENU_1,"No",-;
+		mes "[Wutao]";
+		mes "Come back when you ready!";
+		close;
+L_MENU_1:
+	mes "[Wutao]";
+	mes "All right, let's begin.";
+	next;
+	set @JOB_MONK_C2, rand(1,4);
+L_Again:
+	if(@JOB_MONK_C2 == 1) goto L_ROOT_1;
+	if(@JOB_MONK_C2 == 2) goto L_ROOT_2;
+	if(@JOB_MONK_C2 == 3) goto L_ROOT_3;
+
+	L_ROOT_1:
+		set @monk_str0$,"Supported by dragon and phoenix,";
+		set @monk_str1$,"So flies he westward.";
+		set @monk_str2$,"But the phoenix shall fall to the earth.";
+		set @monk_str3$,"And the dragon shall soar to the sky;";
+		set @monk_str4$,"There shall be successes and failures,";
+		set @monk_str5$,"For such is the eternal law.";
+		set @monk_str6$,"See that ye act when occasion offers,";
+		set @monk_str7$,"Lest ye descend to the Nine Golden Springs.'";
+		goto L_MES;
+	L_ROOT_2:
+		set @monk_str0$,"He boasted not a handsome face,";
+		set @monk_str1$,"Nor was his body blessed with grace.";
+		set @monk_str2$,"His words streamed like a waterfall,";
+		set @monk_str3$,"He read a book and knew it all.";
+		set @monk_str4$,"Shu's glories could he well rehearse,";
+		set @monk_str5$,"His lore embraced the universe.";
+		set @monk_str6$,"Or text or note of scholiast";
+		set @monk_str7$,"Once read, his memory held fast.";
+		goto L_MES;
+	L_ROOT_3:
+		set @monk_str0$,"Seek ye a noble one? Then take ye the way of Jieliang,";
+		set @monk_str1$,"Watch ye how all people revere Guan Yu,";
+		set @monk_str2$,"Each excelling others to honor him,";
+		set @monk_str3$,"Him, one of the three brothers of the Peach Garden Oath,";
+		set @monk_str4$,"Who have won sacrifices, as emperor and king.";
+		set @monk_str5$,"Incomparable their aura spreads through the world;";
+		set @monk_str6$,"They are resplendent as the great lights of the firmament;";
+		set @monk_str7$,"Temples to our Lord Guan Yu abound, no village lacks one,";
+		set @monk_str8$,"Their venerable trees at sundown are the resting places for birds.";
+		goto L_MES;
+L_MES:
+	mes "[Wutao]";
+	mes "Listen carefully!";
+	next;
+	mes "[Wutao]";
+	mes @monk_str0$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str1$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str2$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str3$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str4$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str5$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str6$;
+	next;
+	mes "[Wutao]";
+	mes @monk_str7$;
+	if(@JOB_MONK_C2 < 3) goto L_MES_1;
+	next;
+	mes "[Wutao]";
+	mes @monk_str8$;
+
+L_MES_1:
+	next;
+	mes "[Wutao]";
+	mes "Now, " + strcharinfo(0) + ", it's your turn.";
+	next;
+	set @monk_q, 0;
+	if(@JOB_MONK_C2 == 1) goto L_MONK_Q1_1;
+	if(@JOB_MONK_C2 == 2) goto L_MONK_Q2_1;
+	if(@JOB_MONK_C2 == 3) goto L_MONK_Q3_1;
+
+L_MONK_Q1_1:
+
+	menu "And the dragon shall soar to the sky;",L_MONK_Q1_2,
+		"But the phoenix shall fall to the earth.",L_MONK_Q1_2,
+		"For such is the eternal law.",L_MONK_Q1_2,
+		"See that ye act when occasion offers,",L_MONK_Q1_2,
+		"There shall be successes and failures,",L_MONK_Q1_2,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_2,
+		"Supported by dragon and phoenix,",-,
+		"So flies he westward.",L_MONK_Q1_2;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_2:
+
+	menu "But the phoenix shall fall to the earth.",L_MONK_Q1_3,
+		"See that ye act when occasion offers,",L_MONK_Q1_3,
+		"Supported by dragon and phoenix,",L_MONK_Q1_3,
+		"There shall be successes and failures,",L_MONK_Q1_3,
+		"So flies he westward.",-,
+		"And the dragon shall soar to the sky;",L_MONK_Q1_3,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_3,
+		"For such is the eternal law.",L_MONK_Q1_3;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_3:
+
+	menu "There shall be successes and failures,",L_MONK_Q1_4,
+		"But the phoenix shall fall to the earth.",-,
+		"And the dragon shall soar to the sky;",L_MONK_Q1_4,
+		"So flies he westward.",L_MONK_Q1_4,
+		"For such is the eternal law.",L_MONK_Q1_4,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_4,
+		"See that ye act when occasion offers,",L_MONK_Q1_4,
+		"Supported by dragon and phoenix,",L_MONK_Q1_4;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_4:
+
+	menu "And the dragon shall soar to the sky;",-,
+		"Supported by dragon and phoenix,",L_MONK_Q1_5,
+		"But the phoenix shall fall to the earth.",L_MONK_Q1_5,
+		"So flies he westward.",L_MONK_Q1_5,
+		"For such is the eternal law.",L_MONK_Q1_5,
+		"There shall be successes and failures,",L_MONK_Q1_5,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_5,
+		"See that ye act when occasion offers,",L_MONK_Q1_5;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_5:
+
+	menu "For such is the eternal law.",L_MONK_Q1_6,
+		"And the dragon shall soar to the sky;",L_MONK_Q1_6,
+		"So flies he westward.",L_MONK_Q1_6,
+		"Supported by dragon and phoenix,",L_MONK_Q1_6,
+		"But the phoenix shall fall to the earth.",L_MONK_Q1_6,
+		"See that ye act when occasion offers,",L_MONK_Q1_6,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_6,
+		"There shall be successes and failures,",-;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_6:
+
+	menu "Supported by dragon and phoenix,",L_MONK_Q1_7,
+		"So flies he westward.",L_MONK_Q1_7,
+		"For such is the eternal law.",-,
+		"But the phoenix shall fall to the earth.",L_MONK_Q1_7,
+		"There shall be successes and failures,",L_MONK_Q1_7,
+		"And the dragon shall soar to the sky;",L_MONK_Q1_7,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_7,
+		"See that ye act when occasion offers,",L_MONK_Q1_7;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_7:
+
+	menu "So flies he westward.",L_MONK_Q1_8,
+		"Supported by dragon and phoenix,",L_MONK_Q1_8,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_Q1_8,
+		"See that ye act when occasion offers,",L_MONK_Q1_8,
+		"There shall be successes and failures,",L_MONK_Q1_8,
+		"For such is the eternal law.",L_MONK_Q1_8,
+		"But the phoenix shall fall to the earth.",L_MONK_Q1_8,
+		"And the dragon shall soar to the sky;",L_MONK_Q1_8,
+		"See that ye act when occasion offers,",-;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q1_8:
+
+	menu "Supported by dragon and phoenix,",L_MONK_QUEST_END,
+		"See that ye act when occasion offers,",L_MONK_QUEST_END,
+		"But the phoenix shall fall to the earth.",L_MONK_QUEST_END,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_QUEST_1_2,
+		"And the dragon shall soar to the sky;",L_MONK_QUEST_END,
+		"Lest ye descend to the Nine Golden Springs.",L_MONK_QUEST_END,
+		"So flies he westward.",L_MONK_QUEST_END,
+		"There shall be successes and failures,",L_MONK_QUEST_END,
+		"For such is the eternal law.",L_MONK_QUEST_END;
+
+L_MONK_Q2_1:
+
+	menu "Nor was his body blessed with grace.",L_MONK_Q2_2,
+		"He read a book and knew it all.",L_MONK_Q2_2,
+		"His words streamed like a waterfall,",L_MONK_Q2_2,
+		"He boasted not a handsome face,",-,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_2,
+		"Once read, his memory held fast.",L_MONK_Q2_2,
+		"His lore embraced the universe.",L_MONK_Q2_2,
+		"Or text or note of scholiast",L_MONK_Q2_2;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_2:
+
+	menu "His lore embraced the universe.",L_MONK_Q2_3,
+		"He boasted not a handsome face,",L_MONK_Q2_3,
+		"His words streamed like a waterfall,",L_MONK_Q2_3,
+		"He read a book and knew it all.",L_MONK_Q2_3,
+		"Or text or note of scholiast",L_MONK_Q2_3,
+		"Once read, his memory held fast.",L_MONK_Q2_3,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_3,
+		"Nor was his body blessed with grace.",-;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_3:
+
+	menu "His words streamed like a waterfall,",-,
+		"His lore embraced the universe.",L_MONK_Q2_4,
+		"He read a book and knew it all.",L_MONK_Q2_4,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_4,
+		"Nor was his body blessed with grace.",L_MONK_Q2_4,
+		"Or text or note of scholiast",L_MONK_Q2_4,
+		"He boasted not a handsome face,",L_MONK_Q2_4,
+		"Once read, his memory held fast.",L_MONK_Q2_4;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_4:
+
+	menu "Nor was his body blessed with grace.",L_MONK_Q2_5,
+		"Once read, his memory held fast.",L_MONK_Q2_5,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_5,
+		"Or text or note of scholiast",L_MONK_Q2_5,
+		"He boasted not a handsome face,",L_MONK_Q2_5,
+		"He read a book and knew it all.",-,
+		"His lore embraced the universe.",L_MONK_Q2_5,
+		"His words streamed like a waterfall,",L_MONK_Q2_5;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_5:
+
+	menu "Once read, his memory held fast.",L_MONK_Q2_6,
+		"Or text or note of scholiast",L_MONK_Q2_6,
+		"He read a book and knew it all.",L_MONK_Q2_6,
+		"His words streamed like a waterfall,",L_MONK_Q2_6,
+		"Nor was his body blessed with grace.",L_MONK_Q2_6,
+		"He boasted not a handsome face,",L_MONK_Q2_6,
+		"His lore embraced the universe.",L_MONK_Q2_6,
+		"Shu's glories could he well rehearse,",-;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_6:
+
+	menu "Or text or note of scholiast",L_MONK_Q2_7,
+		"He read a book and knew it all.",L_MONK_Q2_7,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_7,
+		"His words streamed like a waterfall,",L_MONK_Q2_7,
+		"His lore embraced the universe.",-,
+		"He boasted not a handsome face,",L_MONK_Q2_7,
+		"Nor was his body blessed with grace.",L_MONK_Q2_7,
+		"Once read, his memory held fast.",L_MONK_Q2_7;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_7:
+
+	menu "Nor was his body blessed with grace.",L_MONK_Q2_8,
+		"Or text or note of scholiast",-,
+		"His words streamed like a waterfall,",L_MONK_Q2_8,
+		"Once read, his memory held fast.",L_MONK_Q2_8,
+		"He boasted not a handsome face,",L_MONK_Q2_8,
+		"He read a book and knew it all.",L_MONK_Q2_8,
+		"Shu's glories could he well rehearse,",L_MONK_Q2_8,
+		"His lore embraced the universe.",L_MONK_Q2_8;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q2_8:
+
+	menu "He boasted not a handsome face,",L_MONK_QUEST_END,
+		"Nor was his body blessed with grace.",L_MONK_QUEST_END,
+		"Shu's glories could he well rehearse,",L_MONK_QUEST_END,
+		"Or text or note of scholiast",L_MONK_QUEST_END,
+		"His lore embraced the universe.",L_MONK_QUEST_END,
+		"He read a book and knew it all.",L_MONK_QUEST_END,
+		"His words streamed like a waterfall,",L_MONK_QUEST_END,
+		"Once read, his memory held fast.",L_MONK_QUEST_1_2;
+
+L_MONK_Q3_1:
+
+	menu "Watch ye how all people revere Guan Yu,",L_MONK_Q3_2,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",-,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_2,
+		"Each excelling others to honor him,",L_MONK_Q3_2,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_2,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_2,
+		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_2,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_2,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_2;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_2:
+
+	menu "Each excelling others to honor him,",L_MONK_Q3_3,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_3,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_3,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_3,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_3,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_3,
+		"Watch ye how all people revere Guan Yu,",-,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_3,
+		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_3;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_3:
+
+	menu "They are resplendent as the great lights of the firmament;",L_MONK_Q3_4,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_4,
+		"Each excelling others to honor him,",-,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_4,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_4,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_4,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_4,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_4,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_4;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_4:
+
+	menu "Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_5,
+		"Each excelling others to honor him,",L_MONK_Q3_5,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_5,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_5,
+		"Him, one of the three brothers of the Peach Garden Oath,",-,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_5,
+		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_5,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_5,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_5;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_5:
+
+	menu "They are resplendent as the great lights of the firmament;",L_MONK_Q3_6,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_6,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_6,
+		"Who have won sacrifices, as emperor and king.",-,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_6,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_6,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_6,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_6,
+		"Each excelling others to honor him,",L_MONK_Q3_6;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_6:
+
+	menu "Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_7,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_7,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_7,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_7,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_7,
+		"Incomparable their aura spreads through the world;",-,
+		"Each excelling others to honor him,",L_MONK_Q3_7,
+		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_7,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_7;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_7:
+
+	menu "Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_8,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_8,
+		"They are resplendent as the great lights of the firmament;",-,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_8,
+		"Each excelling others to honor him,",L_MONK_Q3_8,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_8,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_8,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_8,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_Q3_8;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_8:
+
+	menu "Temples to our Lord Guan Yu abound, no village lacks one,",-,
+		"Incomparable their aura spreads through the world;",L_MONK_Q3_9,
+		"Their venerable trees at sundown are the resting places for birds.",L_MONK_Q3_9,
+		"They are resplendent as the great lights of the firmament;",L_MONK_Q3_9,
+		"Who have won sacrifices, as emperor and king.",L_MONK_Q3_9,
+		"Him, one of the three brothers of the Peach Garden Oath,",L_MONK_Q3_9,
+		"Watch ye how all people revere Guan Yu,",L_MONK_Q3_9,
+		"Each excelling others to honor him,",L_MONK_Q3_9,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_Q3_9;
+
+		set @monk_q, @monk_q + 1;
+L_MONK_Q3_9:
+
+	menu "Him, one of the three brothers of the Peach Garden Oath,",L_MONK_QUEST_END,
+		"Each excelling others to honor him,",L_MONK_QUEST_END,
+		"Watch ye how all people revere Guan Yu,",L_MONK_QUEST_END,
+		"Who have won sacrifices, as emperor and king.",L_MONK_QUEST_END,
+		"Incomparable their aura spreads through the world;",L_MONK_QUEST_END,
+		"Seek ye a noble one? Then take ye the way of Jieliang,",L_MONK_QUEST_END,
+		"They are resplendent as the great lights of the firmament;",L_MONK_QUEST_END,
+		"Temples to our Lord Guan Yu abound, no village lacks one,",L_MONK_QUEST_END,
+		"Their venerable trees at sundown are the resting places for birds.",-;
+
+L_MONK_QUEST_1_2:
+		set @monk_q, @monk_q + 1;
+L_MONK_QUEST_END:
+
+	if(@monk_q != 10) goto L_C2_FAIL;
+
+L_C2_DONE:
+	set @monk_q, 0;
+	next;
+	mes "[Wutao]";
+	mes "Hmmm...";
+	next;
+	mes "[Wutao]";
+	mes "...Well Done!! It's perfect!";
+	next;
+	mes "[Wutao]";
+	mes "However, don't be happy too early. There is much long way to go before you become a Monk.";
+	next;
+	mes "[Wutao]";
+	mes "DaAhaaaa...";
+	next;
+	mes "[Wutao]";
+	mes "ShuKeeee.....";
+	next;
+	mes "[Wutao]";
+	mes "SouKouuuuu....";
+	next;
+	mes "[Wutao]";
+	mes "PaYennnn....";
+	next;
+	mes "[Wutao]";
+	mes "As I promised, your mental status is now running like a Monk do.";
+	next;
+	mes "[Wutao]";
+	mes "Now go, seek ^000080Fuhai^000000 for further guidance.";
+	set JOB_MONK_Q, 6;
+	close;
+
+L_C2_FAIL:
+	mes "[" + strcharinfo(0) + "]";
+	mes "Well...? How was that? ";
+	next;
+	mes "[Wutao]";
+	mes "Hmmm...";
+	next;
+	mes "[Wutao]";
+	mes "HeNmmm...";	
+	next;
+	mes "[Wutao]";
+	mes "How was that? It's bad! You didn't memorize it all!";
+	next;
+	mes "[Wutao]";
+	mes "You should doult yourself. Are you really have the ability to be a Monk?";
+	mes "...It's really....";
+	next;
+	mes "[Wutao]";
+	mes "Well...That's fine, do you want to try it again?";
+	next;
+	mes "[Wutao]";	
+	mes "Of course! Since you did not pass this test, you can't take the next test.";
+	set JOB_MONK_Q, 5;
+	close;
+
+Part1:
+	mes "[Wutao]";
+	mes "Very well. Let's try it again.";
+	next;
+	goto L_Again;
+
+Part2:
+	mes "[Wutao]";
+	mes "What? You forget whom you should seek for?";
+	next;
+	mes "[Wutao]";
+	mes "......You are so.......";
+	next;
+	mes "[Wutao]";
+	mes "...Are you testing my patient?";
+	next;
+	mes "[Wutao]";
+	mes "...Okay, I'll tell you again...";
+	mes "Go and seek ^000080Fuhai^000000 for further guidance.";
+	close;
+Part3:
+	mes "[Wutao]";
+	mes "May God be with you.";
+	close;
+}
+
+prt_monk.gat,57,179,4	script	Fuhai	110,{
+
+	if(@Choice_mission == 1 ) goto Part1;
+	if(@Choice_mission == 2 ) goto Part2;
+	if(JOB_MONK_Q == 6 ) goto L_START;
+	goto IsOther;
+IsOther:
+	mes "[Fuhai]";
+	mes "HaAhhhhh....!!!";
+	next;
+	mes "- Seems like he is thinking something -";
+	close;
+
+L_START:
+	mes "[Fuhai]";
+	mes "...";
+	next;
+	mes "[Fuhai]";
+	mes "......";
+	next;
+	mes "[Fuhai]";
+	mes ".........";
+	next;
+	mes "[Fuhai]";
+	mes "............";
+	next;
+	menu "Hello there?",-;
+
+		mes "[Fuhai]";
+		mes "...what...WHAT?";
+		mes "How dare you interupt my training!";
+		mes "If it is not very important...";
+		next;
+		mes "[Fuhai]";
+		mes "......";
+		mes "I can't tell...if you can see the son tomorrow...";
+		next;
+		mes "[Fuhai]";
+		mes "Why are you here?";
+		mes "Explain!";
+		next;
+		menu "Some one named [Wutao] send me here.",L_MENU_1,"Well...Nothing...",-;
+			
+			mes "[Fuhai]";
+			mes "......";
+			mes "...How about dig a grave for yourself?";
+			close;
+	L_MENU_1:
+		mes "[Fuhai]";
+		mes "Hmmm...It's that so?";
+		mes "That's...";
+		next;
+		mes "[Fuhai]";
+		mes "Oh...Your mental status...";
+		mes "Ha! Very well...";
+		next;
+		mes "[Fuhai]";
+		mes "However, what did you learn from [Wutao] ?";
+		next;
+		menu "Hmmm...Well...It's...",-,
+			"I repeat what he said, and he send me here.",L_MENU_1_1,
+			"He test my mental status and send me here.",-;
+
+			mes "[Fuhai]";
+			mes "Foolish!";
+			mes "Don't bother me! Go away!";
+			close;
+	L_MENU_1_1:
+		mes "[Fuhai]";
+		mes "Well...Then?";
+		mes "Did he do anything for you?";
+		next;
+		menu "Ah...It's...I can't tell...",-,
+			"Check my body",L_MENU_1_1_1,
+			"Tell me some rules to obey",L_MENU_1_1_1,
+			"modify my mental status",L_MENU_1_1_2;
+
+			mes "[Fuhai]";
+			mes "Foolish!";
+			mes "Don't bother me! Go away!";
+			close;
+	L_MENU_1_1_1:
+		mes "[Fuhai]";
+		mes "That's quite true, but not the point.";
+		mes "Think! Use your brain!";
+		close;
+
+	L_MENU_1_1_2:
+		set JOB_MONK_Q, 7;
+		mes "[Fuhai]";
+		mes "Very well, at least you know what had been change in your body";
+		mes "Now, let's begin the next test.";
+		next;
+		mes "[Fuhai]";
+		mes "I'll give you a chance to choose what kind of test you want to take.";
+		mes "Now, make your own choise.";
+		next;
+		menu "Mushroom Collecting",L_ROOT_1,"Marathon",L_ROOT_2;
+
+	L_ROOT_1:
+		mes "[Fuhai]";
+		mes "Mushroom Collecting? Good choice!";
+		mes "That would make you appreciate the extremity of patient, realize the meaning God give you the great willpower.";
+		mes "Now go, do some prepares. Come back when you ready.";
+		set @Choice_mission, 1;
+		close;
+	L_ROOT_2:
+		mes "[Fuhai]";
+		mes "Marathon? Good choice!";
+		mes "That would make you appreciate the extremity of willpower, realize the meaning God give you the great patient.";
+		mes "Now go, do some prepares. Come back when you ready.";
+		set @Choice_mission, 2;
+		close;
+Part1:
+	mes "[Fuhai]";
+	mes "Are you ready?";
+	mes "Acturily, you don't need to prepare anything if you believe in yourself";
+	next;
+	mes "[Fuhai]";
+	mes "Mushroom Collecting is your choice.";
+	mes "It's a test for yourself.";
+	next;
+	mes "[Fuhai]";
+	mes "Now, go to the building located in the center of this training area.";
+	next;
+	mes "[Fuhai]";
+	mes "You will pass the test when you collect enough mushrooms we think.";
+	mes "Now, what are waitting for? Go ahead!";
+	close;
+Part2:
+	mes "[Fuhai]";
+	mes "Are you ready?";
+	mes "Acturily, you don't need to prepare anything if you believe in yourself";
+	next;
+	mes "[Fuhai]";
+	mes "Marathon is your choice.";
+	mes "It's a test for yourself.";
+	next;
+	mes "[Fuhai]";
+	mes "Now, go to the building located in the center of this training area.";
+	next;
+	mes "[Fuhai]";
+	mes "You will pass the test when you run enough circles we think.";
+	mes "Now, what are waitting for? Go ahead!";
+	close;
+
+}
+
+prt_monk.gat,199,169,4	script	Guard	746,{
+	if(JOB_MONK_Q == 7) goto L_START;
+	if(JOB_MONK_Q > 6) goto Part1;
+	goto IsOther;
+IsOther:
+	mes "[Guard ChaoLi]";
+	mes "This is...";
+	mes "Monk Training Area";
+	next;
+	mes "[Guard ChaoLi]";
+	mes "Please be quiet in this area.";
+	close;
+
+L_START:
+	mes "[Guard ChaoLi]";
+	mes "This is...";
+	mes "Monk Training Area";
+	next;
+	mes "[Guard ChaoLi]";
+	mes strcharinfo(0) + " ... Right?!";
+	next;
+	mes "[Guard ChaoLi]";
+	mes "Go ahead! Quickly!";
+	mes "There is another test waitting for you!";
+	close;
+
+Part1:
+	mes "[Guard ChaoLi]";
+	mes "Please be quiet in this area.";
+	close;
+}
+
+monk_test.gat,329,61,4	script	Bashu	753,{
+	if(JOB_MONK_Q == 7) goto L_START;
+	if(JOB_MONK_Q == 8) goto IsOther;
+	goto IsOther;
+IsOther:
+	mes "[Bashu]";
+	mes "Welcome to ^00FF00St. Capitolina Abbey^000000, the Monk Training Area.";
+	mes "May the light shine on your path.";
+	mes "You can find Monk Daowen who judge the grades of Monk training when you go inside";
+	next;
+	mes "[Bashu]";
+	mes "Never the less, don't touch anything inside and be quiet in front of Monk Daowen.";
+	next;
+	mes "[Bashu]";
+	mes "Then, may you have a happy conversation time with God.";
+	close;
+L_START:
+	mes "[Bashu]";
+	mes "Please select a test.";
+	next;
+	if(@Choice_mission == 0) goto L_MISSC;
+	if(@Choice_mission == 2) goto L_MISS2;
+	mes "[Bashu]";
+	mes "As I know, you choose the Mushroom Collecting as your test.";
+	goto L_MISSC;
+L_MISS2:
+	mes "[Bashu]";
+	mes "As I know, you choose the Marathon as your test.";
+L_MISSC:
+	mes "However, if you cannot complete it, you may switch to the other whenever you feel like it.";
+	next;
+	menu "Monk's patient - Mushroom Collecting",-,
+		"Monk's willpower - Marathon",L_MENU_1;
+
+	mes "[Bashu]";
+	mes "The test you choose is Monk's patient - Mushroom Collecting";
+	next;
+	warp "job_monk.gat",225,179;
+	end;
+
+L_MENU_1:
+	mes "[Bashu]";
+	mes "The test you choose is Monk's willpower - Marathon";	
+	next;
+	warp "monk_test.gat",387,345;
+	end;
+}
+
+monk_test.gat,387,347,4	script	Musha	110,{
+	mes "[Musha]";
+	mes "Wel...Welcome...!";
+	mes "This...This is the area testing the pa...patient of whom want to be a Monk.";
+	next;
+	mes "[Musha]";
+	mes "You should just...just run!";
+	mes "Before we told you to stop.";
+	mes "Run...Run! " + strcharinfo(0) + "! Run!";
+	next;
+	mes "[Musha]";
+	mes "Just Run!! Run Quickly!!";
+	next;
+	mes "[Musha]";
+	mes "One Day, I'll become a Monk!";
+	mes "I.....will......Become...a......MONK!!!";
+	next;
+	mes "[Musha]";
+	mes "Do...Do you...want to give......giveup? or...con...continue?";
+	mes "Giveup?";
+	next;
+	menu "I want to giveup!",-,"I want to run!!",L_MENU_1;
+
+		announce "Musha: " + strcharinfo(0) + " has give...giveup the test...! Giveup the Marathon test... No...No patient.....HaHaHaHa!!!...",8;
+		mes "[Musha]";
+		mes strcharinfo(0) + "...give...giveup the test...";
+		mes "Giveup the Marathon test...";
+		mes "No...No patient.....HaHaHaHa!!!...";
+		next;
+		warp "prt_monk.gat",196,168;
+		end;
+L_MENU_1:
+	next;
+	mes "[Musha]";
+	mes "Before we give you an order to stop....";
+	mes "Run...Run! " + strcharinfo(0) + "! Run!";
+	if(@runtimes == 0) set @runtimes, rand(8,10);
+	close;
+}
+
+monk_test.gat,390,387,0	script	monk_warp	45,1,1,{
+	set @run, @run + 1;
+	if(@run == (@runtimes-1)) mapannounce "monk_test.gat","Musha: cheer up! The next circle is the last!",8;
+	if(@run == @runtimes) goto L_DONE;
+	warp "monk_test.gat",388,348;
+	end;
+L_DONE:
+	mapannounce "monk_test.gat","Musha: Con....Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
+	set JOB_MONK_Q, 8;
+	warp "prt_monk.gat",196,168;
+	end;
+
+}
+monk_test.gat,0,0,0	script	monk_traps	-1,{
+	mapannounce "monk_test.gat","trap: " + strcharinfo(0)+ " , you fall into a trap! Now we warp you to the start place.",8;
+	warp "monk_test.gat",388,348;
+	end;
+}
+//---------------------
+monk_test.gat,386,164,0	script	monk1-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,386,165,0	script	monk1-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,387,164,0	script	monk1-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,387,165,0	script	monk1-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,388,164,0	script	monk1-5	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,388,165,0	script	monk1-6	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,389,164,0	script	monk1-7	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,389,165,0	script	monk1-8	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,386,42,0	script	monk2-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,386,43,0	script	monk2-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,387,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,387,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,388,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,388,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,389,42,0	script	monk2-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,389,43,0	script	monk2-4	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,184,11,0	script	monk3-1	139,0,3,{doevent "monk_traps";end;}
+monk_test.gat,185,11,0	script	monk3-2	139,0,3,{doevent "monk_traps";end;}
+monk_test.gat,186,11,0	script	monk3-3	139,0,3,{doevent "monk_traps";end;}
+monk_test.gat,187,11,0	script	monk3-4	139,0,3,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,70,10,0	script	monk4-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,70,11,0	script	monk4-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,70,12,0	script	monk4-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,70,13,0	script	monk4-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,71,10,0	script	monk4-5	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,71,11,0	script	monk4-6	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,71,12,0	script	monk4-7	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,71,13,0	script	monk4-8	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,8,30,0	script	monk5-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,8,31,0	script	monk5-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,9,30,0	script	monk5-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,9,31,0	script	monk5-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,10,30,0	script	monk5-5	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,10,31,0	script	monk5-6	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,11,30,0	script	monk5-7	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,11,31,0	script	monk5-8	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,12,30,0	script	monk5-9	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,12,31,0	script	monk5-10	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,13,30,0	script	monk5-11	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,13,31,0	script	monk5-12	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,14,30,0	script	monk5-13	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,14,31,0	script	monk5-14	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,15,30,0	script	monk5-15	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,15,31,0	script	monk5-16	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,10,158,0	script	monk6-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,10,159,0	script	monk6-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,11,158,0	script	monk6-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,11,159,0	script	monk6-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,12,158,0	script	monk6-5	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,12,159,0	script	monk6-6	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,13,158,0	script	monk6-7	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,13,159,0	script	monk6-8	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,38,386,0	script	monk7-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,38,387,0	script	monk7-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,38,388,0	script	monk7-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,38,389,0	script	monk7-4	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,39,386,0	script	monk7-5	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,39,387,0	script	monk7-6	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,39,388,0	script	monk7-7	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,39,389,0	script	monk7-8	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,82,390,0	script	monk8-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,82,391,0	script	monk8-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,83,390,0	script	monk8-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,83,391,0	script	monk8-4	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+monk_test.gat,82,384,0	script	monk8-1	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,82,385,0	script	monk8-2	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,83,384,0	script	monk8-3	139,0,0,{doevent "monk_traps";end;}
+monk_test.gat,83,385,0	script	monk8-4	139,0,0,{doevent "monk_traps";end;}
+//---------------------
+prt_monk.gat,225,179,4	script	XuanWu 	89,{
+	mes "[XuanWu]";
+	mes "To see the growing of crop, I deeply appreciate from the grace of God.";
+	next;
+	mes "[XuanWu]";
+	mes "Never the less, see those crop grown by the strong Monks.";
+	mes "I think it's the most beautiful picture!";
+	next;
+	mes "[XuanWu]";
+	mes "Frankly speeking, grower is the greatest people in the world.";
+	mes "The Blue Potion you drink must be made of God's will and by the grower.";
+	next;
+	mes "[XuanWu]";
+	mes "We chould always be grateful.";
+	next;
+	mes "[XuanWu]";
+	mes "God give you everything, even the grower.";
+	next;
+	mes "[XuanWu]";
+	mes "The grower is the root of world. That's quite true.";
+	close;
+}
+job_monk.gat,225,179,4	script	XuanWu	89,{
+
+	if(JOB_MONK_Q == 8 ) goto Part2;
+	if(@mission_start == 1 ) goto Part1;
+
+	mes "[XuanWu]";
+	mes "Welcome! I'm in charge here with the Mushroom Collecting.";
+	mes "My Name is XuanWu";
+	next;
+	mes "[XuanWu]";
+	mes "From now, you should take it for granted that all the suffering is training.";
+	mes "Understand?";
+	next;
+	mes "[XuanWu]";
+	mes "For Monks lives, we should always offer our efforts as a tribute";
+	mes "Grow crop is also a kind of training.";
+	next;
+	mes "[XuanWu]";
+	mes "We think it is the best way to realize the will of God.";
+	mes "Therefore, we had started growing some kind of mushrooms that smell foul";
+	next;
+	mes "[XuanWu]";
+	mes "All you have to do is destory those mushrooms and bring some thing to prove.";
+	mes "What's the thing I mean? The ^ff0000Orange GooeyMushroom and Orange Net Mushroom^000000";
+	next;
+	mes "[XuanWu]";
+	mes "If you want to increase your internal organs and become a Monk, go and destory it.";
+	mes "Bring as many as you can, I won't tell you the amount I need.";
+	mes "Now go!";
+	next;
+	mes "[XuanWu]";
+	mes "Or...You want to giveup?";
+	next;
+	menu "Start Mushroom Collecting",L_MENU_1,"I'll giveup",L_MENU_2;
+
+L_MENU_2:
+		mapannounce "monk_test.gat","XuanWu: ......Another one without willpower...",8;
+		mes "[XuanWu]";
+		mes "Another one without willpower...";
+		set @mission_start, 0;
+		getitem 1069, 1;
+		delitem 1069, 1;
+		next;
+		warp "prt_monk.gat",196,168;
+		end;		
+L_MENU_1:
+	mes "[XuanWu]";
+	mes "Then what are you waitting for? Go Go Go !!";
+	set @mission_start, 1;
+	close;
+
+Part1:
+	if(countitem(1069) >= 30 && countitem(1070) >0 ) goto L_DONE;
+	if(countitem(1070) >= 30 && countitem(1069) >0 ) goto L_DONE;
+	mes "[XuanWu]";
+	mes "Hmmm... Is that all you can do? I don't think it's enough.";
+	next;
+	mes "[XuanWu]";
+	mes "Or...You want to giveup?";
+	next;
+	menu "Continue Mushroom Collecting",-,"I'll giveup",L_MENU_2;
+		close;
+L_DONE:
+	set JOB_MONK_Q, 8;
+	mes "[XuanWu]";
+	mes "Well... I think you can do it better...";
+	mes "However, I should say you pass the test.";
+	set @mission_start, 0;
+	delitem 1069, countitem(1069);
+	delitem 1070, countitem(1070);
+	next;
+	mes "[XuanWu]";
+	mes "Now go to [Daowen], he is in the deep of the building.";
+	close;
+Part2:
+	mes "[XuanWu]";
+	mes "Are you testing my patient??";
+	mes "Now go to [Daowen], he is in the deep of the building.";
+	close;
+}
+job_monk.gat,191,172,4	script	job_monk_warp	45,1,1,{
+	warp "monk_test.gat",329,57;
+	end;
+}
+
+job_monk.gat,199,169,4	script	Guard ChaoLi 	746,{
+	mes "[Guard ChaoLi]";
+	mes "Silence! In test area!";
+	close;
+}
+
+monk_test.gat,319,139,4	script	Daowen	52,{
+	if(JOB_MONK_Q == 8) goto L_START;
+	if(JOB_MONK_Q == 9) goto Part1;
+	if(JOB_MONK_Q == 10) goto Part2;
+		goto IsOther;
+IsOther:
+	mes "[Daowen]";
+	mes "Go throught it quietly...";
+	mes "HuWuWuuuu......";
+	next;
+	mes "[Daowen]";
+	mes "This is St. Capitolina Abbey. If anything goes wrong, all we have done might become nothing.";
+	next;
+	mes "[Daowen]";
+	mes "Leave! If you don't want to die, don't bother me.";
+	close;
+L_START:
+	mes "[Daowen]";
+	mes "Oh! Finally!";
+	mes "This is the last test, and I am I'm in charge here";
+	mes "My name is 'Daowen'";
+	next;
+	mes "[Daowen]";
+	mes "Well... What should I say?";
+	mes "Who block the way? Fight him/her!";
+	next;
+	mes "[Daowen]";
+	mes "Fight! Slash! When you lost and some enemy block your way!";
+	mes "Tell them the will of God!";
+	next;
+	mes "[Daowen]";
+	mes "Don't compare with the weak priest!";
+	mes "We are always strong Monks";
+	next;
+	mes "[Daowen]";
+	mes "We are different from the weak priest that always run away!";
+	next;
+	mes "[Daowen]";
+	mes "Now! Grasp your fist! Go and fight!";
+	next;
+	mes "[Daowen]";
+	mes "Do your best!";
+	mes "HaHaHaHaHa.....!!";
+	next;
+	warp "monk_test",88,73;
+	end;
+
+Part1:
+	mes "[Daowen]";
+	mes "Well done!! HaHaHaHa....!!";
+	mes "I knew you can do it!";
+	mes "I'll give you a special potion that can increase your power";
+	next;
+	getitem 506, 1;
+	mes "[Daowen]";
+	mes "Drink it, and your internal organs will increase enough to be a Monk.";
+	mes "Okay...Then, Go to Wuhai - the first one you meet here.";
+	set JOB_MONK_Q, 10;
+	close;
+Part2:
+	mes "[Daowen]";
+	mes "Go to Wuhai - the first one you meet here.";
+	close;
+}
+
+monk_test.gat,88,91,4	script	Test Assistant	52,{
+	mes "[Test Assistant]";
+	mes "Are you ready for training of evil disperse?";
+	next;
+	mes "[Test Assistant]";
+	mes "The test area is a maze with walls invisable.";
+	mes "The exiting point is on the opposite side of the starting point.";
+	next;
+	mes "[Test Assistant]";
+	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
+	mes "Good lucy! May God be with you.";
+	next;
+	if(getareausers("monk_test.gat",126,161,165,199) > 0) goto L_WAIT;
+	killmonster "monk_test.gat","monk_mob1";
+	enablenpc "monk_mob1_1";
+	enablenpc "monk_mob1_2";
+	enablenpc "monk_mob1_3";
+	enablenpc "monk_mob1_3";
+	warp "monk_test.gat",127,179;
+	end;
+L_WAIT:
+	mes "[Test Assistant]";
+	mes "There is someone taking the test. Please wait a minute.";
+	close;
+}
+monk_test.gat,129,180,4	script	monk_mob1_1	139,0,19,{
+	monster "monk_test.gat",130,183,"--ja--",1015,1,"monk_mob1";
+	monster "monk_test.gat",130,177,"--ja--",1015,1,"monk_mob1";
+//~	disablenpc "monk_mob1_1";
+	end;
+}
+monk_test.gat,133,180,4	script	monk_mob1_2	139,0,19,{
+	monster "monk_test.gat",134,183,"--ja--",1015,1,"monk_mob1";
+	monster "monk_test.gat",134,177,"--ja--",1015,1,"monk_mob1";
+//~	disablenpc "monk_mob1_2";
+	end;
+}
+monk_test.gat,145,180,4	script	monk_mob1_3	139,0,19,{
+	monster "monk_test.gat",145,180,"--ja--",1041,1,"monk_mob1";
+//~	disablenpc "monk_mob1_3";
+	end;
+}
+monk_test.gat,155,180,4	script	monk_mob1_4	139,0,19,{
+	monster "monk_test.gat",157,183,"--ja--",1015,1,"monk_mob1";
+	monster "monk_test.gat",157,177,"--ja--",1015,1,"monk_mob1";
+//~	disablenpc "monk_mob1_4";
+	end;
+}
+monk_test.gat,165,179,4	script	monk_mob3_warp	45,1,1,{
+	set JOB_MONK_Q, 9;
+	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
+	killmonster "monk_test.gat","monk_mob1";
+	warp "monk_test.gat",317,142;
+	end;
+}
+
+monk_test.gat,1,1,1	script	monk_mob1	-1,{
+		end;
+}
+
+monk_test.gat,95,85,4	script	Test Assistant	79,{
+	mes "[Test Assistant]";
+	mes "Are you ready for training of evil disperse?";
+	next;
+	mes "[Test Assistant]";
+	mes "The test area is a maze with walls invisable.";
+	mes "The exiting point is on the opposite side of the starting point.";
+	next;
+	mes "[Test Assistant]";
+	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
+	mes "Good lucy! May God be with you.";
+	next;
+	if(getareausers("monk_test.gat",126,262,165,300) > 0) goto L_WAIT;
+	killmonster "monk_test.gat","monk_mob2";
+	enablenpc "monk_mob2_1";
+	enablenpc "monk_mob2_2";
+	enablenpc "monk_mob2_3";
+	enablenpc "monk_mob2_4";
+	warp "monk_test.gat",127,278;
+	end;
+
+L_WAIT:
+	mes "[Test Assistant]";
+	mes "There is someone taking the test. Please wait a minute.";
+	close;
+
+}
+monk_test.gat,129,281,4	script	monk_mob2_1	139,0,19,{
+	monster "monk_test.gat",130,278,"--ja--",1015,1,"monk_mob2";
+	monster "monk_test.gat",130,284,"--ja--",1015,1,"monk_mob2";
+//~	disablenpc "monk_mob2_1";
+	end;
+}
+monk_test.gat,136,281,4	script	monk_mob2_2	139,0,19,{
+	monster "monk_test.gat",139,278,"--ja--",1015,1,"monk_mob2";
+	monster "monk_test.gat",139,284,"--ja--",1015,1,"monk_mob2";
+//~	disablenpc "monk_mob2_2";
+	end;
+}
+monk_test.gat,144,281,4	script	monk_mob2_3	139,0,19,{
+	monster "monk_test.gat",145,281,"--ja--",1041,1,"monk_mob2";
+//~	disablenpc "monk_mob2_3";
+	end;
+}
+monk_test.gat,153,281,4	script	monk_mob2_4	139,0,19,{
+	monster "monk_test.gat",155,278,"--ja--",1015,1,"monk_mob2";
+	monster "monk_test.gat",155,284,"--ja--",1015,1,"monk_mob2";
+//~	disablenpc "monk_mob2_4";
+	end;
+}
+monk_test.gat,165,278,4	script	monk_mob2_warp	45,1,1,{
+	set JOB_MONK_Q, 9;
+	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
+	killmonster "monk_test.gat","monk_mob2";
+	warp "monk_test.gat",317,142;
+	end;
+}
+
+monk_test.gat,1,1,1	script	monk_mob2	-1,{
+		end;
+}
+
+monk_test.gat,82,85,4	script	Test Assistant	95,{
+	mes "[Test Assistant]";
+	mes "Are you ready for training of evil disperse?";
+	next;
+	mes "[Test Assistant]";
+	mes "The test area is a maze with walls invisable.";
+	mes "The exiting point is on the opposite side of the starting point.";
+	next;
+	mes "[Test Assistant]";
+	mes "Of course, there will be some monster spawn in the maze. You'll have to fight with them.";
+	mes "Good lucy! May God be with you.";
+	next;
+	if(getareausers("monk_test.gat",233,262,269,300) > 0) goto L_WAIT;
+	killmonster "monk_test.gat","monk_mob3";
+	enablenpc "monk_mob3_1";
+	enablenpc "monk_mob3_2";
+	enablenpc "monk_mob3_3";
+	enablenpc "monk_mob3_4";
+	warp "monk_test.gat",231,279;
+	end;
+
+L_WAIT:
+	mes "[Test Assistant]";
+	mes "There is someone taking the test. Please wait a minute.";
+	close;
+}
+
+monk_test.gat,234,281,4	script	monk_mob3_1	139,0,19,{
+	monster "monk_test.gat",235,277,"--ja--",1015,1,"monk_mob3";
+	monster "monk_test.gat",235,284,"--ja--",1015,1,"monk_mob3";
+//~	disablenpc "monk_mob3_1";
+	end;
+}
+monk_test.gat,239,281,4	script	monk_mob3_2	139,0,19,{
+	monster "monk_test.gat",240,277,"--ja--",1015,1,"monk_mob3";
+	monster "monk_test.gat",240,284,"--ja--",1015,1,"monk_mob3";
+//~	disablenpc "monk_mob3_2";
+	end;
+}
+monk_test.gat,248,281,4	script	monk_mob3_3	139,0,19,{
+	monster "monk_test.gat",249,281,"--ja--",1041,1,"monk_mob3";
+//~	disablenpc "monk_mob3_3";
+	end;
+}
+monk_test.gat,260,281,4	script	monk_mob3_4	139,0,19,{
+	monster "monk_test.gat",261,277,"--ja--",1015,1,"monk_mob3";
+	monster "monk_test.gat",261,284,"--ja--",1015,1,"monk_mob3";
+//~	disablenpc "monk_mob3_4";
+	end;
+}
+monk_test.gat,269,279,4	script	monk_mob3_warp	45,1,1,{
+	set JOB_MONK_Q, 9;
+	mapannounce "monk_test.gat","Congratulations!!" + strcharinfo(0)+ " Pass!! Please go to [Daowen], he is in the deep of the building.",8;
+	killmonster "monk_test.gat","monk_mob3";
+	warp "monk_test.gat",317,142;
+	end;
+}
+
+monk_test.gat,1,1,1	script	monk_mob3	-1,{
+		end;
+}
+
+
+
+//==============================================================================
+// Monsters of Mushroom Collecting
+//==============================================================================
+job_monk.gat,0,0,0,0	monster	Thief Mushroom	1182,170,0,0,0
+job_monk.gat,0,0,0,0	monster	Thief Bug Larva	1051,120,0,0,0
+
+//==============================================================================
+// warps
+//==============================================================================
+prt_monk.gat,192,172,0	warp	monk15	1,1,monk_test.gat,329,50
+monk_test.gat,329,47,0	warp	monk16	1,1,prt_monk.gat,193,166
+monk_test.gat,329,76,0	warp	monk17	1,1,monk_test.gat,259,118
+monk_test.gat,259,115,0	warp	monk18	1,1,monk_test.gat,329,71
+monk_test.gat,272,125,0	warp	monk19	1,1,monk_test.gat,301,127
+monk_test.gat,298,127,0	warp	monk20	1,1,monk_test.gat,268,125
+
+//==============================================================================
+// mapflag
+//==============================================================================
+monk_test.gat	mapflag	nomemo	dummy
+monk_test.gat	mapflag	noteleport	dummy
+monk_test.gat	mapflag	nosave	SavePoint
+monk_test.gat	mapflag	nopenalty	dummy
+monk_test.gat	mapflag	nobranch	dummy

+ 15 - 15
npc/sample/npc_test_npctimer2.txt

@@ -1,16 +1,16 @@
-prontera.gat,156,183,0	script	NPCtimerƒeƒXƒg::npctimerX0000	116,{
-L_INIT:
-	mes "What would you like to know?";
-	menu "Tell me my level",L_WAIT;
-
-L_WAIT:
-	mes "I need time to think...";
-	initnpctimer;
-	attachnpctimer;
-	close;
-
-OnTimer5000:
-	mes "Ah, your level is " + readparam(11);
-	detachnpctimer;
-	close;
+prontera.gat,156,183,0	script	NPCtimerƒeƒXƒg::npctimerX0000	116,{
+L_INIT:
+	mes "What would you like to know?";
+	menu "Tell me my level",L_WAIT;
+
+L_WAIT:
+	mes "I need time to think...";
+	initnpctimer;
+	attachnpctimer;
+	close;
+
+OnTimer5000:
+	mes "Ah, your level is " + readparam(11);
+	detachnpctimer;
+	close;
 }

+ 18 - 18
src/common/buffer.h

@@ -1,18 +1,18 @@
-#ifndef _BUFFER_H_
-#define _BUFFER_H_
-
-// Full credit for this goes to Shinomori [Ajarn]
-
-#ifdef __GNUC__ // GCC has variable length arrays
-
-#define CREATE_BUFFER(name, type, size) type name[size]
-#define DELETE_BUFFER(name)
-
-#else // others don't, so we emulate them
-
-#define CREATE_BUFFER(name, type, size) type *name=(type*)aCalloc(size,sizeof(type))
-#define DELETE_BUFFER(name) aFree(name);name=NULL
-
-#endif
-
-#endif
+#ifndef _BUFFER_H_
+#define _BUFFER_H_
+
+// Full credit for this goes to Shinomori [Ajarn]
+
+#ifdef __GNUC__ // GCC has variable length arrays
+
+#define CREATE_BUFFER(name, type, size) type name[size]
+#define DELETE_BUFFER(name)
+
+#else // others don't, so we emulate them
+
+#define CREATE_BUFFER(name, type, size) type *name=(type*)aCalloc(size,sizeof(type))
+#define DELETE_BUFFER(name) aFree(name);name=NULL
+
+#endif
+
+#endif

+ 4823 - 4823
src/map/status.c

@@ -1,4823 +1,4823 @@
-
-// ステータス計算、状態異常処理
-#include <time.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#include "pc.h"
-#include "map.h"
-#include "pet.h"
-#include "mob.h"
-#include "clif.h"
-#include "guild.h"
-#include "skill.h"
-#include "itemdb.h"
-#include "battle.h"
-#include "chrif.h"
-#include "status.h"
-
-#include "timer.h"
-#include "nullpo.h"
-#include "script.h"
-#include "showmsg.h"
-
-static int max_weight_base[MAX_PC_CLASS];
-static int hp_coefficient[MAX_PC_CLASS];
-static int hp_coefficient2[MAX_PC_CLASS];
-static int hp_sigma_val[MAX_PC_CLASS][MAX_LEVEL];
-static int sp_coefficient[MAX_PC_CLASS];
-static int aspd_base[MAX_PC_CLASS][20];
-static int refinebonus[5][3];	// 精錬ボーナステーブル(refine_db.txt)
-int percentrefinery[5][10];	// 精錬成功率(refine_db.txt)
-static int atkmods[3][20];	// 武器ATKサイズ修正(size_fix.txt)
-static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL];
-
-/*==========================================
- * 精錬ボーナス
- *------------------------------------------
- */
-int status_getrefinebonus(int lv,int type)
-{
-	if (lv >= 0 && lv < 5 && type >= 0 && type < 3)
-		return refinebonus[lv][type];
-	return 0;
-}
-
-/*==========================================
- * 精錬成功率
- *------------------------------------------
- */
-int status_percentrefinery(struct map_session_data *sd,struct item *item)
-{
-	int percent;
-
-	nullpo_retr(0, item);
-	percent=percentrefinery[itemdb_wlv(item->nameid)][(int)item->refine];
-
-	percent += pc_checkskill(sd,BS_WEAPONRESEARCH);	// 武器研究スキル所持
-
-	// 確率の有効範囲チェック
-	if( percent > 100 ){
-		percent = 100;
-	}
-	if( percent < 0 ){
-		percent = 0;
-	}
-
-	return percent;
-}
-
-/*==========================================
- * パラメータ計算
- * first==0の時、計算対象のパラメータが呼び出し前から
- * 変 化した場合自動でsendするが、
- * 能動的に変化させたパラメータは自前でsendするように
- *------------------------------------------
- */
-
-int status_calc_pc(struct map_session_data* sd,int first)
-{
-	int b_speed,b_max_hp,b_max_sp,b_hp,b_sp,b_weight,b_max_weight,b_paramb[6],b_parame[6],b_hit,b_flee;
-	int b_aspd,b_watk,b_def,b_watk2,b_def2,b_flee2,b_critical,b_attackrange,b_matk1,b_matk2,b_mdef,b_mdef2,b_class;
-	int b_base_atk;
-	struct skill b_skill[MAX_SKILL];
-	int i,bl,index;
-	int skill,aspd_rate,wele,wele_,def_ele,refinedef=0;
-	int pele=0,pdef_ele=0;
-	int str,dstr,dex;
-	struct pc_base_job s_class;
-
-	nullpo_retr(0, sd);
-
-	//?生や養子の場合の元の職業を算出する
-	s_class = pc_calc_base_job(sd->status.class_);
-
-	b_speed = sd->speed;
-	b_max_hp = sd->status.max_hp;
-	b_max_sp = sd->status.max_sp;
-	b_hp = sd->status.hp;
-	b_sp = sd->status.sp;
-	b_weight = sd->weight;
-	b_max_weight = sd->max_weight;
-	memcpy(b_paramb,&sd->paramb,sizeof(b_paramb));
-	memcpy(b_parame,&sd->paramc,sizeof(b_parame));
-	memcpy(b_skill,&sd->status.skill,sizeof(b_skill));
-	b_hit = sd->hit;
-	b_flee = sd->flee;
-	b_aspd = sd->aspd;
-	b_watk = sd->watk;
-	b_def = sd->def;
-	b_watk2 = sd->watk2;
-	b_def2 = sd->def2;
-	b_flee2 = sd->flee2;
-	b_critical = sd->critical;
-	b_attackrange = sd->attackrange;
-	b_matk1 = sd->matk1;
-	b_matk2 = sd->matk2;
-	b_mdef = sd->mdef;
-	b_mdef2 = sd->mdef2;
-	b_class = sd->view_class;
-	sd->view_class = sd->status.class_;
-	b_base_atk = sd->base_atk;
-
-	pc_calc_skilltree(sd);	// スキルツリ?の計算
-
-	sd->max_weight = max_weight_base[s_class.job]+sd->status.str*300;
-
-	if(first&1) {
-		sd->weight=0;
-		for(i=0;i<MAX_INVENTORY;i++){
-			if(sd->status.inventory[i].nameid==0 || sd->inventory_data[i] == NULL)
-				continue;
-			sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount;
-		}
-		sd->cart_max_weight=battle_config.max_cart_weight;
-		sd->cart_weight=0;
-		sd->cart_max_num=MAX_CART;
-		sd->cart_num=0;
-		for(i=0;i<MAX_CART;i++){
-			if(sd->status.cart[i].nameid==0)
-				continue;
-			sd->cart_weight+=itemdb_weight(sd->status.cart[i].nameid)*sd->status.cart[i].amount;
-			sd->cart_num++;
-		}
-	}
-
-	memset(sd->paramb,0,sizeof(sd->paramb));
-	memset(sd->parame,0,sizeof(sd->parame));
-	sd->hit = 0;
-	sd->flee = 0;
-	sd->flee2 = 0;
-	sd->critical = 0;
-	sd->aspd = 0;
-	sd->watk = 0;
-	sd->def = 0;
-	sd->mdef = 0;
-	sd->watk2 = 0;
-	sd->def2 = 0;
-	sd->mdef2 = 0;
-	sd->status.max_hp = 0;
-	sd->status.max_sp = 0;
-	sd->attackrange = 0;
-	sd->attackrange_ = 0;
-	sd->atk_ele = 0;
-	sd->def_ele = 0;
-	sd->star =0;
-	sd->overrefine =0;
-	sd->matk1 =0;
-	sd->matk2 =0;
-	sd->speed = DEFAULT_WALK_SPEED ;
-	sd->hprate=battle_config.hp_rate;
-	sd->sprate=battle_config.sp_rate;
-	sd->castrate=100;
-	sd->delayrate=100;
-	sd->dsprate=100;
-	sd->base_atk=0;
-	sd->arrow_atk=0;
-	sd->arrow_ele=0;
-	sd->arrow_hit=0;
-	sd->arrow_range=0;
-	sd->nhealhp=sd->nhealsp=sd->nshealhp=sd->nshealsp=sd->nsshealhp=sd->nsshealsp=0;
-	memset(sd->addele,0,sizeof(sd->addele));
-	memset(sd->addrace,0,sizeof(sd->addrace));
-	memset(sd->addsize,0,sizeof(sd->addsize));
-	memset(sd->addele_,0,sizeof(sd->addele_));
-	memset(sd->addrace_,0,sizeof(sd->addrace_));
-	memset(sd->addsize_,0,sizeof(sd->addsize_));
-	memset(sd->subele,0,sizeof(sd->subele));
-	memset(sd->subrace,0,sizeof(sd->subrace));
-	memset(sd->addeff,0,sizeof(sd->addeff));
-	memset(sd->addeff2,0,sizeof(sd->addeff2));
-	memset(sd->reseff,0,sizeof(sd->reseff));
-	memset(&sd->special_state,0,sizeof(sd->special_state));
-	memset(sd->weapon_coma_ele,0,sizeof(sd->weapon_coma_ele));
-	memset(sd->weapon_coma_race,0,sizeof(sd->weapon_coma_race));
-	memset(sd->weapon_atk,0,sizeof(sd->weapon_atk));
-	memset(sd->weapon_atk_rate,0,sizeof(sd->weapon_atk_rate));
-
-	sd->watk_ = 0;			//二刀流用(?)
-	sd->watk_2 = 0;
-	sd->atk_ele_ = 0;
-	sd->star_ = 0;
-	sd->overrefine_ = 0;
-
-	sd->aspd_rate = 100;
-	sd->speed_rate = 100;
-	sd->hprecov_rate = 100;
-	sd->sprecov_rate = 100;
-	sd->critical_def = 0;
-	sd->double_rate = 0;
-	sd->near_attack_def_rate = sd->long_attack_def_rate = 0;
-	sd->atk_rate = sd->matk_rate = 100;
-	sd->ignore_def_ele = sd->ignore_def_race = 0;
-	sd->ignore_def_ele_ = sd->ignore_def_race_ = 0;
-	sd->ignore_mdef_ele = sd->ignore_mdef_race = 0;
-	sd->arrow_cri = 0;
-	sd->magic_def_rate = sd->misc_def_rate = 0;
-	memset(sd->arrow_addele,0,sizeof(sd->arrow_addele));
-	memset(sd->arrow_addrace,0,sizeof(sd->arrow_addrace));
-	memset(sd->arrow_addsize,0,sizeof(sd->arrow_addsize));
-	memset(sd->arrow_addeff,0,sizeof(sd->arrow_addeff));
-	memset(sd->arrow_addeff2,0,sizeof(sd->arrow_addeff2));
-	memset(sd->magic_addele,0,sizeof(sd->magic_addele));
-	memset(sd->magic_addrace,0,sizeof(sd->magic_addrace));
-	memset(sd->magic_subrace,0,sizeof(sd->magic_subrace));
-	sd->perfect_hit = 0;
-	sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100;
-	sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100;
-	sd->def_ratio_atk_ele = sd->def_ratio_atk_ele_ = 0;
-	sd->def_ratio_atk_race = sd->def_ratio_atk_race_ = 0;
-	sd->get_zeny_num = 0;
-	sd->add_damage_class_count = sd->add_damage_class_count_ = sd->add_magic_damage_class_count = 0;
-	sd->add_def_class_count = sd->add_mdef_class_count = 0;
-	sd->monster_drop_item_count = 0;
-	memset(sd->add_damage_classrate,0,sizeof(sd->add_damage_classrate));
-	memset(sd->add_damage_classrate_,0,sizeof(sd->add_damage_classrate_));
-	memset(sd->add_magic_damage_classrate,0,sizeof(sd->add_magic_damage_classrate));
-	memset(sd->add_def_classrate,0,sizeof(sd->add_def_classrate));
-	memset(sd->add_mdef_classrate,0,sizeof(sd->add_mdef_classrate));
-	memset(sd->monster_drop_race,0,sizeof(sd->monster_drop_race));
-	memset(sd->monster_drop_itemrate,0,sizeof(sd->monster_drop_itemrate));
-	sd->speed_add_rate = sd->aspd_add_rate = 100;
-	sd->double_add_rate = sd->perfect_hit_add = sd->get_zeny_add_num = 0;
-	sd->splash_range = sd->splash_add_range = 0;
-	sd->autospell_id = sd->autospell_lv = sd->autospell_rate = 0;
-	sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate = sd->sp_drain_per = 0;
-	sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ = sd->sp_drain_per_ = 0;
-	sd->short_weapon_damage_return = sd->long_weapon_damage_return = 0;
-	sd->magic_damage_return = 0; //AppleGirl Was Here
-	sd->random_attack_increase_add = sd->random_attack_increase_per = 0;
-	sd->hp_drain_value = sd->hp_drain_value_ = sd->sp_drain_value = sd->sp_drain_value_ = 0;
-	sd->unbreakable_equip = 0;
-
-
-	if(!sd->disguiseflag && sd->disguise) {
-		sd->disguise=0;
-		clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
-		clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
-		clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
-		clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
-		clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
-		clif_clearchar(&sd->bl, 9);
-		pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3);
-	}
-
-	for(i=0;i<10;i++) {
-		index = sd->equip_index[i];
-		if(index < 0)
-			continue;
-		if(i == 9 && sd->equip_index[8] == index)
-			continue;
-		if(i == 5 && sd->equip_index[4] == index)
-			continue;
-		if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
-			continue;
-
-		if(sd->inventory_data[index]) {
-			if(sd->inventory_data[index]->type == 4) {
-				if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) {
-					int j;
-					for(j=0;j<sd->inventory_data[index]->slot;j++){	// カ?ド
-						int c=sd->status.inventory[index].card[j];
-						if(c>0){
-							if(i == 8 && sd->status.inventory[index].equip == 0x20)
-								sd->state.lr_flag = 1;
-							run_script(itemdb_equipscript(c),0,sd->bl.id,0);
-							sd->state.lr_flag = 0;
-						}
-					}
-				}
-			}
-			else if(sd->inventory_data[index]->type==5){ // 防具
-				if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) {
-					int j;
-					for(j=0;j<sd->inventory_data[index]->slot;j++){	// カ?ド
-						int c=sd->status.inventory[index].card[j];
-						if(c>0)
-							run_script(itemdb_equipscript(c),0,sd->bl.id,0);
-					}
-				}
-			}
-		}
-	}
-	wele = sd->atk_ele;
-	wele_ = sd->atk_ele_;
-	def_ele = sd->def_ele;
-	if(sd->status.pet_id > 0) {
-		struct pet_data *pd=sd->pd;
-		if((pd && battle_config.pet_status_support==1) && (battle_config.pet_equip_required==0 || (battle_config.pet_equip_required && pd->equip > 0))) {
-			if(sd->status.pet_id > 0 && sd->petDB && sd->pet.intimate > 0)
-				run_script(sd->petDB->script,0,sd->bl.id,0);
-			pele = sd->atk_ele;
-			pdef_ele = sd->def_ele;
-			sd->atk_ele = sd->def_ele = 0;
-		}
-	}
-	memcpy(sd->paramcard,sd->parame,sizeof(sd->paramcard));
-
-	// ?備品によるステ?タス?化はここで?行
-	for(i=0;i<10;i++) {
-		index = sd->equip_index[i];
-		if(index < 0)
-			continue;
-		if(i == 9 && sd->equip_index[8] == index)
-			continue;
-		if(i == 5 && sd->equip_index[4] == index)
-			continue;
-		if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
-			continue;
-		if(sd->inventory_data[index]) {
-			sd->def += sd->inventory_data[index]->def;
-			if(sd->inventory_data[index]->type == 4) {
-				int r,wlv = sd->inventory_data[index]->wlv;
-				if(i == 8 && sd->status.inventory[index].equip == 0x20) {
-					//二刀流用デ?タ入力
-					sd->watk_ += sd->inventory_data[index]->atk;
-					sd->watk_2 = (r=sd->status.inventory[index].refine)*	// 精?攻?力
-						refinebonus[wlv][0];
-					if( (r-=refinebonus[wlv][2])>0 )	// 過?精?ボ?ナス
-						sd->overrefine_ = r*refinebonus[wlv][1];
-
-					if(sd->status.inventory[index].card[0]==0x00ff){	// 製造武器
-						sd->star_ = (sd->status.inventory[index].card[1]>>8);	// 星のかけら
-						wele_= (sd->status.inventory[index].card[1]&0x0f);	// ? 性
-					}
-					sd->attackrange_ += sd->inventory_data[index]->range;
-					sd->state.lr_flag = 1;
-					run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
-					sd->state.lr_flag = 0;
-				}
-				else {	//二刀流武器以外
-					sd->watk += sd->inventory_data[index]->atk;
-					sd->watk2 += (r=sd->status.inventory[index].refine)*	// 精?攻?力
-						refinebonus[wlv][0];
-					if( (r-=refinebonus[wlv][2])>0 )	// 過?精?ボ?ナス
-						sd->overrefine += r*refinebonus[wlv][1];
-
-					if(sd->status.inventory[index].card[0]==0x00ff){	// 製造武器
-						sd->star += (sd->status.inventory[index].card[1]>>8);	// 星のかけら
-						wele = (sd->status.inventory[index].card[1]&0x0f);	// ? 性
-					}
-					sd->attackrange += sd->inventory_data[index]->range;
-					run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
-				}
-			}
-			else if(sd->inventory_data[index]->type == 5) {
-				sd->watk += sd->inventory_data[index]->atk;
-				refinedef += sd->status.inventory[index].refine*refinebonus[0][0];
-				run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
-			}
-		}
-	}
-
-	if(sd->equip_index[10] >= 0){ // 矢
-		index = sd->equip_index[10];
-		if(sd->inventory_data[index]){		//まだ?性が入っていない
-			sd->state.lr_flag = 2;
-			run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
-			sd->state.lr_flag = 0;
-			sd->arrow_atk += sd->inventory_data[index]->atk;
-		}
-	}
-	sd->def += (refinedef+50)/100;
-
-	if(sd->attackrange < 1) sd->attackrange = 1;
-	if(sd->attackrange_ < 1) sd->attackrange_ = 1;
-	if(sd->attackrange < sd->attackrange_)
-		sd->attackrange = sd->attackrange_;
-	if(sd->status.weapon == 11)
-		sd->attackrange += sd->arrow_range;
-	if(wele > 0)
-		sd->atk_ele = wele;
-	if(wele_ > 0)
-		sd->atk_ele_ = wele_;
-	if(def_ele > 0)
-		sd->def_ele = def_ele;
-	if(battle_config.pet_status_support) {
-		if(pele > 0 && !sd->atk_ele)
-			sd->atk_ele = pele;
-		if(pdef_ele > 0 && !sd->def_ele)
-			sd->def_ele = pdef_ele;
-	}
-	sd->double_rate += sd->double_add_rate;
-	sd->perfect_hit += sd->perfect_hit_add;
-	sd->get_zeny_num += sd->get_zeny_add_num;
-	sd->splash_range += sd->splash_add_range;
-	if(sd->speed_add_rate != 100)
-		sd->speed_rate += sd->speed_add_rate - 100;
-	if(sd->aspd_add_rate != 100)
-		sd->aspd_rate += sd->aspd_add_rate - 100;
-
-	// 武器ATKサイズ補正 (右手)
-	sd->atkmods[0] = atkmods[0][sd->weapontype1];
-	sd->atkmods[1] = atkmods[1][sd->weapontype1];
-	sd->atkmods[2] = atkmods[2][sd->weapontype1];
-	//武器ATKサイズ補正 (左手)
-	sd->atkmods_[0] = atkmods[0][sd->weapontype2];
-	sd->atkmods_[1] = atkmods[1][sd->weapontype2];
-	sd->atkmods_[2] = atkmods[2][sd->weapontype2];
-
-	// jobボ?ナス分
-	for(i=0;i<sd->status.job_level && i<MAX_LEVEL;i++){
-		if(job_bonus[s_class.upper][s_class.job][i])
-			sd->paramb[job_bonus[s_class.upper][s_class.job][i]-1]++;
-	}
-
-	if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 )	// skill can be used with an item now, thanks to orn [Valaris]
-		sd->max_weight += skill*2000;
-
-	if( (skill=pc_checkskill(sd,AC_OWL))>0 )	// ふくろうの目
-		sd->paramb[4] += skill;
-
-	if((skill=pc_checkskill(sd,BS_HILTBINDING))>0) {   // Hilt binding gives +1 str +4 atk
-		sd->paramb[0] ++;
-		sd->base_atk += 4;
-	}
-	if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels
-		sd->paramb[3] += (skill+1)*0.5;
-	}
-
-	// New guild skills - Celest
-	if (sd->status.guild_id > 0 && !(first&4)) {
-		struct guild *g;
-		if ((g = guild_search(sd->status.guild_id)) && strcmp(sd->status.name,g->master)==0) {
-			if (!sd->state.leadership_flag && guild_checkskill(g, GD_LEADERSHIP)>0) {
-				skill_unitsetting(&sd->bl,GD_LEADERSHIP,1,sd->bl.x,sd->bl.y,0);
-			}
-			if (!sd->state.glorywounds_flag && guild_checkskill(g, GD_GLORYWOUNDS)>0) {
-				skill_unitsetting(&sd->bl,GD_GLORYWOUNDS,1,sd->bl.x,sd->bl.y,0);
-			}
-			if (!sd->state.soulcold_flag && guild_checkskill(g, GD_SOULCOLD)>0) {
-				skill_unitsetting(&sd->bl,GD_SOULCOLD,1,sd->bl.x,sd->bl.y,0);
-			}
-			if (!sd->state.hawkeyes_flag && guild_checkskill(g, GD_HAWKEYES)>0) {
-				skill_unitsetting(&sd->bl,GD_HAWKEYES,1,sd->bl.x,sd->bl.y,0);
-			}
-		}
-		else if (g) {
-			if (sd->sc_count && sd->sc_data[SC_BATTLEORDERS].timer != -1) {
-				sd->paramb[0]+= 5;
-				sd->paramb[3]+= 5;
-				sd->paramb[4]+= 5;
-			}
-			if (sd->state.leadership_flag)
-				sd->paramb[0] += 2;
-			if (sd->state.glorywounds_flag)
-				sd->paramb[2] += 2;
-			if (sd->state.soulcold_flag)
-				sd->paramb[1] += 2;
-			if (sd->state.hawkeyes_flag)
-				sd->paramb[4] += 2;
-		}
-	}
-
-	// ステ?タス?化による基本パラメ?タ補正
-	if(sd->sc_count){
-		if(sd->sc_data[SC_CONCENTRATE].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1){	// 集中力向上
-			sd->paramb[1]+= (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
-			sd->paramb[4]+= (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
-		}
-		if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){	// 速度?加
-			sd->paramb[1]+= 2+sd->sc_data[SC_INCREASEAGI].val1;
-			sd->speed -= sd->speed *25/100;
-		}
-		if(sd->sc_data[SC_DECREASEAGI].timer!=-1) {	// 速度減少(agiはbattle.cで)
-			sd->speed = sd->speed *125/100;
-			sd->paramb[1] -= 2 + sd->sc_data[SC_DECREASEAGI].val1;	// reduce agility [celest]
-		}
-		if(sd->sc_data[SC_CLOAKING].timer!=-1) {
-			sd->critical_rate += 100; // critical increases
-			sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100;
-		}
-		if(sd->sc_data[SC_CHASEWALK].timer!=-1) {
-			sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; // slow down by chasewalk
-			if(sd->sc_data[SC_CHASEWALK].val4)
-				sd->paramb[0] += (1<<(sd->sc_data[SC_CHASEWALK].val1-1)); // increases strength after 10 seconds
-		}
-		if(sd->sc_data[SC_SLOWDOWN].timer!=-1)
-			sd->speed = sd->speed*150/100;
-		if(sd->sc_data[SC_SPEEDUP0].timer!=-1)
-			sd->speed -= sd->speed*25/100;
-		if(sd->sc_data[SC_BLESSING].timer!=-1){	// ブレッシング
-			sd->paramb[0]+= sd->sc_data[SC_BLESSING].val1;
-			sd->paramb[3]+= sd->sc_data[SC_BLESSING].val1;
-			sd->paramb[4]+= sd->sc_data[SC_BLESSING].val1;
-		}
-		if(sd->sc_data[SC_GLORIA].timer!=-1)	// グロリア
-			sd->paramb[5]+= 30;
-		if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1)	// ラウドボイス
-			sd->paramb[0]+= 4;
-		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){	// クァグマイア
-			//int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
-			//int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
-			//sd->paramb[1]-= agib > 50 ? 50 : agib;
-			//sd->paramb[4]-= dexb > 50 ? 50 : dexb;
-			sd->paramb[1]-= sd->sc_data[SC_QUAGMIRE].val1*5;
-			sd->paramb[4]-= sd->sc_data[SC_QUAGMIRE].val1*5;
-			sd->speed = sd->speed*3/2;
-		}
-		if(sd->sc_data[SC_TRUESIGHT].timer!=-1){	// トゥル?サイト
-			sd->paramb[0]+= 5;
-			sd->paramb[1]+= 5;
-			sd->paramb[2]+= 5;
-			sd->paramb[3]+= 5;
-			sd->paramb[4]+= 5;
-			sd->paramb[5]+= 5;
-		}
-		if(sd->sc_data[SC_MARIONETTE].timer!=-1){
-			struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3);
-			if (psd) {	// if partner is found
-				sd->paramb[0]-= sd->status.str/2;	// bonuses not included
-				sd->paramb[1]-= sd->status.agi/2;
-				sd->paramb[2]-= sd->status.vit/2;
-				sd->paramb[3]-= sd->status.int_/2;
-				sd->paramb[4]-= sd->status.dex/2;
-				sd->paramb[5]-= sd->status.luk/2;
-			}
-		}
-		else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){
-			struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3);
-			if (psd) {	// if partner is found
-				sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2;
-				sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2;
-				sd->paramb[2] += sd->status.vit+psd->status.vit/2 > 99 ? 99-sd->status.vit : psd->status.vit/2;
-				sd->paramb[3] += sd->status.int_+psd->status.int_/2 > 99 ? 99-sd->status.int_ : psd->status.int_/2;
-				sd->paramb[4] += sd->status.dex+psd->status.dex/2 > 99 ? 99-sd->status.dex : psd->status.dex/2;
-				sd->paramb[5] += sd->status.luk+psd->status.luk/2 > 99 ? 99-sd->status.luk : psd->status.luk/2;
-			}
-		}
-		if(sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){
-			if (sd->sc_data[SC_GOSPEL].val3 == 6) {
-				sd->paramb[0]+= 2;
-				sd->paramb[1]+= 2;
-				sd->paramb[2]+= 2;
-				sd->paramb[3]+= 2;
-				sd->paramb[4]+= 2;
-				sd->paramb[5]+= 2;
-			}
-		}
-	}
-
-	//1度も死んでないJob70スパノビに+10
-	if(s_class.job == 23 && sd->die_counter == 0 && sd->status.job_level >= 70){
-		sd->paramb[0]+= 15;
-		sd->paramb[1]+= 15;
-		sd->paramb[2]+= 15;
-		sd->paramb[3]+= 15;
-		sd->paramb[4]+= 15;
-		sd->paramb[5]+= 15;
-	}
-	sd->paramc[0]=sd->status.str+sd->paramb[0]+sd->parame[0];
-	sd->paramc[1]=sd->status.agi+sd->paramb[1]+sd->parame[1];
-	sd->paramc[2]=sd->status.vit+sd->paramb[2]+sd->parame[2];
-	sd->paramc[3]=sd->status.int_+sd->paramb[3]+sd->parame[3];
-	sd->paramc[4]=sd->status.dex+sd->paramb[4]+sd->parame[4];
-	sd->paramc[5]=sd->status.luk+sd->paramb[5]+sd->parame[5];
-	for(i=0;i<6;i++)
-		if(sd->paramc[i] < 0) sd->paramc[i] = 0;
-
-	if (sd->sc_count) {
-		if (sd->sc_data[SC_CURSE].timer!=-1)
-			sd->paramc[5] = 0;
-	}
-
-	if(sd->status.weapon == 11 || sd->status.weapon == 13 || sd->status.weapon == 14) {
-		str = sd->paramc[4];
-		dex = sd->paramc[0];
-	}
-	else {
-		str = sd->paramc[0];
-		dex = sd->paramc[4];
-	}
-	dstr = str/10;
-	sd->base_atk += str + dstr*dstr + dex/5 + sd->paramc[5]/5;
-	sd->matk1 += sd->paramc[3]+(sd->paramc[3]/5)*(sd->paramc[3]/5);
-	sd->matk2 += sd->paramc[3]+(sd->paramc[3]/7)*(sd->paramc[3]/7);
-	if(sd->matk1 < sd->matk2) {
-		int temp = sd->matk2;
-		sd->matk2 = sd->matk1;
-		sd->matk1 = temp;
-	}
-	sd->hit += sd->paramc[4] + sd->status.base_level;
-	sd->flee += sd->paramc[1] + sd->status.base_level;
-	sd->def2 += sd->paramc[2];
-	sd->mdef2 += sd->paramc[3];
-	sd->flee2 += sd->paramc[5]+10;
-	sd->critical += (sd->paramc[5]*3)+10;
-
-	if(sd->base_atk < 1)
-		sd->base_atk = 1;
-	if(sd->critical_rate != 100)
-		sd->critical = (sd->critical*sd->critical_rate)/100;
-	if(sd->critical < 10) sd->critical = 10;
-	if(sd->hit_rate != 100)
-		sd->hit = (sd->hit*sd->hit_rate)/100;
-	if(sd->hit < 1) sd->hit = 1;
-	if(sd->flee_rate != 100)
-		sd->flee = (sd->flee*sd->flee_rate)/100;
-	if(sd->flee < 1) sd->flee = 1;
-	if(sd->flee2_rate != 100)
-		sd->flee2 = (sd->flee2*sd->flee2_rate)/100;
-	if(sd->flee2 < 10) sd->flee2 = 10;
-	if(sd->def_rate != 100)
-		sd->def = (sd->def*sd->def_rate)/100;
-	if(sd->def < 0) sd->def = 0;
-	if(sd->def2_rate != 100)
-		sd->def2 = (sd->def2*sd->def2_rate)/100;
-	if(sd->def2 < 1) sd->def2 = 1;
-	if(sd->mdef_rate != 100)
-		sd->mdef = (sd->mdef*sd->mdef_rate)/100;
-	if(sd->mdef < 0) sd->mdef = 0;
-	if(sd->mdef2_rate != 100)
-		sd->mdef2 = (sd->mdef2*sd->mdef2_rate)/100;
-	if(sd->mdef2 < 1) sd->mdef2 = 1;
-
-	// 二刀流 ASPD 修正
-	if (sd->status.weapon <= 16)
-		sd->aspd += aspd_base[s_class.job][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->status.weapon]/1000;
-	else
-		sd->aspd += (
-			(aspd_base[s_class.job][sd->weapontype1]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype1]/1000) +
-			(aspd_base[s_class.job][sd->weapontype2]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype2]/1000)
-			) * 140 / 200;
-
-	aspd_rate = sd->aspd_rate;
-
-	//攻?速度?加
-
-	if((skill=pc_checkskill(sd,AC_VULTURE))>0){	// ワシの目
-		sd->hit += skill;
-		if(sd->status.weapon == 11)
-			sd->attackrange += skill;
-	}
-
-	if( (skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0)	// 武器?究の命中率?加
-		sd->hit += skill*2;
-	if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 )	// トンネルドライブ	// トンネルドライブ
-		sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9);
-	if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0)	// カ?トによる速度低下
-		sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1);
-	else if (pc_isriding(sd)) {	// ペコペコ?りによる速度?加
-		sd->speed -= (0.25 * DEFAULT_WALK_SPEED);
-		sd->max_weight += 10000;
-	}
-	if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス
-		sd->status.max_hp += skill*200;
-		sd->subele[6] += skill*5;
-	}
-	if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) {
-		sd->subele[0] += skill;
-		sd->subele[3] += skill*5;
-	}
-	if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 )
-		aspd_rate -= skill*0.5;
-
-	bl=sd->status.base_level;
-
-	sd->status.max_hp += (3500 + bl*hp_coefficient2[s_class.job] + hp_sigma_val[s_class.job][(bl > 0)? bl-1:0])/100 * (100 + sd->paramc[2])/100 + (sd->parame[2] - sd->paramcard[2]);
-		if (s_class.upper==1) // [MouseJstr]
-			sd->status.max_hp = sd->status.max_hp * 130/100;
-		else if (s_class.upper==2)
-			sd->status.max_hp = sd->status.max_hp * 70/100;
-
-	if(sd->hprate!=100)
-		sd->status.max_hp = sd->status.max_hp*sd->hprate/100;
-
-	if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1){	// バ?サ?ク
-		sd->status.max_hp = sd->status.max_hp * 3;
-		// sd->status.hp = sd->status.hp * 3;
-		if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris
-			sd->status.max_hp = battle_config.max_hp;
-		if(sd->status.hp > battle_config.max_hp) // removed negative max hp bug by Valaris
-			sd->status.hp = battle_config.max_hp;
-	}
-	if(s_class.job == 23 && sd->status.base_level >= 99){
-		sd->status.max_hp = sd->status.max_hp + 2000;
-	}
-
-	if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris
-		sd->status.max_hp = battle_config.max_hp;
-	if(sd->status.max_hp <= 0) sd->status.max_hp = 1; // end
-
-	// 最大SP計算
-	sd->status.max_sp += ((sp_coefficient[s_class.job] * bl) + 1000)/100 * (100 + sd->paramc[3])/100 + (sd->parame[3] - sd->paramcard[3]);
-		if (s_class.upper==1) // [MouseJstr]
-			sd->status.max_sp = sd->status.max_sp * 130/100;
-		else if (s_class.upper==2)
-			sd->status.max_sp = sd->status.max_sp * 70/100;
-	if(sd->sprate!=100)
-		sd->status.max_sp = sd->status.max_sp*sd->sprate/100;
-
-	if((skill=pc_checkskill(sd,HP_MEDITATIO))>0) // メディテイティオ
-		sd->status.max_sp += sd->status.max_sp*skill/100;
-	if((skill=pc_checkskill(sd,HW_SOULDRAIN))>0) /* ソウルドレイン */
-		sd->status.max_sp += sd->status.max_sp*2*skill/100;
-
-	if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp)
-		sd->status.max_sp = battle_config.max_sp;
-
-	//自然回復HP
-	sd->nhealhp = 1 + (sd->paramc[2]/5) + (sd->status.max_hp/200);
-	if((skill=pc_checkskill(sd,SM_RECOVERY)) > 0) {	/* HP回復力向上 */
-		sd->nshealhp = skill*5 + (sd->status.max_hp*skill/500);
-		if(sd->nshealhp > 0x7fff) sd->nshealhp = 0x7fff;
-	}
-	//自然回復SP
-	sd->nhealsp = 1 + (sd->paramc[3]/6) + (sd->status.max_sp/100);
-	if(sd->paramc[3] >= 120)
-		sd->nhealsp += ((sd->paramc[3]-120)>>1) + 4;
-	if((skill=pc_checkskill(sd,MG_SRECOVERY)) > 0) { /* SP回復力向上 */
-		sd->nshealsp = skill*3 + (sd->status.max_sp*skill/500);
-		if(sd->nshealsp > 0x7fff) sd->nshealsp = 0x7fff;
-	}
-
-	if((skill = pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0) {
-		sd->nsshealhp = skill*4 + (sd->status.max_hp*skill/500);
-		sd->nsshealsp = skill*2 + (sd->status.max_sp*skill/500);
-		if(sd->nsshealhp > 0x7fff) sd->nsshealhp = 0x7fff;
-		if(sd->nsshealsp > 0x7fff) sd->nsshealsp = 0x7fff;
-	}
-	if(sd->hprecov_rate != 100) {
-		sd->nhealhp = sd->nhealhp*sd->hprecov_rate/100;
-		if(sd->nhealhp < 1) sd->nhealhp = 1;
-	}
-	if(sd->sprecov_rate != 100) {
-		sd->nhealsp = sd->nhealsp*sd->sprecov_rate/100;
-		if(sd->nhealsp < 1) sd->nhealsp = 1;
-	}
-	/* if((skill=pc_checkskill(sd,HP_MEDITATIO)) > 0) { // f?fffBfefCfefBfI,I'SPR,A*,I',E`,。ゥZ((c)。ョR「カn~.ゥォ,E',(c),(c),e'
-		sd->nhealsp += 3*skill*(sd->status.max_sp)/100;
-		if(sd->nhealsp > 0x7fff) sd->nhealsp = 0x7fff;
-		} Increase natural SP regen instead of colossal SP Recovery effect [DracoRPG]*/
-
-	// 種族耐性(これでいいの? ディバインプロテクションと同じ?理がいるかも)
-	if( (skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // ドラゴノロジ?
-		skill = skill*4;
-		sd->addrace[9]+=skill;
-		sd->addrace_[9]+=skill;
-		sd->subrace[9]+=skill;
-		sd->magic_addrace[9]+=skill;
-		sd->magic_subrace[9]-=skill;
-	}
-
-	//Flee上昇
-	if( (skill=pc_checkskill(sd,TF_MISS))>0 ){	// 回避率?加
-		if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23){
-			sd->flee += skill*3;
-		}
-		if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018)
-			sd->flee += skill*4;
-		if(sd->status.class_==12||sd->status.class_==4013)
-			sd->speed -= sd->speed *(skill*1.5)/100;
-	}
-	if( (skill=pc_checkskill(sd,MO_DODGE))>0 )	// 見切り
-		sd->flee += (skill*3)>>1;
-
-	// スキルやステ?タス異常による?りのパラメ?タ補正
-	if(sd->sc_count){
-		// ATK/DEF?化形
-		if(sd->sc_data[SC_ANGELUS].timer!=-1)	// エンジェラス
-			sd->def2 = sd->def2*(110+5*sd->sc_data[SC_ANGELUS].val1)/100;
-		if(sd->sc_data[SC_IMPOSITIO].timer!=-1)	{// インポシティオマヌス
-			sd->watk += sd->sc_data[SC_IMPOSITIO].val1*5;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
-				sd->watk_ += sd->sc_data[SC_IMPOSITIO].val1*5;
-		}
-		if(sd->sc_data[SC_PROVOKE].timer!=-1){	// プロボック
-			sd->def2 = sd->def2*(100-6*sd->sc_data[SC_PROVOKE].val1)/100;
-			sd->base_atk = sd->base_atk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
-			sd->watk = sd->watk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
-				sd->watk_ = sd->watk_*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
-		}
-		if(sd->sc_data[SC_ENDURE].timer!=-1)
-			sd->mdef2 += sd->sc_data[SC_ENDURE].val1;
-		if(sd->sc_data[SC_MINDBREAKER].timer!=-1){	// プロボック
-			sd->mdef2 = sd->mdef2*(100-6*sd->sc_data[SC_MINDBREAKER].val1)/100;
-			sd->matk1 = sd->matk1*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100;
-			sd->matk2 = sd->matk2*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100;
-		}
-		if(sd->sc_data[SC_POISON].timer!=-1)	// 毒?態
-			sd->def2 = sd->def2*75/100;
-		if(sd->sc_data[SC_CURSE].timer!=-1){
-			sd->base_atk = sd->base_atk*75/100;
-			sd->watk = sd->watk*75/100;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
-				sd->watk_ = sd->watk_*75/100;
-		}
-		if(sd->sc_data[SC_DRUMBATTLE].timer!=-1){	// ?太鼓の響き
-			sd->watk += sd->sc_data[SC_DRUMBATTLE].val2;
-			sd->def  += sd->sc_data[SC_DRUMBATTLE].val3;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
-				sd->watk_ += sd->sc_data[SC_DRUMBATTLE].val2;
-		}
-		if(sd->sc_data[SC_NIBELUNGEN].timer!=-1) {	// ニ?ベルングの指輪
-			index = sd->equip_index[9];
-			/*if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3)
-				sd->watk += sd->sc_data[SC_NIBELUNGEN].val3;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3)
-				sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val3;
-			index = sd->equip_index[9];*/
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
-				sd->watk2 += sd->sc_data[SC_NIBELUNGEN].val3;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
-				sd->watk_2 += sd->sc_data[SC_NIBELUNGEN].val3;
-		}
-
-		if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){	// ボルケ?ノ
-			sd->watk += sd->sc_data[SC_VIOLENTGALE].val3;
-		}
-
-		if(sd->sc_data[SC_SIGNUMCRUCIS].timer!=-1)
-			sd->def = sd->def * (100 - sd->sc_data[SC_SIGNUMCRUCIS].val2)/100;
-		if(sd->sc_data[SC_ETERNALCHAOS].timer!=-1)	// エタ?ナルカオス
-			sd->def=0;
-
-		if(sd->sc_data[SC_CONCENTRATION].timer!=-1){ //コンセントレ?ション
-			sd->watk = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
-			index = sd->equip_index[8];
-			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
-				sd->watk_ = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
-			sd->def = sd->def * (100 - 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
-		}
-
-		if(sd->sc_data[SC_MAGICPOWER].timer!=-1){ //魔法力?幅
-			sd->matk1 = sd->matk1*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100;
-			sd->matk2 = sd->matk2*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100;
-		}
-		if(sd->sc_data[SC_ATKPOT].timer!=-1)
-			sd->watk += sd->sc_data[SC_ATKPOT].val1;
-		if(sd->sc_data[SC_MATKPOT].timer!=-1){
-			sd->matk1 += sd->sc_data[SC_MATKPOT].val1;
-			sd->matk2 += sd->sc_data[SC_MATKPOT].val1;
-		}
-
-		// ASPD/移動速度?化系
-		if(sd->sc_data[SC_TWOHANDQUICKEN].timer != -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
-			aspd_rate -= 30;
-		if(sd->sc_data[SC_ADRENALINE].timer != -1 && sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
-			sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
-			if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
-				aspd_rate -= 30;
-			else
-				aspd_rate -= 25;
-		}
-		if(sd->sc_data[SC_SPEARSQUICKEN].timer != -1 && sd->sc_data[SC_ADRENALINE].timer == -1 &&
-			sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
-			aspd_rate -= sd->sc_data[SC_SPEARSQUICKEN].val2;
-		if(sd->sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
-			sd->sc_data[SC_TWOHANDQUICKEN].timer==-1 && sd->sc_data[SC_ADRENALINE].timer==-1 && sd->sc_data[SC_SPEARSQUICKEN].timer==-1 &&
-			sd->sc_data[SC_DONTFORGETME].timer == -1)
-				aspd_rate -= 5+sd->sc_data[SC_ASSNCROS].val1+sd->sc_data[SC_ASSNCROS].val2+sd->sc_data[SC_ASSNCROS].val3;
-		if(sd->sc_data[SC_DONTFORGETME].timer!=-1){		// 私を忘れないで
-			aspd_rate += sd->sc_data[SC_DONTFORGETME].val1*3 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3>>16);
-			sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100;
-		}
-		if(	sd->sc_data[i=SC_SPEEDPOTION3].timer!=-1 ||
-			sd->sc_data[i=SC_SPEEDPOTION2].timer!=-1 ||
-			sd->sc_data[i=SC_SPEEDPOTION1].timer!=-1 ||
-			sd->sc_data[i=SC_SPEEDPOTION0].timer!=-1)	// ? 速ポ?ション
-			aspd_rate -= sd->sc_data[i].val2;
-		if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1)	//ウィンドウォ?ク暫ヘLv*2%減算
-			sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100;
-		if(sd->sc_data[SC_CARTBOOST].timer!=-1)	// カ?トブ?スト
-		sd->speed -= (DEFAULT_WALK_SPEED * 20)/100;
-		if(sd->sc_data[SC_BERSERK].timer!=-1)	//バ?サ?ク中はIAと同じぐらい速い?
-			sd->speed -= sd->speed *25/100;
-		if(sd->sc_data[SC_WEDDING].timer!=-1)	//結婚中は?くのが?い
-			sd->speed = 2*DEFAULT_WALK_SPEED;
-
-		// HIT/FLEE?化系
-		if(sd->sc_data[SC_WHISTLE].timer!=-1){  // 口笛
-			sd->flee += sd->flee * (sd->sc_data[SC_WHISTLE].val1
-					+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3>>16))/100;
-			sd->flee2+= (sd->sc_data[SC_WHISTLE].val1+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3&0xffff)) * 10;
-		}
-		if(sd->sc_data[SC_HUMMING].timer!=-1)  // ハミング
-			sd->hit += (sd->sc_data[SC_HUMMING].val1*2+sd->sc_data[SC_HUMMING].val2
-					+sd->sc_data[SC_HUMMING].val3) * sd->hit/100;
-		if(sd->sc_data[SC_VIOLENTGALE].timer!=-1 && sd->def_ele==4){	// バイオレントゲイル
-			sd->flee += sd->flee*sd->sc_data[SC_VIOLENTGALE].val3/100;
-		}
-		if(sd->sc_data[SC_BLIND].timer!=-1){	// 暗?
-			sd->hit -= sd->hit*25/100;
-			sd->flee -= sd->flee*25/100;
-		}
-		if(sd->sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォ?ク
-			sd->flee += sd->flee*(sd->sc_data[SC_WINDWALK].val2)/100;
-		if(sd->sc_data[SC_SPIDERWEB].timer!=-1) //スパイダ?ウェブ
-			sd->flee -= sd->flee*50/100;
-		if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト
-			sd->hit += 3*(sd->sc_data[SC_TRUESIGHT].val1);
-		if(sd->sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレ?ション
-			sd->hit += (10*(sd->sc_data[SC_CONCENTRATION].val1));
-
-		// 耐性
-		if(sd->sc_data[SC_SIEGFRIED].timer!=-1){  // 不死身のジ?クフリ?ド
-			sd->subele[1] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[2] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[3] += sd->sc_data[SC_SIEGFRIED].val2;	// 火
-			sd->subele[4] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[5] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[6] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[7] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[8] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-			sd->subele[9] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
-		}
-		if(sd->sc_data[SC_PROVIDENCE].timer!=-1){	// プロヴィデンス
-			sd->subele[6] += sd->sc_data[SC_PROVIDENCE].val2;	// ? 聖?性
-			sd->subrace[6] += sd->sc_data[SC_PROVIDENCE].val2;	// ? ?魔
-		}
-
-		// その他
-		if(sd->sc_data[SC_APPLEIDUN].timer!=-1){	// イドゥンの林檎
-			sd->status.max_hp += ((5+sd->sc_data[SC_APPLEIDUN].val1*2+((sd->sc_data[SC_APPLEIDUN].val2+1)>>1)
-						+sd->sc_data[SC_APPLEIDUN].val3/10) * sd->status.max_hp)/100;
-			if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp)
-				sd->status.max_hp = battle_config.max_hp;
-		}
-		if(sd->sc_data[SC_DELUGE].timer!=-1 && sd->def_ele==1){	// デリュ?ジ
-			sd->status.max_hp += sd->status.max_hp*sd->sc_data[SC_DELUGE].val3/100;
-			if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp)
-				sd->status.max_hp = battle_config.max_hp;
-		}
-		if(sd->sc_data[SC_SERVICE4U].timer!=-1) {	// サ?ビスフォ?ユ?
-			sd->status.max_sp += sd->status.max_sp*(10+sd->sc_data[SC_SERVICE4U].val1+sd->sc_data[SC_SERVICE4U].val2
-						+sd->sc_data[SC_SERVICE4U].val3)/100;
-			if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp)
-				sd->status.max_sp = battle_config.max_sp;
-			sd->dsprate-=(10+sd->sc_data[SC_SERVICE4U].val1*3+sd->sc_data[SC_SERVICE4U].val2
-					+sd->sc_data[SC_SERVICE4U].val3);
-			if(sd->dsprate<0)sd->dsprate=0;
-		}
-
-		if(sd->sc_data[SC_FORTUNE].timer!=-1)	// 幸運のキス
-			sd->critical += (10+sd->sc_data[SC_FORTUNE].val1+sd->sc_data[SC_FORTUNE].val2
-						+sd->sc_data[SC_FORTUNE].val3)*10;
-
-		if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1){	// 爆裂波動
-			if(s_class.job==23)
-				sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val1*100;
-			else
-			sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2;
-		}
-
-		if(sd->sc_data[SC_STEELBODY].timer!=-1){	// 金剛
-			sd->def = 90;
-			sd->mdef = 90;
-			aspd_rate += 25;
-			sd->speed = (sd->speed * 125) / 100;
-		}
-		if(sd->sc_data[SC_DEFENDER].timer != -1) {
-			sd->aspd += (550 - sd->sc_data[SC_DEFENDER].val1*50);
-			// removed as of 12/14's patch [celest]
-			//sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100;
-		}
-		if(sd->sc_data[SC_ENCPOISON].timer != -1)
-			sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2;
-
-		if( sd->sc_data[SC_DANCING].timer!=-1 ){		// 演奏/ダンス使用中
-			sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)));
-			//sd->speed*=4;
-			sd->nhealsp = 0;
-			sd->nshealsp = 0;
-			sd->nsshealsp = 0;
-		}
-		if(sd->sc_data[SC_CURSE].timer!=-1)
-			sd->speed += 450;
-
-		if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト
-			sd->critical += sd->critical*(sd->sc_data[SC_TRUESIGHT].val1)/100;
-
-/*		if(sd->sc_data[SC_VOLCANO].timer!=-1)	// エンチャントポイズン(?性はbattle.cで)
-			sd->addeff[2]+=sd->sc_data[SC_VOLCANO].val2;//% of granting
-		if(sd->sc_data[SC_DELUGE].timer!=-1)	// エンチャントポイズン(?性はbattle.cで)
-			sd->addeff[0]+=sd->sc_data[SC_DELUGE].val2;//% of granting
-		*/
-		if(sd->sc_data[SC_BERSERK].timer!=-1) {	//All Def/MDef reduced to 0 while in Berserk [DracoRPG]
-			sd->def = sd->def2 = 0;
-			sd->mdef = sd->mdef2 = 0;
-			sd->flee -= sd->flee*50/100;
-			aspd_rate -= 30;
-			//sd->base_atk *= 3;
-		}
-		if(sd->sc_data[SC_KEEPING].timer!=-1)
-			sd->def = 100;
-		if(sd->sc_data[SC_BARRIER].timer!=-1)
-			sd->mdef = 100;
-
-		if(sd->sc_data[SC_JOINTBEAT].timer!=-1) { // Random break [DracoRPG]
-			switch(sd->sc_data[SC_JOINTBEAT].val2) {
-			case 1: //Ankle break
-				sd->speed_rate += 50;
-				break;
-			case 2:	//Wrist	break
-				sd->aspd_rate += 25;
-				break;
-			case 3:	//Knee break
-				sd->speed_rate += 30;
-				sd->aspd_rate += 10;
-				break;
-			case 4:	//Shoulder break
-				sd->def2 -= sd->def2*50/100;
-				break;
-			case 5:	//Waist	break
-				sd->def2 -= sd->def2*50/100;
-				sd->base_atk -= sd->base_atk*25/100;
-				break;
-			}
-		}
-
-		if(sd->sc_data[SC_GOSPEL].timer!=-1) {
-			if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){
-				switch (sd->sc_data[SC_GOSPEL].val3)
-				{
-				case 4:
-					sd->status.max_hp += sd->status.max_hp * 25 / 100;
-					if(sd->status.max_hp > battle_config.max_hp)
-						sd->status.max_hp = battle_config.max_hp;
-					break;
-				case 5:
-					sd->status.max_sp += sd->status.max_sp * 25 / 100;
-					if(sd->status.max_sp > battle_config.max_sp)
-						sd->status.max_sp = battle_config.max_sp;
-					break;
-				case 11:
-					sd->def += sd->def * 25 / 100;
-					sd->def2 += sd->def2 * 25 / 100;
-					break;
-				case 12:
-					sd->base_atk += sd->base_atk * 8 / 100;
-					break;
-				case 13:
-					sd->flee += sd->flee * 5 / 100;
-					break;
-				case 14:
-					sd->hit += sd->hit * 5 / 100;
-					break;
-				}
-			} else if (sd->sc_data[SC_GOSPEL].val4 == BCT_ENEMY){
-				switch (sd->sc_data[SC_GOSPEL].val3)
-				{
-					case 5:
-						sd->def = 0;
-						sd->def2 = 0;
-						break;
-					case 6:
-						sd->base_atk = 0;
-						sd->watk = 0;
-						sd->watk2 = 0;
-						break;
-					case 7:
-						sd->flee = 0;
-						break;
-					case 8:
-						sd->speed_rate += 75;
-						aspd_rate += 75;
-						break;
-				}
-			}
-		}
-	}
-
-	if (sd->speed_rate <= 0)
-		sd->speed_rate = 1;
-
-	if(sd->speed_rate != 100)
-		sd->speed = sd->speed*sd->speed_rate/100;
-	if(sd->speed < 1) sd->speed = 1;
-	if(aspd_rate != 100)
-		sd->aspd = sd->aspd*aspd_rate/100;
-	if(pc_isriding(sd))							// 騎兵修練
-		sd->aspd = sd->aspd*(100 + 10*(5 - pc_checkskill(sd,KN_CAVALIERMASTERY)))/ 100;
-	if(sd->aspd < battle_config.max_aspd) sd->aspd = battle_config.max_aspd;
-	sd->amotion = sd->aspd;
-	sd->dmotion = 800-sd->paramc[1]*4;
-	if(sd->dmotion<400)
-		sd->dmotion = 400;
-	if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) {
-		sd->prev_speed = sd->speed;
-		sd->speed = sd->speed*(175 - skill*5)/100;
-	}
-
-	if(sd->status.hp>sd->status.max_hp)
-		sd->status.hp=sd->status.max_hp;
-	if(sd->status.sp>sd->status.max_sp)
-		sd->status.sp=sd->status.max_sp;
-
-	if(first&4)
-		return 0;
-	if(first&3) {
-		clif_updatestatus(sd,SP_SPEED);
-		clif_updatestatus(sd,SP_MAXHP);
-		clif_updatestatus(sd,SP_MAXSP);
-		if(first&1) {
-			clif_updatestatus(sd,SP_HP);
-			clif_updatestatus(sd,SP_SP);
-		}
-		return 0;
-	}
-
-	if(b_class != sd->view_class) {
-		clif_changelook(&sd->bl,LOOK_BASE,sd->view_class);
-#if PACKETVER < 4
-		clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
-		clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
-#else
-		clif_changelook(&sd->bl,LOOK_WEAPON,0);
-#endif
-	}
-
-	if( memcmp(b_skill,sd->status.skill,sizeof(sd->status.skill)) || b_attackrange != sd->attackrange)
-		clif_skillinfoblock(sd);	// スキル送信
-
-	if(b_speed != sd->speed)
-		clif_updatestatus(sd,SP_SPEED);
-	if(b_weight != sd->weight)
-		clif_updatestatus(sd,SP_WEIGHT);
-	if(b_max_weight != sd->max_weight) {
-		clif_updatestatus(sd,SP_MAXWEIGHT);
-		pc_checkweighticon(sd);
-	}
-	for(i=0;i<6;i++)
-		if(b_paramb[i] + b_parame[i] != sd->paramb[i] + sd->parame[i])
-			clif_updatestatus(sd,SP_STR+i);
-	if(b_hit != sd->hit)
-		clif_updatestatus(sd,SP_HIT);
-	if(b_flee != sd->flee)
-		clif_updatestatus(sd,SP_FLEE1);
-	if(b_aspd != sd->aspd)
-		clif_updatestatus(sd,SP_ASPD);
-	if(b_watk != sd->watk || b_base_atk != sd->base_atk)
-		clif_updatestatus(sd,SP_ATK1);
-	if(b_def != sd->def)
-		clif_updatestatus(sd,SP_DEF1);
-	if(b_watk2 != sd->watk2)
-		clif_updatestatus(sd,SP_ATK2);
-	if(b_def2 != sd->def2)
-		clif_updatestatus(sd,SP_DEF2);
-	if(b_flee2 != sd->flee2)
-		clif_updatestatus(sd,SP_FLEE2);
-	if(b_critical != sd->critical)
-		clif_updatestatus(sd,SP_CRITICAL);
-	if(b_matk1 != sd->matk1)
-		clif_updatestatus(sd,SP_MATK1);
-	if(b_matk2 != sd->matk2)
-		clif_updatestatus(sd,SP_MATK2);
-	if(b_mdef != sd->mdef)
-		clif_updatestatus(sd,SP_MDEF1);
-	if(b_mdef2 != sd->mdef2)
-		clif_updatestatus(sd,SP_MDEF2);
-	if(b_attackrange != sd->attackrange)
-		clif_updatestatus(sd,SP_ATTACKRANGE);
-	if(b_max_hp != sd->status.max_hp)
-		clif_updatestatus(sd,SP_MAXHP);
-	if(b_max_sp != sd->status.max_sp)
-		clif_updatestatus(sd,SP_MAXSP);
-	if(b_hp != sd->status.hp)
-		clif_updatestatus(sd,SP_HP);
-	if(b_sp != sd->status.sp)
-		clif_updatestatus(sd,SP_SP);
-
-/*	if(before.cart_num != before.cart_num || before.cart_max_num != before.cart_max_num ||
-		before.cart_weight != before.cart_weight || before.cart_max_weight != before.cart_max_weight )
-		clif_updatestatus(sd,SP_CARTINFO);*/
-
-	//if(sd->status.hp<sd->status.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 &&
-	if(sd->status.hp<sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 &&
-		(sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ) && !pc_isdead(sd))
-		// オ?トバ?サ?ク?動
-		status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0);
-
-	return 0;
-}
-
-/*==========================================
- * For quick calculating [Celest]
- *------------------------------------------
- */
-int status_calc_speed (struct map_session_data *sd)
-{
-	int b_speed, skill;
-	struct pc_base_job s_class;
-
-	nullpo_retr(0, sd);
-
-	s_class = pc_calc_base_job(sd->status.class_);
-
-	b_speed = sd->speed;
-	sd->speed = DEFAULT_WALK_SPEED ;
-
-	if(sd->sc_count){
-		if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){	// 速度?加
-			sd->speed -= sd->speed *25/100;
-		}
-		if(sd->sc_data[SC_DECREASEAGI].timer!=-1) {
-			sd->speed = sd->speed *125/100;
-		}
-		if(sd->sc_data[SC_CLOAKING].timer!=-1) {
-			sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100;
-		}
-		if(sd->sc_data[SC_CHASEWALK].timer!=-1) {
-			sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100;
-		}
-		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){
-			sd->speed = sd->speed*3/2;
-		}
-		if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) {
-			sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100;
-		}
-		if(sd->sc_data[SC_CARTBOOST].timer!=-1) {
-			sd->speed -= (DEFAULT_WALK_SPEED * 20)/100;
-		}
-		if(sd->sc_data[SC_BERSERK].timer!=-1) {
-			sd->speed -= sd->speed *25/100;
-		}
-		if(sd->sc_data[SC_WEDDING].timer!=-1) {
-			sd->speed = 2*DEFAULT_WALK_SPEED;
-		}
-		if(sd->sc_data[SC_DONTFORGETME].timer!=-1){
-			sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100;
-		}
-		if(sd->sc_data[SC_STEELBODY].timer!=-1){
-			sd->speed = (sd->speed * 125) / 100;
-		}
-		if(sd->sc_data[SC_DEFENDER].timer != -1) {
-			// removed as of 12/14's patch [celest]
-			//sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100;
-		}
-		if( sd->sc_data[SC_DANCING].timer!=-1 ){
-			sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)));
-		}
-		if(sd->sc_data[SC_CURSE].timer!=-1)
-			sd->speed += 450;
-		if(sd->sc_data[SC_SLOWDOWN].timer!=-1)
-			sd->speed = sd->speed*150/100;
-		if(sd->sc_data[SC_SPEEDUP0].timer!=-1)
-			sd->speed -= sd->speed*25/100;
-	}
-
-	if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 )
-		sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9);
-	if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0)
-		sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1);
-	else if (pc_isriding(sd)) {
-		sd->speed -= (0.25 * DEFAULT_WALK_SPEED);
-	}
-	if((skill=pc_checkskill(sd,TF_MISS))>0)
-		if(s_class.job==12)
-			sd->speed -= sd->speed *(skill*1.5)/100;
-
-	if(sd->speed_rate != 100)
-		sd->speed = sd->speed*sd->speed_rate/100;
-	if(sd->speed < 1) sd->speed = 1;
-
-	if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) {
-		sd->prev_speed = sd->speed;
-		sd->speed = sd->speed*(175 - skill*5)/100;
-	}
-
-	if(b_speed != sd->speed)
-		clif_updatestatus(sd,SP_SPEED);
-
-	return 0;
-}
-
-/*==========================================
- * 対象のClassを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_class(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data *)bl)->class_;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->status.class_;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return ((struct pet_data *)bl)->class_;
-	else
-		return 0;
-}
-/*==========================================
- * 対象の方向を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_dir(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data *)bl)->dir;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->dir;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return ((struct pet_data *)bl)->dir;
-	else
-		return 0;
-}
-/*==========================================
- * 対象のレベルを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_lv(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data *)bl)->level;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->status.base_level;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return ((struct pet_data *)bl)->msd->pet.level;
-	else
-		return 0;
-}
-
-/*==========================================
- * 対象の射程を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_range(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return mob_db[((struct mob_data *)bl)->class_].range;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->attackrange;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return mob_db[((struct pet_data *)bl)->class_].range;
-	else
-		return 0;
-}
-/*==========================================
- * 対象のHPを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_hp(struct block_list *bl)
-{
-	nullpo_retr(1, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data *)bl)->hp;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->status.hp;
-	else
-		return 1;
-}
-/*==========================================
- * 対象のMHPを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_max_hp(struct block_list *bl)
-{
-	nullpo_retr(1, bl);
-
-	if(bl->type==BL_PC && ((struct map_session_data *)bl))
-		return ((struct map_session_data *)bl)->status.max_hp;
-	else {
-		struct status_change *sc_data;		
-		int max_hp = 1;
-
-		if(bl->type == BL_MOB) {
-			struct mob_data *md;
-			nullpo_retr(1, md = (struct mob_data *)bl);
-			max_hp = mob_db[md->class_].max_hp;
-
-			if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris]
-				max_hp += (md->level - mob_db[md->class_].lv) * status_get_vit(bl);
-
-			if(mob_db[md->class_].mexp > 0) {
-				if(battle_config.mvp_hp_rate != 100)
-					max_hp = (max_hp * battle_config.mvp_hp_rate)/100;
-			}
-			else {
-				if(battle_config.monster_hp_rate != 100)
-					max_hp = (max_hp * battle_config.monster_hp_rate)/100;
-			}
-		}
-		else if(bl->type == BL_PET) {
-			struct pet_data *pd;
-			nullpo_retr(1, pd = (struct pet_data*)bl);
-			max_hp = mob_db[pd->class_].max_hp;
-
-			if(mob_db[pd->class_].mexp > 0) {
-				if(battle_config.mvp_hp_rate != 100)
-					max_hp = (max_hp * battle_config.mvp_hp_rate)/100;
-			}
-			else {
-				if(battle_config.monster_hp_rate != 100)
-					max_hp = (max_hp * battle_config.monster_hp_rate)/100;
-			}
-		}
-
-		sc_data = status_get_sc_data(bl);
-		if(sc_data) {
-			if(sc_data[SC_APPLEIDUN].timer != -1)
-				max_hp += ((5 + sc_data[SC_APPLEIDUN].val1 * 2 + ((sc_data[SC_APPLEIDUN].val2 + 1) >> 1)
-					+ sc_data[SC_APPLEIDUN].val3 / 10) * max_hp)/100;
-			if(sc_data[SC_GOSPEL].timer != -1 &&
-				sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-				sc_data[SC_GOSPEL].val3 == 4)
-				max_hp += max_hp * 25 / 100;
-		}
-		if(max_hp < 1) max_hp = 1;
-		return max_hp;
-	}
-	return 1;
-}
-/*==========================================
- * 対象のStrを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_str(struct block_list *bl)
-{
-	int str = 0;
-	nullpo_retr(0, bl);
-
-	if (bl->type == BL_PC && ((struct map_session_data *)bl))
-		return ((struct map_session_data *)bl)->paramc[0];
-	else {		
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);
-
-		if(bl->type == BL_MOB && ((struct mob_data *)bl)) {
-			str = mob_db[((struct mob_data *)bl)->class_].str;
-			if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris]
-				str += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}
-		else if(bl->type == BL_PET && ((struct pet_data *)bl))
-			str = mob_db[((struct pet_data *)bl)->class_].str;
-
-		if(sc_data) {
-			if(sc_data[SC_LOUD].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1)
-				str += 4;
-			if( sc_data[SC_BLESSING].timer != -1){	// ブレッシング
-				int race = status_get_race(bl);
-				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6)
-					str >>= 1;	// 悪 魔/不死
-				else str += sc_data[SC_BLESSING].val1;	// その他
-			}
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				str += 5;
-		}
-	}
-	if(str < 0) str = 0;
-	return str;
-}
-/*==========================================
- * 対象のAgiを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-
-int status_get_agi(struct block_list *bl)
-{
-	int agi=0;
-	nullpo_retr(0, bl);
-
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->paramc[1];
-	else {
-		struct status_change *sc_data;	
-		sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB && (struct mob_data *)bl) {
-			agi = mob_db[((struct mob_data *)bl)->class_].agi;
-			if(battle_config.mobs_level_up) // increase of mobs leveling up [Valaris]
-				agi += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			agi = mob_db[((struct pet_data *)bl)->class_].agi;
-
-		if(sc_data) {
-			if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 速度増加(PCはpc.cで)
-				agi += 2 + sc_data[SC_INCREASEAGI].val1;
-			if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1)
-				agi += agi * (2 + sc_data[SC_CONCENTRATE].val1)/100;
-			if(sc_data[SC_DECREASEAGI].timer!=-1)	// 速度減少
-				agi -= 2 + sc_data[SC_DECREASEAGI].val1;
-			if(sc_data[SC_QUAGMIRE].timer!=-1 ) {	// クァグマイア
-				//agi >>= 1;
-				//int agib = agi*(sc_data[SC_QUAGMIRE].val1*10)/100;
-				//agi -= agib > 50 ? 50 : agib;
-				agi -= sc_data[SC_QUAGMIRE].val1*10;
-			}
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				agi += 5;
-		}
-	}
-	if(agi < 0) agi = 0;
-	return agi;
-}
-/*==========================================
- * 対象のVitを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_vit(struct block_list *bl)
-{
-	int vit = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->paramc[2];
-	else {
-		struct status_change *sc_data;	
-		sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB && (struct mob_data *)bl) {
-			vit = mob_db[((struct mob_data *)bl)->class_].vit;
-			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
-				vit += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}	
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			vit = mob_db[((struct pet_data *)bl)->class_].vit;
-		if(sc_data) {
-			if(sc_data[SC_STRIPARMOR].timer != -1)
-				vit = vit*60/100;
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				vit += 5;
-		}
-	}
-	if(vit < 0) vit = 0;
-	return vit;
-}
-/*==========================================
- * 対象のIntを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_int(struct block_list *bl)
-{
-	int int_=0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->paramc[3];
-	else {
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB && (struct mob_data *)bl){
-			int_ = mob_db[((struct mob_data *)bl)->class_].int_;
-			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
-				int_ += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}		
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			int_ = mob_db[((struct pet_data *)bl)->class_].int_;
-
-		if(sc_data) {
-			if(sc_data[SC_BLESSING].timer != -1){	// ブレッシング
-				int race = status_get_race(bl);
-				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6 )
-					int_ >>= 1;	// 悪 魔/不死
-				else
-					int_ += sc_data[SC_BLESSING].val1;	// その他
-			}
-			if(sc_data[SC_STRIPHELM].timer != -1)
-				int_ = int_*60/100;
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				int_ += 5;
-		}
-	}
-	if(int_ < 0) int_ = 0;
-	return int_;
-}
-/*==========================================
- * 対象のDexを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_dex(struct block_list *bl)
-{
-	int dex = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->paramc[4];
-	else {
-		struct status_change *sc_data;	
-		sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB && (struct mob_data *)bl) {
-			dex = mob_db[((struct mob_data *)bl)->class_].dex;
-			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
-				dex += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}		
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			dex = mob_db[((struct pet_data *)bl)->class_].dex;
-
-		if(sc_data) {
-			if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1)
-				dex += dex*(2+sc_data[SC_CONCENTRATE].val1)/100;
-			if(sc_data[SC_BLESSING].timer != -1){	// ブレッシング
-				int race = status_get_race(bl);
-				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6 )
-					dex >>= 1;	// 悪 魔/不死
-				else dex += sc_data[SC_BLESSING].val1;	// その他
-			}
-			if(sc_data[SC_QUAGMIRE].timer!=-1)	{ // クァグマイア
-				// dex >>= 1;
-				//int dexb = dex*(sc_data[SC_QUAGMIRE].val1*10)/100;
-				//dex -= dexb > 50 ? 50 : dexb;
-				dex -= sc_data[SC_QUAGMIRE].val1*10;
-			}
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				dex += 5;
-		}
-	}
-	if(dex < 0) dex = 0;
-	return dex;
-}
-/*==========================================
- * 対象のLukを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_luk(struct block_list *bl)
-{
-	int luk = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->paramc[5];
-	else {
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB && (struct mob_data *)bl) {
-			luk = mob_db[((struct mob_data *)bl)->class_].luk;
-			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
-				luk += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}		
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			luk = mob_db[((struct pet_data *)bl)->class_].luk;
-		if(sc_data) {
-			if(sc_data[SC_GLORIA].timer!=-1)	// グロリア(PCはpc.cで)
-				luk += 30;
-			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
-				luk += 5;
-			if(sc_data[SC_CURSE].timer!=-1)		// 呪い
-				luk = 0;
-		}
-	}
-	if(luk < 0) luk = 0;
-	return luk;
-}
-
-/*==========================================
- * 対象のFleeを返す(汎用)
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_flee(struct block_list *bl)
-{
-	int flee = 1;
-	nullpo_retr(1, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->flee;
-	else {
-		struct status_change *sc_data;	
-		sc_data = status_get_sc_data(bl);
-		flee = status_get_agi(bl) + status_get_lv(bl);
-
-		if(sc_data){
-			if(sc_data[SC_WHISTLE].timer!=-1)
-				flee += flee*(sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2
-					+(sc_data[SC_WHISTLE].val3>>16))/100;
-			if(sc_data[SC_BLIND].timer!=-1)
-				flee -= flee*25/100;
-			if(sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォーク
-				flee += flee*(sc_data[SC_WINDWALK].val2)/100;
-			if(sc_data[SC_SPIDERWEB].timer!=-1) //スパイダーウェブ
-				flee -= flee*50/100;
-			if(sc_data[SC_GOSPEL].timer!=-1) {
-				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-					sc_data[SC_GOSPEL].val3 == 13)
-					flee += flee*5/100;
-				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-					sc_data[SC_GOSPEL].val3 == 7)
-					flee = 0;
-			}
-		}
-	}
-	if(flee < 1) flee = 1;
-	return flee;
-}
-/*==========================================
- * 対象のHitを返す(汎用)
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_hit(struct block_list *bl)
-{
-	int hit = 1;
-	nullpo_retr(1, bl);
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->hit;
-	else {
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);		
-		hit = status_get_dex(bl) + status_get_lv(bl);
-
-		if(sc_data) {
-			if(sc_data[SC_HUMMING].timer!=-1)	//
-				hit += hit*(sc_data[SC_HUMMING].val1*2+sc_data[SC_HUMMING].val2
-					+sc_data[SC_HUMMING].val3)/100;
-			if(sc_data[SC_BLIND].timer!=-1)		// 呪い
-				hit -= hit*25/100;
-			if(sc_data[SC_TRUESIGHT].timer!=-1)		// トゥルーサイト
-				hit += 3*(sc_data[SC_TRUESIGHT].val1);
-			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
-				hit += (hit*(10*(sc_data[SC_CONCENTRATION].val1)))/100;
-			if(sc_data[SC_GOSPEL].timer!=-1 &&
-				sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-				sc_data[SC_GOSPEL].val3 == 14)
-				hit += hit*5/100;
-		}
-	}
-	if(hit < 1) hit = 1;
-	return hit;
-}
-/*==========================================
- * 対象の完全回避を返す(汎用)
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_flee2(struct block_list *bl)
-{
-	int flee2 = 1;
-	nullpo_retr(1, bl);
-
-	if(bl->type==BL_PC && (struct map_session_data *)bl){
-		return ((struct map_session_data *)bl)->flee2;
-	} else {
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);
-		flee2 = status_get_luk(bl)+1;
-
-		if(sc_data) {
-			if(sc_data[SC_WHISTLE].timer!=-1)
-				flee2 += (sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2
-					+(sc_data[SC_WHISTLE].val3&0xffff))*10;
-		}
-	}
-	if(flee2 < 1) flee2 = 1;
-	return flee2;
-}
-/*==========================================
- * 対象のクリティカルを返す(汎用)
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_critical(struct block_list *bl)
-{
-	int critical = 1;
-	nullpo_retr(1, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl){
-		return ((struct map_session_data *)bl)->critical;
-	} else {
-		struct status_change *sc_data;
-		sc_data = status_get_sc_data(bl);		
-		critical = status_get_luk(bl)*3 + 1;
-
-		if(sc_data) {
-			if(sc_data[SC_FORTUNE].timer!=-1)
-				critical += (10+sc_data[SC_FORTUNE].val1+sc_data[SC_FORTUNE].val2
-					+ sc_data[SC_FORTUNE].val3)*10;
-			if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1)
-				critical += sc_data[SC_EXPLOSIONSPIRITS].val2;
-			if(sc_data[SC_TRUESIGHT].timer!=-1) //トゥルーサイト
-				critical += critical*sc_data[SC_TRUESIGHT].val1/100;
-		}
-	}
-	if(critical < 1) critical = 1;
-	return critical;
-}
-/*==========================================
- * base_atkの取得
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_baseatk(struct block_list *bl)
-{
-	int batk = 1;
-	nullpo_retr(1, bl);
-	
-	if(bl->type==BL_PC && (struct map_session_data *)bl) {
-		batk = ((struct map_session_data *)bl)->base_atk; //設定されているbase_atk
-		if (((struct map_session_data *)bl)->status.weapon < 16)
-			batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon];
-	} else { //それ以外なら
-		struct status_change *sc_data;
-		int str,dstr;
-		str = status_get_str(bl); //STR
-		dstr = str/10;
-		batk = dstr*dstr + str; //base_atkを計算する
-		sc_data = status_get_sc_data(bl);
-
-		if(sc_data) { //状態異常あり
-			if(sc_data[SC_PROVOKE].timer!=-1) //PCでプロボック(SM_PROVOKE)状態
-				batk = batk*(100+2*sc_data[SC_PROVOKE].val1)/100; //base_atk増加
-			if(sc_data[SC_CURSE].timer!=-1) //呪われていたら
-				batk -= batk*25/100; //base_atkが25%減少
-			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
-				batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100;
-		}
-	}
-	if(batk < 1) batk = 1; //base_atkは最低でも1
-	return batk;
-}
-/*==========================================
- * 対象のAtkを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_atk(struct block_list *bl)
-{
-	int atk = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data*)bl)->watk;
-	else {
-		struct status_change *sc_data;
-		sc_data=status_get_sc_data(bl);
-		
-		if(bl->type == BL_MOB && (struct mob_data *)bl)
-			atk = mob_db[((struct mob_data*)bl)->class_].atk1;
-		else if(bl->type == BL_PET && (struct pet_data *)bl)
-			atk = mob_db[((struct pet_data*)bl)->class_].atk1;
-
-		if(sc_data) {
-			if(sc_data[SC_PROVOKE].timer!=-1)
-				atk = atk*(100+2*sc_data[SC_PROVOKE].val1)/100;
-			if(sc_data[SC_CURSE].timer!=-1)
-				atk -= atk*25/100;
-			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
-				atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100;
-
-			if(sc_data[SC_GOSPEL].timer!=-1) {
-				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-					sc_data[SC_GOSPEL].val3 == 12)
-					atk += atk*8/100;
-				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-					sc_data[SC_GOSPEL].val3 == 6)
-					atk = 0;
-			}
-		}
-	}
-	if(atk < 0) atk = 0;
-	return atk;
-}
-/*==========================================
- * 対象の左手Atkを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_atk_(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl){
-		int atk=((struct map_session_data*)bl)->watk_;
-		return atk;
-	}
-	else
-		return 0;
-}
-/*==========================================
- * 対象のAtk2を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_atk2(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data*)bl)->watk2;
-	else {
-		struct status_change *sc_data=status_get_sc_data(bl);
-		int atk2=0;
-		if(bl->type==BL_MOB && (struct mob_data *)bl)
-			atk2 = mob_db[((struct mob_data*)bl)->class_].atk2;
-		else if(bl->type==BL_PET && (struct pet_data *)bl)
-			atk2 = mob_db[((struct pet_data*)bl)->class_].atk2;
-		if(sc_data) {
-			if( sc_data[SC_IMPOSITIO].timer!=-1)
-				atk2 += sc_data[SC_IMPOSITIO].val1*5;
-			if( sc_data[SC_PROVOKE].timer!=-1 )
-				atk2 = atk2*(100+2*sc_data[SC_PROVOKE].val1)/100;
-			if( sc_data[SC_CURSE].timer!=-1 )
-				atk2 -= atk2*25/100;
-			if(sc_data[SC_DRUMBATTLE].timer!=-1)
-				atk2 += sc_data[SC_DRUMBATTLE].val2;
-			if(sc_data[SC_NIBELUNGEN].timer!=-1 && (status_get_element(bl)/10) >= 8 )
-				atk2 += sc_data[SC_NIBELUNGEN].val3;
-			if(sc_data[SC_STRIPWEAPON].timer!=-1)
-				atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100;
-			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
-				atk2 += atk2*(5*sc_data[SC_CONCENTRATION].val1)/100;
-		}
-		if(atk2 < 0) atk2 = 0;
-		return atk2;
-	}
-	return 0;
-}
-/*==========================================
- * 対象の左手Atk2を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_atk_2(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data*)bl)->watk_2;
-	else
-		return 0;
-}
-/*==========================================
- * 対象のMAtk1を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_matk1(struct block_list *bl)
-{
-	int matk = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->matk1;
-	else {
-		struct status_change *sc_data;
-		int int_ = status_get_int(bl);
-		matk = int_+(int_/5)*(int_/5);
-
-		sc_data = status_get_sc_data(bl);
-		if(sc_data) {
-			if(sc_data[SC_MINDBREAKER].timer!=-1)
-				matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100;
-		}
-	}
-	return matk;
-}
-/*==========================================
- * 対象のMAtk2を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_matk2(struct block_list *bl)
-{
-	int matk = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->matk2;
-	else {
-		struct status_change *sc_data = status_get_sc_data(bl);
-		int int_ = status_get_int(bl);
-		matk = int_+(int_/7)*(int_/7);
-
-		if(sc_data) {
-			if(sc_data[SC_MINDBREAKER].timer!=-1)
-				matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100;
-		}
-	}
-	return matk;
-}
-/*==========================================
- * 対象のDefを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_def(struct block_list *bl)
-{
-	struct status_change *sc_data;
-	int def=0,skilltimer=-1,skillid=0;
-
-	nullpo_retr(0, bl);
-	sc_data=status_get_sc_data(bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl){
-		def = ((struct map_session_data *)bl)->def;
-		skilltimer = ((struct map_session_data *)bl)->skilltimer;
-		skillid = ((struct map_session_data *)bl)->skillid;
-	}
-	else if(bl->type==BL_MOB && (struct mob_data *)bl) {
-		def = mob_db[((struct mob_data *)bl)->class_].def;
-		skilltimer = ((struct mob_data *)bl)->skilltimer;
-		skillid = ((struct mob_data *)bl)->skillid;
-	}
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		def = mob_db[((struct pet_data *)bl)->class_].def;
-
-	if(def < 1000000) {
-		if(sc_data) {
-			//凍結、石化時は右シフト
-			if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))
-				def >>= 1;
-
-			if (bl->type != BL_PC) {
-				//キーピング時はDEF100
-				if( sc_data[SC_KEEPING].timer!=-1)
-					def = 100;
-				//プロボック時は減算
-				if( sc_data[SC_PROVOKE].timer!=-1)
-					def = (def*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100;
-				//戦太鼓の響き時は加算
-				if( sc_data[SC_DRUMBATTLE].timer!=-1)
-					def += sc_data[SC_DRUMBATTLE].val3;
-				//毒にかかっている時は減算
-				if(sc_data[SC_POISON].timer!=-1)
-					def = def*75/100;
-				//ストリップシールド時は減算
-				if(sc_data[SC_STRIPSHIELD].timer!=-1)
-					def = def*sc_data[SC_STRIPSHIELD].val2/100;
-				//シグナムクルシス時は減算
-				if(sc_data[SC_SIGNUMCRUCIS].timer!=-1)
-					def = def * (100 - sc_data[SC_SIGNUMCRUCIS].val2)/100;
-				//永遠の混沌時はDEF0になる
-				if(sc_data[SC_ETERNALCHAOS].timer!=-1)
-					def = 0;
-				//コンセントレーション時は減算
-				if( sc_data[SC_CONCENTRATION].timer!=-1)
-					def = (def*(100 - 5*sc_data[SC_CONCENTRATION].val1))/100;
-
-				if(sc_data[SC_GOSPEL].timer!=-1) {
-					if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-						sc_data[SC_GOSPEL].val3 == 11)
-						def += def*25/100;
-					else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-						sc_data[SC_GOSPEL].val3 == 5)
-						def = 0;
-				}
-				if(sc_data[SC_JOINTBEAT].timer!=-1) {
-					if (sc_data[SC_JOINTBEAT].val2 == 4)
-						def -= def*50/100;
-					else if (sc_data[SC_JOINTBEAT].val2 == 5)
-						def -= def*25/100;
-				}
-			}
-		}
-		//詠唱中は詠唱時減算率に基づいて減算
-		if(skilltimer != -1) {
-			int def_rate = skill_get_castdef(skillid);
-			if(def_rate != 0)
-				def = (def * (100 - def_rate))/100;
-		}
-	}
-	if(def < 0) def = 0;
-	return def;
-}
-/*==========================================
- * 対象のMDefを返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_mdef(struct block_list *bl)
-{
-	struct status_change *sc_data;
-	int mdef=0;
-
-	nullpo_retr(0, bl);
-	sc_data=status_get_sc_data(bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		mdef = ((struct map_session_data *)bl)->mdef;
-	else if(bl->type==BL_MOB && (struct mob_data *)bl)
-		mdef = mob_db[((struct mob_data *)bl)->class_].mdef;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		mdef = mob_db[((struct pet_data *)bl)->class_].mdef;
-
-	if(mdef < 1000000) {
-		if(sc_data) {
-			//バリアー状態時はMDEF100
-			if(sc_data[SC_BARRIER].timer != -1)
-				mdef = 100;
-			//凍結、石化時は1.25倍
-			if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))
-				mdef = mdef*125/100;
-			if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC)
-				mdef -= (mdef*6*sc_data[SC_MINDBREAKER].val1)/100;
-		}
-	}
-	if(mdef < 0) mdef = 0;
-	return mdef;
-}
-/*==========================================
- * 対象のDef2を返す(汎用)
- * 戻りは整数で1以上
- *------------------------------------------
- */
-int status_get_def2(struct block_list *bl)
-{
-	int def2 = 1;
-	nullpo_retr(1, bl);
-	
-	if(bl->type==BL_PC)
-		return ((struct map_session_data *)bl)->def2;
-	else {
-		struct status_change *sc_data;
-
-		if(bl->type==BL_MOB)
-			def2 = mob_db[((struct mob_data *)bl)->class_].vit;
-		else if(bl->type==BL_PET)
-			def2 = mob_db[((struct pet_data *)bl)->class_].vit;
-
-		sc_data = status_get_sc_data(bl);
-		if(sc_data) {
-			if(sc_data[SC_ANGELUS].timer != -1)
-				def2 = def2*(110+5*sc_data[SC_ANGELUS].val1)/100;
-			if(sc_data[SC_PROVOKE].timer!=-1)
-				def2 = (def2*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100;
-			if(sc_data[SC_POISON].timer!=-1)
-				def2 = def2*75/100;
-			//コンセントレーション時は減算
-			if( sc_data[SC_CONCENTRATION].timer!=-1)
-				def2 = def2*(100 - 5*sc_data[SC_CONCENTRATION].val1)/100;
-
-			if(sc_data[SC_GOSPEL].timer!=-1) {
-				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-					sc_data[SC_GOSPEL].val3 == 11)
-					def2 += def2*25/100;
-				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-					sc_data[SC_GOSPEL].val3 == 5)
-					def2 = 0;
-			}
-		}
-	}
-	if(def2 < 1) def2 = 1;
-	return def2;
-}
-/*==========================================
- * 対象のMDef2を返す(汎用)
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int status_get_mdef2(struct block_list *bl)
-{
-	int mdef2 = 0;
-	nullpo_retr(0, bl);
-
-	if(bl->type == BL_PC)
-		return ((struct map_session_data *)bl)->mdef2 + (((struct map_session_data *)bl)->paramc[2]>>1);
-	else {
-		struct status_change *sc_data = status_get_sc_data(bl);
-		if(bl->type == BL_MOB)
-			mdef2 = mob_db[((struct mob_data *)bl)->class_].int_ + (mob_db[((struct mob_data *)bl)->class_].vit>>1);
-		else if(bl->type == BL_PET)
-			mdef2 = mob_db[((struct pet_data *)bl)->class_].int_ + (mob_db[((struct pet_data *)bl)->class_].vit>>1);
-		if(sc_data) {
-			if(sc_data[SC_MINDBREAKER].timer!=-1)
-				mdef2 -= (mdef2*6*sc_data[SC_MINDBREAKER].val1)/100;
-		}
-	}
-	if(mdef2 < 0) mdef2 = 0;
-		return mdef2;
-}
-/*==========================================
- * 対象のSpeed(移動速度)を返す(汎用)
- * 戻りは整数で1以上
- * Speedは小さいほうが移動速度が速い
- *------------------------------------------
- */
-int status_get_speed(struct block_list *bl)
-{
-	nullpo_retr(1000, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->speed;
-	else {
-		struct status_change *sc_data=status_get_sc_data(bl);
-		int speed = 1000;
-		if(bl->type==BL_MOB && (struct mob_data *)bl) {
-			speed = ((struct mob_data *)bl)->speed;
-			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
-				speed-=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
-		}
-		else if(bl->type==BL_PET && (struct pet_data *)bl)
-			speed = ((struct pet_data *)bl)->msd->petDB->speed;
-
-		if(sc_data) {
-			//速度増加時は25%減算
-			if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_DONTFORGETME].timer == -1)
-				speed -= speed*25/100;
-			//速度減少時は25%加算
-			if(sc_data[SC_DECREASEAGI].timer!=-1)
-				speed = speed*125/100;
-			//クァグマイア時は50%加算
-			if(sc_data[SC_QUAGMIRE].timer!=-1)
-				speed = speed*3/2;
-			//私を忘れないで…時は加算
-			if(sc_data[SC_DONTFORGETME].timer!=-1)
-				speed = speed*(100+sc_data[SC_DONTFORGETME].val1*2 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3&0xffff))/100;
-			//金剛時は25%加算
-			if(sc_data[SC_STEELBODY].timer!=-1)
-				speed = speed*125/100;
-			//ディフェンダー時は加算
-			// removed as of 12/14's patch [celest]
-			/*if(sc_data[SC_DEFENDER].timer!=-1)
-				speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100;*/
-			//踊り状態は4倍遅い
-			if(sc_data[SC_DANCING].timer!=-1 )
-				speed *= 6;
-			//呪い時は450加算
-			if(sc_data[SC_CURSE].timer!=-1)
-				speed = speed + 450;
-			//ウィンドウォーク時はLv*2%減算
-			if(sc_data[SC_WINDWALK].timer!=-1 && sc_data[SC_INCREASEAGI].timer==-1)
-				speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100;
-			if(sc_data[SC_SLOWDOWN].timer!=-1)
-				speed = speed*150/100;
-			if(sc_data[SC_SPEEDUP0].timer!=-1)
-				speed -= speed*25/100;
-			if(sc_data[SC_GOSPEL].timer!=-1 &&
-				sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-				sc_data[SC_GOSPEL].val3 == 8)
-				speed = speed*125/100;
-			if(sc_data[SC_JOINTBEAT].timer!=-1) {
-				if (sc_data[SC_JOINTBEAT].val2 == 1)
-					speed = speed*150/100;
-				else if (sc_data[SC_JOINTBEAT].val2 == 3)
-					speed = speed*130/100;				
-			}
-		}
-		if(speed < 1) speed = 1;
-		return speed;
-	}
-
-	return 1000;
-}
-/*==========================================
- * 対象のaDelay(攻撃時ディレイ)を返す(汎用)
- * aDelayは小さいほうが攻撃速度が速い
- *------------------------------------------
- */
-int status_get_adelay(struct block_list *bl)
-{
-	nullpo_retr(4000, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return (((struct map_session_data *)bl)->aspd<<1);
-	else {
-		struct status_change *sc_data=status_get_sc_data(bl);
-		int adelay=4000,aspd_rate = 100,i;
-		if(bl->type==BL_MOB && (struct mob_data *)bl)
-			adelay = mob_db[((struct mob_data *)bl)->class_].adelay;
-		else if(bl->type==BL_PET && (struct pet_data *)bl)
-			adelay = mob_db[((struct pet_data *)bl)->class_].adelay;
-
-		if(sc_data) {
-			//ツーハンドクイッケン使用時でクァグマイアでも私を忘れないで…でもない時は3割減算
-			if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
-				aspd_rate -= 30;
-			//アドレナリンラッシュ使用時でツーハンドクイッケンでもクァグマイアでも私を忘れないで…でもない時は
-			if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
-				sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
-				//使用者とパーティメンバーで格差が出る設定でなければ3割減算
-				if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
-					aspd_rate -= 30;
-				//そうでなければ2.5割減算
-				else
-					aspd_rate -= 25;
-			}
-			//スピアクィッケン時は減算
-			if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 &&
-				sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
-				aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2;
-			//夕日のアサシンクロス時は減算
-			if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
-				sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 &&
-				sc_data[SC_DONTFORGETME].timer == -1)
-				aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3;
-			//私を忘れないで…時は加算
-			if(sc_data[SC_DONTFORGETME].timer!=-1)		// 私を忘れないで
-				aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16);
-			//金剛時25%加算
-			if(sc_data[SC_STEELBODY].timer!=-1)	// 金剛
-				aspd_rate += 25;
-			//増速ポーション使用時は減算
-			if(	sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1)
-				aspd_rate -= sc_data[i].val2;
-			//ディフェンダー時は加算
-			if(sc_data[SC_DEFENDER].timer != -1)
-				adelay += (1100 - sc_data[SC_DEFENDER].val1*100);
-			if(sc_data[SC_GOSPEL].timer!=-1 &&
-				sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
-				sc_data[SC_GOSPEL].val3 == 8)
-				aspd_rate = aspd_rate*125/100;
-			if(sc_data[SC_JOINTBEAT].timer!=-1) {
-				if (sc_data[SC_JOINTBEAT].val2 == 2)
-					aspd_rate = aspd_rate*125/100;
-				else if (sc_data[SC_JOINTBEAT].val2 == 3)
-					aspd_rate = aspd_rate*110/100;
-			}
-		}
-		if(aspd_rate != 100)
-			adelay = adelay*aspd_rate/100;
-		if(adelay < battle_config.monster_max_aspd<<1) adelay = battle_config.monster_max_aspd<<1;
-		return adelay;
-	}
-	return 4000;
-}
-int status_get_amotion(struct block_list *bl)
-{
-	nullpo_retr(2000, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->amotion;
-	else {
-		struct status_change *sc_data=status_get_sc_data(bl);
-		int amotion=2000,aspd_rate = 100,i;
-		if(bl->type==BL_MOB && (struct mob_data *)bl)
-			amotion = mob_db[((struct mob_data *)bl)->class_].amotion;
-		else if(bl->type==BL_PET && (struct pet_data *)bl)
-			amotion = mob_db[((struct pet_data *)bl)->class_].amotion;
-
-		if(sc_data) {
-			if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
-				aspd_rate -= 30;
-			if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
-				sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
-				if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
-					aspd_rate -= 30;
-				else
-					aspd_rate -= 25;
-			}
-			if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 &&
-				sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
-				aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2;
-			if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
-				sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 &&
-				sc_data[SC_DONTFORGETME].timer == -1)
-				aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3;
-			if(sc_data[SC_DONTFORGETME].timer!=-1)		// 私を忘れないで
-				aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16);
-			if(sc_data[SC_STEELBODY].timer!=-1)	// 金剛
-				aspd_rate += 25;
-			if(	sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1)
-				aspd_rate -= sc_data[i].val2;
-			if(sc_data[SC_DEFENDER].timer != -1)
-				amotion += (550 - sc_data[SC_DEFENDER].val1*50);
-		}
-		if(aspd_rate != 100)
-			amotion = amotion*aspd_rate/100;
-		if(amotion < battle_config.monster_max_aspd) amotion = battle_config.monster_max_aspd;
-		return amotion;
-	}
-	return 2000;
-}
-int status_get_dmotion(struct block_list *bl)
-{
-	int ret;
-	struct status_change *sc_data;
-
-	nullpo_retr(0, bl);
-	sc_data = status_get_sc_data(bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl){
-		ret=mob_db[((struct mob_data *)bl)->class_].dmotion;
-		if(battle_config.monster_damage_delay_rate != 100)
-			ret = ret*battle_config.monster_damage_delay_rate/400;
-	}
-	else if(bl->type==BL_PC && (struct map_session_data *)bl){
-		ret=((struct map_session_data *)bl)->dmotion;
-		if(battle_config.pc_damage_delay_rate != 100)
-			ret = ret*battle_config.pc_damage_delay_rate/400;
-	}
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		ret=mob_db[((struct pet_data *)bl)->class_].dmotion;
-	else
-		return 2000;
-
-	if((sc_data && (sc_data[SC_ENDURE].timer!=-1 || sc_data[SC_BERSERK].timer!=-1)) ||
-		(bl->type == BL_PC && ((struct map_session_data *)bl)->special_state.infinite_endure))
-		ret=0;
-
-	return ret;
-}
-int status_get_element(struct block_list *bl)
-{
-	int ret = 20;
-	struct status_change *sc_data;
-
-	nullpo_retr(ret, bl);
-	sc_data = status_get_sc_data(bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)	// 10の位=Lv*2、1の位=属性
-		ret=((struct mob_data *)bl)->def_ele;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		ret=20+((struct map_session_data *)bl)->def_ele;	// 防御属性Lv1
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		ret = mob_db[((struct pet_data *)bl)->class_].element;
-
-	if(sc_data) {
-		if( sc_data[SC_BENEDICTIO].timer!=-1 )	// 聖体降福
-			ret=26;
-		if( sc_data[SC_FREEZE].timer!=-1 )	// 凍結
-			ret=21;
-		if( sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
-			ret=22;
-	}
-
-	return ret;
-}
-
-int status_get_attack_element(struct block_list *bl)
-{
-	int ret = 0;
-	struct status_change *sc_data=status_get_sc_data(bl);
-
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		ret=0;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		ret=((struct map_session_data *)bl)->atk_ele;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		ret=0;
-
-	if(sc_data) {
-		if( sc_data[SC_FROSTWEAPON].timer!=-1)	// フロストウェポン
-			ret=1;
-		if( sc_data[SC_SEISMICWEAPON].timer!=-1)	// サイズミックウェポン
-			ret=2;
-		if( sc_data[SC_FLAMELAUNCHER].timer!=-1)	// フレームランチャー
-			ret=3;
-		if( sc_data[SC_LIGHTNINGLOADER].timer!=-1)	// ライトニングローダー
-			ret=4;
-		if( sc_data[SC_ENCPOISON].timer!=-1)	// エンチャントポイズン
-			ret=5;
-		if( sc_data[SC_ASPERSIO].timer!=-1)		// アスペルシオ
-			ret=6;
-	}
-
-	return ret;
-}
-int status_get_attack_element2(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl) {
-		int ret = ((struct map_session_data *)bl)->atk_ele_;
-		struct status_change *sc_data = ((struct map_session_data *)bl)->sc_data;
-
-		if(sc_data) {
-			if( sc_data[SC_FROSTWEAPON].timer!=-1)	// フロストウェポン
-				ret=1;
-			if( sc_data[SC_SEISMICWEAPON].timer!=-1)	// サイズミックウェポン
-				ret=2;
-			if( sc_data[SC_FLAMELAUNCHER].timer!=-1)	// フレームランチャー
-				ret=3;
-			if( sc_data[SC_LIGHTNINGLOADER].timer!=-1)	// ライトニングローダー
-				ret=4;
-			if( sc_data[SC_ENCPOISON].timer!=-1)	// エンチャントポイズン
-				ret=5;
-			if( sc_data[SC_ASPERSIO].timer!=-1)		// アスペルシオ
-				ret=6;
-		}
-		return ret;
-	}
-	return 0;
-}
-int status_get_party_id(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->status.party_id;
-	else if(bl->type==BL_MOB && (struct mob_data *)bl){
-		struct mob_data *md=(struct mob_data *)bl;
-		if( md->master_id>0 )
-			return -md->master_id;
-		return -md->bl.id;
-	}
-	else if(bl->type==BL_SKILL && (struct skill_unit *)bl)
-		return ((struct skill_unit *)bl)->group->party_id;
-	else
-		return 0;
-}
-int status_get_guild_id(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data *)bl)->status.guild_id;
-	else if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data *)bl)->class_;
-	else if(bl->type==BL_SKILL && (struct skill_unit *)bl)
-		return ((struct skill_unit *)bl)->group->guild_id;
-	else
-		return 0;
-}
-int status_get_race(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return mob_db[((struct mob_data *)bl)->class_].race;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return 7;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return mob_db[((struct pet_data *)bl)->class_].race;
-	else
-		return 0;
-}
-int status_get_size(struct block_list *bl)
-{
-	nullpo_retr(1, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return mob_db[((struct mob_data *)bl)->class_].size;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return 1;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return mob_db[((struct pet_data *)bl)->class_].size;
-	else
-		return 1;
-}
-int status_get_mode(struct block_list *bl)
-{
-	nullpo_retr(0x01, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return mob_db[((struct mob_data *)bl)->class_].mode;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return mob_db[((struct pet_data *)bl)->class_].mode;
-	else
-		return 0x01;	// とりあえず動くということで1
-}
-
-int status_get_mexp(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return mob_db[((struct mob_data *)bl)->class_].mexp;
-	else if(bl->type==BL_PET && (struct pet_data *)bl)
-		return mob_db[((struct pet_data *)bl)->class_].mexp;
-	else
-		return 0;
-}
-
-// StatusChange系の所得
-struct status_change *status_get_sc_data(struct block_list *bl)
-{
-	nullpo_retr(NULL, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return ((struct mob_data*)bl)->sc_data;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return ((struct map_session_data*)bl)->sc_data;
-	return NULL;
-}
-short *status_get_sc_count(struct block_list *bl)
-{
-	nullpo_retr(NULL, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return &((struct mob_data*)bl)->sc_count;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return &((struct map_session_data*)bl)->sc_count;
-	return NULL;
-}
-short *status_get_opt1(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return &((struct mob_data*)bl)->opt1;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return &((struct map_session_data*)bl)->opt1;
-	else if(bl->type==BL_NPC && (struct npc_data *)bl)
-		return &((struct npc_data*)bl)->opt1;
-	return 0;
-}
-short *status_get_opt2(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return &((struct mob_data*)bl)->opt2;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return &((struct map_session_data*)bl)->opt2;
-	else if(bl->type==BL_NPC && (struct npc_data *)bl)
-		return &((struct npc_data*)bl)->opt2;
-	return 0;
-}
-short *status_get_opt3(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return &((struct mob_data*)bl)->opt3;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return &((struct map_session_data*)bl)->opt3;
-	else if(bl->type==BL_NPC && (struct npc_data *)bl)
-		return &((struct npc_data*)bl)->opt3;
-	return 0;
-}
-short *status_get_option(struct block_list *bl)
-{
-	nullpo_retr(0, bl);
-	if(bl->type==BL_MOB && (struct mob_data *)bl)
-		return &((struct mob_data*)bl)->option;
-	else if(bl->type==BL_PC && (struct map_session_data *)bl)
-		return &((struct map_session_data*)bl)->status.option;
-	else if(bl->type==BL_NPC && (struct npc_data *)bl)
-		return &((struct npc_data*)bl)->option;
-	return 0;
-}
-
-int status_get_sc_def(struct block_list *bl, int type)
-{
-	int sc_def;
-	nullpo_retr(0, bl);
-	
-	switch (type)
-	{
-	case SP_MDEF1:	// mdef
-		sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
-		break;
-	case SP_MDEF2:	// int
-		sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
-		break;
-	case SP_DEF1:	// def
-		sc_def = 100 - (3 + status_get_def(bl) + status_get_luk(bl)/3);
-		break;
-	case SP_DEF2:	// vit
-		sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
-		break;
-	case SP_LUK:	// luck
-		sc_def = 100 - (3 + status_get_luk(bl));
-		break;
-
-	case SC_STONE:
-	case SC_FREEZE:
-		sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
-		break;
-	case SC_STAN:
-	case SC_POISON:
-	case SC_SILENCE:
-		sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
-		break;	
-	case SC_SLEEP:
-	case SC_CONFUSION:
-	case SC_BLIND:
-		sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
-		break;
-	case SC_CURSE:
-		sc_def = 100 - (3 + status_get_luk(bl));
-		break;	
-
-	default:
-		sc_def = 100;
-		break;
-	}
-
-	if(bl->type == BL_MOB && sc_def < 50)
-		sc_def = 50;
-	else if(bl->type == BL_PC) {
-		struct status_change* sc_data = status_get_sc_data(bl);
-		if (sc_data && sc_data[SC_GOSPEL].timer != -1 &&
-			sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
-			sc_data[SC_GOSPEL].val3 == 3)
-			sc_def -= 25;
-	}
-
-	return (sc_def < 0) ? 0 : sc_def;
-}
-
-/*==========================================
- * ステータス異常開始
- *------------------------------------------
- */
-int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag)
-{
-	struct map_session_data *sd = NULL;
-	struct status_change* sc_data;
-	short *sc_count, *option, *opt1, *opt2, *opt3;
-	int opt_flag = 0, calc_flag = 0,updateflag = 0, save_flag = 0, race, mode, elem, undead_flag;
-	int scdef=0;
-
-	nullpo_retr(0, bl);
-	if(bl->type == BL_SKILL)
-		return 0;
-	nullpo_retr(0, sc_data=status_get_sc_data(bl));
-	nullpo_retr(0, sc_count=status_get_sc_count(bl));
-	nullpo_retr(0, option=status_get_option(bl));
-	nullpo_retr(0, opt1=status_get_opt1(bl));
-	nullpo_retr(0, opt2=status_get_opt2(bl));
-	nullpo_retr(0, opt3=status_get_opt3(bl));
-
-
-	race=status_get_race(bl);
-	mode=status_get_mode(bl);
-	elem=status_get_elem_type(bl);
-	undead_flag=battle_check_undead(race,elem);
-
-	if(type == SC_AETERNA && (sc_data[SC_STONE].timer != -1 || sc_data[SC_FREEZE].timer != -1) )
-		return 0;
-
-	switch(type){
-		case SC_STONE:
-		case SC_FREEZE:
-			scdef=3+status_get_mdef(bl)+status_get_luk(bl)/3;
-			break;
-		case SC_STAN:
-		case SC_SILENCE:
-		case SC_POISON:
-		case SC_DPOISON:
-			scdef=3+status_get_vit(bl)+status_get_luk(bl)/3;
-			break;
-		case SC_SLEEP:
-		case SC_BLIND:
-			scdef=3+status_get_int(bl)+status_get_luk(bl)/3;
-			break;
-		case SC_CURSE:
-			scdef=3+status_get_luk(bl);
-			break;
-
-//		case SC_CONFUSION:
-		default:
-			scdef=0;
-	}
-	if(scdef>=100)
-		return 0;
-	if(bl->type==BL_PC){
-		sd=(struct map_session_data *)bl;
-		if( sd && type == SC_ADRENALINE && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
-			return 0;
-
-		if(SC_STONE<=type && type<=SC_BLIND){	/* カ?ドによる耐性 */
-			if( sd && sd->reseff[type-SC_STONE] > 0 && rand()%10000<sd->reseff[type-SC_STONE]){
-				if(battle_config.battle_log)
-					printf("PC %d skill_sc_start: cardによる異常耐性?動\n",sd->bl.id);
-				return 0;
-			}
-		}
-	}
-	else if(bl->type == BL_MOB) {
-	}
-	else {
-		if(battle_config.error_log)
-			printf("status_change_start: neither MOB nor PC !\n");
-		return 0;
-	}
-
-	if(type==SC_FREEZE && undead_flag && !(flag&1))
-		return 0;
-
-	if((type == SC_ADRENALINE || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) &&
-		sc_data[type].timer != -1 && sc_data[type].val2 && !val2)
-		return 0;
-
-	if(mode & 0x20 && (type==SC_STONE || type==SC_FREEZE ||
-		type==SC_STAN || type==SC_SLEEP || type==SC_SILENCE || type==SC_QUAGMIRE || type == SC_DECREASEAGI || type == SC_SIGNUMCRUCIS || type == SC_PROVOKE ||
-		(type == SC_BLESSING && (undead_flag || race == 6))) && !(flag&1)){
-		/* ボスには?かない(ただしカ?ドによる?果は適用される) */
-		return 0;
-	}
-	if(type==SC_FREEZE || type==SC_STAN || type==SC_SLEEP)
-		battle_stopwalking(bl,1);
-
-	if(sc_data[type].timer != -1){	/* すでに同じ異常になっている場合タイマ解除 */
-		if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION &&
-			type != SC_SPEEDPOTION0 && type != SC_SPEEDPOTION1 && type != SC_SPEEDPOTION2 && type != SC_SPEEDPOTION3
-						 && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris]
-			return 0;
-		if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON)
-			return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */
-		if(type == SC_GRAFFITI){	//異常中にもう一度?態異常になった時に解除してから再度かかる
-			status_change_end(bl,type,-1);
-		} else {
-			(*sc_count)--;
-			delete_timer(sc_data[type].timer, status_change_timer);
-			sc_data[type].timer = -1;
-		}
-	}
-
-	switch(type){	/* 異常の種類ごとの?理 */
-		case SC_PROVOKE:			/* プロボック */
-			calc_flag = 1;
-			if(tick <= 0) tick = 1000;	/* (オ?トバ?サ?ク) */
-			break;
-		case SC_ENDURE:				/* インデュア */
-			if(tick <= 0) tick = 1000 * 60;
-			calc_flag = 1; // for updating mdef
-			val2 = 7; // [Celest]
-			break;
-		case SC_AUTOBERSERK:
-			{
-				tick = 60*1000;
-				if (bl->type == BL_PC && sd->status.hp<sd->status.max_hp>>2 &&
-					(sc_data[SC_PROVOKE].timer==-1 || sc_data[SC_PROVOKE].val2==0))
-					status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0);
-			}
-			break;
-		case SC_CONCENTRATE:		/* 集中力向上 */
-			calc_flag = 1;
-			break;
-		case SC_BLESSING:			/* ブレッシング */
-			{
-				if(bl->type == BL_PC || (!undead_flag && race != 6)) {
-					if(sc_data[SC_CURSE].timer!=-1 )
-						status_change_end(bl,SC_CURSE,-1);
-					if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0)
-						status_change_end(bl,SC_STONE,-1);
-				}
-				calc_flag = 1;
-			}
-			break;
-		case SC_ANGELUS:			/* アンゼルス */
-			calc_flag = 1;
-			break;
-		case SC_INCREASEAGI:		/* 速度上昇 */
-			calc_flag = 1;
-			if(sc_data[SC_DECREASEAGI].timer!=-1 )
-				status_change_end(bl,SC_DECREASEAGI,-1);
-			// the effect will still remain [celest]
-//			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
-//				status_change_end(bl,SC_WINDWALK,-1);
-			break;
-		case SC_DECREASEAGI:		/* 速度減少 */
-			if (bl->type == BL_PC)	// Celest
-				tick>>=1;
-			calc_flag = 1;
-			if(sc_data[SC_INCREASEAGI].timer!=-1 )
-				status_change_end(bl,SC_INCREASEAGI,-1);
-			if(sc_data[SC_ADRENALINE].timer!=-1 )
-				status_change_end(bl,SC_ADRENALINE,-1);
-			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_SPEARSQUICKEN,-1);
-			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
-			break;
-		case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
-			calc_flag = 1;
-//			val2 = 14 + val1;
-			val2 = 10 + val1*2;
-			tick = 600*1000;
-			clif_emotion(bl,4);
-			break;
-		case SC_SLOWPOISON:
-			if (sc_data[SC_POISON].timer == -1 && sc_data[SC_DPOISON].timer == -1)
-				return 0;
-			break;
-		case SC_TWOHANDQUICKEN:		/* 2HQ */
-			if(sc_data[SC_DECREASEAGI].timer!=-1)
-				return 0;
-			*opt3 |= 1;
-			calc_flag = 1;
-			break;
-		case SC_ADRENALINE:			/* アドレナリンラッシュ */
-			if(sc_data[SC_DECREASEAGI].timer!=-1)
-				return 0;
-			calc_flag = 1;
-			break;
-		case SC_WEAPONPERFECTION:	/* ウェポンパ?フェクション */
-			// Lasting time penalties have been removed on sakray as of 12/14 [celest]
-			//if(battle_config.party_skill_penalty && !val2) tick /= 5;
-			break;
-		case SC_OVERTHRUST:			/* オ?バ?スラスト */
-			*opt3 |= 2;
-			// Lasting time penalties have been removed on sakray as of 12/14 [celest]
-			//if(battle_config.party_skill_penalty && !val2) tick /= 10;
-			break;
-		case SC_MAXIMIZEPOWER:		/* マキシマイズパワ?(SPが1減る時間,val2にも) */
-			if(bl->type == BL_PC)
-				val2 = tick;
-			else
-				tick = 5000*val1;
-			break;
-		case SC_ENCPOISON:			/* エンチャントポイズン */
-			calc_flag = 1;
-			val2=(((val1 - 1) / 2) + 3)*100;	/* 毒付?確率 */
-			skill_encchant_eremental_end(bl,SC_ENCPOISON);
-			break;
-		case SC_EDP:	// [Celest]
-			val2 = val1 + 2;			/* 猛毒付?確率(%) */
-			calc_flag = 1;
-			break;
-		case SC_POISONREACT:	/* ポイズンリアクト */
-			val2=val1/2 + val1%2; // [Celest]
-			break;
-		case SC_IMPOSITIO:			/* インポシティオマヌス */
-			calc_flag = 1;
-			break;
-		case SC_ASPERSIO:			/* アスペルシオ */
-			skill_encchant_eremental_end(bl,SC_ASPERSIO);
-			break;
-		case SC_SUFFRAGIUM:			/* サフラギム */
-		case SC_BENEDICTIO:			/* 聖? */
-		case SC_MAGNIFICAT:			/* マグニフィカ?ト */
-		case SC_AETERNA:			/* エ?テルナ */
-			break;
-		case SC_ENERGYCOAT:			/* エナジ?コ?ト */
-			*opt3 |= 4;
-			break;
-		case SC_MAGICROD:
-			val2 = val1*20;
-			break;
-		case SC_KYRIE:				/* キリエエレイソン */
-			val2 = status_get_max_hp(bl) * (val1 * 2 + 10) / 100;/* 耐久度 */
-			val3 = (val1 / 2 + 5);	/* 回? */
-// -- moonsoul (added to undo assumptio status if target has it)
-			if(sc_data[SC_ASSUMPTIO].timer!=-1 )
-				status_change_end(bl,SC_ASSUMPTIO,-1);
-			break;
-		case SC_MINDBREAKER:
-			calc_flag = 1;
-			if(tick <= 0) tick = 1000;	/* (オ?トバ?サ?ク) */
-		case SC_GLORIA:				/* グロリア */
-			calc_flag = 1;
-			break;
-		case SC_LOUD:				/* ラウドボイス */
-			calc_flag = 1;
-			break;
-		case SC_TRICKDEAD:			/* 死んだふり */
-			if (bl->type == BL_PC) {
-				pc_stopattack((struct map_session_data *)sd);
-			}
-			break;
-		case SC_QUAGMIRE:			/* クァグマイア */
-			calc_flag = 1;
-			if(sc_data[SC_CONCENTRATE].timer!=-1 )	/* 集中力向上解除 */
-				status_change_end(bl,SC_CONCENTRATE,-1);
-			if(sc_data[SC_INCREASEAGI].timer!=-1 )	/* 速度上昇解除 */
-				status_change_end(bl,SC_INCREASEAGI,-1);
-			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
-			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_SPEARSQUICKEN,-1);
-			if(sc_data[SC_ADRENALINE].timer!=-1 )
-				status_change_end(bl,SC_ADRENALINE,-1);
-			if(sc_data[SC_LOUD].timer!=-1 )
-				status_change_end(bl,SC_LOUD,-1);
-			if(sc_data[SC_TRUESIGHT].timer!=-1 )	/* トゥル?サイト */
-				status_change_end(bl,SC_TRUESIGHT,-1);
-			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
-				status_change_end(bl,SC_WINDWALK,-1);
-			if(sc_data[SC_CARTBOOST].timer!=-1 )	/* カ?トブ?スト */
-				status_change_end(bl,SC_CARTBOOST,-1);
-			break;
-		case SC_MAGICPOWER:
-			calc_flag = 1;
-			val2 = 1;
-			break;
-		case SC_SACRIFICE:
-			val2 = 5;
-			break;
-		case SC_FLAMELAUNCHER:		/* フレ?ムランチャ? */
-			skill_encchant_eremental_end(bl,SC_FLAMELAUNCHER);
-			break;
-		case SC_FROSTWEAPON:		/* フロストウェポン */
-			skill_encchant_eremental_end(bl,SC_FROSTWEAPON);
-			break;
-		case SC_LIGHTNINGLOADER:	/* ライトニングロ?ダ? */
-			skill_encchant_eremental_end(bl,SC_LIGHTNINGLOADER);
-			break;
-		case SC_SEISMICWEAPON:		/* サイズミックウェポン */
-			skill_encchant_eremental_end(bl,SC_SEISMICWEAPON);
-			break;
-		case SC_DEVOTION:			/* ディボ?ション */
-			calc_flag = 1;
-			break;
-		case SC_PROVIDENCE:			/* プロヴィデンス */
-			calc_flag = 1;
-			val2=val1*5;
-			break;
-		case SC_REFLECTSHIELD:
-			val2=10+val1*3;
-			break;
-		case SC_STRIPWEAPON:
-			if (val2==0) val2=90;
-			break;
-		case SC_STRIPSHIELD:
-			if (val2==0) val2=85;
-			break;
-		case SC_STRIPARMOR:
-		case SC_STRIPHELM:
-		case SC_CP_WEAPON:
-		case SC_CP_SHIELD:
-		case SC_CP_ARMOR:
-		case SC_CP_HELM:
-			break;
-
-		case SC_AUTOSPELL:			/* オ?トスペル */
-			val4 = 5 + val1*2;
-			break;
-
-		case SC_VOLCANO:
-			calc_flag = 1;
-			val3 = val1*10;
-			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
-			break;
-		case SC_DELUGE:
-			calc_flag = 1;
-			val3 = val1>=5?15: (val1==4?14: (val1==3?12: ( val1==2?9:5 ) ) );
-			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
-			break;
-		case SC_VIOLENTGALE:
-			calc_flag = 1;
-			val3 = val1*3;
-			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
-			break;
-
-		case SC_SPEARSQUICKEN:		/* スピアクイッケン */
-			calc_flag = 1;
-			val2 = 20+val1;
-			*opt3 |= 1;
-			break;
-		case SC_COMBO:
-			break;
-		case SC_BLADESTOP_WAIT:		/* 白刃取り(待ち) */
-			break;
-		case SC_BLADESTOP:		/* 白刃取り */
-			if(val2==2) clif_bladestop((struct block_list *)val3,(struct block_list *)val4,1);
-			*opt3 |= 32;
-			break;
-
-		case SC_LULLABY:			/* 子守唄 */
-			val2 = 11;
-			break;
-		case SC_RICHMANKIM:
-			break;
-		case SC_ETERNALCHAOS:		/* エタ?ナルカオス */
-			calc_flag = 1;
-			break;
-		case SC_DRUMBATTLE:			/* ?太鼓の響き */
-			calc_flag = 1;
-			val2 = (val1+1)*25;
-			val3 = (val1+1)*2;
-			break;
-		case SC_NIBELUNGEN:			/* ニ?ベルングの指輪 */
-			calc_flag = 1;
-			//val2 = (val1+2)*50;
-			val3 = (val1+2)*25;
-			break;
-		case SC_ROKISWEIL:			/* ロキの叫び */
-			break;
-		case SC_INTOABYSS:			/* 深淵の中に */
-			break;
-		case SC_SIEGFRIED:			/* 不死身のジ?クフリ?ド */
-			calc_flag = 1;
-			val2 = 55 + val1*5;
-			val3 = val1*10;
-			break;
-		case SC_DISSONANCE:			/* 不協和音 */
-			val2 = 10;
-			break;
-		case SC_WHISTLE:			/* 口笛 */
-			calc_flag = 1;
-			break;
-		case SC_ASSNCROS:			/* 夕陽のアサシンクロス */
-			calc_flag = 1;
-			break;
-		case SC_POEMBRAGI:			/* ブラギの詩 */
-			break;
-		case SC_APPLEIDUN:			/* イドゥンの林檎 */
-			calc_flag = 1;
-			break;
-		case SC_UGLYDANCE:			/* 自分勝手なダンス */
-			val2 = 10;
-			break;
-		case SC_HUMMING:			/* ハミング */
-			calc_flag = 1;
-			break;
-		case SC_DONTFORGETME:		/* 私を忘れないで */
-			calc_flag = 1;
-			if(sc_data[SC_INCREASEAGI].timer!=-1 )	/* 速度上昇解除 */
-				status_change_end(bl,SC_INCREASEAGI,-1);
-			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
-			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
-				status_change_end(bl,SC_SPEARSQUICKEN,-1);
-			if(sc_data[SC_ADRENALINE].timer!=-1 )
-				status_change_end(bl,SC_ADRENALINE,-1);
-			if(sc_data[SC_ASSNCROS].timer!=-1 )
-				status_change_end(bl,SC_ASSNCROS,-1);
-			if(sc_data[SC_TRUESIGHT].timer!=-1 )	/* トゥル?サイト */
-				status_change_end(bl,SC_TRUESIGHT,-1);
-			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
-				status_change_end(bl,SC_WINDWALK,-1);
-			if(sc_data[SC_CARTBOOST].timer!=-1 )	/* カ?トブ?スト */
-				status_change_end(bl,SC_CARTBOOST,-1);
-			break;
-		case SC_FORTUNE:			/* 幸運のキス */
-			calc_flag = 1;
-			break;
-		case SC_SERVICE4U:			/* サ?ビスフォ?ユ? */
-			calc_flag = 1;
-			break;
-		case SC_MOONLIT:
-			val2 = bl->id;
-			break;
-		case SC_DANCING:			/* ダンス/演奏中 */
-			calc_flag = 1;
-			val3= tick / 1000;
-			tick = 1000;
-			break;
-
-		case SC_EXPLOSIONSPIRITS:	// 爆裂波動
-			calc_flag = 1;
-			val2 = 75 + 25*val1;
-			*opt3 |= 8;
-			break;
-		case SC_STEELBODY:			// 金剛
-			calc_flag = 1;
-			*opt3 |= 16;
-			break;
-		case SC_EXTREMITYFIST:		/* 阿修羅覇凰拳 */
-			break;
-		case SC_AUTOCOUNTER:
-			val3 = val4 = 0;
-			break;
-
-		case SC_SPEEDPOTION0:		/* ?速ポ?ション */
-		case SC_SPEEDPOTION1:
-		case SC_SPEEDPOTION2:
-		case SC_SPEEDPOTION3:
-			calc_flag = 1;
-			tick = 1000 * tick;
-			val2 = 5*(2+type-SC_SPEEDPOTION0);
-			break;
-
-		/* atk & matk potions [Valaris] */
-		case SC_ATKPOT:
-		case SC_MATKPOT:
-			calc_flag = 1;
-			tick = 1000 * tick;
-			break;
-		case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
-			{
-				time_t timer;
-
-				calc_flag = 1;
-				tick = 10000;
-				if(!val2)
-					val2 = time(&timer);
-			}
-			break;
-		case SC_NOCHAT:	//チャット禁止?態
-			{
-				time_t timer;
-
-				if(!battle_config.muting_players)
-					break;
-
-				tick = 60000;
-				if(!val2)
-					val2 = time(&timer);
-				updateflag = SP_MANNER;
-				save_flag = 1; // celest
-			}
-			break;
-		case SC_SELFDESTRUCTION: //自爆
-			clif_skillcasting(bl,bl->id, bl->id,0,0,331,skill_get_time(val2,val1));
-			val3 = tick / 1000;
-			tick = 1000;
-			break;
-
-		/* option1 */
-		case SC_STONE:				/* 石化 */
-			if(!(flag&2)) {
-				int sc_def = status_get_mdef(bl)*200;
-				tick = tick - sc_def;
-			}
-			val3 = tick/1000;
-			if(val3 < 1) val3 = 1;
-			tick = 5000;
-			val2 = 1;
-			break;
-		case SC_SLEEP:				/* 睡眠 */
-			if(!(flag&2)) {
-//				int sc_def = 100 - (status_get_int(bl) + status_get_luk(bl)/3);
-//				tick = tick * sc_def / 100;
-//				if(tick < 1000) tick = 1000;
-				tick = 30000;//睡眠はステ?タス耐性に?わらず30秒
-			}
-			break;
-		case SC_FREEZE:				/* 凍結 */
-			if(!(flag&2)) {
-				int sc_def = 100 - status_get_mdef(bl);
-				tick = tick * sc_def / 100;
-			}
-			break;
-		case SC_STAN:				/* スタン(val2にミリ秒セット) */
-			if(!(flag&2)) {
-				int sc_def = status_get_sc_def_vit(bl);
-				tick = tick * sc_def / 100;
-			}
-			break;
-
-			/* option2 */
-		case SC_DPOISON:			/* 猛毒 */
-		{
-			int mhp = status_get_max_hp(bl);
-			int hp = status_get_hp(bl);
-			// MHP?1/4????????
-			if (hp > mhp>>2) {
-				if(bl->type == BL_PC) {
-					int diff = mhp*10/100;
-					if (hp - diff < mhp>>2)
-						hp = hp - (mhp>>2);
-					pc_heal((struct map_session_data *)bl, -hp, 0);
-				} else if(bl->type == BL_MOB) {
-					struct mob_data *md = (struct mob_data *)bl;
-					hp -= mhp*15/100;
-					if (hp > mhp>>2)
-						md->hp = hp;
-					else
-						md->hp = mhp>>2;
-				}
-			}
-		}	// fall through
-		case SC_POISON:				/* 毒 */
-			calc_flag = 1;
-			if(!(flag&2)) {
-				int sc_def = 100 - (status_get_vit(bl) + status_get_luk(bl)/5);
-				tick = tick * sc_def / 100;
-			}
-			val3 = tick/1000;
-			if(val3 < 1) val3 = 1;
-			tick = 1000;
-			break;
-		case SC_SILENCE:			/* 沈?(レックスデビ?ナ) */
-			if(!(flag&2)) {
-				int sc_def = 100 - status_get_vit(bl);
-				tick = tick * sc_def / 100;
-			}
-			break;
-		case SC_CONFUSION:
-			val2 = tick;
-			tick = 100;
-			clif_emotion(bl,1);
-			if (sd) {
-				pc_stop_walking (sd, 0);
-			}
-			break;
-		case SC_BLIND:				/* 暗? */
-			calc_flag = 1;
-			if(!(flag&2)) {
-				int sc_def = status_get_lv(bl)/10 + status_get_int(bl)/15;
-				tick = 30000 - sc_def;
-			}
-			break;
-		case SC_CURSE:
-			calc_flag = 1;
-			if(!(flag&2)) {
-				int sc_def = 100 - status_get_vit(bl);
-				tick = tick * sc_def / 100;
-			}
-			break;
-
-		/* option */
-		case SC_HIDING:		/* ハイディング */
-			calc_flag = 1;
-			if(bl->type == BL_PC) {
-				val2 = tick / 1000;		/* 持?時間 */
-				tick = 1000;
-			}
-			break;
-		case SC_CHASEWALK:
-		case SC_CLOAKING:		/* クロ?キング */
-			if(bl->type == BL_PC) {
-				calc_flag = 1; // [Celest]
-				val2 = tick;
-				val3 = type==SC_CLOAKING ? 130-val1*3 : 135-val1*5;
-			}
-			else
-				tick = 5000*val1;
-			break;
-		case SC_SIGHT:			/* サイト/ルアフ */
-		case SC_RUWACH:
-			val2 = tick/250;
-			tick = 10;
-			break;
-
-		/* セ?フティウォ?ル、ニュ?マ */
-		case SC_SAFETYWALL:	case SC_PNEUMA:
-			tick=((struct skill_unit *)val2)->group->limit;
-			break;
-
-		/* アンクル */
-		case SC_ANKLE:
-			break;
-
-		/* ウォ?タ?ボ?ル */
-		case SC_WATERBALL:
-			tick=150;
-			if(val1>5) //レベルが5以上の場合は25?に制限(1?目はすでに打ってるので-1)
-				val3=5*5-1;
-			else
-				val3= (val1|1)*(val1|1)-1;
-			break;
-
-		/* スキルじゃない/時間に?係しない */
-		case SC_RIDING:
-			calc_flag = 1;
-			tick = 600*1000;
-			break;
-		case SC_FALCON:
-		case SC_WEIGHT50:
-		case SC_WEIGHT90:
-		case SC_BROKNWEAPON:
-		case SC_BROKNARMOR:
-			tick=600*1000;
-			break;
-
-		case SC_AUTOGUARD:
-			{
-				int i,t;
-				for(i=val2=0;i<val1;i++) {
-					t = 5-(i>>1);
-					val2 += (t < 0)? 1:t;
-				}
-			}
-			break;
-
-		case SC_DEFENDER:
-			calc_flag = 1;
-			val2 = 5 + val1*15;
-			break;
-
-		case SC_KEEPING:
-		case SC_BARRIER:
-			calc_flag = 1;
-
-		case SC_HALLUCINATION:
-			break;
-
-		case SC_CONCENTRATION:	/* コンセントレ?ション */
-			*opt3 |= 1;
-			calc_flag = 1;
-			break;
-
-		case SC_TENSIONRELAX:	/* テンションリラックス */
-			calc_flag = 1;
-			if(bl->type == BL_PC) {
-				tick = 10000;
-			}
-			break;
-
-		case SC_AURABLADE:		/* オ?ラブレ?ド */
-		case SC_PARRYING:		/* パリイング */
-//		case SC_ASSUMPTIO:		/*  */
-		case SC_HEADCRUSH:		/* ヘッドクラッシュ */
-//		case SC_JOINTBEAT:		/* ジョイントビ?ト */
-//		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
-
-			//とりあえず手?き
-			break;
-
-// -- moonsoul	(for new upper class related skill status effects)
-/*
-		case SC_AURABLADE:
-			val2 = val1*10;
-			break;
-		case SC_PARRYING:
-			val2=val1*3;
-			break;
-		case SC_CONCENTRATION:
-			calc_flag=1;
-			val2=val1*10;
-			val3=val1*5;
-			break;
-		case SC_TENSIONRELAX:
-//			val2 = 10;
-//			val3 = 15;
-			break;
-		case SC_BERSERK:
-			calc_flag=1;
-			break;
-		case SC_ASSUMPTIO:
-			if(sc_data[SC_KYRIE].timer!=-1 )
-				status_change_end(bl,SC_KYRIE,-1);
-				break;*/
-
-		case SC_WINDWALK:		/* ウインドウォ?ク */
-			calc_flag = 1;
-			val2 = (val1 / 2); //Flee上昇率
-			break;
-		
-		case SC_JOINTBEAT: // Random break [DracoRPG]
-			calc_flag = 1;
-			val2 = rand()%6 + 1;
-			if (val2 == 6) status_change_start(bl,SC_BLEEDING,val1,0,0,0,skill_get_time2(type,val1),0);
-			break;
-
-		case SC_BERSERK:		/* バ?サ?ク */
-			if(sd){
-				sd->status.hp = sd->status.max_hp * 3;
-				sd->status.sp = 0;
-				clif_updatestatus(sd,SP_HP);
-				clif_updatestatus(sd,SP_SP);
-				clif_status_change(bl,SC_INCREASEAGI,1);	/* アイコン表示 */
-				sd->canregen_tick = gettick() + 300000;
-			}
-			*opt3 |= 128;
-			tick = 10000;
-			calc_flag = 1;
-			break;
-
-		case SC_ASSUMPTIO:		/* アスムプティオ */
-			if(sc_data[SC_KYRIE].timer!=-1 )
-				status_change_end(bl,SC_KYRIE,-1);
-				break;
-			*opt3 |= 2048;
-			break;
-
-		case SC_BASILICA: // [celest]
-			break;
-
-		case SC_GOSPEL:
-			if (val4 == BCT_SELF) {	// self effect
-				int i;
-				if (sd) {
-					sd->canact_tick += tick;
-					sd->canmove_tick += tick;
-				}
-				val2 = tick;
-				tick = 1000;
-				for (i=0; i<=26; i++) {
-					if(sc_data[i].timer!=-1)
-						status_change_end(bl,i,-1);
-				}
-				for (i=58; i<=62; i++) {
-					if(sc_data[i].timer!=-1)
-						status_change_end(bl,i,-1);
-				}
-				for (i=132; i<=136; i++) {
-					if(sc_data[i].timer!=-1)
-						status_change_end(bl,i,-1);
-				}
-			}
-			break;
-
-		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
-		case SC_MARIONETTE2:
-			val2 = tick;
-			if (!val3)
-				return 0;
-			tick = 1000;
-			calc_flag = 1;
-			*opt3 |= 1024;
-			break;
-
-		case SC_MELTDOWN:		/* メルトダウン */
-		case SC_CARTBOOST:		/* カ?トブ?スト */
-		case SC_TRUESIGHT:		/* トゥル?サイト */
-		case SC_SPIDERWEB:		/* スパイダ?ウェッブ */
-			calc_flag = 1;
-			break;
-
-		case SC_REJECTSWORD:	/* リジェクトソ?ド */
-			val2 = 3; //3回攻?を跳ね返す
-			break;
-
-		case SC_MEMORIZE:		/* メモライズ */
-			val2 = 3; //3回詠唱を1/3にする
-			break;
-
-		case SC_GRAFFITI:		/* グラフィティ */
-			{
-				struct skill_unit_group *sg = skill_unitsetting(bl,RG_GRAFFITI,val1,val2,val3,0);
-				if(sg)
-					val4 = (int)sg;
-			}
-			break;
-
-		case SC_SPLASHER:		/* ベナムスプラッシャ? */
-			break;
-
-		case SC_FOGWALL:
-			val2 = 75;
-			// calc_flag = 1;	// not sure of effects yet [celest]
-			break;
-
-		case SC_PRESERVE:
-			break;
-
-		case SC_BLOCKSKILL:
-			if (!tick) tick = 60000;
-			if (!val3) val3 = -1;
-			break;
-
-		case SC_SLOWDOWN:
-		case SC_SPEEDUP0:
-			calc_flag = 1;
-			break;
-
-		case SC_REGENERATION:
-			val1 = 2;
-		case SC_BATTLEORDERS:
-			tick = 60000; // 1 minute
-			calc_flag = 1;
-			break;
-
-		default:
-			if(battle_config.error_log)
-				printf("UnknownStatusChange [%d]\n", type);
-			return 0;
-	}
-
-	if(bl->type==BL_PC &&
-		(type<SC_SENDMAX || type==SC_PRESERVE || type==SC_BATTLEORDERS))
-		clif_status_change(bl,type,1);	/* アイコン表示 */
-
-	/* optionの?更 */
-	switch(type){
-		case SC_STONE:
-		case SC_FREEZE:
-		case SC_STAN:
-		case SC_SLEEP:
-			battle_stopattack(bl);	/* 攻?停止 */
-			skill_stop_dancing(bl,0);	/* 演奏/ダンスの中? */
-			{	/* 同時に掛からないステ?タス異常を解除 */
-				int i;
-				for(i = SC_STONE; i <= SC_SLEEP; i++){
-					if(sc_data[i].timer != -1){
-						(*sc_count)--;
-						delete_timer(sc_data[i].timer, status_change_timer);
-						sc_data[i].timer = -1;
-					}
-				}
-			}
-			if(type == SC_STONE)
-				*opt1 = 6;
-			else
-				*opt1 = type - SC_STONE + 1;
-			opt_flag = 1;
-			break;
-		case SC_POISON:
-		case SC_CURSE:
-		case SC_SILENCE:
-		case SC_BLIND:
-			*opt2 |= 1<<(type-SC_POISON);
-			opt_flag = 1;
-			break;
-		case SC_DPOISON:	// 暫定で毒のエフェクトを使用
-			*opt2 |= 1;
-			opt_flag = 1;
-			break;
-		case SC_SIGNUMCRUCIS:
-			*opt2 |= 0x40;
-			opt_flag = 1;
-			break;
-		case SC_HIDING:
-		case SC_CLOAKING:
-			battle_stopattack(bl);	/* 攻?停止 */
-			*option |= ((type==SC_HIDING)?2:4);
-			opt_flag =1 ;
-			break;
-		case SC_CHASEWALK:
-			battle_stopattack(bl);	/* 攻?停止 */
-			*option |= 16388;
-			opt_flag =1 ;
-			break;
-		case SC_SIGHT:
-			*option |= 1;
-			opt_flag = 1;
-			break;
-		case SC_RUWACH:
-			*option |= 8192;
-			opt_flag = 1;
-			break;
-		case SC_WEDDING:
-			*option |= 4096;
-			opt_flag = 1;
-	}
-
-	if(opt_flag)	/* optionの?更 */
-		clif_changeoption(bl);
-
-	(*sc_count)++;	/* ステ?タス異常の? */
-
-	sc_data[type].val1 = val1;
-	sc_data[type].val2 = val2;
-	sc_data[type].val3 = val3;
-	sc_data[type].val4 = val4;
-	/* タイマ?設定 */
-	sc_data[type].timer = add_timer(
-		gettick() + tick, status_change_timer, bl->id, type);
-
-	if(bl->type==BL_PC && calc_flag)
-		status_calc_pc(sd,0);	/* ステ?タス再計算 */
-
-	if(bl->type==BL_PC && save_flag)
-		chrif_save(sd); // save the player status
-
-	if(bl->type==BL_PC && updateflag)
-		clif_updatestatus(sd,updateflag);	/* ステ?タスをクライアントに送る */
-
-	return 0;
-}
-/*==========================================
- * ステータス異常全解除
- *------------------------------------------
- */
-int status_change_clear(struct block_list *bl,int type)
-{
-	struct status_change* sc_data;
-	short *sc_count, *option, *opt1, *opt2, *opt3;
-	int i;
-
-	nullpo_retr(0, bl);
-	nullpo_retr(0, sc_data = status_get_sc_data(bl));
-	nullpo_retr(0, sc_count = status_get_sc_count(bl));
-	nullpo_retr(0, option = status_get_option(bl));
-	nullpo_retr(0, opt1 = status_get_opt1(bl));
-	nullpo_retr(0, opt2 = status_get_opt2(bl));
-	nullpo_retr(0, opt3 = status_get_opt3(bl));
-
-	if (*sc_count == 0)
-		return 0;
-	for(i = 0; i < MAX_STATUSCHANGE; i++){
-		if(sc_data[i].timer != -1){	/* 異常があるならタイマ?を削除する */
-			status_change_end(bl, i, -1);
-		}
-	}
-	*sc_count = 0;
-	*opt1 = 0;
-	*opt2 = 0;
-	*opt3 = 0;
-	*option &= OPTION_MASK;
-
-	if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors && // by [Yor]
-		!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) // [celest]
-		*opt2 |= STATE_BLIND;
-
-	if(!type || type&2)
-		clif_changeoption(bl);
-
-	return 0;
-}
-
-/*==========================================
- * ステータス異常終了
- *------------------------------------------
- */
-int status_change_end( struct block_list* bl , int type,int tid )
-{
-	struct status_change* sc_data;
-	int opt_flag=0, calc_flag = 0;
-	short *sc_count, *option, *opt1, *opt2, *opt3;
-
-	nullpo_retr(0, bl);
-	if(bl->type!=BL_PC && bl->type!=BL_MOB) {
-		if(battle_config.error_log)
-			printf("status_change_end: neither MOB nor PC !\n");
-		return 0;
-	}
-	nullpo_retr(0, sc_data = status_get_sc_data(bl));
-	nullpo_retr(0, sc_count = status_get_sc_count(bl));
-	nullpo_retr(0, option = status_get_option(bl));
-	nullpo_retr(0, opt1 = status_get_opt1(bl));
-	nullpo_retr(0, opt2 = status_get_opt2(bl));
-	nullpo_retr(0, opt3 = status_get_opt3(bl));
-
-	if ((*sc_count) > 0 && sc_data[type].timer != -1 && (sc_data[type].timer == tid || tid == -1)) {
-
-		if (tid == -1)	// タイマから呼ばれていないならタイマ削除をする
-			delete_timer(sc_data[type].timer,status_change_timer);
-
-		/* 該?の異常を正常に?す */
-		sc_data[type].timer=-1;
-		(*sc_count)--;
-
-		switch(type){	/* 異常の種類ごとの?理 */
-			case SC_PROVOKE:			/* プロボック */
-			case SC_ENDURE: // celest
-			case SC_CONCENTRATE:		/* 集中力向上 */
-			case SC_BLESSING:			/* ブレッシング */
-			case SC_ANGELUS:			/* アンゼルス */
-			case SC_INCREASEAGI:		/* 速度上昇 */
-			case SC_DECREASEAGI:		/* 速度減少 */
-			case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
-			case SC_HIDING:
-			case SC_TWOHANDQUICKEN:		/* 2HQ */
-			case SC_ADRENALINE:			/* アドレナリンラッシュ */
-			case SC_ENCPOISON:			/* エンチャントポイズン */
-			case SC_IMPOSITIO:			/* インポシティオマヌス */
-			case SC_GLORIA:				/* グロリア */
-			case SC_LOUD:				/* ラウドボイス */
-			case SC_QUAGMIRE:			/* クァグマイア */
-			case SC_PROVIDENCE:			/* プロヴィデンス */
-			case SC_SPEARSQUICKEN:		/* スピアクイッケン */
-			case SC_VOLCANO:
-			case SC_DELUGE:
-			case SC_VIOLENTGALE:
-			case SC_ETERNALCHAOS:		/* エタ?ナルカオス */
-			case SC_DRUMBATTLE:			/* ?太鼓の響き */
-			case SC_NIBELUNGEN:			/* ニ?ベルングの指輪 */
-			case SC_SIEGFRIED:			/* 不死身のジ?クフリ?ド */
-			case SC_WHISTLE:			/* 口笛 */
-			case SC_ASSNCROS:			/* 夕陽のアサシンクロス */
-			case SC_HUMMING:			/* ハミング */
-			case SC_DONTFORGETME:		/* 私を忘れないで */
-			case SC_FORTUNE:			/* 幸運のキス */
-			case SC_SERVICE4U:			/* サ?ビスフォ?ユ? */
-			case SC_EXPLOSIONSPIRITS:	// 爆裂波動
-			case SC_STEELBODY:			// 金剛
-			case SC_DEFENDER:
-			case SC_SPEEDPOTION0:		/* ?速ポ?ション */
-			case SC_SPEEDPOTION1:
-			case SC_SPEEDPOTION2:
-			case SC_SPEEDPOTION3:
-			case SC_APPLEIDUN:			/* イドゥンの林檎 */
-			case SC_RIDING:
-			case SC_BLADESTOP_WAIT:
-			case SC_AURABLADE:			/* オ?ラブレ?ド */
-			case SC_PARRYING:			/* パリイング */
-			case SC_CONCENTRATION:		/* コンセントレ?ション */
-			case SC_TENSIONRELAX:		/* テンションリラックス */
-			case SC_ASSUMPTIO:			/* アシャンプティオ */
-			case SC_WINDWALK:		/* ウインドウォ?ク */
-			case SC_TRUESIGHT:		/* トゥル?サイト */
-			case SC_SPIDERWEB:		/* スパイダ?ウェッブ */
-			case SC_MAGICPOWER:		/* 魔法力?幅 */
-			case SC_CHASEWALK:
-			case SC_ATKPOT:		/* attack potion [Valaris] */
-			case SC_MATKPOT:		/* magic attack potion [Valaris] */
-			case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
-			case SC_MELTDOWN:		/* メルトダウン */
-			// Celest
-			case SC_EDP:
-			case SC_SLOWDOWN:
-			case SC_SPEEDUP0:
-/*			case SC_LEADERSHIP:
-			case SC_GLORYWOUNDS:
-			case SC_SOULCOLD:
-			case SC_HAWKEYES:*/
-			case SC_BATTLEORDERS:
-			case SC_REGENERATION:
-				calc_flag = 1;
-				break;
-			case SC_AUTOBERSERK:
-				if (sc_data[SC_PROVOKE].timer != -1)
-					status_change_end(bl,SC_PROVOKE,-1);
-				break;
-			case SC_BERSERK:			/* バ?サ?ク */
-				calc_flag = 1;
-				clif_status_change(bl,SC_INCREASEAGI,0);	/* アイコン消去 */
-				break;
-			case SC_DEVOTION:		/* ディボ?ション */
-				{
-					struct map_session_data *md = map_id2sd(sc_data[type].val1);
-					sc_data[type].val1=sc_data[type].val2=0;
-					skill_devotion(md,bl->id);
-					calc_flag = 1;
-				}
-				break;
-			case SC_BLADESTOP:
-				{
-					struct status_change *t_sc_data = status_get_sc_data((struct block_list *)sc_data[type].val4);
-					//片方が切れたので相手の白刃?態が切れてないのなら解除
-					if(t_sc_data && t_sc_data[SC_BLADESTOP].timer!=-1)
-						status_change_end((struct block_list *)sc_data[type].val4,SC_BLADESTOP,-1);
-
-					if(sc_data[type].val2==2)
-						clif_bladestop((struct block_list *)sc_data[type].val3,(struct block_list *)sc_data[type].val4,0);
-				}
-				break;
-			case SC_DANCING:
-				{
-					struct map_session_data *dsd;
-					struct status_change *d_sc_data;
-					if(sc_data[type].val4 && (dsd=map_id2sd(sc_data[type].val4))){
-						d_sc_data = dsd->sc_data;
-						//合奏で相手がいる場合相手のval4を0にする
-						if(d_sc_data && d_sc_data[type].timer!=-1)
-							d_sc_data[type].val4=0;
-					}
-				}
-				calc_flag = 1;
-				break;
-			case SC_GRAFFITI:
-				{
-					struct skill_unit_group *sg=(struct skill_unit_group *)sc_data[type].val4;	//val4がグラフィティのgroup_id
-					if(sg)
-						skill_delunitgroup(sg);
-				}
-				break;
-			case SC_NOCHAT:	//チャット禁止?態
-				{
-					struct map_session_data *sd=NULL;
-					if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){
-						if (sd->status.manner >= 0) // weeee ^^ [celest]
-							sd->status.manner = 0;
-						clif_updatestatus(sd,SP_MANNER);
-					}
-				}
-				break;
-			case SC_SPLASHER:		/* ベナムスプラッシャ? */
-				{
-					struct block_list *src=map_id2bl(sc_data[type].val3);
-					if(src && tid!=-1){
-						//自分にダメ?ジ&周?3*3にダメ?ジ
-						skill_castend_damage_id(src, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 );
-					}
-				}
-				break;
-			case SC_SELFDESTRUCTION:		/* 自爆 */
-				{
-					//自分のダメ?ジは0にして
-					struct mob_data *md=NULL;
-					if(bl->type == BL_MOB && (md=(struct mob_data*)bl))
-						skill_castend_damage_id(bl, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 );
-				}
-				break;
-		/* option1 */
-			case SC_FREEZE:
-				sc_data[type].val3 = 0;
-				break;
-
-		/* option2 */
-			case SC_POISON:				/* 毒 */
-			case SC_BLIND:				/* 暗? */
-			case SC_CURSE:
-				calc_flag = 1;
-				break;
-
-			// celest
-			case SC_CONFUSION:
-				{
-					struct map_session_data *sd=NULL;
-					if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){
-						sd->next_walktime = -1;
-					}
-				}
-				break;
-
-			case SC_MARIONETTE:		/* マリオネットコントロ?ル */
-			case SC_MARIONETTE2:	/// Marionette target
-				{
-					// check for partner and end their marionette status as well
-					int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
-					struct block_list *pbl = map_id2bl(sc_data[type].val3);
-					if (pbl) {
-						struct status_change* sc_data;
-						if (*status_get_sc_count(pbl) > 0 &&
-							(sc_data = status_get_sc_data(pbl)) &&
-							sc_data[type2].timer != -1)
-							status_change_end(pbl, type2, -1);
-					}
-					calc_flag = 1;
-				}
-				break;
-			}
-
-		if(bl->type==BL_PC &&
-			(type<SC_SENDMAX || type==SC_PRESERVE || type==SC_BATTLEORDERS))
-			clif_status_change(bl,type,0);	/* アイコン消去 */
-
-		switch(type){	/* 正常に?るときなにか?理が必要 */
-		case SC_STONE:
-		case SC_FREEZE:
-		case SC_STAN:
-		case SC_SLEEP:
-			*opt1 = 0;
-			opt_flag = 1;
-			break;
-
-		case SC_POISON:
-			if (sc_data[SC_DPOISON].timer != -1)	//
-				break;						// DPOISON用のオプション
-			*opt2 &= ~1;					// が?用に用意された場合には
-			opt_flag = 1;					// ここは削除する
-			break;							//
-		case SC_CURSE:
-		case SC_SILENCE:
-		case SC_BLIND:
-			*opt2 &= ~(1<<(type-SC_POISON));
-			opt_flag = 1;
-			break;
-		case SC_DPOISON:
-			if (sc_data[SC_POISON].timer != -1)	// DPOISON用のオプションが
-				break;							// 用意されたら削除
-			*opt2 &= ~1;	// 毒?態解除
-			opt_flag = 1;
-			break;
-		case SC_SIGNUMCRUCIS:
-			*opt2 &= ~0x40;
-			opt_flag = 1;
-			break;
-
-		case SC_HIDING:
-		case SC_CLOAKING:
-			*option &= ~((type == SC_HIDING) ? 2 : 4);
-			calc_flag = 1;	// orn
-			opt_flag = 1 ;
-			break;
-
-		case SC_CHASEWALK:
-			*option &= ~16388;
-			opt_flag = 1 ;
-			break;
-
-		case SC_SIGHT:
-			*option &= ~1;
-			opt_flag = 1;
-			break;
-		case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
-			*option &= ~4096;
-			opt_flag = 1;
-			break;
-		case SC_RUWACH:
-			*option &= ~8192;
-			opt_flag = 1;
-			break;
-
-		//opt3
-		case SC_TWOHANDQUICKEN:		/* 2HQ */
-		case SC_SPEARSQUICKEN:		/* スピアクイッケン */
-		case SC_CONCENTRATION:		/* コンセントレ?ション */
-			*opt3 &= ~1;
-			break;
-		case SC_OVERTHRUST:			/* オ?バ?スラスト */
-			*opt3 &= ~2;
-			break;
-		case SC_ENERGYCOAT:			/* エナジ?コ?ト */
-			*opt3 &= ~4;
-			break;
-		case SC_EXPLOSIONSPIRITS:	// 爆裂波動
-			*opt3 &= ~8;
-			break;
-		case SC_STEELBODY:			// 金剛
-			*opt3 &= ~16;
-			break;
-		case SC_BLADESTOP:		/* 白刃取り */
-			*opt3 &= ~32;
-			break;
-		case SC_BERSERK:		/* バ?サ?ク */
-			*opt3 &= ~128;
-			break;
-		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
-		case SC_MARIONETTE2:
-			*opt3 &= ~1024;
-			break;
-		case SC_ASSUMPTIO:		/* アスムプティオ */
-			*opt3 &= ~2048;
-			break;
-		}
-
-		if (night_flag == 1 && (*opt2 & STATE_BLIND) == 0 && bl->type == BL_PC && // by [Yor]
-			!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) { // [celest]
-			*opt2 |= STATE_BLIND;
-			opt_flag = 1;
-		}
-
-		if(opt_flag)	/* optionの?更を?える */
-			clif_changeoption(bl);
-
-		if (bl->type == BL_PC && calc_flag)
-			status_calc_pc((struct map_session_data *)bl,0);	/* ステ?タス再計算 */
-	}
-
-	return 0;
-}
-
-
-/*==========================================
- * ステータス異常終了タイマー
- *------------------------------------------
- */
-int status_change_timer(int tid, unsigned int tick, int id, int data)
-{
-	int type=data;
-	struct block_list *bl;
-	struct map_session_data *sd=NULL;
-	struct status_change *sc_data;
-	//short *sc_count; //使ってない?
-
-	nullpo_retr(0, bl=map_id2bl(id));
-	nullpo_retr(0, sc_data=status_get_sc_data(bl));
-
-	if(bl->type==BL_PC)
-		nullpo_retr(0, sd=(struct map_session_data *)bl);
-
-	//sc_count=status_get_sc_count(bl); //使ってない?
-
-	if(sc_data[type].timer != tid) {
-		if(battle_config.error_log)
-			printf("status_change_timer %d != %d\n",tid,sc_data[type].timer);
-		return 0;
-	}
-
-	switch(type){	/* 特殊な?理になる場合 */
-	case SC_MAXIMIZEPOWER:	/* マキシマイズパワ? */
-	case SC_CLOAKING:
-		if(sd){
-			if( sd->status.sp > 0 ){ /* SP切れるまで持? */
-				sd->status.sp--;
-				clif_updatestatus(sd,SP_SP);
-				sc_data[type].timer=add_timer( /* タイマ?再設定 */
-				sc_data[type].val2+tick, status_change_timer, bl->id, data);
-				return 0;
-			}
-		}
-		break;
-
-	case SC_CHASEWALK:
-		if(sd){
-			int sp = 10+sc_data[SC_CHASEWALK].val1*2;
-			if (map[sd->bl.m].flag.gvg) sp *= 5;
-			if( sd->status.sp > sp){
-				sd->status.sp -= sp; // update sp cost [Celest]
-				clif_updatestatus(sd,SP_SP);
-				sc_data[type].timer=add_timer( /* タイマ?再設定 */
-					sc_data[type].val2+tick, status_change_timer, bl->id, data);
-				sc_data[SC_CHASEWALK].val4++;
-				if (sc_data[SC_CHASEWALK].val4 > 3)
-					sc_data[SC_CHASEWALK].val4 = 0;
-				status_calc_pc (sd, 0);
-				return 0;
-			}
-		}
-	break;
-
-	case SC_HIDING:		/* ハイディング */
-		if(sd){		/* SPがあって、時間制限の間は持? */
-			if( sd->status.sp > 0 && (--sc_data[type].val2)>0 ){
-				if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){
-					sd->status.sp--;
-					clif_updatestatus(sd,SP_SP);
-				}
-				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-					1000+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-		}
-	break;
-
-	case SC_SIGHT:	/* サイト */
-	case SC_RUWACH:	/* ルアフ */
-		{
-			int range = 5;
-			if ( type == SC_SIGHT ) range = 7;
-			map_foreachinarea( status_change_timer_sub,
-				bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0,
-				bl,type,tick);
-
-			if( (--sc_data[type].val2)>0 ){
-				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-					250+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-		}
-		break;
-
-	case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
-		{
-			int race = status_get_race(bl);
-			if(race == 6 || battle_check_undead(race,status_get_elem_type(bl))) {
-				sc_data[type].timer=add_timer(1000*600+tick,status_change_timer, bl->id, data );
-				return 0;
-			}
-		}
-		break;
-
-	case SC_PROVOKE:	/* プロボック/オ?トバ?サ?ク */
-		if(sc_data[type].val2!=0){	/* オ?トバ?サ?ク(1秒ごとにHPチェック) */
-			if(sd && sd->status.hp>sd->status.max_hp>>2)	/* 停止 */
-				break;
-			sc_data[type].timer=add_timer( 1000+tick,status_change_timer, bl->id, data );
-			return 0;
-		}
-		break;
-
-	case SC_WATERBALL:	/* ウォ?タ?ボ?ル */
-		{
-			struct block_list *target=map_id2bl(sc_data[type].val2);
-			nullpo_retb(target);
-			nullpo_retb(target->prev);
-			skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0);
-			if((--sc_data[type].val3)>0) {
-				sc_data[type].timer=add_timer( 150+tick,status_change_timer, bl->id, data );
-				return 0;
-			}
-		}
-		break;
-
-	case SC_ENDURE:	/* インデュア */
-	case SC_AUTOBERSERK: // Celest
-		if(sd && sd->special_state.infinite_endure) {
-#ifdef TWILIGHT
-			sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
-#else
-			sc_data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data );
-#endif
-			//sc_data[type].val2=1;
-			return 0;
-		}
-		break;
-
-	case SC_DISSONANCE:	/* 不協和音 */
-		if( (--sc_data[type].val2)>0){
-			struct skill_unit *unit=
-				(struct skill_unit *)sc_data[type].val4;
-			struct block_list *src;
-			/*if(!unit || !unit->group)
-				break;
-			src=map_id2bl(unit->group->src_id);
-			if(!src)
-				break;*/
-			nullpo_retb(unit);
-			nullpo_retb(unit->group);
-			nullpo_retr(0, src=map_id2bl(unit->group->src_id));
-			skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0);
-			sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick,
-				status_change_timer, bl->id, data );
-			return 0;
-		}
-		break;
-
-	case SC_LULLABY:	/* 子守唄 */
-		if( (--sc_data[type].val2)>0){
-			struct skill_unit *unit=
-				(struct skill_unit *)sc_data[type].val4;
-			nullpo_retb(unit);
-			nullpo_retb(unit->group);
-			if(unit->group->src_id == bl->id)
-				break;
-			skill_additional_effect(bl,bl,unit->group->skill_id,sc_data[type].val1,BF_LONG|BF_SKILL|BF_MISC,tick);
-			if (unit->group != 0)
-				sc_data[type].timer=add_timer(skill_get_time(unit->group->skill_id,unit->group->skill_lv)/10+tick,
-					status_change_timer, bl->id, data );
-			return 0;
-		}
-		break;
-
-	case SC_STONE:
-		if(sc_data[type].val2 != 0) {
-			short *opt1 = status_get_opt1(bl);
-			sc_data[type].val2 = 0;
-			sc_data[type].val4 = 0;
-			battle_stopwalking(bl,1);
-			if(opt1) {
-				*opt1 = 1;
-				clif_changeoption(bl);
-			}
-			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-			return 0;
-		}
-		else if( (--sc_data[type].val3) > 0) {
-			int hp = status_get_max_hp(bl);
-			if((++sc_data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) {
-				hp = hp/100;
-				if(hp < 1) hp = 1;
-				if(sd)
-					pc_heal(sd,-hp,0);
-				else if(bl->type == BL_MOB){
-					struct mob_data *md;
-					if((md=((struct mob_data *)bl)) == NULL)
-						break;
-					md->hp -= hp;
-				}
-			}
-			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-			return 0;
-		}
-		break;
-	case SC_POISON:
-		if(sc_data[SC_SLOWPOISON].timer == -1) {
-			if( (--sc_data[type].val3) > 0) {
-				int hp = status_get_max_hp(bl);
-				if(status_get_hp(bl) > hp>>2) {
-					if(bl->type == BL_PC) {
-						hp = 3 + hp*3/200;
-						pc_heal((struct map_session_data *)bl,-hp,0);
-					}
-					else if(bl->type == BL_MOB) {
-						struct mob_data *md;
-						nullpo_retr(0, md=(struct mob_data *)bl);
-						/*if((md=((struct mob_data *)bl)) == NULL)
-							break;*/
-						hp = 3 + hp/200;
-						md->hp -= hp;
-					}
-				}
-				sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-			}
-		}
-		else
-			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-		break;
-	case SC_DPOISON:
-		if (sc_data[SC_SLOWPOISON].timer == -1 && (--sc_data[type].val3) > 0) {
-			int hp = status_get_max_hp(bl);
-			if (status_get_hp(bl) > hp>>2) {
-				if(sd) {
-					hp = 3 + hp/50;
-					pc_heal(sd, -hp, 0);
-				} else if (bl->type == BL_MOB) {
-					struct mob_data *md;
-					nullpo_retr(0, md=(struct mob_data *)bl);
-					/*if ((md=((struct mob_data *)bl)) == NULL)
-						break;*/
-					hp = 3 + hp/100;
-					md->hp -= hp;
-				}
-			}
-		}
-		if (sc_data[type].val3 > 0)
-			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-		break;
-
-	case SC_TENSIONRELAX:	/* テンションリラックス */
-		if(sd){		/* SPがあって、HPが?タンでなければ?? */
-			if( sd->status.sp > 12 && sd->status.max_hp > sd->status.hp ){
-/*				if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){
-					sd->status.sp -= 12;
-					clif_updatestatus(sd,SP_SP);
-				}						*/
-				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-					10000+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-			if(sd->status.max_hp <= sd->status.hp)
-				status_change_end(&sd->bl,SC_TENSIONRELAX,-1);
-		}
-		break;
-	case SC_HEADCRUSH:	// temporary damage [celest]
-//	case SC_BLEEDING:
-		if((--sc_data[type].val3) > 0) {
-			int hp = status_get_max_hp(bl);
-			if(sd) {
-				hp = 3 + hp*3/200;
-				pc_heal(sd,-hp,0);
-			}
-			else if(bl->type == BL_MOB) {
-				struct mob_data *md;
-				nullpo_retr(0, md=(struct mob_data *)bl);
-				/*if((md=((struct mob_data *)bl)) == NULL)
-					break;*/
-				hp = 3 + hp/200;
-				md->hp -= hp;
-			}
-			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
-		}
-		break;
-
-	/* 時間切れ無し?? */
-	case SC_AETERNA:
-	case SC_TRICKDEAD:
-	case SC_RIDING:
-	case SC_FALCON:
-	case SC_WEIGHT50:
-	case SC_WEIGHT90:
-	case SC_MAGICPOWER:		/* 魔法力?幅 */
-	case SC_REJECTSWORD:	/* リジェクトソ?ド */
-	case SC_MEMORIZE:	/* メモライズ */
-	case SC_BROKNWEAPON:
-	case SC_BROKNARMOR:
-	case SC_SACRIFICE:
-//		if(sc_data[type].timer==tid)
-			sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
-		return 0;
-
-	case SC_DANCING: //ダンススキルの時間SP消費
-		{
-			int s=0;
-			if(sd){
-				if(sd->status.sp > 0 && (--sc_data[type].val3)>0){
-					switch(sc_data[type].val1){
-					case BD_RICHMANKIM:				/* ニヨルドの宴 3秒にSP1 */
-					case BD_DRUMBATTLEFIELD:		/* ?太鼓の響き 3秒にSP1 */
-					case BD_RINGNIBELUNGEN:			/* ニ?ベルングの指輪 3秒にSP1 */
-					case BD_SIEGFRIED:				/* 不死身のジ?クフリ?ド 3秒にSP1 */
-					case BA_DISSONANCE:				/* 不協和音 3秒でSP1 */
-					case BA_ASSASSINCROSS:			/* 夕陽のアサシンクロス 3秒でSP1 */
-					case DC_UGLYDANCE:				/* 自分勝手なダンス 3秒でSP1 */
-						s=3;
-						break;
-					case BD_LULLABY:				/* 子守歌 4秒にSP1 */
-					case BD_ETERNALCHAOS:			/* 永遠の混沌 4秒にSP1 */
-					case BD_ROKISWEIL:				/* ロキの叫び 4秒にSP1 */
-					case DC_FORTUNEKISS:			/* 幸運のキス 4秒でSP1 */
-						s=4;
-						break;
-					case BD_INTOABYSS:				/* 深淵の中に 5秒にSP1 */
-					case BA_WHISTLE:				/* 口笛 5秒でSP1 */
-					case DC_HUMMING:				/* ハミング 5秒でSP1 */
-					case BA_POEMBRAGI:				/* ブラギの詩 5秒でSP1 */
-					case DC_SERVICEFORYOU:			/* サ?ビスフォ?ユ? 5秒でSP1 */
-						s=5;
-						break;
-					case BA_APPLEIDUN:				/* イドゥンの林檎 6秒でSP1 */
-						s=6;
-						break;
-					case DC_DONTFORGETME:			/* 私を忘れないで… 10秒でSP1 */
-					case CG_MOONLIT:				/* 月明りの泉に落ちる花びら 10秒でSP1? */
-						s=10;
-						break;
-					}
-					if(s && ((sc_data[type].val3 % s) == 0)){
-						sd->status.sp--;
-						clif_updatestatus(sd,SP_SP);
-					}
-					sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-						1000+tick, status_change_timer,
-						bl->id, data);
-					return 0;
-				}
-			}
-		}
-		break;
-	case SC_BERSERK:		/* バ?サ?ク */
-		if(sd){		/* HPが100以上なら?? */
-			if( (sd->status.hp - sd->status.max_hp*5/100) > 100 ){	// 5% every 10 seconds [DracoRPG]
-				sd->status.hp -= sd->status.max_hp*5/100;	// changed to max hp [celest]
-				clif_updatestatus(sd,SP_HP);
-				sc_data[type].timer = add_timer(	/* タイマ?再設定 */
-					10000+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-		}
-		break;
-	case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
-		if(sd){
-			time_t timer;
-			if(time(&timer) < ((sc_data[type].val2) + 3600)){	//1時間たっていないので??
-				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-					10000+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-		}
-		break;
-	case SC_NOCHAT:	//チャット禁止?態
-		if(sd && battle_config.muting_players){
-			time_t timer;
-			if((++sd->status.manner) && time(&timer) < ((sc_data[type].val2) + 60*(0-sd->status.manner))){	//開始からstatus.manner分?ってないので??
-				clif_updatestatus(sd,SP_MANNER);
-				sc_data[type].timer=add_timer(	/* タイマ?再設定(60秒) */
-					60000+tick, status_change_timer,
-					bl->id, data);
-				return 0;
-			}
-		}
-		break;
-	case SC_SELFDESTRUCTION:		/* 自爆 */
-		if(--sc_data[type].val3>0){
-			struct mob_data *md;
-			if(bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->speed > 250){
-				md->speed -= 250;
-				md->next_walktime=tick;
-			}
-			sc_data[type].timer=add_timer(	/* タイマ?再設定 */
-				1000+tick, status_change_timer,
-				bl->id, data);
-				return 0;
-		}
-		break;
-
-	case SC_SPLASHER:
-		if (sc_data[type].val4 % 1000 == 0) {
-			char timer[2];
-			sprintf (timer, "%d", sc_data[type].val4/1000);
-			clif_message(bl, timer);
-		}
-		if((sc_data[type].val4 -= 500) > 0) {
-			sc_data[type].timer = add_timer(
-				500 + tick, status_change_timer,
-				bl->id, data);
-				return 0;
-		}
-		break;
-
-	case SC_MARIONETTE:		/* マリオネットコントロ?ル */
-	case SC_MARIONETTE2:
-		{
-			struct block_list *pbl = map_id2bl(sc_data[type].val3);
-			if (pbl && battle_check_range(bl, pbl, 7) &&
-				(sc_data[type].val2 -= 1000)>0) {
-				sc_data[type].timer = add_timer(
-					1000 + tick, status_change_timer,
-					bl->id, data);
-					return 0;
-			}
-		}
-		break;
-
-/*	case SC_LEADERSHIP:
-	case SC_GLORYWOUNDS:
-	case SC_SOULCOLD:
-	case SC_HAWKEYES:
-		if (sd) {
-			sc_data[type].timer = add_timer(
-				1000+tick, status_change_timer,
-				bl->id, data);
-		}
-		break;*/
-
-	// Celest
-	case SC_CONFUSION:
-		{
-			int i = 3000;
-			//struct mob_data *md;
-			if (sd) {
-				pc_randomwalk (sd, gettick());
-				sd->next_walktime = tick + (i=1000 + rand()%1000);
-			} /*else if (bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->mode&1 && mob_can_move(md)) {
-				md->state.state=MS_WALK;
-				if( DIFF_TICK(md->next_walktime,tick) > + 7000 &&
-					(md->walkpath.path_len==0 || md->walkpath.path_pos>=md->walkpath.path_len) )
-					md->next_walktime = tick + 3000*rand()%2000;
-				mob_randomwalk(md,tick);
-			}*/
-			if ((sc_data[type].val2 -= 1000) > 0) {
-				sc_data[type].timer = add_timer(
-					i + tick, status_change_timer,
-					bl->id, data);
-					return 0;
-			}
-		}
-		break;
-
-	case SC_GOSPEL:
-		{
-			int calc_flag = 0;
-			if (sc_data[type].val3 > 0) {
-				sc_data[type].val3 = 0;
-				calc_flag = 1;
-			}
-			if(sd && sc_data[type].val4 == BCT_SELF){
-				int hp, sp;
-				hp = (sc_data[type].val1 > 5) ? 45 : 30;
-				sp = (sc_data[type].val1 > 5) ? 35 : 20;
-				if(sd->status.hp - hp > 0 &&
-					sd->status.sp - sp > 0){
-					sd->status.hp -= hp;
-					sd->status.sp -= sp;
-					clif_updatestatus(sd,SP_HP);
-					clif_updatestatus(sd,SP_SP);
-					if ((sc_data[type].val2 -= 10000) > 0) {
-						sc_data[type].timer = add_timer(
-							10000+tick, status_change_timer,
-							bl->id, data);
-						return 0;
-					}
-				}
-			} else if (sd && sc_data[type].val4 == BCT_PARTY) {
-				int i;
-				switch ((i = rand() % 12)) {
-				case 1: // heal between 100-1000
-					{
-						struct block_list tbl;
-						int heal = rand() % 900 + 100;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,AL_HEAL,heal,1);
-						battle_heal(NULL,bl,heal,0,0);
-					}
-					break;
-				case 2: // end negative status
-					{
-						int j;
-						for (j=0; j<4; j++)
-							if(sc_data[i + SC_POISON].timer!=-1) {
-								status_change_end(bl,j,-1);
-								break;
-							}
-					}
-					break;
-				case 3:	// +25% resistance to negative status
-				case 4: // +25% max hp
-				case 5: // +25% max sp
-				case 6: // +2 to all stats
-				case 11: // +25% armor and vit def
-				case 12: // +8% atk
-				case 13: // +5% flee
-				case 14: // +5% hit
-					sc_data[type].val3 = i;
-					if (i == 6 ||
-						(i >= 11 && i <= 14))
-						calc_flag = 1;
-					break;
-				case 7: // level 5 bless
-					{
-						struct block_list tbl;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,AL_BLESSING,5,1);
-						status_change_start(bl,SkillStatusChangeTable[AL_BLESSING],5,0,0,0,10000,0 );
-					}
-					break;
-				case 8: // level 5 increase agility
-					{
-						struct block_list tbl;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,AL_INCAGI,5,1);
-						status_change_start(bl,SkillStatusChangeTable[AL_INCAGI],5,0,0,0,10000,0 );
-					}
-					break;
-				case 9: // holy element to weapon
-					{
-						struct block_list tbl;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,PR_ASPERSIO,1,1);
-						status_change_start(bl,SkillStatusChangeTable[PR_ASPERSIO],1,0,0,0,10000,0 );
-					}
-					break;
-				case 10: // holy element to armour
-					{
-						struct block_list tbl;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,PR_BENEDICTIO,1,1);
-						status_change_start(bl,SkillStatusChangeTable[PR_BENEDICTIO],1,0,0,0,10000,0 );
-					}
-					break;
-				default:
-					break;
-				}
-			} else if (sc_data[type].val4 == BCT_ENEMY) {
-				int i;
-				switch ((i = rand() % 8)) {
-				case 1: // damage between 300-800
-				case 2: // damage between 150-550 (ignore def)
-					battle_damage(NULL, bl, rand() % 500,0); // temporary damage
-					break;
-				case 3: // random status effect
-					{
-						int effect[3] = {
-							SC_CURSE,
-							SC_BLIND,
-							SC_POISON };
-						status_change_start(bl,effect[rand()%3],1,0,0,0,10000,0 );
-					}
-					break;
-				case 4: // level 10 provoke
-					{
-						struct block_list tbl;
-						tbl.id = 0;
-						tbl.m = bl->m;
-						tbl.x = bl->x;
-						tbl.y = bl->y;
-						clif_skill_nodamage(&tbl,bl,SM_PROVOKE,1,1);
-						status_change_start(bl,SkillStatusChangeTable[SM_PROVOKE],10,0,0,0,10000,0 );
-					}
-					break;
-				case 5: // 0 def
-				case 6: // 0 atk
-				case 7: // 0 flee
-				case 8: // -75% move speed and aspd
-					sc_data[type].val3 = i;
-					calc_flag = 1;
-					break;
-				default:
-					break;
-				}
-			}
-			if (sd && calc_flag)
-				status_calc_pc (sd, 0);
-		}
-		break;
-	}
-
-	return status_change_end( bl,type,tid );
-}
-
-/*==========================================
- * ステータス異常タイマー範囲処理
- *------------------------------------------
- */
-int status_change_timer_sub(struct block_list *bl, va_list ap )
-{
-	struct block_list *src;
-	int type;
-	unsigned int tick;
-
-	nullpo_retr(0, bl);
-	nullpo_retr(0, ap);
-	nullpo_retr(0, src=va_arg(ap,struct block_list*));
-	type=va_arg(ap,int);
-	tick=va_arg(ap,unsigned int);
-
-	if(bl->type!=BL_PC && bl->type!=BL_MOB)
-		return 0;
-
-	switch( type ){
-	case SC_SIGHT:	/* サイト */
-	case SC_CONCENTRATE:
-		if( (*status_get_option(bl))&6 ){
-			status_change_end( bl, SC_HIDING, -1);
-			status_change_end( bl, SC_CLOAKING, -1);
-		}
-		break;
-	case SC_RUWACH:	/* ルアフ */
-		if( (*status_get_option(bl))&6 ){
-			struct status_change *sc_data = status_get_sc_data(bl);	// check whether the target is hiding/cloaking [celest]
-			if (sc_data && (sc_data[SC_HIDING].timer != -1 ||	// if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother
-				sc_data[SC_CLOAKING].timer != -1)) {
-				status_change_end( bl, SC_HIDING, -1);
-				status_change_end( bl, SC_CLOAKING, -1);
-			}
-			if(battle_check_target( src,bl, BCT_ENEMY ) > 0)
-				skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0);
-		}
-		break;
-	}
-	return 0;
-}
-
-
-static int status_calc_sigma(void)
-{
-	int i,j,k;
-
-	for(i=0;i<MAX_PC_CLASS;i++) {
-		memset(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
-		for(k=0,j=2;j<=MAX_LEVEL;j++) {
-			k += hp_coefficient[i]*j + 50;
-			k -= k%100;
-			hp_sigma_val[i][j-1] = k;
-		}
-	}
-	return 0;
-}
-
-int status_readdb(void) {
-	int i,j,k;
-	FILE *fp;
-	char line[1024],*p;
-
-	// JOB補正?値1
-	fp=fopen("db/job_db1.txt","r");
-	if(fp==NULL){
-		printf("can't read db/job_db1.txt\n");
-		return 1;
-	}
-	i=0;
-	while(fgets(line, sizeof(line)-1, fp)){
-		char *split[50];
-		if(line[0]=='/' && line[1]=='/')
-			continue;
-		for(j=0,p=line;j<21 && p;j++){
-			split[j]=p;
-			p=strchr(p,',');
-			if(p) *p++=0;
-		}
-		if(j<21)
-			continue;
-		max_weight_base[i]=atoi(split[0]);
-		hp_coefficient[i]=atoi(split[1]);
-		hp_coefficient2[i]=atoi(split[2]);
-		sp_coefficient[i]=atoi(split[3]);
-		for(j=0;j<17;j++)
-			aspd_base[i][j]=atoi(split[j+4]);
-		i++;
-// -- moonsoul (below two lines added to accommodate high numbered new class ids)
-		if(i==24)
-			i=4001;
-		if(i==MAX_PC_CLASS)
-			break;
-	}
-	fclose(fp);
-	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db1.txt");
-	ShowStatus(tmp_output);
-
-	// JOBボ?ナス
-	memset(job_bonus,0,sizeof(job_bonus));
-	fp=fopen("db/job_db2.txt","r");
-	if(fp==NULL){
-		printf("can't read db/job_db2.txt\n");
-		return 1;
-	}
-	i=0;
-	while(fgets(line, sizeof(line)-1, fp)){
-		if(line[0]=='/' && line[1]=='/')
-			continue;
-		for(j=0,p=line;j<MAX_LEVEL && p;j++){
-			if(sscanf(p,"%d",&k)==0)
-				break;
-			job_bonus[0][i][j]=k;
-			job_bonus[2][i][j]=k; //養子職のボ?ナスは分からないので?
-			p=strchr(p,',');
-			if(p) p++;
-		}
-		i++;
-// -- moonsoul (below two lines added to accommodate high numbered new class ids)
-		if(i==24)
-			i=4001;
-		if(i==MAX_PC_CLASS)
-			break;
-	}
-	fclose(fp);
-	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db2.txt");
-	ShowStatus(tmp_output);
-
-	// JOBボ?ナス2 ?生職用
-	fp=fopen("db/job_db2-2.txt","r");
-	if(fp==NULL){
-		printf("can't read db/job_db2-2.txt\n");
-		return 1;
-	}
-	i=0;
-	while(fgets(line, sizeof(line)-1, fp)){
-		if(line[0]=='/' && line[1]=='/')
-			continue;
-		for(j=0,p=line;j<MAX_LEVEL && p;j++){
-			if(sscanf(p,"%d",&k)==0)
-				break;
-			job_bonus[1][i][j]=k;
-			p=strchr(p,',');
-			if(p) p++;
-		}
-		i++;
-		if(i==MAX_PC_CLASS)
-			break;
-	}
-	fclose(fp);
-	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db2-2.txt");
-	ShowStatus(tmp_output);
-
-	// サイズ補正テ?ブル
-	for(i=0;i<3;i++)
-		for(j=0;j<20;j++)
-			atkmods[i][j]=100;
-	fp=fopen("db/size_fix.txt","r");
-	if(fp==NULL){
-		printf("can't read db/size_fix.txt\n");
-		return 1;
-	}
-	i=0;
-	while(fgets(line, sizeof(line)-1, fp)){
-		char *split[20];
-		if(line[0]=='/' && line[1]=='/')
-			continue;
-		if(atoi(line)<=0)
-			continue;
-		memset(split,0,sizeof(split));
-		for(j=0,p=line;j<20 && p;j++){
-			split[j]=p;
-			p=strchr(p,',');
-			if(p) *p++=0;
-		}
-		for(j=0;j<20 && split[j];j++)
-			atkmods[i][j]=atoi(split[j]);
-		i++;
-	}
-	fclose(fp);
-	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/size_fix.txt");
-	ShowStatus(tmp_output);
-
-	// 精?デ?タテ?ブル
-	for(i=0;i<5;i++){
-		for(j=0;j<10;j++)
-			percentrefinery[i][j]=100;
-		refinebonus[i][0]=0;
-		refinebonus[i][1]=0;
-		refinebonus[i][2]=10;
-	}
-	fp=fopen("db/refine_db.txt","r");
-	if(fp==NULL){
-		printf("can't read db/refine_db.txt\n");
-		return 1;
-	}
-	i=0;
-	while(fgets(line, sizeof(line)-1, fp)){
-		char *split[16];
-		if(line[0]=='/' && line[1]=='/')
-			continue;
-		if(atoi(line)<=0)
-			continue;
-		memset(split,0,sizeof(split));
-		for(j=0,p=line;j<16 && p;j++){
-			split[j]=p;
-			p=strchr(p,',');
-			if(p) *p++=0;
-		}
-		refinebonus[i][0]=atoi(split[0]);	// 精?ボ?ナス
-		refinebonus[i][1]=atoi(split[1]);	// 過?精?ボ?ナス
-		refinebonus[i][2]=atoi(split[2]);	// 安全精?限界
-		for(j=0;j<10 && split[j];j++)
-			percentrefinery[i][j]=atoi(split[j+3]);
-		i++;
-	}
-	fclose(fp); //Lupus. close this file!!!
-	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/refine_db.txt");
-	ShowStatus(tmp_output);
-
-	return 0;
-}
-
-/*==========================================
- * スキル関係初期化処理
- *------------------------------------------
- */
-int do_init_status(void)
-{
-	add_timer_func_list(status_change_timer,"status_change_timer");
-	status_readdb();
-	status_calc_sigma();
-	return 0;
-}
+
+// ステータス計算、状態異常処理
+#include <time.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <memory.h>
+
+#include "pc.h"
+#include "map.h"
+#include "pet.h"
+#include "mob.h"
+#include "clif.h"
+#include "guild.h"
+#include "skill.h"
+#include "itemdb.h"
+#include "battle.h"
+#include "chrif.h"
+#include "status.h"
+
+#include "timer.h"
+#include "nullpo.h"
+#include "script.h"
+#include "showmsg.h"
+
+static int max_weight_base[MAX_PC_CLASS];
+static int hp_coefficient[MAX_PC_CLASS];
+static int hp_coefficient2[MAX_PC_CLASS];
+static int hp_sigma_val[MAX_PC_CLASS][MAX_LEVEL];
+static int sp_coefficient[MAX_PC_CLASS];
+static int aspd_base[MAX_PC_CLASS][20];
+static int refinebonus[5][3];	// 精錬ボーナステーブル(refine_db.txt)
+int percentrefinery[5][10];	// 精錬成功率(refine_db.txt)
+static int atkmods[3][20];	// 武器ATKサイズ修正(size_fix.txt)
+static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL];
+
+/*==========================================
+ * 精錬ボーナス
+ *------------------------------------------
+ */
+int status_getrefinebonus(int lv,int type)
+{
+	if (lv >= 0 && lv < 5 && type >= 0 && type < 3)
+		return refinebonus[lv][type];
+	return 0;
+}
+
+/*==========================================
+ * 精錬成功率
+ *------------------------------------------
+ */
+int status_percentrefinery(struct map_session_data *sd,struct item *item)
+{
+	int percent;
+
+	nullpo_retr(0, item);
+	percent=percentrefinery[itemdb_wlv(item->nameid)][(int)item->refine];
+
+	percent += pc_checkskill(sd,BS_WEAPONRESEARCH);	// 武器研究スキル所持
+
+	// 確率の有効範囲チェック
+	if( percent > 100 ){
+		percent = 100;
+	}
+	if( percent < 0 ){
+		percent = 0;
+	}
+
+	return percent;
+}
+
+/*==========================================
+ * パラメータ計算
+ * first==0の時、計算対象のパラメータが呼び出し前から
+ * 変 化した場合自動でsendするが、
+ * 能動的に変化させたパラメータは自前でsendするように
+ *------------------------------------------
+ */
+
+int status_calc_pc(struct map_session_data* sd,int first)
+{
+	int b_speed,b_max_hp,b_max_sp,b_hp,b_sp,b_weight,b_max_weight,b_paramb[6],b_parame[6],b_hit,b_flee;
+	int b_aspd,b_watk,b_def,b_watk2,b_def2,b_flee2,b_critical,b_attackrange,b_matk1,b_matk2,b_mdef,b_mdef2,b_class;
+	int b_base_atk;
+	struct skill b_skill[MAX_SKILL];
+	int i,bl,index;
+	int skill,aspd_rate,wele,wele_,def_ele,refinedef=0;
+	int pele=0,pdef_ele=0;
+	int str,dstr,dex;
+	struct pc_base_job s_class;
+
+	nullpo_retr(0, sd);
+
+	//?生や養子の場合の元の職業を算出する
+	s_class = pc_calc_base_job(sd->status.class_);
+
+	b_speed = sd->speed;
+	b_max_hp = sd->status.max_hp;
+	b_max_sp = sd->status.max_sp;
+	b_hp = sd->status.hp;
+	b_sp = sd->status.sp;
+	b_weight = sd->weight;
+	b_max_weight = sd->max_weight;
+	memcpy(b_paramb,&sd->paramb,sizeof(b_paramb));
+	memcpy(b_parame,&sd->paramc,sizeof(b_parame));
+	memcpy(b_skill,&sd->status.skill,sizeof(b_skill));
+	b_hit = sd->hit;
+	b_flee = sd->flee;
+	b_aspd = sd->aspd;
+	b_watk = sd->watk;
+	b_def = sd->def;
+	b_watk2 = sd->watk2;
+	b_def2 = sd->def2;
+	b_flee2 = sd->flee2;
+	b_critical = sd->critical;
+	b_attackrange = sd->attackrange;
+	b_matk1 = sd->matk1;
+	b_matk2 = sd->matk2;
+	b_mdef = sd->mdef;
+	b_mdef2 = sd->mdef2;
+	b_class = sd->view_class;
+	sd->view_class = sd->status.class_;
+	b_base_atk = sd->base_atk;
+
+	pc_calc_skilltree(sd);	// スキルツリ?の計算
+
+	sd->max_weight = max_weight_base[s_class.job]+sd->status.str*300;
+
+	if(first&1) {
+		sd->weight=0;
+		for(i=0;i<MAX_INVENTORY;i++){
+			if(sd->status.inventory[i].nameid==0 || sd->inventory_data[i] == NULL)
+				continue;
+			sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount;
+		}
+		sd->cart_max_weight=battle_config.max_cart_weight;
+		sd->cart_weight=0;
+		sd->cart_max_num=MAX_CART;
+		sd->cart_num=0;
+		for(i=0;i<MAX_CART;i++){
+			if(sd->status.cart[i].nameid==0)
+				continue;
+			sd->cart_weight+=itemdb_weight(sd->status.cart[i].nameid)*sd->status.cart[i].amount;
+			sd->cart_num++;
+		}
+	}
+
+	memset(sd->paramb,0,sizeof(sd->paramb));
+	memset(sd->parame,0,sizeof(sd->parame));
+	sd->hit = 0;
+	sd->flee = 0;
+	sd->flee2 = 0;
+	sd->critical = 0;
+	sd->aspd = 0;
+	sd->watk = 0;
+	sd->def = 0;
+	sd->mdef = 0;
+	sd->watk2 = 0;
+	sd->def2 = 0;
+	sd->mdef2 = 0;
+	sd->status.max_hp = 0;
+	sd->status.max_sp = 0;
+	sd->attackrange = 0;
+	sd->attackrange_ = 0;
+	sd->atk_ele = 0;
+	sd->def_ele = 0;
+	sd->star =0;
+	sd->overrefine =0;
+	sd->matk1 =0;
+	sd->matk2 =0;
+	sd->speed = DEFAULT_WALK_SPEED ;
+	sd->hprate=battle_config.hp_rate;
+	sd->sprate=battle_config.sp_rate;
+	sd->castrate=100;
+	sd->delayrate=100;
+	sd->dsprate=100;
+	sd->base_atk=0;
+	sd->arrow_atk=0;
+	sd->arrow_ele=0;
+	sd->arrow_hit=0;
+	sd->arrow_range=0;
+	sd->nhealhp=sd->nhealsp=sd->nshealhp=sd->nshealsp=sd->nsshealhp=sd->nsshealsp=0;
+	memset(sd->addele,0,sizeof(sd->addele));
+	memset(sd->addrace,0,sizeof(sd->addrace));
+	memset(sd->addsize,0,sizeof(sd->addsize));
+	memset(sd->addele_,0,sizeof(sd->addele_));
+	memset(sd->addrace_,0,sizeof(sd->addrace_));
+	memset(sd->addsize_,0,sizeof(sd->addsize_));
+	memset(sd->subele,0,sizeof(sd->subele));
+	memset(sd->subrace,0,sizeof(sd->subrace));
+	memset(sd->addeff,0,sizeof(sd->addeff));
+	memset(sd->addeff2,0,sizeof(sd->addeff2));
+	memset(sd->reseff,0,sizeof(sd->reseff));
+	memset(&sd->special_state,0,sizeof(sd->special_state));
+	memset(sd->weapon_coma_ele,0,sizeof(sd->weapon_coma_ele));
+	memset(sd->weapon_coma_race,0,sizeof(sd->weapon_coma_race));
+	memset(sd->weapon_atk,0,sizeof(sd->weapon_atk));
+	memset(sd->weapon_atk_rate,0,sizeof(sd->weapon_atk_rate));
+
+	sd->watk_ = 0;			//二刀流用(?)
+	sd->watk_2 = 0;
+	sd->atk_ele_ = 0;
+	sd->star_ = 0;
+	sd->overrefine_ = 0;
+
+	sd->aspd_rate = 100;
+	sd->speed_rate = 100;
+	sd->hprecov_rate = 100;
+	sd->sprecov_rate = 100;
+	sd->critical_def = 0;
+	sd->double_rate = 0;
+	sd->near_attack_def_rate = sd->long_attack_def_rate = 0;
+	sd->atk_rate = sd->matk_rate = 100;
+	sd->ignore_def_ele = sd->ignore_def_race = 0;
+	sd->ignore_def_ele_ = sd->ignore_def_race_ = 0;
+	sd->ignore_mdef_ele = sd->ignore_mdef_race = 0;
+	sd->arrow_cri = 0;
+	sd->magic_def_rate = sd->misc_def_rate = 0;
+	memset(sd->arrow_addele,0,sizeof(sd->arrow_addele));
+	memset(sd->arrow_addrace,0,sizeof(sd->arrow_addrace));
+	memset(sd->arrow_addsize,0,sizeof(sd->arrow_addsize));
+	memset(sd->arrow_addeff,0,sizeof(sd->arrow_addeff));
+	memset(sd->arrow_addeff2,0,sizeof(sd->arrow_addeff2));
+	memset(sd->magic_addele,0,sizeof(sd->magic_addele));
+	memset(sd->magic_addrace,0,sizeof(sd->magic_addrace));
+	memset(sd->magic_subrace,0,sizeof(sd->magic_subrace));
+	sd->perfect_hit = 0;
+	sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100;
+	sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100;
+	sd->def_ratio_atk_ele = sd->def_ratio_atk_ele_ = 0;
+	sd->def_ratio_atk_race = sd->def_ratio_atk_race_ = 0;
+	sd->get_zeny_num = 0;
+	sd->add_damage_class_count = sd->add_damage_class_count_ = sd->add_magic_damage_class_count = 0;
+	sd->add_def_class_count = sd->add_mdef_class_count = 0;
+	sd->monster_drop_item_count = 0;
+	memset(sd->add_damage_classrate,0,sizeof(sd->add_damage_classrate));
+	memset(sd->add_damage_classrate_,0,sizeof(sd->add_damage_classrate_));
+	memset(sd->add_magic_damage_classrate,0,sizeof(sd->add_magic_damage_classrate));
+	memset(sd->add_def_classrate,0,sizeof(sd->add_def_classrate));
+	memset(sd->add_mdef_classrate,0,sizeof(sd->add_mdef_classrate));
+	memset(sd->monster_drop_race,0,sizeof(sd->monster_drop_race));
+	memset(sd->monster_drop_itemrate,0,sizeof(sd->monster_drop_itemrate));
+	sd->speed_add_rate = sd->aspd_add_rate = 100;
+	sd->double_add_rate = sd->perfect_hit_add = sd->get_zeny_add_num = 0;
+	sd->splash_range = sd->splash_add_range = 0;
+	sd->autospell_id = sd->autospell_lv = sd->autospell_rate = 0;
+	sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate = sd->sp_drain_per = 0;
+	sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ = sd->sp_drain_per_ = 0;
+	sd->short_weapon_damage_return = sd->long_weapon_damage_return = 0;
+	sd->magic_damage_return = 0; //AppleGirl Was Here
+	sd->random_attack_increase_add = sd->random_attack_increase_per = 0;
+	sd->hp_drain_value = sd->hp_drain_value_ = sd->sp_drain_value = sd->sp_drain_value_ = 0;
+	sd->unbreakable_equip = 0;
+
+
+	if(!sd->disguiseflag && sd->disguise) {
+		sd->disguise=0;
+		clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
+		clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+		clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom);
+		clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top);
+		clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid);
+		clif_clearchar(&sd->bl, 9);
+		pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3);
+	}
+
+	for(i=0;i<10;i++) {
+		index = sd->equip_index[i];
+		if(index < 0)
+			continue;
+		if(i == 9 && sd->equip_index[8] == index)
+			continue;
+		if(i == 5 && sd->equip_index[4] == index)
+			continue;
+		if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
+			continue;
+
+		if(sd->inventory_data[index]) {
+			if(sd->inventory_data[index]->type == 4) {
+				if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) {
+					int j;
+					for(j=0;j<sd->inventory_data[index]->slot;j++){	// カ?ド
+						int c=sd->status.inventory[index].card[j];
+						if(c>0){
+							if(i == 8 && sd->status.inventory[index].equip == 0x20)
+								sd->state.lr_flag = 1;
+							run_script(itemdb_equipscript(c),0,sd->bl.id,0);
+							sd->state.lr_flag = 0;
+						}
+					}
+				}
+			}
+			else if(sd->inventory_data[index]->type==5){ // 防具
+				if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) {
+					int j;
+					for(j=0;j<sd->inventory_data[index]->slot;j++){	// カ?ド
+						int c=sd->status.inventory[index].card[j];
+						if(c>0)
+							run_script(itemdb_equipscript(c),0,sd->bl.id,0);
+					}
+				}
+			}
+		}
+	}
+	wele = sd->atk_ele;
+	wele_ = sd->atk_ele_;
+	def_ele = sd->def_ele;
+	if(sd->status.pet_id > 0) {
+		struct pet_data *pd=sd->pd;
+		if((pd && battle_config.pet_status_support==1) && (battle_config.pet_equip_required==0 || (battle_config.pet_equip_required && pd->equip > 0))) {
+			if(sd->status.pet_id > 0 && sd->petDB && sd->pet.intimate > 0)
+				run_script(sd->petDB->script,0,sd->bl.id,0);
+			pele = sd->atk_ele;
+			pdef_ele = sd->def_ele;
+			sd->atk_ele = sd->def_ele = 0;
+		}
+	}
+	memcpy(sd->paramcard,sd->parame,sizeof(sd->paramcard));
+
+	// ?備品によるステ?タス?化はここで?行
+	for(i=0;i<10;i++) {
+		index = sd->equip_index[i];
+		if(index < 0)
+			continue;
+		if(i == 9 && sd->equip_index[8] == index)
+			continue;
+		if(i == 5 && sd->equip_index[4] == index)
+			continue;
+		if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index))
+			continue;
+		if(sd->inventory_data[index]) {
+			sd->def += sd->inventory_data[index]->def;
+			if(sd->inventory_data[index]->type == 4) {
+				int r,wlv = sd->inventory_data[index]->wlv;
+				if(i == 8 && sd->status.inventory[index].equip == 0x20) {
+					//二刀流用デ?タ入力
+					sd->watk_ += sd->inventory_data[index]->atk;
+					sd->watk_2 = (r=sd->status.inventory[index].refine)*	// 精?攻?力
+						refinebonus[wlv][0];
+					if( (r-=refinebonus[wlv][2])>0 )	// 過?精?ボ?ナス
+						sd->overrefine_ = r*refinebonus[wlv][1];
+
+					if(sd->status.inventory[index].card[0]==0x00ff){	// 製造武器
+						sd->star_ = (sd->status.inventory[index].card[1]>>8);	// 星のかけら
+						wele_= (sd->status.inventory[index].card[1]&0x0f);	// ? 性
+					}
+					sd->attackrange_ += sd->inventory_data[index]->range;
+					sd->state.lr_flag = 1;
+					run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
+					sd->state.lr_flag = 0;
+				}
+				else {	//二刀流武器以外
+					sd->watk += sd->inventory_data[index]->atk;
+					sd->watk2 += (r=sd->status.inventory[index].refine)*	// 精?攻?力
+						refinebonus[wlv][0];
+					if( (r-=refinebonus[wlv][2])>0 )	// 過?精?ボ?ナス
+						sd->overrefine += r*refinebonus[wlv][1];
+
+					if(sd->status.inventory[index].card[0]==0x00ff){	// 製造武器
+						sd->star += (sd->status.inventory[index].card[1]>>8);	// 星のかけら
+						wele = (sd->status.inventory[index].card[1]&0x0f);	// ? 性
+					}
+					sd->attackrange += sd->inventory_data[index]->range;
+					run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
+				}
+			}
+			else if(sd->inventory_data[index]->type == 5) {
+				sd->watk += sd->inventory_data[index]->atk;
+				refinedef += sd->status.inventory[index].refine*refinebonus[0][0];
+				run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
+			}
+		}
+	}
+
+	if(sd->equip_index[10] >= 0){ // 矢
+		index = sd->equip_index[10];
+		if(sd->inventory_data[index]){		//まだ?性が入っていない
+			sd->state.lr_flag = 2;
+			run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
+			sd->state.lr_flag = 0;
+			sd->arrow_atk += sd->inventory_data[index]->atk;
+		}
+	}
+	sd->def += (refinedef+50)/100;
+
+	if(sd->attackrange < 1) sd->attackrange = 1;
+	if(sd->attackrange_ < 1) sd->attackrange_ = 1;
+	if(sd->attackrange < sd->attackrange_)
+		sd->attackrange = sd->attackrange_;
+	if(sd->status.weapon == 11)
+		sd->attackrange += sd->arrow_range;
+	if(wele > 0)
+		sd->atk_ele = wele;
+	if(wele_ > 0)
+		sd->atk_ele_ = wele_;
+	if(def_ele > 0)
+		sd->def_ele = def_ele;
+	if(battle_config.pet_status_support) {
+		if(pele > 0 && !sd->atk_ele)
+			sd->atk_ele = pele;
+		if(pdef_ele > 0 && !sd->def_ele)
+			sd->def_ele = pdef_ele;
+	}
+	sd->double_rate += sd->double_add_rate;
+	sd->perfect_hit += sd->perfect_hit_add;
+	sd->get_zeny_num += sd->get_zeny_add_num;
+	sd->splash_range += sd->splash_add_range;
+	if(sd->speed_add_rate != 100)
+		sd->speed_rate += sd->speed_add_rate - 100;
+	if(sd->aspd_add_rate != 100)
+		sd->aspd_rate += sd->aspd_add_rate - 100;
+
+	// 武器ATKサイズ補正 (右手)
+	sd->atkmods[0] = atkmods[0][sd->weapontype1];
+	sd->atkmods[1] = atkmods[1][sd->weapontype1];
+	sd->atkmods[2] = atkmods[2][sd->weapontype1];
+	//武器ATKサイズ補正 (左手)
+	sd->atkmods_[0] = atkmods[0][sd->weapontype2];
+	sd->atkmods_[1] = atkmods[1][sd->weapontype2];
+	sd->atkmods_[2] = atkmods[2][sd->weapontype2];
+
+	// jobボ?ナス分
+	for(i=0;i<sd->status.job_level && i<MAX_LEVEL;i++){
+		if(job_bonus[s_class.upper][s_class.job][i])
+			sd->paramb[job_bonus[s_class.upper][s_class.job][i]-1]++;
+	}
+
+	if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 )	// skill can be used with an item now, thanks to orn [Valaris]
+		sd->max_weight += skill*2000;
+
+	if( (skill=pc_checkskill(sd,AC_OWL))>0 )	// ふくろうの目
+		sd->paramb[4] += skill;
+
+	if((skill=pc_checkskill(sd,BS_HILTBINDING))>0) {   // Hilt binding gives +1 str +4 atk
+		sd->paramb[0] ++;
+		sd->base_atk += 4;
+	}
+	if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels
+		sd->paramb[3] += (skill+1)*0.5;
+	}
+
+	// New guild skills - Celest
+	if (sd->status.guild_id > 0 && !(first&4)) {
+		struct guild *g;
+		if ((g = guild_search(sd->status.guild_id)) && strcmp(sd->status.name,g->master)==0) {
+			if (!sd->state.leadership_flag && guild_checkskill(g, GD_LEADERSHIP)>0) {
+				skill_unitsetting(&sd->bl,GD_LEADERSHIP,1,sd->bl.x,sd->bl.y,0);
+			}
+			if (!sd->state.glorywounds_flag && guild_checkskill(g, GD_GLORYWOUNDS)>0) {
+				skill_unitsetting(&sd->bl,GD_GLORYWOUNDS,1,sd->bl.x,sd->bl.y,0);
+			}
+			if (!sd->state.soulcold_flag && guild_checkskill(g, GD_SOULCOLD)>0) {
+				skill_unitsetting(&sd->bl,GD_SOULCOLD,1,sd->bl.x,sd->bl.y,0);
+			}
+			if (!sd->state.hawkeyes_flag && guild_checkskill(g, GD_HAWKEYES)>0) {
+				skill_unitsetting(&sd->bl,GD_HAWKEYES,1,sd->bl.x,sd->bl.y,0);
+			}
+		}
+		else if (g) {
+			if (sd->sc_count && sd->sc_data[SC_BATTLEORDERS].timer != -1) {
+				sd->paramb[0]+= 5;
+				sd->paramb[3]+= 5;
+				sd->paramb[4]+= 5;
+			}
+			if (sd->state.leadership_flag)
+				sd->paramb[0] += 2;
+			if (sd->state.glorywounds_flag)
+				sd->paramb[2] += 2;
+			if (sd->state.soulcold_flag)
+				sd->paramb[1] += 2;
+			if (sd->state.hawkeyes_flag)
+				sd->paramb[4] += 2;
+		}
+	}
+
+	// ステ?タス?化による基本パラメ?タ補正
+	if(sd->sc_count){
+		if(sd->sc_data[SC_CONCENTRATE].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1){	// 集中力向上
+			sd->paramb[1]+= (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
+			sd->paramb[4]+= (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100;
+		}
+		if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){	// 速度?加
+			sd->paramb[1]+= 2+sd->sc_data[SC_INCREASEAGI].val1;
+			sd->speed -= sd->speed *25/100;
+		}
+		if(sd->sc_data[SC_DECREASEAGI].timer!=-1) {	// 速度減少(agiはbattle.cで)
+			sd->speed = sd->speed *125/100;
+			sd->paramb[1] -= 2 + sd->sc_data[SC_DECREASEAGI].val1;	// reduce agility [celest]
+		}
+		if(sd->sc_data[SC_CLOAKING].timer!=-1) {
+			sd->critical_rate += 100; // critical increases
+			sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100;
+		}
+		if(sd->sc_data[SC_CHASEWALK].timer!=-1) {
+			sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; // slow down by chasewalk
+			if(sd->sc_data[SC_CHASEWALK].val4)
+				sd->paramb[0] += (1<<(sd->sc_data[SC_CHASEWALK].val1-1)); // increases strength after 10 seconds
+		}
+		if(sd->sc_data[SC_SLOWDOWN].timer!=-1)
+			sd->speed = sd->speed*150/100;
+		if(sd->sc_data[SC_SPEEDUP0].timer!=-1)
+			sd->speed -= sd->speed*25/100;
+		if(sd->sc_data[SC_BLESSING].timer!=-1){	// ブレッシング
+			sd->paramb[0]+= sd->sc_data[SC_BLESSING].val1;
+			sd->paramb[3]+= sd->sc_data[SC_BLESSING].val1;
+			sd->paramb[4]+= sd->sc_data[SC_BLESSING].val1;
+		}
+		if(sd->sc_data[SC_GLORIA].timer!=-1)	// グロリア
+			sd->paramb[5]+= 30;
+		if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1)	// ラウドボイス
+			sd->paramb[0]+= 4;
+		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){	// クァグマイア
+			//int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
+			//int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100;
+			//sd->paramb[1]-= agib > 50 ? 50 : agib;
+			//sd->paramb[4]-= dexb > 50 ? 50 : dexb;
+			sd->paramb[1]-= sd->sc_data[SC_QUAGMIRE].val1*5;
+			sd->paramb[4]-= sd->sc_data[SC_QUAGMIRE].val1*5;
+			sd->speed = sd->speed*3/2;
+		}
+		if(sd->sc_data[SC_TRUESIGHT].timer!=-1){	// トゥル?サイト
+			sd->paramb[0]+= 5;
+			sd->paramb[1]+= 5;
+			sd->paramb[2]+= 5;
+			sd->paramb[3]+= 5;
+			sd->paramb[4]+= 5;
+			sd->paramb[5]+= 5;
+		}
+		if(sd->sc_data[SC_MARIONETTE].timer!=-1){
+			struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3);
+			if (psd) {	// if partner is found
+				sd->paramb[0]-= sd->status.str/2;	// bonuses not included
+				sd->paramb[1]-= sd->status.agi/2;
+				sd->paramb[2]-= sd->status.vit/2;
+				sd->paramb[3]-= sd->status.int_/2;
+				sd->paramb[4]-= sd->status.dex/2;
+				sd->paramb[5]-= sd->status.luk/2;
+			}
+		}
+		else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){
+			struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3);
+			if (psd) {	// if partner is found
+				sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2;
+				sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2;
+				sd->paramb[2] += sd->status.vit+psd->status.vit/2 > 99 ? 99-sd->status.vit : psd->status.vit/2;
+				sd->paramb[3] += sd->status.int_+psd->status.int_/2 > 99 ? 99-sd->status.int_ : psd->status.int_/2;
+				sd->paramb[4] += sd->status.dex+psd->status.dex/2 > 99 ? 99-sd->status.dex : psd->status.dex/2;
+				sd->paramb[5] += sd->status.luk+psd->status.luk/2 > 99 ? 99-sd->status.luk : psd->status.luk/2;
+			}
+		}
+		if(sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){
+			if (sd->sc_data[SC_GOSPEL].val3 == 6) {
+				sd->paramb[0]+= 2;
+				sd->paramb[1]+= 2;
+				sd->paramb[2]+= 2;
+				sd->paramb[3]+= 2;
+				sd->paramb[4]+= 2;
+				sd->paramb[5]+= 2;
+			}
+		}
+	}
+
+	//1度も死んでないJob70スパノビに+10
+	if(s_class.job == 23 && sd->die_counter == 0 && sd->status.job_level >= 70){
+		sd->paramb[0]+= 15;
+		sd->paramb[1]+= 15;
+		sd->paramb[2]+= 15;
+		sd->paramb[3]+= 15;
+		sd->paramb[4]+= 15;
+		sd->paramb[5]+= 15;
+	}
+	sd->paramc[0]=sd->status.str+sd->paramb[0]+sd->parame[0];
+	sd->paramc[1]=sd->status.agi+sd->paramb[1]+sd->parame[1];
+	sd->paramc[2]=sd->status.vit+sd->paramb[2]+sd->parame[2];
+	sd->paramc[3]=sd->status.int_+sd->paramb[3]+sd->parame[3];
+	sd->paramc[4]=sd->status.dex+sd->paramb[4]+sd->parame[4];
+	sd->paramc[5]=sd->status.luk+sd->paramb[5]+sd->parame[5];
+	for(i=0;i<6;i++)
+		if(sd->paramc[i] < 0) sd->paramc[i] = 0;
+
+	if (sd->sc_count) {
+		if (sd->sc_data[SC_CURSE].timer!=-1)
+			sd->paramc[5] = 0;
+	}
+
+	if(sd->status.weapon == 11 || sd->status.weapon == 13 || sd->status.weapon == 14) {
+		str = sd->paramc[4];
+		dex = sd->paramc[0];
+	}
+	else {
+		str = sd->paramc[0];
+		dex = sd->paramc[4];
+	}
+	dstr = str/10;
+	sd->base_atk += str + dstr*dstr + dex/5 + sd->paramc[5]/5;
+	sd->matk1 += sd->paramc[3]+(sd->paramc[3]/5)*(sd->paramc[3]/5);
+	sd->matk2 += sd->paramc[3]+(sd->paramc[3]/7)*(sd->paramc[3]/7);
+	if(sd->matk1 < sd->matk2) {
+		int temp = sd->matk2;
+		sd->matk2 = sd->matk1;
+		sd->matk1 = temp;
+	}
+	sd->hit += sd->paramc[4] + sd->status.base_level;
+	sd->flee += sd->paramc[1] + sd->status.base_level;
+	sd->def2 += sd->paramc[2];
+	sd->mdef2 += sd->paramc[3];
+	sd->flee2 += sd->paramc[5]+10;
+	sd->critical += (sd->paramc[5]*3)+10;
+
+	if(sd->base_atk < 1)
+		sd->base_atk = 1;
+	if(sd->critical_rate != 100)
+		sd->critical = (sd->critical*sd->critical_rate)/100;
+	if(sd->critical < 10) sd->critical = 10;
+	if(sd->hit_rate != 100)
+		sd->hit = (sd->hit*sd->hit_rate)/100;
+	if(sd->hit < 1) sd->hit = 1;
+	if(sd->flee_rate != 100)
+		sd->flee = (sd->flee*sd->flee_rate)/100;
+	if(sd->flee < 1) sd->flee = 1;
+	if(sd->flee2_rate != 100)
+		sd->flee2 = (sd->flee2*sd->flee2_rate)/100;
+	if(sd->flee2 < 10) sd->flee2 = 10;
+	if(sd->def_rate != 100)
+		sd->def = (sd->def*sd->def_rate)/100;
+	if(sd->def < 0) sd->def = 0;
+	if(sd->def2_rate != 100)
+		sd->def2 = (sd->def2*sd->def2_rate)/100;
+	if(sd->def2 < 1) sd->def2 = 1;
+	if(sd->mdef_rate != 100)
+		sd->mdef = (sd->mdef*sd->mdef_rate)/100;
+	if(sd->mdef < 0) sd->mdef = 0;
+	if(sd->mdef2_rate != 100)
+		sd->mdef2 = (sd->mdef2*sd->mdef2_rate)/100;
+	if(sd->mdef2 < 1) sd->mdef2 = 1;
+
+	// 二刀流 ASPD 修正
+	if (sd->status.weapon <= 16)
+		sd->aspd += aspd_base[s_class.job][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->status.weapon]/1000;
+	else
+		sd->aspd += (
+			(aspd_base[s_class.job][sd->weapontype1]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype1]/1000) +
+			(aspd_base[s_class.job][sd->weapontype2]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype2]/1000)
+			) * 140 / 200;
+
+	aspd_rate = sd->aspd_rate;
+
+	//攻?速度?加
+
+	if((skill=pc_checkskill(sd,AC_VULTURE))>0){	// ワシの目
+		sd->hit += skill;
+		if(sd->status.weapon == 11)
+			sd->attackrange += skill;
+	}
+
+	if( (skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0)	// 武器?究の命中率?加
+		sd->hit += skill*2;
+	if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 )	// トンネルドライブ	// トンネルドライブ
+		sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9);
+	if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0)	// カ?トによる速度低下
+		sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1);
+	else if (pc_isriding(sd)) {	// ペコペコ?りによる速度?加
+		sd->speed -= (0.25 * DEFAULT_WALK_SPEED);
+		sd->max_weight += 10000;
+	}
+	if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス
+		sd->status.max_hp += skill*200;
+		sd->subele[6] += skill*5;
+	}
+	if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) {
+		sd->subele[0] += skill;
+		sd->subele[3] += skill*5;
+	}
+	if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 )
+		aspd_rate -= skill*0.5;
+
+	bl=sd->status.base_level;
+
+	sd->status.max_hp += (3500 + bl*hp_coefficient2[s_class.job] + hp_sigma_val[s_class.job][(bl > 0)? bl-1:0])/100 * (100 + sd->paramc[2])/100 + (sd->parame[2] - sd->paramcard[2]);
+		if (s_class.upper==1) // [MouseJstr]
+			sd->status.max_hp = sd->status.max_hp * 130/100;
+		else if (s_class.upper==2)
+			sd->status.max_hp = sd->status.max_hp * 70/100;
+
+	if(sd->hprate!=100)
+		sd->status.max_hp = sd->status.max_hp*sd->hprate/100;
+
+	if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1){	// バ?サ?ク
+		sd->status.max_hp = sd->status.max_hp * 3;
+		// sd->status.hp = sd->status.hp * 3;
+		if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris
+			sd->status.max_hp = battle_config.max_hp;
+		if(sd->status.hp > battle_config.max_hp) // removed negative max hp bug by Valaris
+			sd->status.hp = battle_config.max_hp;
+	}
+	if(s_class.job == 23 && sd->status.base_level >= 99){
+		sd->status.max_hp = sd->status.max_hp + 2000;
+	}
+
+	if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris
+		sd->status.max_hp = battle_config.max_hp;
+	if(sd->status.max_hp <= 0) sd->status.max_hp = 1; // end
+
+	// 最大SP計算
+	sd->status.max_sp += ((sp_coefficient[s_class.job] * bl) + 1000)/100 * (100 + sd->paramc[3])/100 + (sd->parame[3] - sd->paramcard[3]);
+		if (s_class.upper==1) // [MouseJstr]
+			sd->status.max_sp = sd->status.max_sp * 130/100;
+		else if (s_class.upper==2)
+			sd->status.max_sp = sd->status.max_sp * 70/100;
+	if(sd->sprate!=100)
+		sd->status.max_sp = sd->status.max_sp*sd->sprate/100;
+
+	if((skill=pc_checkskill(sd,HP_MEDITATIO))>0) // メディテイティオ
+		sd->status.max_sp += sd->status.max_sp*skill/100;
+	if((skill=pc_checkskill(sd,HW_SOULDRAIN))>0) /* ソウルドレイン */
+		sd->status.max_sp += sd->status.max_sp*2*skill/100;
+
+	if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp)
+		sd->status.max_sp = battle_config.max_sp;
+
+	//自然回復HP
+	sd->nhealhp = 1 + (sd->paramc[2]/5) + (sd->status.max_hp/200);
+	if((skill=pc_checkskill(sd,SM_RECOVERY)) > 0) {	/* HP回復力向上 */
+		sd->nshealhp = skill*5 + (sd->status.max_hp*skill/500);
+		if(sd->nshealhp > 0x7fff) sd->nshealhp = 0x7fff;
+	}
+	//自然回復SP
+	sd->nhealsp = 1 + (sd->paramc[3]/6) + (sd->status.max_sp/100);
+	if(sd->paramc[3] >= 120)
+		sd->nhealsp += ((sd->paramc[3]-120)>>1) + 4;
+	if((skill=pc_checkskill(sd,MG_SRECOVERY)) > 0) { /* SP回復力向上 */
+		sd->nshealsp = skill*3 + (sd->status.max_sp*skill/500);
+		if(sd->nshealsp > 0x7fff) sd->nshealsp = 0x7fff;
+	}
+
+	if((skill = pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0) {
+		sd->nsshealhp = skill*4 + (sd->status.max_hp*skill/500);
+		sd->nsshealsp = skill*2 + (sd->status.max_sp*skill/500);
+		if(sd->nsshealhp > 0x7fff) sd->nsshealhp = 0x7fff;
+		if(sd->nsshealsp > 0x7fff) sd->nsshealsp = 0x7fff;
+	}
+	if(sd->hprecov_rate != 100) {
+		sd->nhealhp = sd->nhealhp*sd->hprecov_rate/100;
+		if(sd->nhealhp < 1) sd->nhealhp = 1;
+	}
+	if(sd->sprecov_rate != 100) {
+		sd->nhealsp = sd->nhealsp*sd->sprecov_rate/100;
+		if(sd->nhealsp < 1) sd->nhealsp = 1;
+	}
+	/* if((skill=pc_checkskill(sd,HP_MEDITATIO)) > 0) { // f?fffBfefCfefBfI,I'SPR,A*,I',E`,。ゥZ((c)。ョR「カn~.ゥォ,E',(c),(c),e'
+		sd->nhealsp += 3*skill*(sd->status.max_sp)/100;
+		if(sd->nhealsp > 0x7fff) sd->nhealsp = 0x7fff;
+		} Increase natural SP regen instead of colossal SP Recovery effect [DracoRPG]*/
+
+	// 種族耐性(これでいいの? ディバインプロテクションと同じ?理がいるかも)
+	if( (skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // ドラゴノロジ?
+		skill = skill*4;
+		sd->addrace[9]+=skill;
+		sd->addrace_[9]+=skill;
+		sd->subrace[9]+=skill;
+		sd->magic_addrace[9]+=skill;
+		sd->magic_subrace[9]-=skill;
+	}
+
+	//Flee上昇
+	if( (skill=pc_checkskill(sd,TF_MISS))>0 ){	// 回避率?加
+		if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23){
+			sd->flee += skill*3;
+		}
+		if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018)
+			sd->flee += skill*4;
+		if(sd->status.class_==12||sd->status.class_==4013)
+			sd->speed -= sd->speed *(skill*1.5)/100;
+	}
+	if( (skill=pc_checkskill(sd,MO_DODGE))>0 )	// 見切り
+		sd->flee += (skill*3)>>1;
+
+	// スキルやステ?タス異常による?りのパラメ?タ補正
+	if(sd->sc_count){
+		// ATK/DEF?化形
+		if(sd->sc_data[SC_ANGELUS].timer!=-1)	// エンジェラス
+			sd->def2 = sd->def2*(110+5*sd->sc_data[SC_ANGELUS].val1)/100;
+		if(sd->sc_data[SC_IMPOSITIO].timer!=-1)	{// インポシティオマヌス
+			sd->watk += sd->sc_data[SC_IMPOSITIO].val1*5;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
+				sd->watk_ += sd->sc_data[SC_IMPOSITIO].val1*5;
+		}
+		if(sd->sc_data[SC_PROVOKE].timer!=-1){	// プロボック
+			sd->def2 = sd->def2*(100-6*sd->sc_data[SC_PROVOKE].val1)/100;
+			sd->base_atk = sd->base_atk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
+			sd->watk = sd->watk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
+				sd->watk_ = sd->watk_*(100+2*sd->sc_data[SC_PROVOKE].val1)/100;
+		}
+		if(sd->sc_data[SC_ENDURE].timer!=-1)
+			sd->mdef2 += sd->sc_data[SC_ENDURE].val1;
+		if(sd->sc_data[SC_MINDBREAKER].timer!=-1){	// プロボック
+			sd->mdef2 = sd->mdef2*(100-6*sd->sc_data[SC_MINDBREAKER].val1)/100;
+			sd->matk1 = sd->matk1*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100;
+			sd->matk2 = sd->matk2*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100;
+		}
+		if(sd->sc_data[SC_POISON].timer!=-1)	// 毒?態
+			sd->def2 = sd->def2*75/100;
+		if(sd->sc_data[SC_CURSE].timer!=-1){
+			sd->base_atk = sd->base_atk*75/100;
+			sd->watk = sd->watk*75/100;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
+				sd->watk_ = sd->watk_*75/100;
+		}
+		if(sd->sc_data[SC_DRUMBATTLE].timer!=-1){	// ?太鼓の響き
+			sd->watk += sd->sc_data[SC_DRUMBATTLE].val2;
+			sd->def  += sd->sc_data[SC_DRUMBATTLE].val3;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
+				sd->watk_ += sd->sc_data[SC_DRUMBATTLE].val2;
+		}
+		if(sd->sc_data[SC_NIBELUNGEN].timer!=-1) {	// ニ?ベルングの指輪
+			index = sd->equip_index[9];
+			/*if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3)
+				sd->watk += sd->sc_data[SC_NIBELUNGEN].val3;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3)
+				sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val3;
+			index = sd->equip_index[9];*/
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
+				sd->watk2 += sd->sc_data[SC_NIBELUNGEN].val3;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4)
+				sd->watk_2 += sd->sc_data[SC_NIBELUNGEN].val3;
+		}
+
+		if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){	// ボルケ?ノ
+			sd->watk += sd->sc_data[SC_VIOLENTGALE].val3;
+		}
+
+		if(sd->sc_data[SC_SIGNUMCRUCIS].timer!=-1)
+			sd->def = sd->def * (100 - sd->sc_data[SC_SIGNUMCRUCIS].val2)/100;
+		if(sd->sc_data[SC_ETERNALCHAOS].timer!=-1)	// エタ?ナルカオス
+			sd->def=0;
+
+		if(sd->sc_data[SC_CONCENTRATION].timer!=-1){ //コンセントレ?ション
+			sd->watk = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
+			index = sd->equip_index[8];
+			if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4)
+				sd->watk_ = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
+			sd->def = sd->def * (100 - 5*sd->sc_data[SC_CONCENTRATION].val1)/100;
+		}
+
+		if(sd->sc_data[SC_MAGICPOWER].timer!=-1){ //魔法力?幅
+			sd->matk1 = sd->matk1*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100;
+			sd->matk2 = sd->matk2*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100;
+		}
+		if(sd->sc_data[SC_ATKPOT].timer!=-1)
+			sd->watk += sd->sc_data[SC_ATKPOT].val1;
+		if(sd->sc_data[SC_MATKPOT].timer!=-1){
+			sd->matk1 += sd->sc_data[SC_MATKPOT].val1;
+			sd->matk2 += sd->sc_data[SC_MATKPOT].val1;
+		}
+
+		// ASPD/移動速度?化系
+		if(sd->sc_data[SC_TWOHANDQUICKEN].timer != -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
+			aspd_rate -= 30;
+		if(sd->sc_data[SC_ADRENALINE].timer != -1 && sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
+			sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
+			if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
+				aspd_rate -= 30;
+			else
+				aspd_rate -= 25;
+		}
+		if(sd->sc_data[SC_SPEARSQUICKEN].timer != -1 && sd->sc_data[SC_ADRENALINE].timer == -1 &&
+			sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
+			aspd_rate -= sd->sc_data[SC_SPEARSQUICKEN].val2;
+		if(sd->sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
+			sd->sc_data[SC_TWOHANDQUICKEN].timer==-1 && sd->sc_data[SC_ADRENALINE].timer==-1 && sd->sc_data[SC_SPEARSQUICKEN].timer==-1 &&
+			sd->sc_data[SC_DONTFORGETME].timer == -1)
+				aspd_rate -= 5+sd->sc_data[SC_ASSNCROS].val1+sd->sc_data[SC_ASSNCROS].val2+sd->sc_data[SC_ASSNCROS].val3;
+		if(sd->sc_data[SC_DONTFORGETME].timer!=-1){		// 私を忘れないで
+			aspd_rate += sd->sc_data[SC_DONTFORGETME].val1*3 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3>>16);
+			sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100;
+		}
+		if(	sd->sc_data[i=SC_SPEEDPOTION3].timer!=-1 ||
+			sd->sc_data[i=SC_SPEEDPOTION2].timer!=-1 ||
+			sd->sc_data[i=SC_SPEEDPOTION1].timer!=-1 ||
+			sd->sc_data[i=SC_SPEEDPOTION0].timer!=-1)	// ? 速ポ?ション
+			aspd_rate -= sd->sc_data[i].val2;
+		if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1)	//ウィンドウォ?ク暫ヘLv*2%減算
+			sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100;
+		if(sd->sc_data[SC_CARTBOOST].timer!=-1)	// カ?トブ?スト
+		sd->speed -= (DEFAULT_WALK_SPEED * 20)/100;
+		if(sd->sc_data[SC_BERSERK].timer!=-1)	//バ?サ?ク中はIAと同じぐらい速い?
+			sd->speed -= sd->speed *25/100;
+		if(sd->sc_data[SC_WEDDING].timer!=-1)	//結婚中は?くのが?い
+			sd->speed = 2*DEFAULT_WALK_SPEED;
+
+		// HIT/FLEE?化系
+		if(sd->sc_data[SC_WHISTLE].timer!=-1){  // 口笛
+			sd->flee += sd->flee * (sd->sc_data[SC_WHISTLE].val1
+					+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3>>16))/100;
+			sd->flee2+= (sd->sc_data[SC_WHISTLE].val1+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3&0xffff)) * 10;
+		}
+		if(sd->sc_data[SC_HUMMING].timer!=-1)  // ハミング
+			sd->hit += (sd->sc_data[SC_HUMMING].val1*2+sd->sc_data[SC_HUMMING].val2
+					+sd->sc_data[SC_HUMMING].val3) * sd->hit/100;
+		if(sd->sc_data[SC_VIOLENTGALE].timer!=-1 && sd->def_ele==4){	// バイオレントゲイル
+			sd->flee += sd->flee*sd->sc_data[SC_VIOLENTGALE].val3/100;
+		}
+		if(sd->sc_data[SC_BLIND].timer!=-1){	// 暗?
+			sd->hit -= sd->hit*25/100;
+			sd->flee -= sd->flee*25/100;
+		}
+		if(sd->sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォ?ク
+			sd->flee += sd->flee*(sd->sc_data[SC_WINDWALK].val2)/100;
+		if(sd->sc_data[SC_SPIDERWEB].timer!=-1) //スパイダ?ウェブ
+			sd->flee -= sd->flee*50/100;
+		if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト
+			sd->hit += 3*(sd->sc_data[SC_TRUESIGHT].val1);
+		if(sd->sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレ?ション
+			sd->hit += (10*(sd->sc_data[SC_CONCENTRATION].val1));
+
+		// 耐性
+		if(sd->sc_data[SC_SIEGFRIED].timer!=-1){  // 不死身のジ?クフリ?ド
+			sd->subele[1] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[2] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[3] += sd->sc_data[SC_SIEGFRIED].val2;	// 火
+			sd->subele[4] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[5] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[6] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[7] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[8] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+			sd->subele[9] += sd->sc_data[SC_SIEGFRIED].val2;	// 水
+		}
+		if(sd->sc_data[SC_PROVIDENCE].timer!=-1){	// プロヴィデンス
+			sd->subele[6] += sd->sc_data[SC_PROVIDENCE].val2;	// ? 聖?性
+			sd->subrace[6] += sd->sc_data[SC_PROVIDENCE].val2;	// ? ?魔
+		}
+
+		// その他
+		if(sd->sc_data[SC_APPLEIDUN].timer!=-1){	// イドゥンの林檎
+			sd->status.max_hp += ((5+sd->sc_data[SC_APPLEIDUN].val1*2+((sd->sc_data[SC_APPLEIDUN].val2+1)>>1)
+						+sd->sc_data[SC_APPLEIDUN].val3/10) * sd->status.max_hp)/100;
+			if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp)
+				sd->status.max_hp = battle_config.max_hp;
+		}
+		if(sd->sc_data[SC_DELUGE].timer!=-1 && sd->def_ele==1){	// デリュ?ジ
+			sd->status.max_hp += sd->status.max_hp*sd->sc_data[SC_DELUGE].val3/100;
+			if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp)
+				sd->status.max_hp = battle_config.max_hp;
+		}
+		if(sd->sc_data[SC_SERVICE4U].timer!=-1) {	// サ?ビスフォ?ユ?
+			sd->status.max_sp += sd->status.max_sp*(10+sd->sc_data[SC_SERVICE4U].val1+sd->sc_data[SC_SERVICE4U].val2
+						+sd->sc_data[SC_SERVICE4U].val3)/100;
+			if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp)
+				sd->status.max_sp = battle_config.max_sp;
+			sd->dsprate-=(10+sd->sc_data[SC_SERVICE4U].val1*3+sd->sc_data[SC_SERVICE4U].val2
+					+sd->sc_data[SC_SERVICE4U].val3);
+			if(sd->dsprate<0)sd->dsprate=0;
+		}
+
+		if(sd->sc_data[SC_FORTUNE].timer!=-1)	// 幸運のキス
+			sd->critical += (10+sd->sc_data[SC_FORTUNE].val1+sd->sc_data[SC_FORTUNE].val2
+						+sd->sc_data[SC_FORTUNE].val3)*10;
+
+		if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1){	// 爆裂波動
+			if(s_class.job==23)
+				sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val1*100;
+			else
+			sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2;
+		}
+
+		if(sd->sc_data[SC_STEELBODY].timer!=-1){	// 金剛
+			sd->def = 90;
+			sd->mdef = 90;
+			aspd_rate += 25;
+			sd->speed = (sd->speed * 125) / 100;
+		}
+		if(sd->sc_data[SC_DEFENDER].timer != -1) {
+			sd->aspd += (550 - sd->sc_data[SC_DEFENDER].val1*50);
+			// removed as of 12/14's patch [celest]
+			//sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100;
+		}
+		if(sd->sc_data[SC_ENCPOISON].timer != -1)
+			sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2;
+
+		if( sd->sc_data[SC_DANCING].timer!=-1 ){		// 演奏/ダンス使用中
+			sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)));
+			//sd->speed*=4;
+			sd->nhealsp = 0;
+			sd->nshealsp = 0;
+			sd->nsshealsp = 0;
+		}
+		if(sd->sc_data[SC_CURSE].timer!=-1)
+			sd->speed += 450;
+
+		if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト
+			sd->critical += sd->critical*(sd->sc_data[SC_TRUESIGHT].val1)/100;
+
+/*		if(sd->sc_data[SC_VOLCANO].timer!=-1)	// エンチャントポイズン(?性はbattle.cで)
+			sd->addeff[2]+=sd->sc_data[SC_VOLCANO].val2;//% of granting
+		if(sd->sc_data[SC_DELUGE].timer!=-1)	// エンチャントポイズン(?性はbattle.cで)
+			sd->addeff[0]+=sd->sc_data[SC_DELUGE].val2;//% of granting
+		*/
+		if(sd->sc_data[SC_BERSERK].timer!=-1) {	//All Def/MDef reduced to 0 while in Berserk [DracoRPG]
+			sd->def = sd->def2 = 0;
+			sd->mdef = sd->mdef2 = 0;
+			sd->flee -= sd->flee*50/100;
+			aspd_rate -= 30;
+			//sd->base_atk *= 3;
+		}
+		if(sd->sc_data[SC_KEEPING].timer!=-1)
+			sd->def = 100;
+		if(sd->sc_data[SC_BARRIER].timer!=-1)
+			sd->mdef = 100;
+
+		if(sd->sc_data[SC_JOINTBEAT].timer!=-1) { // Random break [DracoRPG]
+			switch(sd->sc_data[SC_JOINTBEAT].val2) {
+			case 1: //Ankle break
+				sd->speed_rate += 50;
+				break;
+			case 2:	//Wrist	break
+				sd->aspd_rate += 25;
+				break;
+			case 3:	//Knee break
+				sd->speed_rate += 30;
+				sd->aspd_rate += 10;
+				break;
+			case 4:	//Shoulder break
+				sd->def2 -= sd->def2*50/100;
+				break;
+			case 5:	//Waist	break
+				sd->def2 -= sd->def2*50/100;
+				sd->base_atk -= sd->base_atk*25/100;
+				break;
+			}
+		}
+
+		if(sd->sc_data[SC_GOSPEL].timer!=-1) {
+			if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){
+				switch (sd->sc_data[SC_GOSPEL].val3)
+				{
+				case 4:
+					sd->status.max_hp += sd->status.max_hp * 25 / 100;
+					if(sd->status.max_hp > battle_config.max_hp)
+						sd->status.max_hp = battle_config.max_hp;
+					break;
+				case 5:
+					sd->status.max_sp += sd->status.max_sp * 25 / 100;
+					if(sd->status.max_sp > battle_config.max_sp)
+						sd->status.max_sp = battle_config.max_sp;
+					break;
+				case 11:
+					sd->def += sd->def * 25 / 100;
+					sd->def2 += sd->def2 * 25 / 100;
+					break;
+				case 12:
+					sd->base_atk += sd->base_atk * 8 / 100;
+					break;
+				case 13:
+					sd->flee += sd->flee * 5 / 100;
+					break;
+				case 14:
+					sd->hit += sd->hit * 5 / 100;
+					break;
+				}
+			} else if (sd->sc_data[SC_GOSPEL].val4 == BCT_ENEMY){
+				switch (sd->sc_data[SC_GOSPEL].val3)
+				{
+					case 5:
+						sd->def = 0;
+						sd->def2 = 0;
+						break;
+					case 6:
+						sd->base_atk = 0;
+						sd->watk = 0;
+						sd->watk2 = 0;
+						break;
+					case 7:
+						sd->flee = 0;
+						break;
+					case 8:
+						sd->speed_rate += 75;
+						aspd_rate += 75;
+						break;
+				}
+			}
+		}
+	}
+
+	if (sd->speed_rate <= 0)
+		sd->speed_rate = 1;
+
+	if(sd->speed_rate != 100)
+		sd->speed = sd->speed*sd->speed_rate/100;
+	if(sd->speed < 1) sd->speed = 1;
+	if(aspd_rate != 100)
+		sd->aspd = sd->aspd*aspd_rate/100;
+	if(pc_isriding(sd))							// 騎兵修練
+		sd->aspd = sd->aspd*(100 + 10*(5 - pc_checkskill(sd,KN_CAVALIERMASTERY)))/ 100;
+	if(sd->aspd < battle_config.max_aspd) sd->aspd = battle_config.max_aspd;
+	sd->amotion = sd->aspd;
+	sd->dmotion = 800-sd->paramc[1]*4;
+	if(sd->dmotion<400)
+		sd->dmotion = 400;
+	if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) {
+		sd->prev_speed = sd->speed;
+		sd->speed = sd->speed*(175 - skill*5)/100;
+	}
+
+	if(sd->status.hp>sd->status.max_hp)
+		sd->status.hp=sd->status.max_hp;
+	if(sd->status.sp>sd->status.max_sp)
+		sd->status.sp=sd->status.max_sp;
+
+	if(first&4)
+		return 0;
+	if(first&3) {
+		clif_updatestatus(sd,SP_SPEED);
+		clif_updatestatus(sd,SP_MAXHP);
+		clif_updatestatus(sd,SP_MAXSP);
+		if(first&1) {
+			clif_updatestatus(sd,SP_HP);
+			clif_updatestatus(sd,SP_SP);
+		}
+		return 0;
+	}
+
+	if(b_class != sd->view_class) {
+		clif_changelook(&sd->bl,LOOK_BASE,sd->view_class);
+#if PACKETVER < 4
+		clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon);
+		clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield);
+#else
+		clif_changelook(&sd->bl,LOOK_WEAPON,0);
+#endif
+	}
+
+	if( memcmp(b_skill,sd->status.skill,sizeof(sd->status.skill)) || b_attackrange != sd->attackrange)
+		clif_skillinfoblock(sd);	// スキル送信
+
+	if(b_speed != sd->speed)
+		clif_updatestatus(sd,SP_SPEED);
+	if(b_weight != sd->weight)
+		clif_updatestatus(sd,SP_WEIGHT);
+	if(b_max_weight != sd->max_weight) {
+		clif_updatestatus(sd,SP_MAXWEIGHT);
+		pc_checkweighticon(sd);
+	}
+	for(i=0;i<6;i++)
+		if(b_paramb[i] + b_parame[i] != sd->paramb[i] + sd->parame[i])
+			clif_updatestatus(sd,SP_STR+i);
+	if(b_hit != sd->hit)
+		clif_updatestatus(sd,SP_HIT);
+	if(b_flee != sd->flee)
+		clif_updatestatus(sd,SP_FLEE1);
+	if(b_aspd != sd->aspd)
+		clif_updatestatus(sd,SP_ASPD);
+	if(b_watk != sd->watk || b_base_atk != sd->base_atk)
+		clif_updatestatus(sd,SP_ATK1);
+	if(b_def != sd->def)
+		clif_updatestatus(sd,SP_DEF1);
+	if(b_watk2 != sd->watk2)
+		clif_updatestatus(sd,SP_ATK2);
+	if(b_def2 != sd->def2)
+		clif_updatestatus(sd,SP_DEF2);
+	if(b_flee2 != sd->flee2)
+		clif_updatestatus(sd,SP_FLEE2);
+	if(b_critical != sd->critical)
+		clif_updatestatus(sd,SP_CRITICAL);
+	if(b_matk1 != sd->matk1)
+		clif_updatestatus(sd,SP_MATK1);
+	if(b_matk2 != sd->matk2)
+		clif_updatestatus(sd,SP_MATK2);
+	if(b_mdef != sd->mdef)
+		clif_updatestatus(sd,SP_MDEF1);
+	if(b_mdef2 != sd->mdef2)
+		clif_updatestatus(sd,SP_MDEF2);
+	if(b_attackrange != sd->attackrange)
+		clif_updatestatus(sd,SP_ATTACKRANGE);
+	if(b_max_hp != sd->status.max_hp)
+		clif_updatestatus(sd,SP_MAXHP);
+	if(b_max_sp != sd->status.max_sp)
+		clif_updatestatus(sd,SP_MAXSP);
+	if(b_hp != sd->status.hp)
+		clif_updatestatus(sd,SP_HP);
+	if(b_sp != sd->status.sp)
+		clif_updatestatus(sd,SP_SP);
+
+/*	if(before.cart_num != before.cart_num || before.cart_max_num != before.cart_max_num ||
+		before.cart_weight != before.cart_weight || before.cart_max_weight != before.cart_max_weight )
+		clif_updatestatus(sd,SP_CARTINFO);*/
+
+	//if(sd->status.hp<sd->status.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 &&
+	if(sd->status.hp<sd->status.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 &&
+		(sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ) && !pc_isdead(sd))
+		// オ?トバ?サ?ク?動
+		status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0);
+
+	return 0;
+}
+
+/*==========================================
+ * For quick calculating [Celest]
+ *------------------------------------------
+ */
+int status_calc_speed (struct map_session_data *sd)
+{
+	int b_speed, skill;
+	struct pc_base_job s_class;
+
+	nullpo_retr(0, sd);
+
+	s_class = pc_calc_base_job(sd->status.class_);
+
+	b_speed = sd->speed;
+	sd->speed = DEFAULT_WALK_SPEED ;
+
+	if(sd->sc_count){
+		if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){	// 速度?加
+			sd->speed -= sd->speed *25/100;
+		}
+		if(sd->sc_data[SC_DECREASEAGI].timer!=-1) {
+			sd->speed = sd->speed *125/100;
+		}
+		if(sd->sc_data[SC_CLOAKING].timer!=-1) {
+			sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100;
+		}
+		if(sd->sc_data[SC_CHASEWALK].timer!=-1) {
+			sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100;
+		}
+		if(sd->sc_data[SC_QUAGMIRE].timer!=-1){
+			sd->speed = sd->speed*3/2;
+		}
+		if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) {
+			sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100;
+		}
+		if(sd->sc_data[SC_CARTBOOST].timer!=-1) {
+			sd->speed -= (DEFAULT_WALK_SPEED * 20)/100;
+		}
+		if(sd->sc_data[SC_BERSERK].timer!=-1) {
+			sd->speed -= sd->speed *25/100;
+		}
+		if(sd->sc_data[SC_WEDDING].timer!=-1) {
+			sd->speed = 2*DEFAULT_WALK_SPEED;
+		}
+		if(sd->sc_data[SC_DONTFORGETME].timer!=-1){
+			sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100;
+		}
+		if(sd->sc_data[SC_STEELBODY].timer!=-1){
+			sd->speed = (sd->speed * 125) / 100;
+		}
+		if(sd->sc_data[SC_DEFENDER].timer != -1) {
+			// removed as of 12/14's patch [celest]
+			//sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100;
+		}
+		if( sd->sc_data[SC_DANCING].timer!=-1 ){
+			sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON)));
+		}
+		if(sd->sc_data[SC_CURSE].timer!=-1)
+			sd->speed += 450;
+		if(sd->sc_data[SC_SLOWDOWN].timer!=-1)
+			sd->speed = sd->speed*150/100;
+		if(sd->sc_data[SC_SPEEDUP0].timer!=-1)
+			sd->speed -= sd->speed*25/100;
+	}
+
+	if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 )
+		sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9);
+	if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0)
+		sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1);
+	else if (pc_isriding(sd)) {
+		sd->speed -= (0.25 * DEFAULT_WALK_SPEED);
+	}
+	if((skill=pc_checkskill(sd,TF_MISS))>0)
+		if(s_class.job==12)
+			sd->speed -= sd->speed *(skill*1.5)/100;
+
+	if(sd->speed_rate != 100)
+		sd->speed = sd->speed*sd->speed_rate/100;
+	if(sd->speed < 1) sd->speed = 1;
+
+	if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) {
+		sd->prev_speed = sd->speed;
+		sd->speed = sd->speed*(175 - skill*5)/100;
+	}
+
+	if(b_speed != sd->speed)
+		clif_updatestatus(sd,SP_SPEED);
+
+	return 0;
+}
+
+/*==========================================
+ * 対象のClassを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_class(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data *)bl)->class_;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->status.class_;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return ((struct pet_data *)bl)->class_;
+	else
+		return 0;
+}
+/*==========================================
+ * 対象の方向を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_dir(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data *)bl)->dir;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->dir;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return ((struct pet_data *)bl)->dir;
+	else
+		return 0;
+}
+/*==========================================
+ * 対象のレベルを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_lv(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data *)bl)->level;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->status.base_level;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return ((struct pet_data *)bl)->msd->pet.level;
+	else
+		return 0;
+}
+
+/*==========================================
+ * 対象の射程を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_range(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return mob_db[((struct mob_data *)bl)->class_].range;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->attackrange;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return mob_db[((struct pet_data *)bl)->class_].range;
+	else
+		return 0;
+}
+/*==========================================
+ * 対象のHPを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_hp(struct block_list *bl)
+{
+	nullpo_retr(1, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data *)bl)->hp;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->status.hp;
+	else
+		return 1;
+}
+/*==========================================
+ * 対象のMHPを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_max_hp(struct block_list *bl)
+{
+	nullpo_retr(1, bl);
+
+	if(bl->type==BL_PC && ((struct map_session_data *)bl))
+		return ((struct map_session_data *)bl)->status.max_hp;
+	else {
+		struct status_change *sc_data;		
+		int max_hp = 1;
+
+		if(bl->type == BL_MOB) {
+			struct mob_data *md;
+			nullpo_retr(1, md = (struct mob_data *)bl);
+			max_hp = mob_db[md->class_].max_hp;
+
+			if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris]
+				max_hp += (md->level - mob_db[md->class_].lv) * status_get_vit(bl);
+
+			if(mob_db[md->class_].mexp > 0) {
+				if(battle_config.mvp_hp_rate != 100)
+					max_hp = (max_hp * battle_config.mvp_hp_rate)/100;
+			}
+			else {
+				if(battle_config.monster_hp_rate != 100)
+					max_hp = (max_hp * battle_config.monster_hp_rate)/100;
+			}
+		}
+		else if(bl->type == BL_PET) {
+			struct pet_data *pd;
+			nullpo_retr(1, pd = (struct pet_data*)bl);
+			max_hp = mob_db[pd->class_].max_hp;
+
+			if(mob_db[pd->class_].mexp > 0) {
+				if(battle_config.mvp_hp_rate != 100)
+					max_hp = (max_hp * battle_config.mvp_hp_rate)/100;
+			}
+			else {
+				if(battle_config.monster_hp_rate != 100)
+					max_hp = (max_hp * battle_config.monster_hp_rate)/100;
+			}
+		}
+
+		sc_data = status_get_sc_data(bl);
+		if(sc_data) {
+			if(sc_data[SC_APPLEIDUN].timer != -1)
+				max_hp += ((5 + sc_data[SC_APPLEIDUN].val1 * 2 + ((sc_data[SC_APPLEIDUN].val2 + 1) >> 1)
+					+ sc_data[SC_APPLEIDUN].val3 / 10) * max_hp)/100;
+			if(sc_data[SC_GOSPEL].timer != -1 &&
+				sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+				sc_data[SC_GOSPEL].val3 == 4)
+				max_hp += max_hp * 25 / 100;
+		}
+		if(max_hp < 1) max_hp = 1;
+		return max_hp;
+	}
+	return 1;
+}
+/*==========================================
+ * 対象のStrを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_str(struct block_list *bl)
+{
+	int str = 0;
+	nullpo_retr(0, bl);
+
+	if (bl->type == BL_PC && ((struct map_session_data *)bl))
+		return ((struct map_session_data *)bl)->paramc[0];
+	else {		
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);
+
+		if(bl->type == BL_MOB && ((struct mob_data *)bl)) {
+			str = mob_db[((struct mob_data *)bl)->class_].str;
+			if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris]
+				str += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}
+		else if(bl->type == BL_PET && ((struct pet_data *)bl))
+			str = mob_db[((struct pet_data *)bl)->class_].str;
+
+		if(sc_data) {
+			if(sc_data[SC_LOUD].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1)
+				str += 4;
+			if( sc_data[SC_BLESSING].timer != -1){	// ブレッシング
+				int race = status_get_race(bl);
+				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6)
+					str >>= 1;	// 悪 魔/不死
+				else str += sc_data[SC_BLESSING].val1;	// その他
+			}
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				str += 5;
+		}
+	}
+	if(str < 0) str = 0;
+	return str;
+}
+/*==========================================
+ * 対象のAgiを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+
+int status_get_agi(struct block_list *bl)
+{
+	int agi=0;
+	nullpo_retr(0, bl);
+
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->paramc[1];
+	else {
+		struct status_change *sc_data;	
+		sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB && (struct mob_data *)bl) {
+			agi = mob_db[((struct mob_data *)bl)->class_].agi;
+			if(battle_config.mobs_level_up) // increase of mobs leveling up [Valaris]
+				agi += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			agi = mob_db[((struct pet_data *)bl)->class_].agi;
+
+		if(sc_data) {
+			if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 速度増加(PCはpc.cで)
+				agi += 2 + sc_data[SC_INCREASEAGI].val1;
+			if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1)
+				agi += agi * (2 + sc_data[SC_CONCENTRATE].val1)/100;
+			if(sc_data[SC_DECREASEAGI].timer!=-1)	// 速度減少
+				agi -= 2 + sc_data[SC_DECREASEAGI].val1;
+			if(sc_data[SC_QUAGMIRE].timer!=-1 ) {	// クァグマイア
+				//agi >>= 1;
+				//int agib = agi*(sc_data[SC_QUAGMIRE].val1*10)/100;
+				//agi -= agib > 50 ? 50 : agib;
+				agi -= sc_data[SC_QUAGMIRE].val1*10;
+			}
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				agi += 5;
+		}
+	}
+	if(agi < 0) agi = 0;
+	return agi;
+}
+/*==========================================
+ * 対象のVitを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_vit(struct block_list *bl)
+{
+	int vit = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->paramc[2];
+	else {
+		struct status_change *sc_data;	
+		sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB && (struct mob_data *)bl) {
+			vit = mob_db[((struct mob_data *)bl)->class_].vit;
+			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
+				vit += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}	
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			vit = mob_db[((struct pet_data *)bl)->class_].vit;
+		if(sc_data) {
+			if(sc_data[SC_STRIPARMOR].timer != -1)
+				vit = vit*60/100;
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				vit += 5;
+		}
+	}
+	if(vit < 0) vit = 0;
+	return vit;
+}
+/*==========================================
+ * 対象のIntを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_int(struct block_list *bl)
+{
+	int int_=0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->paramc[3];
+	else {
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB && (struct mob_data *)bl){
+			int_ = mob_db[((struct mob_data *)bl)->class_].int_;
+			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
+				int_ += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}		
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			int_ = mob_db[((struct pet_data *)bl)->class_].int_;
+
+		if(sc_data) {
+			if(sc_data[SC_BLESSING].timer != -1){	// ブレッシング
+				int race = status_get_race(bl);
+				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6 )
+					int_ >>= 1;	// 悪 魔/不死
+				else
+					int_ += sc_data[SC_BLESSING].val1;	// その他
+			}
+			if(sc_data[SC_STRIPHELM].timer != -1)
+				int_ = int_*60/100;
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				int_ += 5;
+		}
+	}
+	if(int_ < 0) int_ = 0;
+	return int_;
+}
+/*==========================================
+ * 対象のDexを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_dex(struct block_list *bl)
+{
+	int dex = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->paramc[4];
+	else {
+		struct status_change *sc_data;	
+		sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB && (struct mob_data *)bl) {
+			dex = mob_db[((struct mob_data *)bl)->class_].dex;
+			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
+				dex += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}		
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			dex = mob_db[((struct pet_data *)bl)->class_].dex;
+
+		if(sc_data) {
+			if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1)
+				dex += dex*(2+sc_data[SC_CONCENTRATE].val1)/100;
+			if(sc_data[SC_BLESSING].timer != -1){	// ブレッシング
+				int race = status_get_race(bl);
+				if(battle_check_undead(race,status_get_elem_type(bl)) || race == 6 )
+					dex >>= 1;	// 悪 魔/不死
+				else dex += sc_data[SC_BLESSING].val1;	// その他
+			}
+			if(sc_data[SC_QUAGMIRE].timer!=-1)	{ // クァグマイア
+				// dex >>= 1;
+				//int dexb = dex*(sc_data[SC_QUAGMIRE].val1*10)/100;
+				//dex -= dexb > 50 ? 50 : dexb;
+				dex -= sc_data[SC_QUAGMIRE].val1*10;
+			}
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				dex += 5;
+		}
+	}
+	if(dex < 0) dex = 0;
+	return dex;
+}
+/*==========================================
+ * 対象のLukを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_luk(struct block_list *bl)
+{
+	int luk = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->paramc[5];
+	else {
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB && (struct mob_data *)bl) {
+			luk = mob_db[((struct mob_data *)bl)->class_].luk;
+			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
+				luk += ((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}		
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			luk = mob_db[((struct pet_data *)bl)->class_].luk;
+		if(sc_data) {
+			if(sc_data[SC_GLORIA].timer!=-1)	// グロリア(PCはpc.cで)
+				luk += 30;
+			if(sc_data[SC_TRUESIGHT].timer!=-1)	// トゥルーサイト
+				luk += 5;
+			if(sc_data[SC_CURSE].timer!=-1)		// 呪い
+				luk = 0;
+		}
+	}
+	if(luk < 0) luk = 0;
+	return luk;
+}
+
+/*==========================================
+ * 対象のFleeを返す(汎用)
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_flee(struct block_list *bl)
+{
+	int flee = 1;
+	nullpo_retr(1, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->flee;
+	else {
+		struct status_change *sc_data;	
+		sc_data = status_get_sc_data(bl);
+		flee = status_get_agi(bl) + status_get_lv(bl);
+
+		if(sc_data){
+			if(sc_data[SC_WHISTLE].timer!=-1)
+				flee += flee*(sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2
+					+(sc_data[SC_WHISTLE].val3>>16))/100;
+			if(sc_data[SC_BLIND].timer!=-1)
+				flee -= flee*25/100;
+			if(sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォーク
+				flee += flee*(sc_data[SC_WINDWALK].val2)/100;
+			if(sc_data[SC_SPIDERWEB].timer!=-1) //スパイダーウェブ
+				flee -= flee*50/100;
+			if(sc_data[SC_GOSPEL].timer!=-1) {
+				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+					sc_data[SC_GOSPEL].val3 == 13)
+					flee += flee*5/100;
+				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+					sc_data[SC_GOSPEL].val3 == 7)
+					flee = 0;
+			}
+		}
+	}
+	if(flee < 1) flee = 1;
+	return flee;
+}
+/*==========================================
+ * 対象のHitを返す(汎用)
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_hit(struct block_list *bl)
+{
+	int hit = 1;
+	nullpo_retr(1, bl);
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->hit;
+	else {
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);		
+		hit = status_get_dex(bl) + status_get_lv(bl);
+
+		if(sc_data) {
+			if(sc_data[SC_HUMMING].timer!=-1)	//
+				hit += hit*(sc_data[SC_HUMMING].val1*2+sc_data[SC_HUMMING].val2
+					+sc_data[SC_HUMMING].val3)/100;
+			if(sc_data[SC_BLIND].timer!=-1)		// 呪い
+				hit -= hit*25/100;
+			if(sc_data[SC_TRUESIGHT].timer!=-1)		// トゥルーサイト
+				hit += 3*(sc_data[SC_TRUESIGHT].val1);
+			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
+				hit += (hit*(10*(sc_data[SC_CONCENTRATION].val1)))/100;
+			if(sc_data[SC_GOSPEL].timer!=-1 &&
+				sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+				sc_data[SC_GOSPEL].val3 == 14)
+				hit += hit*5/100;
+		}
+	}
+	if(hit < 1) hit = 1;
+	return hit;
+}
+/*==========================================
+ * 対象の完全回避を返す(汎用)
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_flee2(struct block_list *bl)
+{
+	int flee2 = 1;
+	nullpo_retr(1, bl);
+
+	if(bl->type==BL_PC && (struct map_session_data *)bl){
+		return ((struct map_session_data *)bl)->flee2;
+	} else {
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);
+		flee2 = status_get_luk(bl)+1;
+
+		if(sc_data) {
+			if(sc_data[SC_WHISTLE].timer!=-1)
+				flee2 += (sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2
+					+(sc_data[SC_WHISTLE].val3&0xffff))*10;
+		}
+	}
+	if(flee2 < 1) flee2 = 1;
+	return flee2;
+}
+/*==========================================
+ * 対象のクリティカルを返す(汎用)
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_critical(struct block_list *bl)
+{
+	int critical = 1;
+	nullpo_retr(1, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl){
+		return ((struct map_session_data *)bl)->critical;
+	} else {
+		struct status_change *sc_data;
+		sc_data = status_get_sc_data(bl);		
+		critical = status_get_luk(bl)*3 + 1;
+
+		if(sc_data) {
+			if(sc_data[SC_FORTUNE].timer!=-1)
+				critical += (10+sc_data[SC_FORTUNE].val1+sc_data[SC_FORTUNE].val2
+					+ sc_data[SC_FORTUNE].val3)*10;
+			if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1)
+				critical += sc_data[SC_EXPLOSIONSPIRITS].val2;
+			if(sc_data[SC_TRUESIGHT].timer!=-1) //トゥルーサイト
+				critical += critical*sc_data[SC_TRUESIGHT].val1/100;
+		}
+	}
+	if(critical < 1) critical = 1;
+	return critical;
+}
+/*==========================================
+ * base_atkの取得
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_baseatk(struct block_list *bl)
+{
+	int batk = 1;
+	nullpo_retr(1, bl);
+	
+	if(bl->type==BL_PC && (struct map_session_data *)bl) {
+		batk = ((struct map_session_data *)bl)->base_atk; //設定されているbase_atk
+		if (((struct map_session_data *)bl)->status.weapon < 16)
+			batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon];
+	} else { //それ以外なら
+		struct status_change *sc_data;
+		int str,dstr;
+		str = status_get_str(bl); //STR
+		dstr = str/10;
+		batk = dstr*dstr + str; //base_atkを計算する
+		sc_data = status_get_sc_data(bl);
+
+		if(sc_data) { //状態異常あり
+			if(sc_data[SC_PROVOKE].timer!=-1) //PCでプロボック(SM_PROVOKE)状態
+				batk = batk*(100+2*sc_data[SC_PROVOKE].val1)/100; //base_atk増加
+			if(sc_data[SC_CURSE].timer!=-1) //呪われていたら
+				batk -= batk*25/100; //base_atkが25%減少
+			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
+				batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100;
+		}
+	}
+	if(batk < 1) batk = 1; //base_atkは最低でも1
+	return batk;
+}
+/*==========================================
+ * 対象のAtkを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_atk(struct block_list *bl)
+{
+	int atk = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data*)bl)->watk;
+	else {
+		struct status_change *sc_data;
+		sc_data=status_get_sc_data(bl);
+		
+		if(bl->type == BL_MOB && (struct mob_data *)bl)
+			atk = mob_db[((struct mob_data*)bl)->class_].atk1;
+		else if(bl->type == BL_PET && (struct pet_data *)bl)
+			atk = mob_db[((struct pet_data*)bl)->class_].atk1;
+
+		if(sc_data) {
+			if(sc_data[SC_PROVOKE].timer!=-1)
+				atk = atk*(100+2*sc_data[SC_PROVOKE].val1)/100;
+			if(sc_data[SC_CURSE].timer!=-1)
+				atk -= atk*25/100;
+			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
+				atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100;
+
+			if(sc_data[SC_GOSPEL].timer!=-1) {
+				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+					sc_data[SC_GOSPEL].val3 == 12)
+					atk += atk*8/100;
+				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+					sc_data[SC_GOSPEL].val3 == 6)
+					atk = 0;
+			}
+		}
+	}
+	if(atk < 0) atk = 0;
+	return atk;
+}
+/*==========================================
+ * 対象の左手Atkを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_atk_(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl){
+		int atk=((struct map_session_data*)bl)->watk_;
+		return atk;
+	}
+	else
+		return 0;
+}
+/*==========================================
+ * 対象のAtk2を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_atk2(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data*)bl)->watk2;
+	else {
+		struct status_change *sc_data=status_get_sc_data(bl);
+		int atk2=0;
+		if(bl->type==BL_MOB && (struct mob_data *)bl)
+			atk2 = mob_db[((struct mob_data*)bl)->class_].atk2;
+		else if(bl->type==BL_PET && (struct pet_data *)bl)
+			atk2 = mob_db[((struct pet_data*)bl)->class_].atk2;
+		if(sc_data) {
+			if( sc_data[SC_IMPOSITIO].timer!=-1)
+				atk2 += sc_data[SC_IMPOSITIO].val1*5;
+			if( sc_data[SC_PROVOKE].timer!=-1 )
+				atk2 = atk2*(100+2*sc_data[SC_PROVOKE].val1)/100;
+			if( sc_data[SC_CURSE].timer!=-1 )
+				atk2 -= atk2*25/100;
+			if(sc_data[SC_DRUMBATTLE].timer!=-1)
+				atk2 += sc_data[SC_DRUMBATTLE].val2;
+			if(sc_data[SC_NIBELUNGEN].timer!=-1 && (status_get_element(bl)/10) >= 8 )
+				atk2 += sc_data[SC_NIBELUNGEN].val3;
+			if(sc_data[SC_STRIPWEAPON].timer!=-1)
+				atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100;
+			if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション
+				atk2 += atk2*(5*sc_data[SC_CONCENTRATION].val1)/100;
+		}
+		if(atk2 < 0) atk2 = 0;
+		return atk2;
+	}
+	return 0;
+}
+/*==========================================
+ * 対象の左手Atk2を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_atk_2(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data*)bl)->watk_2;
+	else
+		return 0;
+}
+/*==========================================
+ * 対象のMAtk1を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_matk1(struct block_list *bl)
+{
+	int matk = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->matk1;
+	else {
+		struct status_change *sc_data;
+		int int_ = status_get_int(bl);
+		matk = int_+(int_/5)*(int_/5);
+
+		sc_data = status_get_sc_data(bl);
+		if(sc_data) {
+			if(sc_data[SC_MINDBREAKER].timer!=-1)
+				matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100;
+		}
+	}
+	return matk;
+}
+/*==========================================
+ * 対象のMAtk2を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_matk2(struct block_list *bl)
+{
+	int matk = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->matk2;
+	else {
+		struct status_change *sc_data = status_get_sc_data(bl);
+		int int_ = status_get_int(bl);
+		matk = int_+(int_/7)*(int_/7);
+
+		if(sc_data) {
+			if(sc_data[SC_MINDBREAKER].timer!=-1)
+				matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100;
+		}
+	}
+	return matk;
+}
+/*==========================================
+ * 対象のDefを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_def(struct block_list *bl)
+{
+	struct status_change *sc_data;
+	int def=0,skilltimer=-1,skillid=0;
+
+	nullpo_retr(0, bl);
+	sc_data=status_get_sc_data(bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl){
+		def = ((struct map_session_data *)bl)->def;
+		skilltimer = ((struct map_session_data *)bl)->skilltimer;
+		skillid = ((struct map_session_data *)bl)->skillid;
+	}
+	else if(bl->type==BL_MOB && (struct mob_data *)bl) {
+		def = mob_db[((struct mob_data *)bl)->class_].def;
+		skilltimer = ((struct mob_data *)bl)->skilltimer;
+		skillid = ((struct mob_data *)bl)->skillid;
+	}
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		def = mob_db[((struct pet_data *)bl)->class_].def;
+
+	if(def < 1000000) {
+		if(sc_data) {
+			//凍結、石化時は右シフト
+			if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))
+				def >>= 1;
+
+			if (bl->type != BL_PC) {
+				//キーピング時はDEF100
+				if( sc_data[SC_KEEPING].timer!=-1)
+					def = 100;
+				//プロボック時は減算
+				if( sc_data[SC_PROVOKE].timer!=-1)
+					def = (def*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100;
+				//戦太鼓の響き時は加算
+				if( sc_data[SC_DRUMBATTLE].timer!=-1)
+					def += sc_data[SC_DRUMBATTLE].val3;
+				//毒にかかっている時は減算
+				if(sc_data[SC_POISON].timer!=-1)
+					def = def*75/100;
+				//ストリップシールド時は減算
+				if(sc_data[SC_STRIPSHIELD].timer!=-1)
+					def = def*sc_data[SC_STRIPSHIELD].val2/100;
+				//シグナムクルシス時は減算
+				if(sc_data[SC_SIGNUMCRUCIS].timer!=-1)
+					def = def * (100 - sc_data[SC_SIGNUMCRUCIS].val2)/100;
+				//永遠の混沌時はDEF0になる
+				if(sc_data[SC_ETERNALCHAOS].timer!=-1)
+					def = 0;
+				//コンセントレーション時は減算
+				if( sc_data[SC_CONCENTRATION].timer!=-1)
+					def = (def*(100 - 5*sc_data[SC_CONCENTRATION].val1))/100;
+
+				if(sc_data[SC_GOSPEL].timer!=-1) {
+					if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+						sc_data[SC_GOSPEL].val3 == 11)
+						def += def*25/100;
+					else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+						sc_data[SC_GOSPEL].val3 == 5)
+						def = 0;
+				}
+				if(sc_data[SC_JOINTBEAT].timer!=-1) {
+					if (sc_data[SC_JOINTBEAT].val2 == 4)
+						def -= def*50/100;
+					else if (sc_data[SC_JOINTBEAT].val2 == 5)
+						def -= def*25/100;
+				}
+			}
+		}
+		//詠唱中は詠唱時減算率に基づいて減算
+		if(skilltimer != -1) {
+			int def_rate = skill_get_castdef(skillid);
+			if(def_rate != 0)
+				def = (def * (100 - def_rate))/100;
+		}
+	}
+	if(def < 0) def = 0;
+	return def;
+}
+/*==========================================
+ * 対象のMDefを返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_mdef(struct block_list *bl)
+{
+	struct status_change *sc_data;
+	int mdef=0;
+
+	nullpo_retr(0, bl);
+	sc_data=status_get_sc_data(bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		mdef = ((struct map_session_data *)bl)->mdef;
+	else if(bl->type==BL_MOB && (struct mob_data *)bl)
+		mdef = mob_db[((struct mob_data *)bl)->class_].mdef;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		mdef = mob_db[((struct pet_data *)bl)->class_].mdef;
+
+	if(mdef < 1000000) {
+		if(sc_data) {
+			//バリアー状態時はMDEF100
+			if(sc_data[SC_BARRIER].timer != -1)
+				mdef = 100;
+			//凍結、石化時は1.25倍
+			if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))
+				mdef = mdef*125/100;
+			if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC)
+				mdef -= (mdef*6*sc_data[SC_MINDBREAKER].val1)/100;
+		}
+	}
+	if(mdef < 0) mdef = 0;
+	return mdef;
+}
+/*==========================================
+ * 対象のDef2を返す(汎用)
+ * 戻りは整数で1以上
+ *------------------------------------------
+ */
+int status_get_def2(struct block_list *bl)
+{
+	int def2 = 1;
+	nullpo_retr(1, bl);
+	
+	if(bl->type==BL_PC)
+		return ((struct map_session_data *)bl)->def2;
+	else {
+		struct status_change *sc_data;
+
+		if(bl->type==BL_MOB)
+			def2 = mob_db[((struct mob_data *)bl)->class_].vit;
+		else if(bl->type==BL_PET)
+			def2 = mob_db[((struct pet_data *)bl)->class_].vit;
+
+		sc_data = status_get_sc_data(bl);
+		if(sc_data) {
+			if(sc_data[SC_ANGELUS].timer != -1)
+				def2 = def2*(110+5*sc_data[SC_ANGELUS].val1)/100;
+			if(sc_data[SC_PROVOKE].timer!=-1)
+				def2 = (def2*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100;
+			if(sc_data[SC_POISON].timer!=-1)
+				def2 = def2*75/100;
+			//コンセントレーション時は減算
+			if( sc_data[SC_CONCENTRATION].timer!=-1)
+				def2 = def2*(100 - 5*sc_data[SC_CONCENTRATION].val1)/100;
+
+			if(sc_data[SC_GOSPEL].timer!=-1) {
+				if (sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+					sc_data[SC_GOSPEL].val3 == 11)
+					def2 += def2*25/100;
+				else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+					sc_data[SC_GOSPEL].val3 == 5)
+					def2 = 0;
+			}
+		}
+	}
+	if(def2 < 1) def2 = 1;
+	return def2;
+}
+/*==========================================
+ * 対象のMDef2を返す(汎用)
+ * 戻りは整数で0以上
+ *------------------------------------------
+ */
+int status_get_mdef2(struct block_list *bl)
+{
+	int mdef2 = 0;
+	nullpo_retr(0, bl);
+
+	if(bl->type == BL_PC)
+		return ((struct map_session_data *)bl)->mdef2 + (((struct map_session_data *)bl)->paramc[2]>>1);
+	else {
+		struct status_change *sc_data = status_get_sc_data(bl);
+		if(bl->type == BL_MOB)
+			mdef2 = mob_db[((struct mob_data *)bl)->class_].int_ + (mob_db[((struct mob_data *)bl)->class_].vit>>1);
+		else if(bl->type == BL_PET)
+			mdef2 = mob_db[((struct pet_data *)bl)->class_].int_ + (mob_db[((struct pet_data *)bl)->class_].vit>>1);
+		if(sc_data) {
+			if(sc_data[SC_MINDBREAKER].timer!=-1)
+				mdef2 -= (mdef2*6*sc_data[SC_MINDBREAKER].val1)/100;
+		}
+	}
+	if(mdef2 < 0) mdef2 = 0;
+		return mdef2;
+}
+/*==========================================
+ * 対象のSpeed(移動速度)を返す(汎用)
+ * 戻りは整数で1以上
+ * Speedは小さいほうが移動速度が速い
+ *------------------------------------------
+ */
+int status_get_speed(struct block_list *bl)
+{
+	nullpo_retr(1000, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->speed;
+	else {
+		struct status_change *sc_data=status_get_sc_data(bl);
+		int speed = 1000;
+		if(bl->type==BL_MOB && (struct mob_data *)bl) {
+			speed = ((struct mob_data *)bl)->speed;
+			if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris]
+				speed-=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv;
+		}
+		else if(bl->type==BL_PET && (struct pet_data *)bl)
+			speed = ((struct pet_data *)bl)->msd->petDB->speed;
+
+		if(sc_data) {
+			//速度増加時は25%減算
+			if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_DONTFORGETME].timer == -1)
+				speed -= speed*25/100;
+			//速度減少時は25%加算
+			if(sc_data[SC_DECREASEAGI].timer!=-1)
+				speed = speed*125/100;
+			//クァグマイア時は50%加算
+			if(sc_data[SC_QUAGMIRE].timer!=-1)
+				speed = speed*3/2;
+			//私を忘れないで…時は加算
+			if(sc_data[SC_DONTFORGETME].timer!=-1)
+				speed = speed*(100+sc_data[SC_DONTFORGETME].val1*2 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3&0xffff))/100;
+			//金剛時は25%加算
+			if(sc_data[SC_STEELBODY].timer!=-1)
+				speed = speed*125/100;
+			//ディフェンダー時は加算
+			// removed as of 12/14's patch [celest]
+			/*if(sc_data[SC_DEFENDER].timer!=-1)
+				speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100;*/
+			//踊り状態は4倍遅い
+			if(sc_data[SC_DANCING].timer!=-1 )
+				speed *= 6;
+			//呪い時は450加算
+			if(sc_data[SC_CURSE].timer!=-1)
+				speed = speed + 450;
+			//ウィンドウォーク時はLv*2%減算
+			if(sc_data[SC_WINDWALK].timer!=-1 && sc_data[SC_INCREASEAGI].timer==-1)
+				speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100;
+			if(sc_data[SC_SLOWDOWN].timer!=-1)
+				speed = speed*150/100;
+			if(sc_data[SC_SPEEDUP0].timer!=-1)
+				speed -= speed*25/100;
+			if(sc_data[SC_GOSPEL].timer!=-1 &&
+				sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+				sc_data[SC_GOSPEL].val3 == 8)
+				speed = speed*125/100;
+			if(sc_data[SC_JOINTBEAT].timer!=-1) {
+				if (sc_data[SC_JOINTBEAT].val2 == 1)
+					speed = speed*150/100;
+				else if (sc_data[SC_JOINTBEAT].val2 == 3)
+					speed = speed*130/100;				
+			}
+		}
+		if(speed < 1) speed = 1;
+		return speed;
+	}
+
+	return 1000;
+}
+/*==========================================
+ * 対象のaDelay(攻撃時ディレイ)を返す(汎用)
+ * aDelayは小さいほうが攻撃速度が速い
+ *------------------------------------------
+ */
+int status_get_adelay(struct block_list *bl)
+{
+	nullpo_retr(4000, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return (((struct map_session_data *)bl)->aspd<<1);
+	else {
+		struct status_change *sc_data=status_get_sc_data(bl);
+		int adelay=4000,aspd_rate = 100,i;
+		if(bl->type==BL_MOB && (struct mob_data *)bl)
+			adelay = mob_db[((struct mob_data *)bl)->class_].adelay;
+		else if(bl->type==BL_PET && (struct pet_data *)bl)
+			adelay = mob_db[((struct pet_data *)bl)->class_].adelay;
+
+		if(sc_data) {
+			//ツーハンドクイッケン使用時でクァグマイアでも私を忘れないで…でもない時は3割減算
+			if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
+				aspd_rate -= 30;
+			//アドレナリンラッシュ使用時でツーハンドクイッケンでもクァグマイアでも私を忘れないで…でもない時は
+			if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
+				sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
+				//使用者とパーティメンバーで格差が出る設定でなければ3割減算
+				if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
+					aspd_rate -= 30;
+				//そうでなければ2.5割減算
+				else
+					aspd_rate -= 25;
+			}
+			//スピアクィッケン時は減算
+			if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 &&
+				sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
+				aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2;
+			//夕日のアサシンクロス時は減算
+			if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
+				sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 &&
+				sc_data[SC_DONTFORGETME].timer == -1)
+				aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3;
+			//私を忘れないで…時は加算
+			if(sc_data[SC_DONTFORGETME].timer!=-1)		// 私を忘れないで
+				aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16);
+			//金剛時25%加算
+			if(sc_data[SC_STEELBODY].timer!=-1)	// 金剛
+				aspd_rate += 25;
+			//増速ポーション使用時は減算
+			if(	sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1)
+				aspd_rate -= sc_data[i].val2;
+			//ディフェンダー時は加算
+			if(sc_data[SC_DEFENDER].timer != -1)
+				adelay += (1100 - sc_data[SC_DEFENDER].val1*100);
+			if(sc_data[SC_GOSPEL].timer!=-1 &&
+				sc_data[SC_GOSPEL].val4 == BCT_ENEMY &&
+				sc_data[SC_GOSPEL].val3 == 8)
+				aspd_rate = aspd_rate*125/100;
+			if(sc_data[SC_JOINTBEAT].timer!=-1) {
+				if (sc_data[SC_JOINTBEAT].val2 == 2)
+					aspd_rate = aspd_rate*125/100;
+				else if (sc_data[SC_JOINTBEAT].val2 == 3)
+					aspd_rate = aspd_rate*110/100;
+			}
+		}
+		if(aspd_rate != 100)
+			adelay = adelay*aspd_rate/100;
+		if(adelay < battle_config.monster_max_aspd<<1) adelay = battle_config.monster_max_aspd<<1;
+		return adelay;
+	}
+	return 4000;
+}
+int status_get_amotion(struct block_list *bl)
+{
+	nullpo_retr(2000, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->amotion;
+	else {
+		struct status_change *sc_data=status_get_sc_data(bl);
+		int amotion=2000,aspd_rate = 100,i;
+		if(bl->type==BL_MOB && (struct mob_data *)bl)
+			amotion = mob_db[((struct mob_data *)bl)->class_].amotion;
+		else if(bl->type==BL_PET && (struct pet_data *)bl)
+			amotion = mob_db[((struct pet_data *)bl)->class_].amotion;
+
+		if(sc_data) {
+			if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// 2HQ
+				aspd_rate -= 30;
+			if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 &&
+				sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) {	// アドレナリンラッシュ
+				if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty)
+					aspd_rate -= 30;
+				else
+					aspd_rate -= 25;
+			}
+			if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 &&
+				sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1)	// スピアクィッケン
+				aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2;
+			if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス
+				sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 &&
+				sc_data[SC_DONTFORGETME].timer == -1)
+				aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3;
+			if(sc_data[SC_DONTFORGETME].timer!=-1)		// 私を忘れないで
+				aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16);
+			if(sc_data[SC_STEELBODY].timer!=-1)	// 金剛
+				aspd_rate += 25;
+			if(	sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1)
+				aspd_rate -= sc_data[i].val2;
+			if(sc_data[SC_DEFENDER].timer != -1)
+				amotion += (550 - sc_data[SC_DEFENDER].val1*50);
+		}
+		if(aspd_rate != 100)
+			amotion = amotion*aspd_rate/100;
+		if(amotion < battle_config.monster_max_aspd) amotion = battle_config.monster_max_aspd;
+		return amotion;
+	}
+	return 2000;
+}
+int status_get_dmotion(struct block_list *bl)
+{
+	int ret;
+	struct status_change *sc_data;
+
+	nullpo_retr(0, bl);
+	sc_data = status_get_sc_data(bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl){
+		ret=mob_db[((struct mob_data *)bl)->class_].dmotion;
+		if(battle_config.monster_damage_delay_rate != 100)
+			ret = ret*battle_config.monster_damage_delay_rate/400;
+	}
+	else if(bl->type==BL_PC && (struct map_session_data *)bl){
+		ret=((struct map_session_data *)bl)->dmotion;
+		if(battle_config.pc_damage_delay_rate != 100)
+			ret = ret*battle_config.pc_damage_delay_rate/400;
+	}
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		ret=mob_db[((struct pet_data *)bl)->class_].dmotion;
+	else
+		return 2000;
+
+	if((sc_data && (sc_data[SC_ENDURE].timer!=-1 || sc_data[SC_BERSERK].timer!=-1)) ||
+		(bl->type == BL_PC && ((struct map_session_data *)bl)->special_state.infinite_endure))
+		ret=0;
+
+	return ret;
+}
+int status_get_element(struct block_list *bl)
+{
+	int ret = 20;
+	struct status_change *sc_data;
+
+	nullpo_retr(ret, bl);
+	sc_data = status_get_sc_data(bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)	// 10の位=Lv*2、1の位=属性
+		ret=((struct mob_data *)bl)->def_ele;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		ret=20+((struct map_session_data *)bl)->def_ele;	// 防御属性Lv1
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		ret = mob_db[((struct pet_data *)bl)->class_].element;
+
+	if(sc_data) {
+		if( sc_data[SC_BENEDICTIO].timer!=-1 )	// 聖体降福
+			ret=26;
+		if( sc_data[SC_FREEZE].timer!=-1 )	// 凍結
+			ret=21;
+		if( sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0)
+			ret=22;
+	}
+
+	return ret;
+}
+
+int status_get_attack_element(struct block_list *bl)
+{
+	int ret = 0;
+	struct status_change *sc_data=status_get_sc_data(bl);
+
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		ret=0;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		ret=((struct map_session_data *)bl)->atk_ele;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		ret=0;
+
+	if(sc_data) {
+		if( sc_data[SC_FROSTWEAPON].timer!=-1)	// フロストウェポン
+			ret=1;
+		if( sc_data[SC_SEISMICWEAPON].timer!=-1)	// サイズミックウェポン
+			ret=2;
+		if( sc_data[SC_FLAMELAUNCHER].timer!=-1)	// フレームランチャー
+			ret=3;
+		if( sc_data[SC_LIGHTNINGLOADER].timer!=-1)	// ライトニングローダー
+			ret=4;
+		if( sc_data[SC_ENCPOISON].timer!=-1)	// エンチャントポイズン
+			ret=5;
+		if( sc_data[SC_ASPERSIO].timer!=-1)		// アスペルシオ
+			ret=6;
+	}
+
+	return ret;
+}
+int status_get_attack_element2(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl) {
+		int ret = ((struct map_session_data *)bl)->atk_ele_;
+		struct status_change *sc_data = ((struct map_session_data *)bl)->sc_data;
+
+		if(sc_data) {
+			if( sc_data[SC_FROSTWEAPON].timer!=-1)	// フロストウェポン
+				ret=1;
+			if( sc_data[SC_SEISMICWEAPON].timer!=-1)	// サイズミックウェポン
+				ret=2;
+			if( sc_data[SC_FLAMELAUNCHER].timer!=-1)	// フレームランチャー
+				ret=3;
+			if( sc_data[SC_LIGHTNINGLOADER].timer!=-1)	// ライトニングローダー
+				ret=4;
+			if( sc_data[SC_ENCPOISON].timer!=-1)	// エンチャントポイズン
+				ret=5;
+			if( sc_data[SC_ASPERSIO].timer!=-1)		// アスペルシオ
+				ret=6;
+		}
+		return ret;
+	}
+	return 0;
+}
+int status_get_party_id(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->status.party_id;
+	else if(bl->type==BL_MOB && (struct mob_data *)bl){
+		struct mob_data *md=(struct mob_data *)bl;
+		if( md->master_id>0 )
+			return -md->master_id;
+		return -md->bl.id;
+	}
+	else if(bl->type==BL_SKILL && (struct skill_unit *)bl)
+		return ((struct skill_unit *)bl)->group->party_id;
+	else
+		return 0;
+}
+int status_get_guild_id(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data *)bl)->status.guild_id;
+	else if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data *)bl)->class_;
+	else if(bl->type==BL_SKILL && (struct skill_unit *)bl)
+		return ((struct skill_unit *)bl)->group->guild_id;
+	else
+		return 0;
+}
+int status_get_race(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return mob_db[((struct mob_data *)bl)->class_].race;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return 7;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return mob_db[((struct pet_data *)bl)->class_].race;
+	else
+		return 0;
+}
+int status_get_size(struct block_list *bl)
+{
+	nullpo_retr(1, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return mob_db[((struct mob_data *)bl)->class_].size;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return 1;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return mob_db[((struct pet_data *)bl)->class_].size;
+	else
+		return 1;
+}
+int status_get_mode(struct block_list *bl)
+{
+	nullpo_retr(0x01, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return mob_db[((struct mob_data *)bl)->class_].mode;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return mob_db[((struct pet_data *)bl)->class_].mode;
+	else
+		return 0x01;	// とりあえず動くということで1
+}
+
+int status_get_mexp(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return mob_db[((struct mob_data *)bl)->class_].mexp;
+	else if(bl->type==BL_PET && (struct pet_data *)bl)
+		return mob_db[((struct pet_data *)bl)->class_].mexp;
+	else
+		return 0;
+}
+
+// StatusChange系の所得
+struct status_change *status_get_sc_data(struct block_list *bl)
+{
+	nullpo_retr(NULL, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return ((struct mob_data*)bl)->sc_data;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return ((struct map_session_data*)bl)->sc_data;
+	return NULL;
+}
+short *status_get_sc_count(struct block_list *bl)
+{
+	nullpo_retr(NULL, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return &((struct mob_data*)bl)->sc_count;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return &((struct map_session_data*)bl)->sc_count;
+	return NULL;
+}
+short *status_get_opt1(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return &((struct mob_data*)bl)->opt1;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return &((struct map_session_data*)bl)->opt1;
+	else if(bl->type==BL_NPC && (struct npc_data *)bl)
+		return &((struct npc_data*)bl)->opt1;
+	return 0;
+}
+short *status_get_opt2(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return &((struct mob_data*)bl)->opt2;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return &((struct map_session_data*)bl)->opt2;
+	else if(bl->type==BL_NPC && (struct npc_data *)bl)
+		return &((struct npc_data*)bl)->opt2;
+	return 0;
+}
+short *status_get_opt3(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return &((struct mob_data*)bl)->opt3;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return &((struct map_session_data*)bl)->opt3;
+	else if(bl->type==BL_NPC && (struct npc_data *)bl)
+		return &((struct npc_data*)bl)->opt3;
+	return 0;
+}
+short *status_get_option(struct block_list *bl)
+{
+	nullpo_retr(0, bl);
+	if(bl->type==BL_MOB && (struct mob_data *)bl)
+		return &((struct mob_data*)bl)->option;
+	else if(bl->type==BL_PC && (struct map_session_data *)bl)
+		return &((struct map_session_data*)bl)->status.option;
+	else if(bl->type==BL_NPC && (struct npc_data *)bl)
+		return &((struct npc_data*)bl)->option;
+	return 0;
+}
+
+int status_get_sc_def(struct block_list *bl, int type)
+{
+	int sc_def;
+	nullpo_retr(0, bl);
+	
+	switch (type)
+	{
+	case SP_MDEF1:	// mdef
+		sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+		break;
+	case SP_MDEF2:	// int
+		sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
+		break;
+	case SP_DEF1:	// def
+		sc_def = 100 - (3 + status_get_def(bl) + status_get_luk(bl)/3);
+		break;
+	case SP_DEF2:	// vit
+		sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
+		break;
+	case SP_LUK:	// luck
+		sc_def = 100 - (3 + status_get_luk(bl));
+		break;
+
+	case SC_STONE:
+	case SC_FREEZE:
+		sc_def = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3);
+		break;
+	case SC_STAN:
+	case SC_POISON:
+	case SC_SILENCE:
+		sc_def = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3);
+		break;	
+	case SC_SLEEP:
+	case SC_CONFUSION:
+	case SC_BLIND:
+		sc_def = 100 - (3 + status_get_int(bl) + status_get_luk(bl)/3);
+		break;
+	case SC_CURSE:
+		sc_def = 100 - (3 + status_get_luk(bl));
+		break;	
+
+	default:
+		sc_def = 100;
+		break;
+	}
+
+	if(bl->type == BL_MOB && sc_def < 50)
+		sc_def = 50;
+	else if(bl->type == BL_PC) {
+		struct status_change* sc_data = status_get_sc_data(bl);
+		if (sc_data && sc_data[SC_GOSPEL].timer != -1 &&
+			sc_data[SC_GOSPEL].val4 == BCT_PARTY &&
+			sc_data[SC_GOSPEL].val3 == 3)
+			sc_def -= 25;
+	}
+
+	return (sc_def < 0) ? 0 : sc_def;
+}
+
+/*==========================================
+ * ステータス異常開始
+ *------------------------------------------
+ */
+int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag)
+{
+	struct map_session_data *sd = NULL;
+	struct status_change* sc_data;
+	short *sc_count, *option, *opt1, *opt2, *opt3;
+	int opt_flag = 0, calc_flag = 0,updateflag = 0, save_flag = 0, race, mode, elem, undead_flag;
+	int scdef=0;
+
+	nullpo_retr(0, bl);
+	if(bl->type == BL_SKILL)
+		return 0;
+	nullpo_retr(0, sc_data=status_get_sc_data(bl));
+	nullpo_retr(0, sc_count=status_get_sc_count(bl));
+	nullpo_retr(0, option=status_get_option(bl));
+	nullpo_retr(0, opt1=status_get_opt1(bl));
+	nullpo_retr(0, opt2=status_get_opt2(bl));
+	nullpo_retr(0, opt3=status_get_opt3(bl));
+
+
+	race=status_get_race(bl);
+	mode=status_get_mode(bl);
+	elem=status_get_elem_type(bl);
+	undead_flag=battle_check_undead(race,elem);
+
+	if(type == SC_AETERNA && (sc_data[SC_STONE].timer != -1 || sc_data[SC_FREEZE].timer != -1) )
+		return 0;
+
+	switch(type){
+		case SC_STONE:
+		case SC_FREEZE:
+			scdef=3+status_get_mdef(bl)+status_get_luk(bl)/3;
+			break;
+		case SC_STAN:
+		case SC_SILENCE:
+		case SC_POISON:
+		case SC_DPOISON:
+			scdef=3+status_get_vit(bl)+status_get_luk(bl)/3;
+			break;
+		case SC_SLEEP:
+		case SC_BLIND:
+			scdef=3+status_get_int(bl)+status_get_luk(bl)/3;
+			break;
+		case SC_CURSE:
+			scdef=3+status_get_luk(bl);
+			break;
+
+//		case SC_CONFUSION:
+		default:
+			scdef=0;
+	}
+	if(scdef>=100)
+		return 0;
+	if(bl->type==BL_PC){
+		sd=(struct map_session_data *)bl;
+		if( sd && type == SC_ADRENALINE && !(skill_get_weapontype(BS_ADRENALINE)&(1<<sd->status.weapon)))
+			return 0;
+
+		if(SC_STONE<=type && type<=SC_BLIND){	/* カ?ドによる耐性 */
+			if( sd && sd->reseff[type-SC_STONE] > 0 && rand()%10000<sd->reseff[type-SC_STONE]){
+				if(battle_config.battle_log)
+					printf("PC %d skill_sc_start: cardによる異常耐性?動\n",sd->bl.id);
+				return 0;
+			}
+		}
+	}
+	else if(bl->type == BL_MOB) {
+	}
+	else {
+		if(battle_config.error_log)
+			printf("status_change_start: neither MOB nor PC !\n");
+		return 0;
+	}
+
+	if(type==SC_FREEZE && undead_flag && !(flag&1))
+		return 0;
+
+	if((type == SC_ADRENALINE || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) &&
+		sc_data[type].timer != -1 && sc_data[type].val2 && !val2)
+		return 0;
+
+	if(mode & 0x20 && (type==SC_STONE || type==SC_FREEZE ||
+		type==SC_STAN || type==SC_SLEEP || type==SC_SILENCE || type==SC_QUAGMIRE || type == SC_DECREASEAGI || type == SC_SIGNUMCRUCIS || type == SC_PROVOKE ||
+		(type == SC_BLESSING && (undead_flag || race == 6))) && !(flag&1)){
+		/* ボスには?かない(ただしカ?ドによる?果は適用される) */
+		return 0;
+	}
+	if(type==SC_FREEZE || type==SC_STAN || type==SC_SLEEP)
+		battle_stopwalking(bl,1);
+
+	if(sc_data[type].timer != -1){	/* すでに同じ異常になっている場合タイマ解除 */
+		if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION &&
+			type != SC_SPEEDPOTION0 && type != SC_SPEEDPOTION1 && type != SC_SPEEDPOTION2 && type != SC_SPEEDPOTION3
+						 && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris]
+			return 0;
+		if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON)
+			return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */
+		if(type == SC_GRAFFITI){	//異常中にもう一度?態異常になった時に解除してから再度かかる
+			status_change_end(bl,type,-1);
+		} else {
+			(*sc_count)--;
+			delete_timer(sc_data[type].timer, status_change_timer);
+			sc_data[type].timer = -1;
+		}
+	}
+
+	switch(type){	/* 異常の種類ごとの?理 */
+		case SC_PROVOKE:			/* プロボック */
+			calc_flag = 1;
+			if(tick <= 0) tick = 1000;	/* (オ?トバ?サ?ク) */
+			break;
+		case SC_ENDURE:				/* インデュア */
+			if(tick <= 0) tick = 1000 * 60;
+			calc_flag = 1; // for updating mdef
+			val2 = 7; // [Celest]
+			break;
+		case SC_AUTOBERSERK:
+			{
+				tick = 60*1000;
+				if (bl->type == BL_PC && sd->status.hp<sd->status.max_hp>>2 &&
+					(sc_data[SC_PROVOKE].timer==-1 || sc_data[SC_PROVOKE].val2==0))
+					status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0);
+			}
+			break;
+		case SC_CONCENTRATE:		/* 集中力向上 */
+			calc_flag = 1;
+			break;
+		case SC_BLESSING:			/* ブレッシング */
+			{
+				if(bl->type == BL_PC || (!undead_flag && race != 6)) {
+					if(sc_data[SC_CURSE].timer!=-1 )
+						status_change_end(bl,SC_CURSE,-1);
+					if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0)
+						status_change_end(bl,SC_STONE,-1);
+				}
+				calc_flag = 1;
+			}
+			break;
+		case SC_ANGELUS:			/* アンゼルス */
+			calc_flag = 1;
+			break;
+		case SC_INCREASEAGI:		/* 速度上昇 */
+			calc_flag = 1;
+			if(sc_data[SC_DECREASEAGI].timer!=-1 )
+				status_change_end(bl,SC_DECREASEAGI,-1);
+			// the effect will still remain [celest]
+//			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
+//				status_change_end(bl,SC_WINDWALK,-1);
+			break;
+		case SC_DECREASEAGI:		/* 速度減少 */
+			if (bl->type == BL_PC)	// Celest
+				tick>>=1;
+			calc_flag = 1;
+			if(sc_data[SC_INCREASEAGI].timer!=-1 )
+				status_change_end(bl,SC_INCREASEAGI,-1);
+			if(sc_data[SC_ADRENALINE].timer!=-1 )
+				status_change_end(bl,SC_ADRENALINE,-1);
+			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_SPEARSQUICKEN,-1);
+			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
+			break;
+		case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
+			calc_flag = 1;
+//			val2 = 14 + val1;
+			val2 = 10 + val1*2;
+			tick = 600*1000;
+			clif_emotion(bl,4);
+			break;
+		case SC_SLOWPOISON:
+			if (sc_data[SC_POISON].timer == -1 && sc_data[SC_DPOISON].timer == -1)
+				return 0;
+			break;
+		case SC_TWOHANDQUICKEN:		/* 2HQ */
+			if(sc_data[SC_DECREASEAGI].timer!=-1)
+				return 0;
+			*opt3 |= 1;
+			calc_flag = 1;
+			break;
+		case SC_ADRENALINE:			/* アドレナリンラッシュ */
+			if(sc_data[SC_DECREASEAGI].timer!=-1)
+				return 0;
+			calc_flag = 1;
+			break;
+		case SC_WEAPONPERFECTION:	/* ウェポンパ?フェクション */
+			// Lasting time penalties have been removed on sakray as of 12/14 [celest]
+			//if(battle_config.party_skill_penalty && !val2) tick /= 5;
+			break;
+		case SC_OVERTHRUST:			/* オ?バ?スラスト */
+			*opt3 |= 2;
+			// Lasting time penalties have been removed on sakray as of 12/14 [celest]
+			//if(battle_config.party_skill_penalty && !val2) tick /= 10;
+			break;
+		case SC_MAXIMIZEPOWER:		/* マキシマイズパワ?(SPが1減る時間,val2にも) */
+			if(bl->type == BL_PC)
+				val2 = tick;
+			else
+				tick = 5000*val1;
+			break;
+		case SC_ENCPOISON:			/* エンチャントポイズン */
+			calc_flag = 1;
+			val2=(((val1 - 1) / 2) + 3)*100;	/* 毒付?確率 */
+			skill_encchant_eremental_end(bl,SC_ENCPOISON);
+			break;
+		case SC_EDP:	// [Celest]
+			val2 = val1 + 2;			/* 猛毒付?確率(%) */
+			calc_flag = 1;
+			break;
+		case SC_POISONREACT:	/* ポイズンリアクト */
+			val2=val1/2 + val1%2; // [Celest]
+			break;
+		case SC_IMPOSITIO:			/* インポシティオマヌス */
+			calc_flag = 1;
+			break;
+		case SC_ASPERSIO:			/* アスペルシオ */
+			skill_encchant_eremental_end(bl,SC_ASPERSIO);
+			break;
+		case SC_SUFFRAGIUM:			/* サフラギム */
+		case SC_BENEDICTIO:			/* 聖? */
+		case SC_MAGNIFICAT:			/* マグニフィカ?ト */
+		case SC_AETERNA:			/* エ?テルナ */
+			break;
+		case SC_ENERGYCOAT:			/* エナジ?コ?ト */
+			*opt3 |= 4;
+			break;
+		case SC_MAGICROD:
+			val2 = val1*20;
+			break;
+		case SC_KYRIE:				/* キリエエレイソン */
+			val2 = status_get_max_hp(bl) * (val1 * 2 + 10) / 100;/* 耐久度 */
+			val3 = (val1 / 2 + 5);	/* 回? */
+// -- moonsoul (added to undo assumptio status if target has it)
+			if(sc_data[SC_ASSUMPTIO].timer!=-1 )
+				status_change_end(bl,SC_ASSUMPTIO,-1);
+			break;
+		case SC_MINDBREAKER:
+			calc_flag = 1;
+			if(tick <= 0) tick = 1000;	/* (オ?トバ?サ?ク) */
+		case SC_GLORIA:				/* グロリア */
+			calc_flag = 1;
+			break;
+		case SC_LOUD:				/* ラウドボイス */
+			calc_flag = 1;
+			break;
+		case SC_TRICKDEAD:			/* 死んだふり */
+			if (bl->type == BL_PC) {
+				pc_stopattack((struct map_session_data *)sd);
+			}
+			break;
+		case SC_QUAGMIRE:			/* クァグマイア */
+			calc_flag = 1;
+			if(sc_data[SC_CONCENTRATE].timer!=-1 )	/* 集中力向上解除 */
+				status_change_end(bl,SC_CONCENTRATE,-1);
+			if(sc_data[SC_INCREASEAGI].timer!=-1 )	/* 速度上昇解除 */
+				status_change_end(bl,SC_INCREASEAGI,-1);
+			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
+			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_SPEARSQUICKEN,-1);
+			if(sc_data[SC_ADRENALINE].timer!=-1 )
+				status_change_end(bl,SC_ADRENALINE,-1);
+			if(sc_data[SC_LOUD].timer!=-1 )
+				status_change_end(bl,SC_LOUD,-1);
+			if(sc_data[SC_TRUESIGHT].timer!=-1 )	/* トゥル?サイト */
+				status_change_end(bl,SC_TRUESIGHT,-1);
+			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
+				status_change_end(bl,SC_WINDWALK,-1);
+			if(sc_data[SC_CARTBOOST].timer!=-1 )	/* カ?トブ?スト */
+				status_change_end(bl,SC_CARTBOOST,-1);
+			break;
+		case SC_MAGICPOWER:
+			calc_flag = 1;
+			val2 = 1;
+			break;
+		case SC_SACRIFICE:
+			val2 = 5;
+			break;
+		case SC_FLAMELAUNCHER:		/* フレ?ムランチャ? */
+			skill_encchant_eremental_end(bl,SC_FLAMELAUNCHER);
+			break;
+		case SC_FROSTWEAPON:		/* フロストウェポン */
+			skill_encchant_eremental_end(bl,SC_FROSTWEAPON);
+			break;
+		case SC_LIGHTNINGLOADER:	/* ライトニングロ?ダ? */
+			skill_encchant_eremental_end(bl,SC_LIGHTNINGLOADER);
+			break;
+		case SC_SEISMICWEAPON:		/* サイズミックウェポン */
+			skill_encchant_eremental_end(bl,SC_SEISMICWEAPON);
+			break;
+		case SC_DEVOTION:			/* ディボ?ション */
+			calc_flag = 1;
+			break;
+		case SC_PROVIDENCE:			/* プロヴィデンス */
+			calc_flag = 1;
+			val2=val1*5;
+			break;
+		case SC_REFLECTSHIELD:
+			val2=10+val1*3;
+			break;
+		case SC_STRIPWEAPON:
+			if (val2==0) val2=90;
+			break;
+		case SC_STRIPSHIELD:
+			if (val2==0) val2=85;
+			break;
+		case SC_STRIPARMOR:
+		case SC_STRIPHELM:
+		case SC_CP_WEAPON:
+		case SC_CP_SHIELD:
+		case SC_CP_ARMOR:
+		case SC_CP_HELM:
+			break;
+
+		case SC_AUTOSPELL:			/* オ?トスペル */
+			val4 = 5 + val1*2;
+			break;
+
+		case SC_VOLCANO:
+			calc_flag = 1;
+			val3 = val1*10;
+			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
+			break;
+		case SC_DELUGE:
+			calc_flag = 1;
+			val3 = val1>=5?15: (val1==4?14: (val1==3?12: ( val1==2?9:5 ) ) );
+			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
+			break;
+		case SC_VIOLENTGALE:
+			calc_flag = 1;
+			val3 = val1*3;
+			val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) );
+			break;
+
+		case SC_SPEARSQUICKEN:		/* スピアクイッケン */
+			calc_flag = 1;
+			val2 = 20+val1;
+			*opt3 |= 1;
+			break;
+		case SC_COMBO:
+			break;
+		case SC_BLADESTOP_WAIT:		/* 白刃取り(待ち) */
+			break;
+		case SC_BLADESTOP:		/* 白刃取り */
+			if(val2==2) clif_bladestop((struct block_list *)val3,(struct block_list *)val4,1);
+			*opt3 |= 32;
+			break;
+
+		case SC_LULLABY:			/* 子守唄 */
+			val2 = 11;
+			break;
+		case SC_RICHMANKIM:
+			break;
+		case SC_ETERNALCHAOS:		/* エタ?ナルカオス */
+			calc_flag = 1;
+			break;
+		case SC_DRUMBATTLE:			/* ?太鼓の響き */
+			calc_flag = 1;
+			val2 = (val1+1)*25;
+			val3 = (val1+1)*2;
+			break;
+		case SC_NIBELUNGEN:			/* ニ?ベルングの指輪 */
+			calc_flag = 1;
+			//val2 = (val1+2)*50;
+			val3 = (val1+2)*25;
+			break;
+		case SC_ROKISWEIL:			/* ロキの叫び */
+			break;
+		case SC_INTOABYSS:			/* 深淵の中に */
+			break;
+		case SC_SIEGFRIED:			/* 不死身のジ?クフリ?ド */
+			calc_flag = 1;
+			val2 = 55 + val1*5;
+			val3 = val1*10;
+			break;
+		case SC_DISSONANCE:			/* 不協和音 */
+			val2 = 10;
+			break;
+		case SC_WHISTLE:			/* 口笛 */
+			calc_flag = 1;
+			break;
+		case SC_ASSNCROS:			/* 夕陽のアサシンクロス */
+			calc_flag = 1;
+			break;
+		case SC_POEMBRAGI:			/* ブラギの詩 */
+			break;
+		case SC_APPLEIDUN:			/* イドゥンの林檎 */
+			calc_flag = 1;
+			break;
+		case SC_UGLYDANCE:			/* 自分勝手なダンス */
+			val2 = 10;
+			break;
+		case SC_HUMMING:			/* ハミング */
+			calc_flag = 1;
+			break;
+		case SC_DONTFORGETME:		/* 私を忘れないで */
+			calc_flag = 1;
+			if(sc_data[SC_INCREASEAGI].timer!=-1 )	/* 速度上昇解除 */
+				status_change_end(bl,SC_INCREASEAGI,-1);
+			if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_TWOHANDQUICKEN,-1);
+			if(sc_data[SC_SPEARSQUICKEN].timer!=-1 )
+				status_change_end(bl,SC_SPEARSQUICKEN,-1);
+			if(sc_data[SC_ADRENALINE].timer!=-1 )
+				status_change_end(bl,SC_ADRENALINE,-1);
+			if(sc_data[SC_ASSNCROS].timer!=-1 )
+				status_change_end(bl,SC_ASSNCROS,-1);
+			if(sc_data[SC_TRUESIGHT].timer!=-1 )	/* トゥル?サイト */
+				status_change_end(bl,SC_TRUESIGHT,-1);
+			if(sc_data[SC_WINDWALK].timer!=-1 )	/* ウインドウォ?ク */
+				status_change_end(bl,SC_WINDWALK,-1);
+			if(sc_data[SC_CARTBOOST].timer!=-1 )	/* カ?トブ?スト */
+				status_change_end(bl,SC_CARTBOOST,-1);
+			break;
+		case SC_FORTUNE:			/* 幸運のキス */
+			calc_flag = 1;
+			break;
+		case SC_SERVICE4U:			/* サ?ビスフォ?ユ? */
+			calc_flag = 1;
+			break;
+		case SC_MOONLIT:
+			val2 = bl->id;
+			break;
+		case SC_DANCING:			/* ダンス/演奏中 */
+			calc_flag = 1;
+			val3= tick / 1000;
+			tick = 1000;
+			break;
+
+		case SC_EXPLOSIONSPIRITS:	// 爆裂波動
+			calc_flag = 1;
+			val2 = 75 + 25*val1;
+			*opt3 |= 8;
+			break;
+		case SC_STEELBODY:			// 金剛
+			calc_flag = 1;
+			*opt3 |= 16;
+			break;
+		case SC_EXTREMITYFIST:		/* 阿修羅覇凰拳 */
+			break;
+		case SC_AUTOCOUNTER:
+			val3 = val4 = 0;
+			break;
+
+		case SC_SPEEDPOTION0:		/* ?速ポ?ション */
+		case SC_SPEEDPOTION1:
+		case SC_SPEEDPOTION2:
+		case SC_SPEEDPOTION3:
+			calc_flag = 1;
+			tick = 1000 * tick;
+			val2 = 5*(2+type-SC_SPEEDPOTION0);
+			break;
+
+		/* atk & matk potions [Valaris] */
+		case SC_ATKPOT:
+		case SC_MATKPOT:
+			calc_flag = 1;
+			tick = 1000 * tick;
+			break;
+		case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
+			{
+				time_t timer;
+
+				calc_flag = 1;
+				tick = 10000;
+				if(!val2)
+					val2 = time(&timer);
+			}
+			break;
+		case SC_NOCHAT:	//チャット禁止?態
+			{
+				time_t timer;
+
+				if(!battle_config.muting_players)
+					break;
+
+				tick = 60000;
+				if(!val2)
+					val2 = time(&timer);
+				updateflag = SP_MANNER;
+				save_flag = 1; // celest
+			}
+			break;
+		case SC_SELFDESTRUCTION: //自爆
+			clif_skillcasting(bl,bl->id, bl->id,0,0,331,skill_get_time(val2,val1));
+			val3 = tick / 1000;
+			tick = 1000;
+			break;
+
+		/* option1 */
+		case SC_STONE:				/* 石化 */
+			if(!(flag&2)) {
+				int sc_def = status_get_mdef(bl)*200;
+				tick = tick - sc_def;
+			}
+			val3 = tick/1000;
+			if(val3 < 1) val3 = 1;
+			tick = 5000;
+			val2 = 1;
+			break;
+		case SC_SLEEP:				/* 睡眠 */
+			if(!(flag&2)) {
+//				int sc_def = 100 - (status_get_int(bl) + status_get_luk(bl)/3);
+//				tick = tick * sc_def / 100;
+//				if(tick < 1000) tick = 1000;
+				tick = 30000;//睡眠はステ?タス耐性に?わらず30秒
+			}
+			break;
+		case SC_FREEZE:				/* 凍結 */
+			if(!(flag&2)) {
+				int sc_def = 100 - status_get_mdef(bl);
+				tick = tick * sc_def / 100;
+			}
+			break;
+		case SC_STAN:				/* スタン(val2にミリ秒セット) */
+			if(!(flag&2)) {
+				int sc_def = status_get_sc_def_vit(bl);
+				tick = tick * sc_def / 100;
+			}
+			break;
+
+			/* option2 */
+		case SC_DPOISON:			/* 猛毒 */
+		{
+			int mhp = status_get_max_hp(bl);
+			int hp = status_get_hp(bl);
+			// MHP?1/4????????
+			if (hp > mhp>>2) {
+				if(bl->type == BL_PC) {
+					int diff = mhp*10/100;
+					if (hp - diff < mhp>>2)
+						hp = hp - (mhp>>2);
+					pc_heal((struct map_session_data *)bl, -hp, 0);
+				} else if(bl->type == BL_MOB) {
+					struct mob_data *md = (struct mob_data *)bl;
+					hp -= mhp*15/100;
+					if (hp > mhp>>2)
+						md->hp = hp;
+					else
+						md->hp = mhp>>2;
+				}
+			}
+		}	// fall through
+		case SC_POISON:				/* 毒 */
+			calc_flag = 1;
+			if(!(flag&2)) {
+				int sc_def = 100 - (status_get_vit(bl) + status_get_luk(bl)/5);
+				tick = tick * sc_def / 100;
+			}
+			val3 = tick/1000;
+			if(val3 < 1) val3 = 1;
+			tick = 1000;
+			break;
+		case SC_SILENCE:			/* 沈?(レックスデビ?ナ) */
+			if(!(flag&2)) {
+				int sc_def = 100 - status_get_vit(bl);
+				tick = tick * sc_def / 100;
+			}
+			break;
+		case SC_CONFUSION:
+			val2 = tick;
+			tick = 100;
+			clif_emotion(bl,1);
+			if (sd) {
+				pc_stop_walking (sd, 0);
+			}
+			break;
+		case SC_BLIND:				/* 暗? */
+			calc_flag = 1;
+			if(!(flag&2)) {
+				int sc_def = status_get_lv(bl)/10 + status_get_int(bl)/15;
+				tick = 30000 - sc_def;
+			}
+			break;
+		case SC_CURSE:
+			calc_flag = 1;
+			if(!(flag&2)) {
+				int sc_def = 100 - status_get_vit(bl);
+				tick = tick * sc_def / 100;
+			}
+			break;
+
+		/* option */
+		case SC_HIDING:		/* ハイディング */
+			calc_flag = 1;
+			if(bl->type == BL_PC) {
+				val2 = tick / 1000;		/* 持?時間 */
+				tick = 1000;
+			}
+			break;
+		case SC_CHASEWALK:
+		case SC_CLOAKING:		/* クロ?キング */
+			if(bl->type == BL_PC) {
+				calc_flag = 1; // [Celest]
+				val2 = tick;
+				val3 = type==SC_CLOAKING ? 130-val1*3 : 135-val1*5;
+			}
+			else
+				tick = 5000*val1;
+			break;
+		case SC_SIGHT:			/* サイト/ルアフ */
+		case SC_RUWACH:
+			val2 = tick/250;
+			tick = 10;
+			break;
+
+		/* セ?フティウォ?ル、ニュ?マ */
+		case SC_SAFETYWALL:	case SC_PNEUMA:
+			tick=((struct skill_unit *)val2)->group->limit;
+			break;
+
+		/* アンクル */
+		case SC_ANKLE:
+			break;
+
+		/* ウォ?タ?ボ?ル */
+		case SC_WATERBALL:
+			tick=150;
+			if(val1>5) //レベルが5以上の場合は25?に制限(1?目はすでに打ってるので-1)
+				val3=5*5-1;
+			else
+				val3= (val1|1)*(val1|1)-1;
+			break;
+
+		/* スキルじゃない/時間に?係しない */
+		case SC_RIDING:
+			calc_flag = 1;
+			tick = 600*1000;
+			break;
+		case SC_FALCON:
+		case SC_WEIGHT50:
+		case SC_WEIGHT90:
+		case SC_BROKNWEAPON:
+		case SC_BROKNARMOR:
+			tick=600*1000;
+			break;
+
+		case SC_AUTOGUARD:
+			{
+				int i,t;
+				for(i=val2=0;i<val1;i++) {
+					t = 5-(i>>1);
+					val2 += (t < 0)? 1:t;
+				}
+			}
+			break;
+
+		case SC_DEFENDER:
+			calc_flag = 1;
+			val2 = 5 + val1*15;
+			break;
+
+		case SC_KEEPING:
+		case SC_BARRIER:
+			calc_flag = 1;
+
+		case SC_HALLUCINATION:
+			break;
+
+		case SC_CONCENTRATION:	/* コンセントレ?ション */
+			*opt3 |= 1;
+			calc_flag = 1;
+			break;
+
+		case SC_TENSIONRELAX:	/* テンションリラックス */
+			calc_flag = 1;
+			if(bl->type == BL_PC) {
+				tick = 10000;
+			}
+			break;
+
+		case SC_AURABLADE:		/* オ?ラブレ?ド */
+		case SC_PARRYING:		/* パリイング */
+//		case SC_ASSUMPTIO:		/*  */
+		case SC_HEADCRUSH:		/* ヘッドクラッシュ */
+//		case SC_JOINTBEAT:		/* ジョイントビ?ト */
+//		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
+
+			//とりあえず手?き
+			break;
+
+// -- moonsoul	(for new upper class related skill status effects)
+/*
+		case SC_AURABLADE:
+			val2 = val1*10;
+			break;
+		case SC_PARRYING:
+			val2=val1*3;
+			break;
+		case SC_CONCENTRATION:
+			calc_flag=1;
+			val2=val1*10;
+			val3=val1*5;
+			break;
+		case SC_TENSIONRELAX:
+//			val2 = 10;
+//			val3 = 15;
+			break;
+		case SC_BERSERK:
+			calc_flag=1;
+			break;
+		case SC_ASSUMPTIO:
+			if(sc_data[SC_KYRIE].timer!=-1 )
+				status_change_end(bl,SC_KYRIE,-1);
+				break;*/
+
+		case SC_WINDWALK:		/* ウインドウォ?ク */
+			calc_flag = 1;
+			val2 = (val1 / 2); //Flee上昇率
+			break;
+		
+		case SC_JOINTBEAT: // Random break [DracoRPG]
+			calc_flag = 1;
+			val2 = rand()%6 + 1;
+			if (val2 == 6) status_change_start(bl,SC_BLEEDING,val1,0,0,0,skill_get_time2(type,val1),0);
+			break;
+
+		case SC_BERSERK:		/* バ?サ?ク */
+			if(sd){
+				sd->status.hp = sd->status.max_hp * 3;
+				sd->status.sp = 0;
+				clif_updatestatus(sd,SP_HP);
+				clif_updatestatus(sd,SP_SP);
+				clif_status_change(bl,SC_INCREASEAGI,1);	/* アイコン表示 */
+				sd->canregen_tick = gettick() + 300000;
+			}
+			*opt3 |= 128;
+			tick = 10000;
+			calc_flag = 1;
+			break;
+
+		case SC_ASSUMPTIO:		/* アスムプティオ */
+			if(sc_data[SC_KYRIE].timer!=-1 )
+				status_change_end(bl,SC_KYRIE,-1);
+				break;
+			*opt3 |= 2048;
+			break;
+
+		case SC_BASILICA: // [celest]
+			break;
+
+		case SC_GOSPEL:
+			if (val4 == BCT_SELF) {	// self effect
+				int i;
+				if (sd) {
+					sd->canact_tick += tick;
+					sd->canmove_tick += tick;
+				}
+				val2 = tick;
+				tick = 1000;
+				for (i=0; i<=26; i++) {
+					if(sc_data[i].timer!=-1)
+						status_change_end(bl,i,-1);
+				}
+				for (i=58; i<=62; i++) {
+					if(sc_data[i].timer!=-1)
+						status_change_end(bl,i,-1);
+				}
+				for (i=132; i<=136; i++) {
+					if(sc_data[i].timer!=-1)
+						status_change_end(bl,i,-1);
+				}
+			}
+			break;
+
+		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
+		case SC_MARIONETTE2:
+			val2 = tick;
+			if (!val3)
+				return 0;
+			tick = 1000;
+			calc_flag = 1;
+			*opt3 |= 1024;
+			break;
+
+		case SC_MELTDOWN:		/* メルトダウン */
+		case SC_CARTBOOST:		/* カ?トブ?スト */
+		case SC_TRUESIGHT:		/* トゥル?サイト */
+		case SC_SPIDERWEB:		/* スパイダ?ウェッブ */
+			calc_flag = 1;
+			break;
+
+		case SC_REJECTSWORD:	/* リジェクトソ?ド */
+			val2 = 3; //3回攻?を跳ね返す
+			break;
+
+		case SC_MEMORIZE:		/* メモライズ */
+			val2 = 3; //3回詠唱を1/3にする
+			break;
+
+		case SC_GRAFFITI:		/* グラフィティ */
+			{
+				struct skill_unit_group *sg = skill_unitsetting(bl,RG_GRAFFITI,val1,val2,val3,0);
+				if(sg)
+					val4 = (int)sg;
+			}
+			break;
+
+		case SC_SPLASHER:		/* ベナムスプラッシャ? */
+			break;
+
+		case SC_FOGWALL:
+			val2 = 75;
+			// calc_flag = 1;	// not sure of effects yet [celest]
+			break;
+
+		case SC_PRESERVE:
+			break;
+
+		case SC_BLOCKSKILL:
+			if (!tick) tick = 60000;
+			if (!val3) val3 = -1;
+			break;
+
+		case SC_SLOWDOWN:
+		case SC_SPEEDUP0:
+			calc_flag = 1;
+			break;
+
+		case SC_REGENERATION:
+			val1 = 2;
+		case SC_BATTLEORDERS:
+			tick = 60000; // 1 minute
+			calc_flag = 1;
+			break;
+
+		default:
+			if(battle_config.error_log)
+				printf("UnknownStatusChange [%d]\n", type);
+			return 0;
+	}
+
+	if(bl->type==BL_PC &&
+		(type<SC_SENDMAX || type==SC_PRESERVE || type==SC_BATTLEORDERS))
+		clif_status_change(bl,type,1);	/* アイコン表示 */
+
+	/* optionの?更 */
+	switch(type){
+		case SC_STONE:
+		case SC_FREEZE:
+		case SC_STAN:
+		case SC_SLEEP:
+			battle_stopattack(bl);	/* 攻?停止 */
+			skill_stop_dancing(bl,0);	/* 演奏/ダンスの中? */
+			{	/* 同時に掛からないステ?タス異常を解除 */
+				int i;
+				for(i = SC_STONE; i <= SC_SLEEP; i++){
+					if(sc_data[i].timer != -1){
+						(*sc_count)--;
+						delete_timer(sc_data[i].timer, status_change_timer);
+						sc_data[i].timer = -1;
+					}
+				}
+			}
+			if(type == SC_STONE)
+				*opt1 = 6;
+			else
+				*opt1 = type - SC_STONE + 1;
+			opt_flag = 1;
+			break;
+		case SC_POISON:
+		case SC_CURSE:
+		case SC_SILENCE:
+		case SC_BLIND:
+			*opt2 |= 1<<(type-SC_POISON);
+			opt_flag = 1;
+			break;
+		case SC_DPOISON:	// 暫定で毒のエフェクトを使用
+			*opt2 |= 1;
+			opt_flag = 1;
+			break;
+		case SC_SIGNUMCRUCIS:
+			*opt2 |= 0x40;
+			opt_flag = 1;
+			break;
+		case SC_HIDING:
+		case SC_CLOAKING:
+			battle_stopattack(bl);	/* 攻?停止 */
+			*option |= ((type==SC_HIDING)?2:4);
+			opt_flag =1 ;
+			break;
+		case SC_CHASEWALK:
+			battle_stopattack(bl);	/* 攻?停止 */
+			*option |= 16388;
+			opt_flag =1 ;
+			break;
+		case SC_SIGHT:
+			*option |= 1;
+			opt_flag = 1;
+			break;
+		case SC_RUWACH:
+			*option |= 8192;
+			opt_flag = 1;
+			break;
+		case SC_WEDDING:
+			*option |= 4096;
+			opt_flag = 1;
+	}
+
+	if(opt_flag)	/* optionの?更 */
+		clif_changeoption(bl);
+
+	(*sc_count)++;	/* ステ?タス異常の? */
+
+	sc_data[type].val1 = val1;
+	sc_data[type].val2 = val2;
+	sc_data[type].val3 = val3;
+	sc_data[type].val4 = val4;
+	/* タイマ?設定 */
+	sc_data[type].timer = add_timer(
+		gettick() + tick, status_change_timer, bl->id, type);
+
+	if(bl->type==BL_PC && calc_flag)
+		status_calc_pc(sd,0);	/* ステ?タス再計算 */
+
+	if(bl->type==BL_PC && save_flag)
+		chrif_save(sd); // save the player status
+
+	if(bl->type==BL_PC && updateflag)
+		clif_updatestatus(sd,updateflag);	/* ステ?タスをクライアントに送る */
+
+	return 0;
+}
+/*==========================================
+ * ステータス異常全解除
+ *------------------------------------------
+ */
+int status_change_clear(struct block_list *bl,int type)
+{
+	struct status_change* sc_data;
+	short *sc_count, *option, *opt1, *opt2, *opt3;
+	int i;
+
+	nullpo_retr(0, bl);
+	nullpo_retr(0, sc_data = status_get_sc_data(bl));
+	nullpo_retr(0, sc_count = status_get_sc_count(bl));
+	nullpo_retr(0, option = status_get_option(bl));
+	nullpo_retr(0, opt1 = status_get_opt1(bl));
+	nullpo_retr(0, opt2 = status_get_opt2(bl));
+	nullpo_retr(0, opt3 = status_get_opt3(bl));
+
+	if (*sc_count == 0)
+		return 0;
+	for(i = 0; i < MAX_STATUSCHANGE; i++){
+		if(sc_data[i].timer != -1){	/* 異常があるならタイマ?を削除する */
+			status_change_end(bl, i, -1);
+		}
+	}
+	*sc_count = 0;
+	*opt1 = 0;
+	*opt2 = 0;
+	*opt3 = 0;
+	*option &= OPTION_MASK;
+
+	if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors && // by [Yor]
+		!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) // [celest]
+		*opt2 |= STATE_BLIND;
+
+	if(!type || type&2)
+		clif_changeoption(bl);
+
+	return 0;
+}
+
+/*==========================================
+ * ステータス異常終了
+ *------------------------------------------
+ */
+int status_change_end( struct block_list* bl , int type,int tid )
+{
+	struct status_change* sc_data;
+	int opt_flag=0, calc_flag = 0;
+	short *sc_count, *option, *opt1, *opt2, *opt3;
+
+	nullpo_retr(0, bl);
+	if(bl->type!=BL_PC && bl->type!=BL_MOB) {
+		if(battle_config.error_log)
+			printf("status_change_end: neither MOB nor PC !\n");
+		return 0;
+	}
+	nullpo_retr(0, sc_data = status_get_sc_data(bl));
+	nullpo_retr(0, sc_count = status_get_sc_count(bl));
+	nullpo_retr(0, option = status_get_option(bl));
+	nullpo_retr(0, opt1 = status_get_opt1(bl));
+	nullpo_retr(0, opt2 = status_get_opt2(bl));
+	nullpo_retr(0, opt3 = status_get_opt3(bl));
+
+	if ((*sc_count) > 0 && sc_data[type].timer != -1 && (sc_data[type].timer == tid || tid == -1)) {
+
+		if (tid == -1)	// タイマから呼ばれていないならタイマ削除をする
+			delete_timer(sc_data[type].timer,status_change_timer);
+
+		/* 該?の異常を正常に?す */
+		sc_data[type].timer=-1;
+		(*sc_count)--;
+
+		switch(type){	/* 異常の種類ごとの?理 */
+			case SC_PROVOKE:			/* プロボック */
+			case SC_ENDURE: // celest
+			case SC_CONCENTRATE:		/* 集中力向上 */
+			case SC_BLESSING:			/* ブレッシング */
+			case SC_ANGELUS:			/* アンゼルス */
+			case SC_INCREASEAGI:		/* 速度上昇 */
+			case SC_DECREASEAGI:		/* 速度減少 */
+			case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
+			case SC_HIDING:
+			case SC_TWOHANDQUICKEN:		/* 2HQ */
+			case SC_ADRENALINE:			/* アドレナリンラッシュ */
+			case SC_ENCPOISON:			/* エンチャントポイズン */
+			case SC_IMPOSITIO:			/* インポシティオマヌス */
+			case SC_GLORIA:				/* グロリア */
+			case SC_LOUD:				/* ラウドボイス */
+			case SC_QUAGMIRE:			/* クァグマイア */
+			case SC_PROVIDENCE:			/* プロヴィデンス */
+			case SC_SPEARSQUICKEN:		/* スピアクイッケン */
+			case SC_VOLCANO:
+			case SC_DELUGE:
+			case SC_VIOLENTGALE:
+			case SC_ETERNALCHAOS:		/* エタ?ナルカオス */
+			case SC_DRUMBATTLE:			/* ?太鼓の響き */
+			case SC_NIBELUNGEN:			/* ニ?ベルングの指輪 */
+			case SC_SIEGFRIED:			/* 不死身のジ?クフリ?ド */
+			case SC_WHISTLE:			/* 口笛 */
+			case SC_ASSNCROS:			/* 夕陽のアサシンクロス */
+			case SC_HUMMING:			/* ハミング */
+			case SC_DONTFORGETME:		/* 私を忘れないで */
+			case SC_FORTUNE:			/* 幸運のキス */
+			case SC_SERVICE4U:			/* サ?ビスフォ?ユ? */
+			case SC_EXPLOSIONSPIRITS:	// 爆裂波動
+			case SC_STEELBODY:			// 金剛
+			case SC_DEFENDER:
+			case SC_SPEEDPOTION0:		/* ?速ポ?ション */
+			case SC_SPEEDPOTION1:
+			case SC_SPEEDPOTION2:
+			case SC_SPEEDPOTION3:
+			case SC_APPLEIDUN:			/* イドゥンの林檎 */
+			case SC_RIDING:
+			case SC_BLADESTOP_WAIT:
+			case SC_AURABLADE:			/* オ?ラブレ?ド */
+			case SC_PARRYING:			/* パリイング */
+			case SC_CONCENTRATION:		/* コンセントレ?ション */
+			case SC_TENSIONRELAX:		/* テンションリラックス */
+			case SC_ASSUMPTIO:			/* アシャンプティオ */
+			case SC_WINDWALK:		/* ウインドウォ?ク */
+			case SC_TRUESIGHT:		/* トゥル?サイト */
+			case SC_SPIDERWEB:		/* スパイダ?ウェッブ */
+			case SC_MAGICPOWER:		/* 魔法力?幅 */
+			case SC_CHASEWALK:
+			case SC_ATKPOT:		/* attack potion [Valaris] */
+			case SC_MATKPOT:		/* magic attack potion [Valaris] */
+			case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
+			case SC_MELTDOWN:		/* メルトダウン */
+			// Celest
+			case SC_EDP:
+			case SC_SLOWDOWN:
+			case SC_SPEEDUP0:
+/*			case SC_LEADERSHIP:
+			case SC_GLORYWOUNDS:
+			case SC_SOULCOLD:
+			case SC_HAWKEYES:*/
+			case SC_BATTLEORDERS:
+			case SC_REGENERATION:
+				calc_flag = 1;
+				break;
+			case SC_AUTOBERSERK:
+				if (sc_data[SC_PROVOKE].timer != -1)
+					status_change_end(bl,SC_PROVOKE,-1);
+				break;
+			case SC_BERSERK:			/* バ?サ?ク */
+				calc_flag = 1;
+				clif_status_change(bl,SC_INCREASEAGI,0);	/* アイコン消去 */
+				break;
+			case SC_DEVOTION:		/* ディボ?ション */
+				{
+					struct map_session_data *md = map_id2sd(sc_data[type].val1);
+					sc_data[type].val1=sc_data[type].val2=0;
+					skill_devotion(md,bl->id);
+					calc_flag = 1;
+				}
+				break;
+			case SC_BLADESTOP:
+				{
+					struct status_change *t_sc_data = status_get_sc_data((struct block_list *)sc_data[type].val4);
+					//片方が切れたので相手の白刃?態が切れてないのなら解除
+					if(t_sc_data && t_sc_data[SC_BLADESTOP].timer!=-1)
+						status_change_end((struct block_list *)sc_data[type].val4,SC_BLADESTOP,-1);
+
+					if(sc_data[type].val2==2)
+						clif_bladestop((struct block_list *)sc_data[type].val3,(struct block_list *)sc_data[type].val4,0);
+				}
+				break;
+			case SC_DANCING:
+				{
+					struct map_session_data *dsd;
+					struct status_change *d_sc_data;
+					if(sc_data[type].val4 && (dsd=map_id2sd(sc_data[type].val4))){
+						d_sc_data = dsd->sc_data;
+						//合奏で相手がいる場合相手のval4を0にする
+						if(d_sc_data && d_sc_data[type].timer!=-1)
+							d_sc_data[type].val4=0;
+					}
+				}
+				calc_flag = 1;
+				break;
+			case SC_GRAFFITI:
+				{
+					struct skill_unit_group *sg=(struct skill_unit_group *)sc_data[type].val4;	//val4がグラフィティのgroup_id
+					if(sg)
+						skill_delunitgroup(sg);
+				}
+				break;
+			case SC_NOCHAT:	//チャット禁止?態
+				{
+					struct map_session_data *sd=NULL;
+					if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){
+						if (sd->status.manner >= 0) // weeee ^^ [celest]
+							sd->status.manner = 0;
+						clif_updatestatus(sd,SP_MANNER);
+					}
+				}
+				break;
+			case SC_SPLASHER:		/* ベナムスプラッシャ? */
+				{
+					struct block_list *src=map_id2bl(sc_data[type].val3);
+					if(src && tid!=-1){
+						//自分にダメ?ジ&周?3*3にダメ?ジ
+						skill_castend_damage_id(src, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 );
+					}
+				}
+				break;
+			case SC_SELFDESTRUCTION:		/* 自爆 */
+				{
+					//自分のダメ?ジは0にして
+					struct mob_data *md=NULL;
+					if(bl->type == BL_MOB && (md=(struct mob_data*)bl))
+						skill_castend_damage_id(bl, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 );
+				}
+				break;
+		/* option1 */
+			case SC_FREEZE:
+				sc_data[type].val3 = 0;
+				break;
+
+		/* option2 */
+			case SC_POISON:				/* 毒 */
+			case SC_BLIND:				/* 暗? */
+			case SC_CURSE:
+				calc_flag = 1;
+				break;
+
+			// celest
+			case SC_CONFUSION:
+				{
+					struct map_session_data *sd=NULL;
+					if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){
+						sd->next_walktime = -1;
+					}
+				}
+				break;
+
+			case SC_MARIONETTE:		/* マリオネットコントロ?ル */
+			case SC_MARIONETTE2:	/// Marionette target
+				{
+					// check for partner and end their marionette status as well
+					int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE;
+					struct block_list *pbl = map_id2bl(sc_data[type].val3);
+					if (pbl) {
+						struct status_change* sc_data;
+						if (*status_get_sc_count(pbl) > 0 &&
+							(sc_data = status_get_sc_data(pbl)) &&
+							sc_data[type2].timer != -1)
+							status_change_end(pbl, type2, -1);
+					}
+					calc_flag = 1;
+				}
+				break;
+			}
+
+		if(bl->type==BL_PC &&
+			(type<SC_SENDMAX || type==SC_PRESERVE || type==SC_BATTLEORDERS))
+			clif_status_change(bl,type,0);	/* アイコン消去 */
+
+		switch(type){	/* 正常に?るときなにか?理が必要 */
+		case SC_STONE:
+		case SC_FREEZE:
+		case SC_STAN:
+		case SC_SLEEP:
+			*opt1 = 0;
+			opt_flag = 1;
+			break;
+
+		case SC_POISON:
+			if (sc_data[SC_DPOISON].timer != -1)	//
+				break;						// DPOISON用のオプション
+			*opt2 &= ~1;					// が?用に用意された場合には
+			opt_flag = 1;					// ここは削除する
+			break;							//
+		case SC_CURSE:
+		case SC_SILENCE:
+		case SC_BLIND:
+			*opt2 &= ~(1<<(type-SC_POISON));
+			opt_flag = 1;
+			break;
+		case SC_DPOISON:
+			if (sc_data[SC_POISON].timer != -1)	// DPOISON用のオプションが
+				break;							// 用意されたら削除
+			*opt2 &= ~1;	// 毒?態解除
+			opt_flag = 1;
+			break;
+		case SC_SIGNUMCRUCIS:
+			*opt2 &= ~0x40;
+			opt_flag = 1;
+			break;
+
+		case SC_HIDING:
+		case SC_CLOAKING:
+			*option &= ~((type == SC_HIDING) ? 2 : 4);
+			calc_flag = 1;	// orn
+			opt_flag = 1 ;
+			break;
+
+		case SC_CHASEWALK:
+			*option &= ~16388;
+			opt_flag = 1 ;
+			break;
+
+		case SC_SIGHT:
+			*option &= ~1;
+			opt_flag = 1;
+			break;
+		case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
+			*option &= ~4096;
+			opt_flag = 1;
+			break;
+		case SC_RUWACH:
+			*option &= ~8192;
+			opt_flag = 1;
+			break;
+
+		//opt3
+		case SC_TWOHANDQUICKEN:		/* 2HQ */
+		case SC_SPEARSQUICKEN:		/* スピアクイッケン */
+		case SC_CONCENTRATION:		/* コンセントレ?ション */
+			*opt3 &= ~1;
+			break;
+		case SC_OVERTHRUST:			/* オ?バ?スラスト */
+			*opt3 &= ~2;
+			break;
+		case SC_ENERGYCOAT:			/* エナジ?コ?ト */
+			*opt3 &= ~4;
+			break;
+		case SC_EXPLOSIONSPIRITS:	// 爆裂波動
+			*opt3 &= ~8;
+			break;
+		case SC_STEELBODY:			// 金剛
+			*opt3 &= ~16;
+			break;
+		case SC_BLADESTOP:		/* 白刃取り */
+			*opt3 &= ~32;
+			break;
+		case SC_BERSERK:		/* バ?サ?ク */
+			*opt3 &= ~128;
+			break;
+		case SC_MARIONETTE:		/* マリオネットコントロ?ル */
+		case SC_MARIONETTE2:
+			*opt3 &= ~1024;
+			break;
+		case SC_ASSUMPTIO:		/* アスムプティオ */
+			*opt3 &= ~2048;
+			break;
+		}
+
+		if (night_flag == 1 && (*opt2 & STATE_BLIND) == 0 && bl->type == BL_PC && // by [Yor]
+			!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) { // [celest]
+			*opt2 |= STATE_BLIND;
+			opt_flag = 1;
+		}
+
+		if(opt_flag)	/* optionの?更を?える */
+			clif_changeoption(bl);
+
+		if (bl->type == BL_PC && calc_flag)
+			status_calc_pc((struct map_session_data *)bl,0);	/* ステ?タス再計算 */
+	}
+
+	return 0;
+}
+
+
+/*==========================================
+ * ステータス異常終了タイマー
+ *------------------------------------------
+ */
+int status_change_timer(int tid, unsigned int tick, int id, int data)
+{
+	int type=data;
+	struct block_list *bl;
+	struct map_session_data *sd=NULL;
+	struct status_change *sc_data;
+	//short *sc_count; //使ってない?
+
+	nullpo_retr(0, bl=map_id2bl(id));
+	nullpo_retr(0, sc_data=status_get_sc_data(bl));
+
+	if(bl->type==BL_PC)
+		nullpo_retr(0, sd=(struct map_session_data *)bl);
+
+	//sc_count=status_get_sc_count(bl); //使ってない?
+
+	if(sc_data[type].timer != tid) {
+		if(battle_config.error_log)
+			printf("status_change_timer %d != %d\n",tid,sc_data[type].timer);
+		return 0;
+	}
+
+	switch(type){	/* 特殊な?理になる場合 */
+	case SC_MAXIMIZEPOWER:	/* マキシマイズパワ? */
+	case SC_CLOAKING:
+		if(sd){
+			if( sd->status.sp > 0 ){ /* SP切れるまで持? */
+				sd->status.sp--;
+				clif_updatestatus(sd,SP_SP);
+				sc_data[type].timer=add_timer( /* タイマ?再設定 */
+				sc_data[type].val2+tick, status_change_timer, bl->id, data);
+				return 0;
+			}
+		}
+		break;
+
+	case SC_CHASEWALK:
+		if(sd){
+			int sp = 10+sc_data[SC_CHASEWALK].val1*2;
+			if (map[sd->bl.m].flag.gvg) sp *= 5;
+			if( sd->status.sp > sp){
+				sd->status.sp -= sp; // update sp cost [Celest]
+				clif_updatestatus(sd,SP_SP);
+				sc_data[type].timer=add_timer( /* タイマ?再設定 */
+					sc_data[type].val2+tick, status_change_timer, bl->id, data);
+				sc_data[SC_CHASEWALK].val4++;
+				if (sc_data[SC_CHASEWALK].val4 > 3)
+					sc_data[SC_CHASEWALK].val4 = 0;
+				status_calc_pc (sd, 0);
+				return 0;
+			}
+		}
+	break;
+
+	case SC_HIDING:		/* ハイディング */
+		if(sd){		/* SPがあって、時間制限の間は持? */
+			if( sd->status.sp > 0 && (--sc_data[type].val2)>0 ){
+				if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){
+					sd->status.sp--;
+					clif_updatestatus(sd,SP_SP);
+				}
+				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+					1000+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+		}
+	break;
+
+	case SC_SIGHT:	/* サイト */
+	case SC_RUWACH:	/* ルアフ */
+		{
+			int range = 5;
+			if ( type == SC_SIGHT ) range = 7;
+			map_foreachinarea( status_change_timer_sub,
+				bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0,
+				bl,type,tick);
+
+			if( (--sc_data[type].val2)>0 ){
+				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+					250+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+		}
+		break;
+
+	case SC_SIGNUMCRUCIS:		/* シグナムクルシス */
+		{
+			int race = status_get_race(bl);
+			if(race == 6 || battle_check_undead(race,status_get_elem_type(bl))) {
+				sc_data[type].timer=add_timer(1000*600+tick,status_change_timer, bl->id, data );
+				return 0;
+			}
+		}
+		break;
+
+	case SC_PROVOKE:	/* プロボック/オ?トバ?サ?ク */
+		if(sc_data[type].val2!=0){	/* オ?トバ?サ?ク(1秒ごとにHPチェック) */
+			if(sd && sd->status.hp>sd->status.max_hp>>2)	/* 停止 */
+				break;
+			sc_data[type].timer=add_timer( 1000+tick,status_change_timer, bl->id, data );
+			return 0;
+		}
+		break;
+
+	case SC_WATERBALL:	/* ウォ?タ?ボ?ル */
+		{
+			struct block_list *target=map_id2bl(sc_data[type].val2);
+			nullpo_retb(target);
+			nullpo_retb(target->prev);
+			skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0);
+			if((--sc_data[type].val3)>0) {
+				sc_data[type].timer=add_timer( 150+tick,status_change_timer, bl->id, data );
+				return 0;
+			}
+		}
+		break;
+
+	case SC_ENDURE:	/* インデュア */
+	case SC_AUTOBERSERK: // Celest
+		if(sd && sd->special_state.infinite_endure) {
+#ifdef TWILIGHT
+			sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
+#else
+			sc_data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data );
+#endif
+			//sc_data[type].val2=1;
+			return 0;
+		}
+		break;
+
+	case SC_DISSONANCE:	/* 不協和音 */
+		if( (--sc_data[type].val2)>0){
+			struct skill_unit *unit=
+				(struct skill_unit *)sc_data[type].val4;
+			struct block_list *src;
+			/*if(!unit || !unit->group)
+				break;
+			src=map_id2bl(unit->group->src_id);
+			if(!src)
+				break;*/
+			nullpo_retb(unit);
+			nullpo_retb(unit->group);
+			nullpo_retr(0, src=map_id2bl(unit->group->src_id));
+			skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0);
+			sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick,
+				status_change_timer, bl->id, data );
+			return 0;
+		}
+		break;
+
+	case SC_LULLABY:	/* 子守唄 */
+		if( (--sc_data[type].val2)>0){
+			struct skill_unit *unit=
+				(struct skill_unit *)sc_data[type].val4;
+			nullpo_retb(unit);
+			nullpo_retb(unit->group);
+			if(unit->group->src_id == bl->id)
+				break;
+			skill_additional_effect(bl,bl,unit->group->skill_id,sc_data[type].val1,BF_LONG|BF_SKILL|BF_MISC,tick);
+			if (unit->group != 0)
+				sc_data[type].timer=add_timer(skill_get_time(unit->group->skill_id,unit->group->skill_lv)/10+tick,
+					status_change_timer, bl->id, data );
+			return 0;
+		}
+		break;
+
+	case SC_STONE:
+		if(sc_data[type].val2 != 0) {
+			short *opt1 = status_get_opt1(bl);
+			sc_data[type].val2 = 0;
+			sc_data[type].val4 = 0;
+			battle_stopwalking(bl,1);
+			if(opt1) {
+				*opt1 = 1;
+				clif_changeoption(bl);
+			}
+			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+			return 0;
+		}
+		else if( (--sc_data[type].val3) > 0) {
+			int hp = status_get_max_hp(bl);
+			if((++sc_data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) {
+				hp = hp/100;
+				if(hp < 1) hp = 1;
+				if(sd)
+					pc_heal(sd,-hp,0);
+				else if(bl->type == BL_MOB){
+					struct mob_data *md;
+					if((md=((struct mob_data *)bl)) == NULL)
+						break;
+					md->hp -= hp;
+				}
+			}
+			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+			return 0;
+		}
+		break;
+	case SC_POISON:
+		if(sc_data[SC_SLOWPOISON].timer == -1) {
+			if( (--sc_data[type].val3) > 0) {
+				int hp = status_get_max_hp(bl);
+				if(status_get_hp(bl) > hp>>2) {
+					if(bl->type == BL_PC) {
+						hp = 3 + hp*3/200;
+						pc_heal((struct map_session_data *)bl,-hp,0);
+					}
+					else if(bl->type == BL_MOB) {
+						struct mob_data *md;
+						nullpo_retr(0, md=(struct mob_data *)bl);
+						/*if((md=((struct mob_data *)bl)) == NULL)
+							break;*/
+						hp = 3 + hp/200;
+						md->hp -= hp;
+					}
+				}
+				sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+			}
+		}
+		else
+			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+		break;
+	case SC_DPOISON:
+		if (sc_data[SC_SLOWPOISON].timer == -1 && (--sc_data[type].val3) > 0) {
+			int hp = status_get_max_hp(bl);
+			if (status_get_hp(bl) > hp>>2) {
+				if(sd) {
+					hp = 3 + hp/50;
+					pc_heal(sd, -hp, 0);
+				} else if (bl->type == BL_MOB) {
+					struct mob_data *md;
+					nullpo_retr(0, md=(struct mob_data *)bl);
+					/*if ((md=((struct mob_data *)bl)) == NULL)
+						break;*/
+					hp = 3 + hp/100;
+					md->hp -= hp;
+				}
+			}
+		}
+		if (sc_data[type].val3 > 0)
+			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+		break;
+
+	case SC_TENSIONRELAX:	/* テンションリラックス */
+		if(sd){		/* SPがあって、HPが?タンでなければ?? */
+			if( sd->status.sp > 12 && sd->status.max_hp > sd->status.hp ){
+/*				if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){
+					sd->status.sp -= 12;
+					clif_updatestatus(sd,SP_SP);
+				}						*/
+				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+					10000+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+			if(sd->status.max_hp <= sd->status.hp)
+				status_change_end(&sd->bl,SC_TENSIONRELAX,-1);
+		}
+		break;
+	case SC_HEADCRUSH:	// temporary damage [celest]
+//	case SC_BLEEDING:
+		if((--sc_data[type].val3) > 0) {
+			int hp = status_get_max_hp(bl);
+			if(sd) {
+				hp = 3 + hp*3/200;
+				pc_heal(sd,-hp,0);
+			}
+			else if(bl->type == BL_MOB) {
+				struct mob_data *md;
+				nullpo_retr(0, md=(struct mob_data *)bl);
+				/*if((md=((struct mob_data *)bl)) == NULL)
+					break;*/
+				hp = 3 + hp/200;
+				md->hp -= hp;
+			}
+			sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data );
+		}
+		break;
+
+	/* 時間切れ無し?? */
+	case SC_AETERNA:
+	case SC_TRICKDEAD:
+	case SC_RIDING:
+	case SC_FALCON:
+	case SC_WEIGHT50:
+	case SC_WEIGHT90:
+	case SC_MAGICPOWER:		/* 魔法力?幅 */
+	case SC_REJECTSWORD:	/* リジェクトソ?ド */
+	case SC_MEMORIZE:	/* メモライズ */
+	case SC_BROKNWEAPON:
+	case SC_BROKNARMOR:
+	case SC_SACRIFICE:
+//		if(sc_data[type].timer==tid)
+			sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data );
+		return 0;
+
+	case SC_DANCING: //ダンススキルの時間SP消費
+		{
+			int s=0;
+			if(sd){
+				if(sd->status.sp > 0 && (--sc_data[type].val3)>0){
+					switch(sc_data[type].val1){
+					case BD_RICHMANKIM:				/* ニヨルドの宴 3秒にSP1 */
+					case BD_DRUMBATTLEFIELD:		/* ?太鼓の響き 3秒にSP1 */
+					case BD_RINGNIBELUNGEN:			/* ニ?ベルングの指輪 3秒にSP1 */
+					case BD_SIEGFRIED:				/* 不死身のジ?クフリ?ド 3秒にSP1 */
+					case BA_DISSONANCE:				/* 不協和音 3秒でSP1 */
+					case BA_ASSASSINCROSS:			/* 夕陽のアサシンクロス 3秒でSP1 */
+					case DC_UGLYDANCE:				/* 自分勝手なダンス 3秒でSP1 */
+						s=3;
+						break;
+					case BD_LULLABY:				/* 子守歌 4秒にSP1 */
+					case BD_ETERNALCHAOS:			/* 永遠の混沌 4秒にSP1 */
+					case BD_ROKISWEIL:				/* ロキの叫び 4秒にSP1 */
+					case DC_FORTUNEKISS:			/* 幸運のキス 4秒でSP1 */
+						s=4;
+						break;
+					case BD_INTOABYSS:				/* 深淵の中に 5秒にSP1 */
+					case BA_WHISTLE:				/* 口笛 5秒でSP1 */
+					case DC_HUMMING:				/* ハミング 5秒でSP1 */
+					case BA_POEMBRAGI:				/* ブラギの詩 5秒でSP1 */
+					case DC_SERVICEFORYOU:			/* サ?ビスフォ?ユ? 5秒でSP1 */
+						s=5;
+						break;
+					case BA_APPLEIDUN:				/* イドゥンの林檎 6秒でSP1 */
+						s=6;
+						break;
+					case DC_DONTFORGETME:			/* 私を忘れないで… 10秒でSP1 */
+					case CG_MOONLIT:				/* 月明りの泉に落ちる花びら 10秒でSP1? */
+						s=10;
+						break;
+					}
+					if(s && ((sc_data[type].val3 % s) == 0)){
+						sd->status.sp--;
+						clif_updatestatus(sd,SP_SP);
+					}
+					sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+						1000+tick, status_change_timer,
+						bl->id, data);
+					return 0;
+				}
+			}
+		}
+		break;
+	case SC_BERSERK:		/* バ?サ?ク */
+		if(sd){		/* HPが100以上なら?? */
+			if( (sd->status.hp - sd->status.max_hp*5/100) > 100 ){	// 5% every 10 seconds [DracoRPG]
+				sd->status.hp -= sd->status.max_hp*5/100;	// changed to max hp [celest]
+				clif_updatestatus(sd,SP_HP);
+				sc_data[type].timer = add_timer(	/* タイマ?再設定 */
+					10000+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+		}
+		break;
+	case SC_WEDDING:	//結婚用(結婚衣裳になって?くのが?いとか)
+		if(sd){
+			time_t timer;
+			if(time(&timer) < ((sc_data[type].val2) + 3600)){	//1時間たっていないので??
+				sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+					10000+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+		}
+		break;
+	case SC_NOCHAT:	//チャット禁止?態
+		if(sd && battle_config.muting_players){
+			time_t timer;
+			if((++sd->status.manner) && time(&timer) < ((sc_data[type].val2) + 60*(0-sd->status.manner))){	//開始からstatus.manner分?ってないので??
+				clif_updatestatus(sd,SP_MANNER);
+				sc_data[type].timer=add_timer(	/* タイマ?再設定(60秒) */
+					60000+tick, status_change_timer,
+					bl->id, data);
+				return 0;
+			}
+		}
+		break;
+	case SC_SELFDESTRUCTION:		/* 自爆 */
+		if(--sc_data[type].val3>0){
+			struct mob_data *md;
+			if(bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->speed > 250){
+				md->speed -= 250;
+				md->next_walktime=tick;
+			}
+			sc_data[type].timer=add_timer(	/* タイマ?再設定 */
+				1000+tick, status_change_timer,
+				bl->id, data);
+				return 0;
+		}
+		break;
+
+	case SC_SPLASHER:
+		if (sc_data[type].val4 % 1000 == 0) {
+			char timer[2];
+			sprintf (timer, "%d", sc_data[type].val4/1000);
+			clif_message(bl, timer);
+		}
+		if((sc_data[type].val4 -= 500) > 0) {
+			sc_data[type].timer = add_timer(
+				500 + tick, status_change_timer,
+				bl->id, data);
+				return 0;
+		}
+		break;
+
+	case SC_MARIONETTE:		/* マリオネットコントロ?ル */
+	case SC_MARIONETTE2:
+		{
+			struct block_list *pbl = map_id2bl(sc_data[type].val3);
+			if (pbl && battle_check_range(bl, pbl, 7) &&
+				(sc_data[type].val2 -= 1000)>0) {
+				sc_data[type].timer = add_timer(
+					1000 + tick, status_change_timer,
+					bl->id, data);
+					return 0;
+			}
+		}
+		break;
+
+/*	case SC_LEADERSHIP:
+	case SC_GLORYWOUNDS:
+	case SC_SOULCOLD:
+	case SC_HAWKEYES:
+		if (sd) {
+			sc_data[type].timer = add_timer(
+				1000+tick, status_change_timer,
+				bl->id, data);
+		}
+		break;*/
+
+	// Celest
+	case SC_CONFUSION:
+		{
+			int i = 3000;
+			//struct mob_data *md;
+			if (sd) {
+				pc_randomwalk (sd, gettick());
+				sd->next_walktime = tick + (i=1000 + rand()%1000);
+			} /*else if (bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->mode&1 && mob_can_move(md)) {
+				md->state.state=MS_WALK;
+				if( DIFF_TICK(md->next_walktime,tick) > + 7000 &&
+					(md->walkpath.path_len==0 || md->walkpath.path_pos>=md->walkpath.path_len) )
+					md->next_walktime = tick + 3000*rand()%2000;
+				mob_randomwalk(md,tick);
+			}*/
+			if ((sc_data[type].val2 -= 1000) > 0) {
+				sc_data[type].timer = add_timer(
+					i + tick, status_change_timer,
+					bl->id, data);
+					return 0;
+			}
+		}
+		break;
+
+	case SC_GOSPEL:
+		{
+			int calc_flag = 0;
+			if (sc_data[type].val3 > 0) {
+				sc_data[type].val3 = 0;
+				calc_flag = 1;
+			}
+			if(sd && sc_data[type].val4 == BCT_SELF){
+				int hp, sp;
+				hp = (sc_data[type].val1 > 5) ? 45 : 30;
+				sp = (sc_data[type].val1 > 5) ? 35 : 20;
+				if(sd->status.hp - hp > 0 &&
+					sd->status.sp - sp > 0){
+					sd->status.hp -= hp;
+					sd->status.sp -= sp;
+					clif_updatestatus(sd,SP_HP);
+					clif_updatestatus(sd,SP_SP);
+					if ((sc_data[type].val2 -= 10000) > 0) {
+						sc_data[type].timer = add_timer(
+							10000+tick, status_change_timer,
+							bl->id, data);
+						return 0;
+					}
+				}
+			} else if (sd && sc_data[type].val4 == BCT_PARTY) {
+				int i;
+				switch ((i = rand() % 12)) {
+				case 1: // heal between 100-1000
+					{
+						struct block_list tbl;
+						int heal = rand() % 900 + 100;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,AL_HEAL,heal,1);
+						battle_heal(NULL,bl,heal,0,0);
+					}
+					break;
+				case 2: // end negative status
+					{
+						int j;
+						for (j=0; j<4; j++)
+							if(sc_data[i + SC_POISON].timer!=-1) {
+								status_change_end(bl,j,-1);
+								break;
+							}
+					}
+					break;
+				case 3:	// +25% resistance to negative status
+				case 4: // +25% max hp
+				case 5: // +25% max sp
+				case 6: // +2 to all stats
+				case 11: // +25% armor and vit def
+				case 12: // +8% atk
+				case 13: // +5% flee
+				case 14: // +5% hit
+					sc_data[type].val3 = i;
+					if (i == 6 ||
+						(i >= 11 && i <= 14))
+						calc_flag = 1;
+					break;
+				case 7: // level 5 bless
+					{
+						struct block_list tbl;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,AL_BLESSING,5,1);
+						status_change_start(bl,SkillStatusChangeTable[AL_BLESSING],5,0,0,0,10000,0 );
+					}
+					break;
+				case 8: // level 5 increase agility
+					{
+						struct block_list tbl;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,AL_INCAGI,5,1);
+						status_change_start(bl,SkillStatusChangeTable[AL_INCAGI],5,0,0,0,10000,0 );
+					}
+					break;
+				case 9: // holy element to weapon
+					{
+						struct block_list tbl;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,PR_ASPERSIO,1,1);
+						status_change_start(bl,SkillStatusChangeTable[PR_ASPERSIO],1,0,0,0,10000,0 );
+					}
+					break;
+				case 10: // holy element to armour
+					{
+						struct block_list tbl;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,PR_BENEDICTIO,1,1);
+						status_change_start(bl,SkillStatusChangeTable[PR_BENEDICTIO],1,0,0,0,10000,0 );
+					}
+					break;
+				default:
+					break;
+				}
+			} else if (sc_data[type].val4 == BCT_ENEMY) {
+				int i;
+				switch ((i = rand() % 8)) {
+				case 1: // damage between 300-800
+				case 2: // damage between 150-550 (ignore def)
+					battle_damage(NULL, bl, rand() % 500,0); // temporary damage
+					break;
+				case 3: // random status effect
+					{
+						int effect[3] = {
+							SC_CURSE,
+							SC_BLIND,
+							SC_POISON };
+						status_change_start(bl,effect[rand()%3],1,0,0,0,10000,0 );
+					}
+					break;
+				case 4: // level 10 provoke
+					{
+						struct block_list tbl;
+						tbl.id = 0;
+						tbl.m = bl->m;
+						tbl.x = bl->x;
+						tbl.y = bl->y;
+						clif_skill_nodamage(&tbl,bl,SM_PROVOKE,1,1);
+						status_change_start(bl,SkillStatusChangeTable[SM_PROVOKE],10,0,0,0,10000,0 );
+					}
+					break;
+				case 5: // 0 def
+				case 6: // 0 atk
+				case 7: // 0 flee
+				case 8: // -75% move speed and aspd
+					sc_data[type].val3 = i;
+					calc_flag = 1;
+					break;
+				default:
+					break;
+				}
+			}
+			if (sd && calc_flag)
+				status_calc_pc (sd, 0);
+		}
+		break;
+	}
+
+	return status_change_end( bl,type,tid );
+}
+
+/*==========================================
+ * ステータス異常タイマー範囲処理
+ *------------------------------------------
+ */
+int status_change_timer_sub(struct block_list *bl, va_list ap )
+{
+	struct block_list *src;
+	int type;
+	unsigned int tick;
+
+	nullpo_retr(0, bl);
+	nullpo_retr(0, ap);
+	nullpo_retr(0, src=va_arg(ap,struct block_list*));
+	type=va_arg(ap,int);
+	tick=va_arg(ap,unsigned int);
+
+	if(bl->type!=BL_PC && bl->type!=BL_MOB)
+		return 0;
+
+	switch( type ){
+	case SC_SIGHT:	/* サイト */
+	case SC_CONCENTRATE:
+		if( (*status_get_option(bl))&6 ){
+			status_change_end( bl, SC_HIDING, -1);
+			status_change_end( bl, SC_CLOAKING, -1);
+		}
+		break;
+	case SC_RUWACH:	/* ルアフ */
+		if( (*status_get_option(bl))&6 ){
+			struct status_change *sc_data = status_get_sc_data(bl);	// check whether the target is hiding/cloaking [celest]
+			if (sc_data && (sc_data[SC_HIDING].timer != -1 ||	// if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother
+				sc_data[SC_CLOAKING].timer != -1)) {
+				status_change_end( bl, SC_HIDING, -1);
+				status_change_end( bl, SC_CLOAKING, -1);
+			}
+			if(battle_check_target( src,bl, BCT_ENEMY ) > 0)
+				skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0);
+		}
+		break;
+	}
+	return 0;
+}
+
+
+static int status_calc_sigma(void)
+{
+	int i,j,k;
+
+	for(i=0;i<MAX_PC_CLASS;i++) {
+		memset(hp_sigma_val[i],0,sizeof(hp_sigma_val[i]));
+		for(k=0,j=2;j<=MAX_LEVEL;j++) {
+			k += hp_coefficient[i]*j + 50;
+			k -= k%100;
+			hp_sigma_val[i][j-1] = k;
+		}
+	}
+	return 0;
+}
+
+int status_readdb(void) {
+	int i,j,k;
+	FILE *fp;
+	char line[1024],*p;
+
+	// JOB補正?値1
+	fp=fopen("db/job_db1.txt","r");
+	if(fp==NULL){
+		printf("can't read db/job_db1.txt\n");
+		return 1;
+	}
+	i=0;
+	while(fgets(line, sizeof(line)-1, fp)){
+		char *split[50];
+		if(line[0]=='/' && line[1]=='/')
+			continue;
+		for(j=0,p=line;j<21 && p;j++){
+			split[j]=p;
+			p=strchr(p,',');
+			if(p) *p++=0;
+		}
+		if(j<21)
+			continue;
+		max_weight_base[i]=atoi(split[0]);
+		hp_coefficient[i]=atoi(split[1]);
+		hp_coefficient2[i]=atoi(split[2]);
+		sp_coefficient[i]=atoi(split[3]);
+		for(j=0;j<17;j++)
+			aspd_base[i][j]=atoi(split[j+4]);
+		i++;
+// -- moonsoul (below two lines added to accommodate high numbered new class ids)
+		if(i==24)
+			i=4001;
+		if(i==MAX_PC_CLASS)
+			break;
+	}
+	fclose(fp);
+	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db1.txt");
+	ShowStatus(tmp_output);
+
+	// JOBボ?ナス
+	memset(job_bonus,0,sizeof(job_bonus));
+	fp=fopen("db/job_db2.txt","r");
+	if(fp==NULL){
+		printf("can't read db/job_db2.txt\n");
+		return 1;
+	}
+	i=0;
+	while(fgets(line, sizeof(line)-1, fp)){
+		if(line[0]=='/' && line[1]=='/')
+			continue;
+		for(j=0,p=line;j<MAX_LEVEL && p;j++){
+			if(sscanf(p,"%d",&k)==0)
+				break;
+			job_bonus[0][i][j]=k;
+			job_bonus[2][i][j]=k; //養子職のボ?ナスは分からないので?
+			p=strchr(p,',');
+			if(p) p++;
+		}
+		i++;
+// -- moonsoul (below two lines added to accommodate high numbered new class ids)
+		if(i==24)
+			i=4001;
+		if(i==MAX_PC_CLASS)
+			break;
+	}
+	fclose(fp);
+	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db2.txt");
+	ShowStatus(tmp_output);
+
+	// JOBボ?ナス2 ?生職用
+	fp=fopen("db/job_db2-2.txt","r");
+	if(fp==NULL){
+		printf("can't read db/job_db2-2.txt\n");
+		return 1;
+	}
+	i=0;
+	while(fgets(line, sizeof(line)-1, fp)){
+		if(line[0]=='/' && line[1]=='/')
+			continue;
+		for(j=0,p=line;j<MAX_LEVEL && p;j++){
+			if(sscanf(p,"%d",&k)==0)
+				break;
+			job_bonus[1][i][j]=k;
+			p=strchr(p,',');
+			if(p) p++;
+		}
+		i++;
+		if(i==MAX_PC_CLASS)
+			break;
+	}
+	fclose(fp);
+	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db2-2.txt");
+	ShowStatus(tmp_output);
+
+	// サイズ補正テ?ブル
+	for(i=0;i<3;i++)
+		for(j=0;j<20;j++)
+			atkmods[i][j]=100;
+	fp=fopen("db/size_fix.txt","r");
+	if(fp==NULL){
+		printf("can't read db/size_fix.txt\n");
+		return 1;
+	}
+	i=0;
+	while(fgets(line, sizeof(line)-1, fp)){
+		char *split[20];
+		if(line[0]=='/' && line[1]=='/')
+			continue;
+		if(atoi(line)<=0)
+			continue;
+		memset(split,0,sizeof(split));
+		for(j=0,p=line;j<20 && p;j++){
+			split[j]=p;
+			p=strchr(p,',');
+			if(p) *p++=0;
+		}
+		for(j=0;j<20 && split[j];j++)
+			atkmods[i][j]=atoi(split[j]);
+		i++;
+	}
+	fclose(fp);
+	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/size_fix.txt");
+	ShowStatus(tmp_output);
+
+	// 精?デ?タテ?ブル
+	for(i=0;i<5;i++){
+		for(j=0;j<10;j++)
+			percentrefinery[i][j]=100;
+		refinebonus[i][0]=0;
+		refinebonus[i][1]=0;
+		refinebonus[i][2]=10;
+	}
+	fp=fopen("db/refine_db.txt","r");
+	if(fp==NULL){
+		printf("can't read db/refine_db.txt\n");
+		return 1;
+	}
+	i=0;
+	while(fgets(line, sizeof(line)-1, fp)){
+		char *split[16];
+		if(line[0]=='/' && line[1]=='/')
+			continue;
+		if(atoi(line)<=0)
+			continue;
+		memset(split,0,sizeof(split));
+		for(j=0,p=line;j<16 && p;j++){
+			split[j]=p;
+			p=strchr(p,',');
+			if(p) *p++=0;
+		}
+		refinebonus[i][0]=atoi(split[0]);	// 精?ボ?ナス
+		refinebonus[i][1]=atoi(split[1]);	// 過?精?ボ?ナス
+		refinebonus[i][2]=atoi(split[2]);	// 安全精?限界
+		for(j=0;j<10 && split[j];j++)
+			percentrefinery[i][j]=atoi(split[j+3]);
+		i++;
+	}
+	fclose(fp); //Lupus. close this file!!!
+	sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/refine_db.txt");
+	ShowStatus(tmp_output);
+
+	return 0;
+}
+
+/*==========================================
+ * スキル関係初期化処理
+ *------------------------------------------
+ */
+int do_init_status(void)
+{
+	add_timer_func_list(status_change_timer,"status_change_timer");
+	status_readdb();
+	status_calc_sigma();
+	return 0;
+}

+ 81 - 81
src/map/status.h

@@ -1,81 +1,81 @@
-#ifndef _STATUS_H_
-#define _STATUS_H_
-
-// パラメータ所得系 battle.c より移動
-int status_get_class(struct block_list *bl);
-int status_get_dir(struct block_list *bl);
-int status_get_lv(struct block_list *bl);
-int status_get_range(struct block_list *bl);
-int status_get_hp(struct block_list *bl);
-int status_get_max_hp(struct block_list *bl);
-int status_get_str(struct block_list *bl);
-int status_get_agi(struct block_list *bl);
-int status_get_vit(struct block_list *bl);
-int status_get_int(struct block_list *bl);
-int status_get_dex(struct block_list *bl);
-int status_get_luk(struct block_list *bl);
-int status_get_hit(struct block_list *bl);
-int status_get_flee(struct block_list *bl);
-int status_get_def(struct block_list *bl);
-int status_get_mdef(struct block_list *bl);
-int status_get_flee2(struct block_list *bl);
-int status_get_def2(struct block_list *bl);
-int status_get_mdef2(struct block_list *bl);
-int status_get_baseatk(struct block_list *bl);
-int status_get_atk(struct block_list *bl);
-int status_get_atk2(struct block_list *bl);
-int status_get_speed(struct block_list *bl);
-int status_get_adelay(struct block_list *bl);
-int status_get_amotion(struct block_list *bl);
-int status_get_dmotion(struct block_list *bl);
-int status_get_element(struct block_list *bl);
-int status_get_attack_element(struct block_list *bl);
-int status_get_attack_element2(struct block_list *bl);  //左手武器属性取得
-#define status_get_elem_type(bl)	(status_get_element(bl)%10)
-#define status_get_elem_level(bl)	(status_get_element(bl)/10/2)
-int status_get_party_id(struct block_list *bl);
-int status_get_guild_id(struct block_list *bl);
-int status_get_race(struct block_list *bl);
-int status_get_size(struct block_list *bl);
-int status_get_mode(struct block_list *bl);
-int status_get_mexp(struct block_list *bl);
-
-struct status_change *status_get_sc_data(struct block_list *bl);
-short *status_get_sc_count(struct block_list *bl);
-short *status_get_opt1(struct block_list *bl);
-short *status_get_opt2(struct block_list *bl);
-short *status_get_opt3(struct block_list *bl);
-short *status_get_option(struct block_list *bl);
-
-int status_get_matk1(struct block_list *bl);
-int status_get_matk2(struct block_list *bl);
-int status_get_critical(struct block_list *bl);
-int status_get_atk_(struct block_list *bl);
-int status_get_atk_2(struct block_list *bl);
-int status_get_atk2(struct block_list *bl);
-
-int status_get_sc_def(struct block_list *bl, int type);
-#define status_get_sc_def_mdef(bl)	(status_get_sc_def(bl, SP_MDEF1))
-#define status_get_sc_def_vit(bl)	(status_get_sc_def(bl, SP_DEF2))
-#define status_get_sc_def_int(bl)	(status_get_sc_def(bl, SP_MDEF2))
-#define status_get_sc_def_luk(bl)	(status_get_sc_def(bl, SP_LUK))
-
-// 状態異常関連 skill.c より移動
-int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag);
-int status_change_end( struct block_list* bl , int type,int tid );
-int status_change_timer(int tid, unsigned int tick, int id, int data);
-int status_change_timer_sub(struct block_list *bl, va_list ap );
-int status_change_clear(struct block_list *bl,int type);
-
-// ステータス計算 pc.c から分離
-// pc_calcstatus
-int status_calc_pc(struct map_session_data* sd,int first);
-int status_calc_speed(struct map_session_data*); // [Celest]
-// int status_calc_skilltree(struct map_session_data *sd);
-int status_getrefinebonus(int lv,int type);
-int status_percentrefinery(struct map_session_data *sd,struct item *item);
-extern int percentrefinery[5][10];
-
-int do_init_status(void);
-
-#endif
+#ifndef _STATUS_H_
+#define _STATUS_H_
+
+// パラメータ所得系 battle.c より移動
+int status_get_class(struct block_list *bl);
+int status_get_dir(struct block_list *bl);
+int status_get_lv(struct block_list *bl);
+int status_get_range(struct block_list *bl);
+int status_get_hp(struct block_list *bl);
+int status_get_max_hp(struct block_list *bl);
+int status_get_str(struct block_list *bl);
+int status_get_agi(struct block_list *bl);
+int status_get_vit(struct block_list *bl);
+int status_get_int(struct block_list *bl);
+int status_get_dex(struct block_list *bl);
+int status_get_luk(struct block_list *bl);
+int status_get_hit(struct block_list *bl);
+int status_get_flee(struct block_list *bl);
+int status_get_def(struct block_list *bl);
+int status_get_mdef(struct block_list *bl);
+int status_get_flee2(struct block_list *bl);
+int status_get_def2(struct block_list *bl);
+int status_get_mdef2(struct block_list *bl);
+int status_get_baseatk(struct block_list *bl);
+int status_get_atk(struct block_list *bl);
+int status_get_atk2(struct block_list *bl);
+int status_get_speed(struct block_list *bl);
+int status_get_adelay(struct block_list *bl);
+int status_get_amotion(struct block_list *bl);
+int status_get_dmotion(struct block_list *bl);
+int status_get_element(struct block_list *bl);
+int status_get_attack_element(struct block_list *bl);
+int status_get_attack_element2(struct block_list *bl);  //左手武器属性取得
+#define status_get_elem_type(bl)	(status_get_element(bl)%10)
+#define status_get_elem_level(bl)	(status_get_element(bl)/10/2)
+int status_get_party_id(struct block_list *bl);
+int status_get_guild_id(struct block_list *bl);
+int status_get_race(struct block_list *bl);
+int status_get_size(struct block_list *bl);
+int status_get_mode(struct block_list *bl);
+int status_get_mexp(struct block_list *bl);
+
+struct status_change *status_get_sc_data(struct block_list *bl);
+short *status_get_sc_count(struct block_list *bl);
+short *status_get_opt1(struct block_list *bl);
+short *status_get_opt2(struct block_list *bl);
+short *status_get_opt3(struct block_list *bl);
+short *status_get_option(struct block_list *bl);
+
+int status_get_matk1(struct block_list *bl);
+int status_get_matk2(struct block_list *bl);
+int status_get_critical(struct block_list *bl);
+int status_get_atk_(struct block_list *bl);
+int status_get_atk_2(struct block_list *bl);
+int status_get_atk2(struct block_list *bl);
+
+int status_get_sc_def(struct block_list *bl, int type);
+#define status_get_sc_def_mdef(bl)	(status_get_sc_def(bl, SP_MDEF1))
+#define status_get_sc_def_vit(bl)	(status_get_sc_def(bl, SP_DEF2))
+#define status_get_sc_def_int(bl)	(status_get_sc_def(bl, SP_MDEF2))
+#define status_get_sc_def_luk(bl)	(status_get_sc_def(bl, SP_LUK))
+
+// 状態異常関連 skill.c より移動
+int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag);
+int status_change_end( struct block_list* bl , int type,int tid );
+int status_change_timer(int tid, unsigned int tick, int id, int data);
+int status_change_timer_sub(struct block_list *bl, va_list ap );
+int status_change_clear(struct block_list *bl,int type);
+
+// ステータス計算 pc.c から分離
+// pc_calcstatus
+int status_calc_pc(struct map_session_data* sd,int first);
+int status_calc_speed(struct map_session_data*); // [Celest]
+// int status_calc_skilltree(struct map_session_data *sd);
+int status_getrefinebonus(int lv,int type);
+int status_percentrefinery(struct map_session_data *sd,struct item *item);
+extern int percentrefinery[5][10];
+
+int do_init_status(void);
+
+#endif