Parcourir la source

- Cleaned up some status_get functions.
- Optimized a bit the SC_PROVOKE code (to use val3/val4)
- Fixed draining when the amount drained is negative (invoke zap rather than heal)
- Implemented GS_FLING as per the current skill description.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6819 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex il y a 19 ans
Parent
commit
8f5c155fb4
5 fichiers modifiés avec 61 ajouts et 47 suppressions
  1. 4 0
      Changelog-Trunk.txt
  2. 15 1
      src/map/battle.c
  3. 11 23
      src/map/skill.c
  4. 25 18
      src/map/status.c
  5. 6 5
      src/map/status.h

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/05/29
+	* Optimized a bit the SC_PROVOKE code (to use val3/val4) [Skotlex]
+	* Fixed draining when the amount drained is negative (invoke zap rather
+	  than heal) [Skotlex]
+	* Implemented GS_FLING as per the current skill description. [Skotlex]
 	* Fixed pc_readparam/pc_setparam to use battle_status.hp/sp rather than
 	  status.hp/sp, fixes scripts reading the wrong Hp/Sp values [Skotlex]
 	* Added some missing SC_* entries on the initial listing (potion related

+ 15 - 1
src/map/battle.c

@@ -2463,6 +2463,7 @@ struct Damage  battle_calc_misc_attack(
 	//Misc Settings
 	switch(skill_num){
 	case PA_PRESSURE:
+	case GS_FLING:
 		flag.elefix = flag.cardfix = 0;
 	case HT_BLITZBEAT:
 	case TF_THROWSTONE:
@@ -2551,6 +2552,9 @@ struct Damage  battle_calc_misc_attack(
 		if(map_flag_vs(target->m) || is_boss(target))
 			md.damage>>=1; //temp value
 		break;
+	case GS_FLING:
+		md.damage = sd?sd->status.job_level:status_get_lv(src);
+		break;
 	}
 	
 	damage_div_fix(md.damage, md.div_);
@@ -2741,7 +2745,17 @@ void battle_drain(TBL_PC *sd, TBL_PC* tsd, int rdamage, int ldamage, int race, i
 	}
 	if (!thp && !tsp) return;
 
-	status_heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1);
+	//Split'em up as Hp/Sp could be drained/leeched.
+	if(thp> 0)
+		status_heal(&sd->bl, thp, 0, battle_config.show_hp_sp_drain?3:1);
+	else if (thp < 0)
+		status_zap(&sd->bl, thp, 0);
+
+	if(tsp > 0)
+		status_heal(&sd->bl, 0, tsp, battle_config.show_hp_sp_drain?3:1);
+	else if (tsp < 0)
+		status_zap(&sd->bl, 0, tsp);
+	
 	
 	if (tsd) {
 		if (rhp || rsp)

+ 11 - 23
src/map/skill.c

@@ -1318,19 +1318,9 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
 	case NJ_HYOUSYOURAKU:
 		sc_start(bl,SC_FREEZE,(10+10*skilllv),skilllv,skill_get_time2(skillid,skilllv));
 		break;
-
-	//case GS_FLING:	// this needs to be looked at [Reddozen]
-	//	if (skill == GS_FLING) { // gunslinger [marquis007]
-	//		int spiritball = (sd->spiritball > 5 ? 5 : sd->spiritball);
-	//	} else {
-	//		int spiritball = 1;
-	//	}
-	//
-	//	if (spiritball <= sd->spiritball && sd->spiritball != 0){
-	//		pc_delspiritball(sd,spiritball,0);
-	//		status_change_start(bl,SC_FLING,10000,spiritball*5,0,0,0,skill_get_time(skillid,skilllv)));
-	//	}
-	//	break;
+	case GS_FLING:
+		sc_start(bl,SC_FLING,100, sd?sd->spiritball_old:5,skill_get_time(skillid,skilllv));
+		break;
 	}
 
 	if (md && battle_config.summons_inherit_effects && md->master_id && md->special_state.ai)
@@ -2946,15 +2936,13 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
 
 	case NPC_DARKBREATH:
 		clif_emotion(src,7);
-		skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag);
-		break;
-
-	case SN_FALCONASSAULT:			/* ファルコンアサルト */
-	case PA_PRESSURE:	/* プレッシャ? */
-	case CR_ACIDDEMONSTRATION:  // Acid Demonstration
-	case TF_THROWSTONE:			/* ?ホ投げ */
-	case NPC_SMOKING:			/* スモ?キング */
-	case NPC_SELFDESTRUCTION:	/* 自爆 */
+	case SN_FALCONASSAULT:
+	case PA_PRESSURE:
+	case CR_ACIDDEMONSTRATION:
+	case TF_THROWSTONE:
+	case NPC_SMOKING:
+	case NPC_SELFDESTRUCTION:
+	case GS_FLING:
 		skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag);
 		break;
 
@@ -3002,7 +2990,6 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
 	case GS_RAPIDSHOWER:
 	case GS_DUST:
 	case GS_FULLBUSTER:
-	case GS_FLING:
 	case NJ_SYURIKEN:
 	case NJ_KUNAI:
 	case NJ_HUUMA:
@@ -5482,6 +5469,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 				pc_delspiritball(sd,1,0);
 		}
 		break;
+
 	default:
 		ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skillid);
 		map_freeblock_unlock();

+ 25 - 18
src/map/status.c

@@ -344,6 +344,8 @@ void initChangeTables(void) {
 	set_sc(GS_ADJUSTMENT, SC_ADJUSTMENT, SI_ADJUSTMENT, SCB_HIT|SCB_FLEE);
 	set_sc(GS_INCREASING, SC_INCREASING, SI_ACCURACY, SCB_AGI|SCB_DEX|SCB_HIT);
 	set_sc(GS_GATLINGFEVER, SC_GATLINGFEVER, SI_GATLINGFEVER, SCB_FLEE|SCB_SPEED|SCB_ASPD);
+	set_sc(GS_FLING, SC_FLING, SI_NONE, SCB_DEF|SCB_DEF2);
+
 	//Uncomment and update when you plan on implementing.
 //	set_sc(NJ_TATAMIGAESHI, SC_TATAMIGAESHI, SI_BLANK);
 //	set_sc(NJ_UTSUSEMI,             SC_UTSUSEMI,            SI_MAEMI);
@@ -2696,7 +2698,7 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan
 	if(sc->data[SC_INCATKRATE].timer!=-1)
 		batk += batk * sc->data[SC_INCATKRATE].val1/100;
 	if(sc->data[SC_PROVOKE].timer!=-1)
-		batk += batk * (2+3*sc->data[SC_PROVOKE].val1)/100;
+		batk += batk * sc->data[SC_PROVOKE].val3/100;
 	if(sc->data[SC_CONCENTRATION].timer!=-1)
 		batk += batk * sc->data[SC_CONCENTRATION].val2/100;
 	if(sc->data[SC_SKE].timer!=-1)
@@ -2729,7 +2731,7 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan
 	if(sc->data[SC_INCATKRATE].timer!=-1)
 		watk += watk * sc->data[SC_INCATKRATE].val1/100;
 	if(sc->data[SC_PROVOKE].timer!=-1)
-		watk += watk * (2+3*sc->data[SC_PROVOKE].val1)/100;
+		watk += watk * sc->data[SC_PROVOKE].val3/100;
 	if(sc->data[SC_CONCENTRATION].timer!=-1)
 		watk += watk * sc->data[SC_CONCENTRATION].val2/100;
 	if(sc->data[SC_SKE].timer!=-1)
@@ -2884,11 +2886,11 @@ static unsigned char status_calc_def(struct block_list *bl, struct status_change
 	if(sc->data[SC_SKE].timer!=-1)
 		def -= def * 50/100;
 	if(sc->data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) // Provoke doesn't alter player defense.
-		def -= def * (5+5*sc->data[SC_PROVOKE].val1)/100;
+		def -= def * sc->data[SC_PROVOKE].val4/100;
 	if(sc->data[SC_STRIPSHIELD].timer!=-1)
 		def -= def * sc->data[SC_STRIPSHIELD].val2/100;
-	//if (sd->data[SC_FLING].timer!=-1 && bl->type != BL_PC)
-	//	def -= (def * sd->data[SC_FLING].val1) / 100;
+	if (sd->data[SC_FLING].timer!=-1)
+		def -= def * (sd->data[SC_FLING].val2)/100;
 	return cap_value(def,0,UCHAR_MAX);
 }
 
@@ -2912,15 +2914,15 @@ static unsigned short status_calc_def2(struct block_list *bl, struct status_chan
 	if(sc->data[SC_SKE].timer!=-1)
 		def2 -= def2 * 50/100;
 	if(sc->data[SC_PROVOKE].timer!=-1)
-		def2 -= def2 * (5+5*sc->data[SC_PROVOKE].val1)/100;
+		def2 -= def2 * sc->data[SC_PROVOKE].val4/100;
 	if(sc->data[SC_JOINTBEAT].timer!=-1){
 		if(sc->data[SC_JOINTBEAT].val2==3)
 			def2 -= def2 * 50/100;
 		else if(sc->data[SC_JOINTBEAT].val2==4)
 			def2 -= def2 * 25/100;
 	}
-	//if (sd->data[SC_FLING].timer!=-1)
-	//	def2 -= (def2 * sd->data[SC_FLING].val1) / 100;
+	if (sd->data[SC_FLING].timer!=-1)
+		def2 -= def2 * (sd->data[SC_FLING].val3)/100;
 
 	return cap_value(def2,0,USHRT_MAX);
 }
@@ -3307,19 +3309,19 @@ struct status_data *status_get_base_status(struct block_list *bl)
 	}
 }
 
-int status_get_lwatk(struct block_list *bl)
+unsigned short status_get_lwatk(struct block_list *bl)
 {
 	struct status_data *status = status_get_status_data(bl);
 	return status->lhw?status->lhw->atk:0;
 }
 
-int status_get_lwatk2(struct block_list *bl)
+unsigned short status_get_lwatk2(struct block_list *bl)
 {
 	struct status_data *status = status_get_status_data(bl);
 	return status->lhw?status->lhw->atk2:0;
 }
 
-int status_get_def(struct block_list *bl)
+unsigned char status_get_def(struct block_list *bl)
 {
 	struct unit_data *ud;
 	struct status_data *status = status_get_status_data(bl);
@@ -3331,18 +3333,14 @@ int status_get_def(struct block_list *bl)
 	return def;
 }
 
-int status_get_speed(struct block_list *bl)
+unsigned short status_get_speed(struct block_list *bl)
 {
-	struct status_data *status;
-
 	if(bl->type==BL_NPC)//Only BL with speed data but no status_data [Skotlex]
 		return ((struct npc_data *)bl)->speed;
-
-	status = status_get_status_data(bl);
-	return status?status->speed:2000;
+	return status_get_status_data(bl)->speed;
 }
 
-int status_get_attack_lelement(struct block_list *bl)
+unsigned char status_get_attack_lelement(struct block_list *bl)
 {
 	struct status_data *status = status_get_status_data(bl);
 	return status->lhw?status->lhw->ele:0;
@@ -4826,6 +4824,15 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 			val3 = 5*val1; //Flee decrease
 			break;
 
+		case SC_FLING:
+			val2 = 3*val1; //Def reduction
+			val3 = 3*val1; //Def2 reduction
+			break;
+		case SC_PROVOKE:
+			//val2 signals autoprovoke.
+			val3 = 2+3*val1; //Atk increase
+			val4 = 5+5*val1; //Def reduction.
+			break;
 		default:
 			if (calc_flag == SCB_NONE && StatusSkillChangeTable[type]==0)
 			{	//Status change with no calc, and no skill associated...? unknown?

+ 6 - 5
src/map/status.h

@@ -248,6 +248,7 @@ enum {
 	SC_NEN,
 	SC_KNOWLEDGE,
 	SC_SMA,
+	SC_FLING,
 	SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
 };
 extern int SkillStatusChangeTable[MAX_SKILL];
@@ -539,7 +540,7 @@ int status_get_lv(struct block_list *bl);
 #define status_get_luk(bl) status_get_status_data(bl)->luk
 #define status_get_hit(bl) status_get_status_data(bl)->hit
 #define status_get_flee(bl) status_get_status_data(bl)->flee
-int status_get_def(struct block_list *bl);
+unsigned char status_get_def(struct block_list *bl);
 #define status_get_mdef(bl) status_get_status_data(bl)->mdef
 #define status_get_flee2(bl) status_get_status_data(bl)->flee2
 #define status_get_def2(bl) status_get_status_data(bl)->def2
@@ -550,9 +551,9 @@ int status_get_def(struct block_list *bl);
 #define status_get_watk2(bl) status_get_status_data(bl)->rhw.atk2
 #define status_get_matk_max(bl) status_get_status_data(bl)->matk_max
 #define status_get_matk_min(bl) status_get_status_data(bl)->matk_min
-int status_get_lwatk(struct block_list *bl);
-int status_get_lwatk2(struct block_list *bl);
-int status_get_speed(struct block_list *bl);
+unsigned short status_get_lwatk(struct block_list *bl);
+unsigned short status_get_lwatk2(struct block_list *bl);
+unsigned short status_get_speed(struct block_list *bl);
 #define status_get_adelay(bl) status_get_status_data(bl)->adelay
 #define status_get_amotion(bl) status_get_status_data(bl)->amotion
 #define status_get_dmotion(bl) status_get_status_data(bl)->dmotion
@@ -561,7 +562,7 @@ int status_get_speed(struct block_list *bl);
 unsigned char status_calc_attack_element(struct block_list *bl, struct status_change *sc, int element);
 #define status_get_attack_sc_element(bl, sc) status_calc_attack_element(bl, sc, 0)
 #define status_get_attack_element(bl) status_get_status_data(bl)->rhw.ele
-int status_get_attack_lelement(struct block_list *bl);
+unsigned char status_get_attack_lelement(struct block_list *bl);
 #define status_get_race(bl) status_get_status_data(bl)->race
 #define status_get_size(bl) status_get_status_data(bl)->size
 #define status_get_mode(bl) status_get_status_data(bl)->mode