Explorar o código

Updated Cloaking, Endure, fixed bug with monster npc's

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@244 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest %!s(int64=20) %!d(string=hai) anos
pai
achega
16cc52bfdc
Modificáronse 13 ficheiros con 83 adicións e 47 borrados
  1. 6 0
      Changelog.txt
  2. 2 0
      db/Changelog.txt
  3. 1 1
      db/skill_cast_db.txt
  4. 3 3
      db/skill_tree.txt
  5. 1 0
      npc/Changelog.txt
  6. 1 1
      npc/cities/payon.txt
  7. 5 5
      src/map/atcommand.c
  8. 1 1
      src/map/chrif.c
  9. 1 1
      src/map/clif.c
  10. 23 16
      src/map/pc.c
  11. 1 1
      src/map/pc.h
  12. 3 3
      src/map/script.c
  13. 35 15
      src/map/skill.c

+ 6 - 0
Changelog.txt

@@ -1,4 +1,10 @@
 Date	Added
+11/18   * Added flag to pc_unequipitem (thanks to DracoRPG for suggestion) [celest]
+        * Skill updates [celest]
+          - Updated Cloaking (thanks to orn), Endure
+        * Modified pc_attack to fix monster npc's not working in certain exes, thanks
+          to leinsirk10 [celest]
+
 11/17   
 	* Added stub-handler for packet 0x3090 into char_sql [MouseJstr]
 	* Fixed a crash in the afm reading/closing code [MouseJstr]

+ 2 - 0
db/Changelog.txt

@@ -5,6 +5,8 @@
 	Ayathoya items == Added but no effect ( all are "ect" itens)
 	Skill databases == celest working on them i believe.
 
+11/17   - Corrected max level for cloaking in skill_tree.txt [celest]
+
 11/16
 	item 7110 fixed name -> Broken Sword (part of Bongun quest) [Lupus]
 	

+ 1 - 1
db/skill_cast_db.txt

@@ -94,7 +94,7 @@
 
 129,1000,1000,0,0	//HT_BLITZBEAT#ブリッツビート#
 
-135,0,0,4000:5000:6000:7000:8000:9000:10000:11000:12000:13000,0	//AS_CLOAKING#クローキング#
+135,0,0,500:1000:2000:3000:4000:5000:6000:7000:8000:9000,0	//AS_CLOAKING#クローキング#
 136,0,0,0,6000:7000:8000:9000:10000:11000:12000:13000:14000:15000	//AS_SONICBLOW#ソニックブロー#
 
 138,0,0,30000:45000:60000:75000:90000:105000:120000:135000:150000:165000,0	//AS_ENCHANTPOISON#エンチャントポイズン#

+ 3 - 3
db/skill_tree.txt

@@ -254,7 +254,7 @@
 12,132,5,0,0,0,0,0,0,0,0,0,0//AS_RIGHT		#右手修練#
 12,133,5,132,2,0,0,0,0,0,0,0,0//AS_LEFT		#左手修練#
 12,134,10,0,0,0,0,0,0,0,0,0,0//AS_KATAR		#カタール修練#
-12,135,5,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
+12,135,10,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
 12,136,10,134,4,0,0,0,0,0,0,0,0//AS_SONICBLOW	#ソニックブロー#
 12,137,5,135,2,136,5,0,0,0,0,0,0//AS_GRIMTOOTH	#グリムトゥース#
 12,138,10,52,1,0,0,0,0,0,0,0,0//AS_ENCHANTPOISON#エンチャントポイズン#
@@ -884,7 +884,7 @@
 4013,132,5,0,0,0,0,0,0,0,0,0,0//AS_RIGHT		#右手修練#
 4013,133,5,132,2,0,0,0,0,0,0,0,0//AS_LEFT		#左手修練#
 4013,134,10,0,0,0,0,0,0,0,0,0,0//AS_KATAR		#カタール修練#
-4013,135,5,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
+4013,135,10,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
 4013,136,10,134,4,0,0,0,0,0,0,0,0//AS_SONICBLOW	#ソニックブロー#
 4013,137,5,135,2,136,5,0,0,0,0,0,0//AS_GRIMTOOTH	#グリムトゥース#
 4013,138,10,52,1,0,0,0,0,0,0,0,0//AS_ENCHANTPOISON#エンチャントポイズン#
@@ -1472,7 +1472,7 @@
 4035,132,5,0,0,0,0,0,0,0,0,0,0//AS_RIGHT		#右手修練#
 4035,133,5,132,2,0,0,0,0,0,0,0,0//AS_LEFT		#左手修練#
 4035,134,10,0,0,0,0,0,0,0,0,0,0//AS_KATAR		#カタール修練#
-4035,135,5,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
+4035,135,10,51,2,0,0,0,0,0,0,0,0//AS_CLOAKING	#クローキング#
 4035,136,10,134,4,0,0,0,0,0,0,0,0//AS_SONICBLOW	#ソニックブロー#
 4035,137,5,135,2,136,5,0,0,0,0,0,0//AS_GRIMTOOTH	#グリムトゥース#
 4035,138,10,52,1,0,0,0,0,0,0,0,0//AS_ENCHANTPOISON#エンチャントポイズン#

+ 1 - 0
npc/Changelog.txt

@@ -35,6 +35,7 @@ Other Ppl
 Date		Added
 ======
 11/18
+        * Fixed typo in payon.txt [celest]
 	* Fixed typos on izlude.txt [shadow]
 	* Added custom WOE warper (now you can get to Novice Castles from Prontera) [Lupus]
 	* Prontera.txt (Sewers) anti-novice exploit fix. should be added to any quests/banks where u once get free items/zeny [Lupus]

+ 1 - 1
npc/cities/payon.txt

@@ -773,7 +773,7 @@ payon.gat,173,238,4	script	Unknown	740,{
 	mes "[Unknown]";
 	mes "This is an new kRO Npc";
 	mes "This Npc hasn't been translated yet";
-	mes "I by excident you know what this npc is and could translate it";
+	mes "If by accident you know what this npc is and could translate it";
 	mes "Please contact Darkchild (eAthena Dev)";
 	close;
 }

+ 5 - 5
src/map/atcommand.c

@@ -3207,7 +3207,7 @@ int atcommand_refine(
 			if (sd->status.inventory[i].refine != final_refine) {
 				sd->status.inventory[i].refine = final_refine;
 				current_position = sd->status.inventory[i].equip;
-				pc_unequipitem(sd, i, 0);
+				pc_unequipitem(sd, i, 0, BF_NORMAL);
 				clif_refine(fd, sd, 0, i, sd->status.inventory[i].refine);
 				clif_delitem(sd, i, 1);
 				clif_additem(sd, i, 1, 0);
@@ -7255,7 +7255,7 @@ atcommand_dropall(const int fd, struct map_session_data* sd,
 	for (i = 0; i < MAX_INVENTORY; i++) {
 	if (sd->status.inventory[i].amount) {
 		if(sd->status.inventory[i].equip != 0)
-			pc_unequipitem(sd, i, 0);
+			pc_unequipitem(sd, i, 0, BF_NORMAL);
 		pc_dropitem(sd,  i, sd->status.inventory[i].amount);
 		}
 	}
@@ -7282,7 +7282,7 @@ atcommand_chardropall(const int fd, struct map_session_data* sd,
 	for (i = 0; i < MAX_INVENTORY; i++) {
 		if (pl_sd->status.inventory[i].amount) {
 			if(pl_sd->status.inventory[i].equip != 0)
-				pc_unequipitem(pl_sd, i, 0);
+				pc_unequipitem(pl_sd, i, 0, BF_NORMAL);
 			pc_dropitem(pl_sd,  i, pl_sd->status.inventory[i].amount);
 		}
 	}
@@ -7312,7 +7312,7 @@ atcommand_storeall(const int fd, struct map_session_data* sd,
 	for (i = 0; i < MAX_INVENTORY; i++) {
 		if (sd->status.inventory[i].amount) {
 			if(sd->status.inventory[i].equip != 0)
-				pc_unequipitem(sd, i, 0);
+				pc_unequipitem(sd, i, 0, BF_NORMAL);
 			storage_storageadd(sd,  i, sd->status.inventory[i].amount);
 		}
 	}
@@ -7347,7 +7347,7 @@ atcommand_charstoreall(const int fd, struct map_session_data* sd,
 	for (i = 0; i < MAX_INVENTORY; i++) {
 		if (pl_sd->status.inventory[i].amount) {
 			if(pl_sd->status.inventory[i].equip != 0)
-				pc_unequipitem(pl_sd, i, 0);
+				pc_unequipitem(pl_sd, i, 0, BF_NORMAL);
 			storage_storageadd(pl_sd,  i, sd->status.inventory[i].amount);
 		}
 	}

+ 1 - 1
src/map/chrif.c

@@ -597,7 +597,7 @@ int chrif_changedsex(int fd)
 			// to avoid any problem with equipment and invalid sex, equipment is unequiped.
 			for (i = 0; i < MAX_INVENTORY; i++) {
 				if (sd->status.inventory[i].nameid && sd->status.inventory[i].equip)
-					pc_unequipitem((struct map_session_data*)sd, i, 0);
+					pc_unequipitem((struct map_session_data*)sd, i, 0, BF_NORMAL);
 			}
 			// reset skill of some job
 			if (s_class.job == 19 || s_class.job == 4020 || s_class.job == 4042 ||

+ 1 - 1
src/map/clif.c

@@ -8209,7 +8209,7 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
 
 	if(sd->npc_id!=0 || sd->vender_id != 0 || sd->opt1 > 0)
 		return;
-	pc_unequipitem(sd,index,0);
+	pc_unequipitem(sd,index,0,BF_NORMAL);
 }
 
 /*==========================================

+ 23 - 16
src/map/pc.c

@@ -603,7 +603,7 @@ int pc_breakweapon(struct map_session_data *sd)
 		if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0002 && !sd->status.inventory[i].attribute==1){
 			item=sd->inventory_data[i];
 			sd->status.inventory[i].attribute=1;
-			pc_unequipitem(sd,i,0);
+			pc_unequipitem(sd,i,0,BF_NORMAL);
 			sprintf(output, "%s has broken.",item->jname);
 			clif_emotion(&sd->bl,23);
 			clif_displaymessage(sd->fd, output);
@@ -635,7 +635,7 @@ int pc_breakarmor(struct map_session_data *sd)
 		if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0010 && !sd->status.inventory[i].attribute==1){
 			item=sd->inventory_data[i];
 			sd->status.inventory[i].attribute=1;
-			pc_unequipitem(sd,i,0);
+			pc_unequipitem(sd,i,0,BF_NORMAL);
 			sprintf(output, "%s has broken.",item->jname);
 			clif_emotion(&sd->bl,23);
 			clif_displaymessage(sd->fd, output);
@@ -1443,10 +1443,13 @@ int pc_calcstatus(struct map_session_data* sd,int first)
 		}
 		if(sd->sc_data[SC_DECREASEAGI].timer!=-1)	// 速度減少(agiはbattle.cで)
 			sd->speed = sd->speed *125/100;
-		if(sd->sc_data[SC_CLOAKING].timer!=-1)
-			sd->speed = (sd->speed*(76+(sd->sc_data[SC_INCREASEAGI].val1*3)))/100;
+		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;
+		}
+			//sd->speed = (sd->speed*(76+(sd->sc_data[SC_INCREASEAGI].val1*3)))/100;
 		if(sd->sc_data[SC_CHASEWALK].timer!=-1)
-			sd->speed = sd->speed*(135-sd->sc_data[SC_CHASEWALK].val1*5)/100; // slow down by chasewalk
+			sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; // slow down by chasewalk
 		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;
@@ -2946,7 +2949,7 @@ int pc_delitem(struct map_session_data *sd,int n,int amount,int type)
 	sd->weight -= sd->inventory_data[n]->weight*amount ;
 	if(sd->status.inventory[n].amount<=0){
 		if(sd->status.inventory[n].equip)
-			pc_unequipitem(sd,n,0);
+			pc_unequipitem(sd,n,0,BF_NORMAL);
 		memset(&sd->status.inventory[n],0,sizeof(sd->status.inventory[0]));
 		sd->inventory_data[n] = NULL;
 	}
@@ -4129,7 +4132,8 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data)
 	if(sd->bl.m != bl->m || pc_isdead(sd))
 		return 0;
 
-	if( sd->opt1>0 || sd->status.option&2 || sd->status.option&16388)	// 異常などで攻撃できない
+	//if( sd->opt1>0 || sd->status.option&2 || sd->status.option&16388)	// 異常などで攻撃できない
+	if( sd->opt1>0 || sd->status.option&2 || sd->status.option&16384)	// 異常などで攻撃できない
 		return 0;
 
 	if(sd->sc_data[SC_AUTOCOUNTER].timer != -1)
@@ -4137,7 +4141,8 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data)
 	if(sd->sc_data[SC_BLADESTOP].timer != -1)
 		return 0;
 
-	if((opt = battle_get_option(bl)) != NULL && *opt&0x46)
+	//if((opt = battle_get_option(bl)) != NULL && *opt&0x46)
+	if((opt = battle_get_option(bl)) != NULL && *opt&0x42)
 		return 0;
 	if(((sc_data = battle_get_sc_data(bl)) != NULL && sc_data[SC_TRICKDEAD].timer != -1) ||
 	((sc_data = battle_get_sc_data(bl)) != NULL && sc_data[SC_BASILICA].timer != -1 ))
@@ -4178,6 +4183,7 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data)
 			map_freeblock_lock();
 			pc_stop_walking(sd,0);
 			sd->attacktarget_lv = battle_weapon_attack(&sd->bl,bl,tick,0);
+			// &2 = ? - Celest
 			if(!(battle_config.pc_cloak_check_type&2) && sd->sc_data[SC_CLOAKING].timer != -1)
 				skill_status_change_end(&sd->bl,SC_CLOAKING,-1);
 			if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_attack_support)
@@ -4221,7 +4227,8 @@ int pc_attack(struct map_session_data *sd,int target_id,int type)
 		return 1;
 	
 	if(bl->type==BL_NPC) { // monster npcs [Valaris]
-		npc_click(sd,RFIFOL(sd->fd,2));
+		//npc_click(sd,RFIFOL(sd->fd,2));
+		npc_click(sd,target_id); // submitted by leinsirk10 [Celest]
 		return 0;
 	}
 	
@@ -4859,7 +4866,7 @@ int pc_resetlvl(struct map_session_data* sd,int type)
 	for(i=0;i<11;i++) { // unequip items that can't be equipped by base 1 [Valaris]
 		if(sd->equip_index[i] >= 0)
 			if(!pc_isequip(sd,sd->equip_index[i]))
-				pc_unequipitem(sd,sd->equip_index[i],1);
+				pc_unequipitem(sd,sd->equip_index[i],1,BF_NORMAL);
 	}
 
 	clif_skillinfoblock(sd);
@@ -5125,7 +5132,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
 					int n = eq_n[rand()%eq_num];//該当アイテムの中からランダム
 					if(rand()%10000 < per){
 						if(sd->status.inventory[n].equip)
-							pc_unequipitem(sd,n,0);
+							pc_unequipitem(sd,n,0,BF_NORMAL);
 						pc_dropitem(sd,n,1);
 					}
 				}
@@ -5138,7 +5145,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage)
 							|| (type == 2 && sd->status.inventory[i].equip)
 							|| type == 3) ){
 						if(sd->status.inventory[i].equip)
-							pc_unequipitem(sd,i,0);
+							pc_unequipitem(sd,i,0,BF_NORMAL);
 						pc_dropitem(sd,i,1);
 						break;
 					}
@@ -5634,7 +5641,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper)
 	for(i=0;i<11;i++) {
 		if(sd->equip_index[i] >= 0)
 			if(!pc_isequip(sd,sd->equip_index[i]))
-				pc_unequipitem(sd,sd->equip_index[i],1);	// 装備外し
+				pc_unequipitem(sd,sd->equip_index[i],1,BF_NORMAL);	// 装備外し
 	}
 
 	clif_changelook(&sd->bl,LOOK_BASE,sd->view_class); // move sprite update to prevent client crashes with incompatible equipment [Valaris]
@@ -6271,7 +6278,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
 	arrow=pc_search_inventory(sd,pc_checkequip(sd,9));	// Added by RoVeRT
 	for(i=0;i<11;i++) {
 		if(sd->equip_index[i] >= 0 && sd->status.inventory[sd->equip_index[i]].equip&pos) {
-			pc_unequipitem(sd,sd->equip_index[i],1);
+			pc_unequipitem(sd,sd->equip_index[i],1,BF_NORMAL);
 		}
 	}
 	// 弓矢装備
@@ -6367,13 +6374,13 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
  * 装 備した物を外す
  *------------------------------------------
  */
-int pc_unequipitem(struct map_session_data *sd,int n,int type)
+int pc_unequipitem(struct map_session_data *sd,int n,int type, int flag)
 {
 	nullpo_retr(0, sd);	
 
 // -- moonsoul	(if player is berserk then cannot unequip)
 //
-	if(sd->sc_data[SC_BERSERK].timer!=-1){
+	if(!flag && sd->sc_data[SC_BERSERK].timer!=-1){
 		clif_unequipitemack(sd,n,0,0);
 		return 0;
 	}

+ 1 - 1
src/map/pc.h

@@ -112,7 +112,7 @@ int pc_resetlvl(struct map_session_data*,int type);
 int pc_resetstate(struct map_session_data*);
 int pc_resetskill(struct map_session_data*);
 int pc_equipitem(struct map_session_data*,int,int);
-int pc_unequipitem(struct map_session_data*,int,int);
+int pc_unequipitem(struct map_session_data*,int,int,int);
 int pc_checkitem(struct map_session_data*);
 int pc_useitem(struct map_session_data*,int);
 

+ 3 - 3
src/map/script.c

@@ -3029,7 +3029,7 @@ int buildin_successrefitem(struct script_state *st)
 		#endif //USE_SQL
 
 		sd->status.inventory[i].refine++;
-		pc_unequipitem(sd,i,0);
+		pc_unequipitem(sd,i,0, BF_NORMAL);
 		clif_refine(sd->fd,sd,0,i,sd->status.inventory[i].refine);
 		clif_delitem(sd,i,1);
 		clif_additem(sd,i,1,0);
@@ -3059,7 +3059,7 @@ int buildin_failedrefitem(struct script_state *st)
 		#endif //USE_SQL
 
 		sd->status.inventory[i].refine = 0;
-		pc_unequipitem(sd,i,0);
+		pc_unequipitem(sd,i,0, BF_NORMAL);
 		// 精錬失敗エフェクトのパケット
 		clif_refine(sd->fd,sd,1,i,sd->status.inventory[i].refine);
 		pc_delitem(sd,i,1,0);
@@ -5801,7 +5801,7 @@ int buildin_nude(struct script_state *st)
 	
 	for(i=0;i<11;i++) 
 		if(sd->equip_index[i] >= 0)
-			pc_unequipitem(sd,sd->equip_index[i],1);
+			pc_unequipitem(sd,sd->equip_index[i],1, BF_NORMAL);
 
 	return 0;
 }

+ 35 - 15
src/map/skill.c

@@ -3380,8 +3380,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 				/* 解除する */
 				skill_status_change_end(bl, sc, -1);
 			}
-
-			skill_check_cloaking(bl);
+			//skill_check_cloaking(bl);
 		}
 		break;
 
@@ -3627,7 +3626,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 			if(dstsd){
 				for(i=0;i<MAX_INVENTORY;i++){
 					if(dstsd->status.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0002){
-						pc_unequipitem(dstsd,i,0);
+						pc_unequipitem(dstsd,i,0,BF_SKILL);
 						break;
 					}
 				}
@@ -3650,7 +3649,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 			if(dstsd){
 				for(i=0;i<MAX_INVENTORY;i++){
 					if(dstsd->status.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0020){
-						pc_unequipitem(dstsd,i,0);
+						pc_unequipitem(dstsd,i,0,BF_SKILL);
 						break;
 					}
 				}
@@ -3673,7 +3672,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 			if(dstsd){
 				for(i=0;i<MAX_INVENTORY;i++){
 					if(dstsd->status.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0010){
-						pc_unequipitem(dstsd,i,0);
+						pc_unequipitem(dstsd,i,0,BF_SKILL);
 						break;
 					}
 				}
@@ -3695,7 +3694,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 			if(dstsd){
 				for(i=0;i<MAX_INVENTORY;i++){
 					if(dstsd->status.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0100){
-						pc_unequipitem(dstsd,i,0);
+						pc_unequipitem(dstsd,i,0,BF_SKILL);
 						break;
 					}
 				}
@@ -4184,6 +4183,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int
 		skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,src->id,0,skill_get_time(skillid,skilllv),0 );
 		break;
 	case ASC_CDP:   // Temporary skill for Create Deadly Poison[Celest]
+		// notes: success rate (from emperium.org) = 20 + [(20*Dex)/50] + [(20*Luk)/100]
 		if(sd) {
 			int eflag;
 			struct item item_tmp;
@@ -7792,6 +7792,7 @@ int skill_status_change_end(struct block_list* bl, int type, int tid)
 
 		switch(type){	/* 異常の種類ごとの?理 */
 			case SC_PROVOKE:			/* プロボック */
+			case SC_ENDURE: // celest
 			case SC_CONCENTRATE:		/* 集中力向上 */
 			case SC_BLESSING:			/* ブレッシング */
 			case SC_ANGELUS:			/* アンゼルス */
@@ -7959,6 +7960,7 @@ int skill_status_change_end(struct block_list* bl, int type, int tid)
 		case SC_HIDING:
 		case SC_CLOAKING:
 			*option &= ~((type == SC_HIDING) ? 2 : 4);
+			calc_flag = 1;	// orn
 			opt_flag = 1 ;
 			break;
 
@@ -8159,8 +8161,8 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data)
 
 	case SC_ENDURE:	/* インデュア */
 		if(sd && sd->special_state.infinite_endure) {
-			sc_data[type].timer=add_timer( 1000*600+tick,skill_status_change_timer, bl->id, data );
-			sc_data[type].val2=1;
+			sc_data[type].timer=add_timer( 1000*60+tick,skill_status_change_timer, bl->id, data );
+			//sc_data[type].val2=1;
 			return 0;
 		}
 		break;
@@ -8544,6 +8546,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val
 			break;
 		case SC_ENDURE:				/* インデュア */
 			if(tick <= 0) tick = 1000 * 60;
+			calc_flag = 1; // for updating mdef
 			val2 = 7; // [Celest]
 			break;
 		case SC_CONCENTRATE:		/* 集中力向上 */
@@ -8961,9 +8964,11 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val
 			break;
 		case SC_CHASEWALK:
 		case SC_CLOAKING:		/* クロ?キング */
-			calc_flag = 1; // [Celest]
-			if(bl->type == BL_PC)
+			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;
@@ -9268,18 +9273,33 @@ int skill_check_cloaking(struct block_list *bl)
 
 	nullpo_retr(0, bl);
 
-	if(bl->type == BL_PC && 
-		(battle_config.pc_cloak_check_type&1 || pc_checkskill(sd,AS_CLOAKING)>2))
+	if(bl->type == BL_PC && !battle_config.pc_cloak_check_type) // If it's No it shouldn't be checked
 		return 0;
-	else if(bl->type == BL_MOB && battle_config.monster_cloak_check_type&1)
+	else if(bl->type == BL_MOB && !battle_config.monster_cloak_check_type)
 		return 0;
 	for(i=0;i<sizeof(dx)/sizeof(dx[0]);i++){
 		int c=map_getcell(bl->m,bl->x+dx[i],bl->y+dy[i]);
 		if(c==1 || c==5) end=0;
 	}
 	if(end){
-		skill_status_change_end(bl, SC_CLOAKING, -1);
-		*battle_get_option(bl)&=~4;	/* 念のための?理 */
+		if ((bl->type == BL_PC && pc_checkskill(sd,AS_CLOAKING)<3) || bl->type == BL_MOB) {
+			skill_status_change_end(bl, SC_CLOAKING, -1);
+			*battle_get_option(bl)&=~4;	/* 念のための?理 */
+		}
+		else if (bl->type == BL_PC) {
+			sd->sc_data[SC_CLOAKING].val3 = 130;
+			//sd->speed = sd->speed * sd->sc_data[SC_CLOAKING].val3 /100;
+			//clif_updatestatus(sd,SP_SPEED);
+			pc_calcstatus (sd,0); // better way than calling this everytime?
+		}
+	}
+	else {
+		if (bl->type == BL_PC) {
+			sd->sc_data[SC_CLOAKING].val3 = 103;
+			//sd->speed = sd->speed * sd->sc_data[SC_CLOAKING].val3 /100;
+			//clif_updatestatus(sd,SP_SPEED);
+			pc_calcstatus (sd,0);
+		}
 	}
 	return end;
 }