Browse Source

- Fixed the inf code update breakage which was blocking all offensive skills.
- Added battle setting homun_critical_rate (defaults to 0)
- Removed enemy_str/pet_str/enemy_perfect_flee and replaced them with
- enable_perfect_flee which specifies which objects can have perfect flee and enable_baseatk which specifies which objects can have a base attack value (both in battle.conf)


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

skotlex 19 năm trước cách đây
mục cha
commit
da34db27c2

+ 7 - 0
Changelog-Trunk.txt

@@ -4,6 +4,13 @@ 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/07/19
+	* Fixed the inf code update breakage which was blocking all offensive
+	  skills. [Skotlex]
+	* Added battle setting homun_critical_rate (defaults to 0) [Skotlex]
+	* Removed enemy_str/pet_str/enemy_perfect_flee and replaced them with
+	  enable_perfect_flee which specifies which objects can have perfect flee and
+	  enable_baseatk which specifies which objects can have a base attack value
+	  (both in battle.conf) [Skotlex]
 	* Modified the targetted skill logic to enable offensive skills to be
 	  targetted at party/guild members if the appropiate inf2 value is set.
 	  [Skotlex]

+ 7 - 0
conf-tmpl/battle/battle.conf

@@ -29,6 +29,13 @@
 // features.
 //--------------------------------------------------------------
 
+
+// Who should have a baseatk value (makes str affect damage)? (Note 4)
+enable_baseatk: 11
+
+// Who can have perfect flee? (Note 4)
+enable_perfect_flee: 5
+
 // Move-delay adjustment after being hit. (Note 2)
 // The 'can't walk' delay after being hit is calculated as a percentage of the damage animation duration.
 // NOTE: Only affects the normal delay from a single attack, not the delay added by the multihit_delay option below.

+ 1 - 6
conf-tmpl/battle/monster.conf

@@ -30,12 +30,7 @@
 // Enemy's Critical Rate (use 0 to disable non-skill criticals) (Note 2)
 // Note: In Official servers enemies don't get criticals other than through skills.
 enemy_critical_rate: 0
-
-// Are enemy attacks effected by their strength? (Note 1)
-enemy_str: yes
-
-// Can enemies have perfect flee? (Note 1)
-enemy_perfect_flee: no
+homun_critical_rate: 0
 
 // [MVP] Summoned monsters HP rate, that is, monsters summoned by an MVP will have this much HP. (Note 2)
 mvp_hp_rate: 100

+ 0 - 4
conf-tmpl/battle/pet.conf

@@ -43,10 +43,6 @@ pet_hungry_delay_rate: 100
 // Note: The friendlyness is 0-1000 total, at 0 the pet runs away.
 pet_hungry_friendly_decrease: 5
 
-// Does Pet's Attack Damage Based On Str (Note 1)
-// Note: Few pets have str above 1, enabling this can give an unfair advantage to these pets.
-pet_str: no
-
 // Does the pet need its equipment before it does its skill? (Note 1)
 pet_equip_required: yes
 

+ 6 - 6
src/map/battle.c

@@ -3321,8 +3321,9 @@ static const struct battle_data_short {
 } battle_data_short[] = {	//List here battle_athena options which are type unsigned short!
 	{ "warp_point_debug",                  &battle_config.warp_point_debug			},
 	{ "enemy_critical_rate",               &battle_config.enemy_critical_rate		},
-	{ "enemy_str",                         &battle_config.enemy_str				},
-	{ "enemy_perfect_flee",                &battle_config.enemy_perfect_flee		},
+	{ "homun_critical_rate",               &battle_config.homun_critical_rate		},
+	{ "enemy_baseatk",                     &battle_config.enable_baseatk				},
+	{ "enable_perfect_flee",               &battle_config.enable_perfect_flee		},
 	{ "casting_rate",                      &battle_config.cast_rate				},
 	{ "delay_rate",                        &battle_config.delay_rate				},
 	{ "delay_dependon_dex",                &battle_config.delay_dependon_dex		},
@@ -3397,7 +3398,6 @@ static const struct battle_data_short {
 	{ "pet_friendly_rate",                 &battle_config.pet_friendly_rate		},
 	{ "pet_hungry_delay_rate",             &battle_config.pet_hungry_delay_rate	},
 	{ "pet_hungry_friendly_decrease",      &battle_config.pet_hungry_friendly_decrease},
-	{ "pet_str",                           &battle_config.pet_str					},
 	{ "pet_status_support",                &battle_config.pet_status_support		},
 	{ "pet_attack_support",                &battle_config.pet_attack_support		},
 	{ "pet_damage_support",                &battle_config.pet_damage_support		},
@@ -3712,8 +3712,9 @@ int battle_get_value(char *w1) {
 void battle_set_defaults() {
 	battle_config.warp_point_debug=0;
 	battle_config.enemy_critical_rate=0;
-	battle_config.enemy_str=1;
-	battle_config.enemy_perfect_flee=0;
+	battle_config.homun_critical_rate=0;
+	battle_config.enable_baseatk = BL_ALL;
+	battle_config.enable_perfect_flee = BL_PC|BL_PET;
 	battle_config.cast_rate=100;
 	battle_config.delay_rate=100;
 	battle_config.delay_dependon_dex=0;
@@ -3797,7 +3798,6 @@ void battle_set_defaults() {
 	battle_config.pet_friendly_rate=100;
 	battle_config.pet_hungry_delay_rate=100;
 	battle_config.pet_hungry_friendly_decrease=5;
-	battle_config.pet_str=0;
 	battle_config.pet_status_support=0;
 	battle_config.pet_attack_support=0;
 	battle_config.pet_damage_support=0;

+ 3 - 3
src/map/battle.h

@@ -95,8 +95,9 @@ int battle_config_switch(const char *str); // [Valaris]
 extern struct Battle_Config {
 	unsigned short warp_point_debug;
 	unsigned short enemy_critical_rate;
-	unsigned short enemy_str;
-	unsigned short enemy_perfect_flee;
+	unsigned short homun_critical_rate;
+	unsigned short enable_baseatk;
+	unsigned short enable_perfect_flee;
 	unsigned short cast_rate,delay_rate,delay_dependon_dex;
 	unsigned short sdelay_attack_enable;
 	unsigned short left_cardfix_to_right;
@@ -174,7 +175,6 @@ extern struct Battle_Config {
 	unsigned short pet_friendly_rate;
 	unsigned short pet_hungry_delay_rate;
 	unsigned short pet_hungry_friendly_decrease;
-	unsigned short pet_str;
 	unsigned short pet_status_support;
 	unsigned short pet_attack_support;
 	unsigned short pet_damage_support;

+ 1 - 7
src/map/mob.c

@@ -3231,18 +3231,12 @@ static int mob_readdb(void)
 			if(battle_config.monster_damage_delay_rate != 100)
 				status->dmotion = status->dmotion*battle_config.monster_damage_delay_rate/100;
 
-			status_calc_misc(status, mob_db_data[class_]->lv);
+			status_calc_misc(status, BL_MOB, mob_db_data[class_]->lv);
 				
-			if(!battle_config.enemy_str)
-				status->batk = 0;
-
 			if(battle_config.enemy_critical_rate != 100)
 				status->cri = status->cri*battle_config.enemy_critical_rate/100;
 			if(!status->cri && battle_config.enemy_critical_rate) status->cri = 1;
 
-			if(!battle_config.enemy_perfect_flee)
-				status->flee2 = 0;
-
 			// MVP EXP Bonus, Chance: MEXP,ExpPer
 			mob_db_data[class_]->mexp=atoi(str[30])*battle_config.mvp_exp_rate/100;
 			mob_db_data[class_]->mexpper=atoi(str[31]);

+ 3 - 3
src/map/skill.c

@@ -5812,10 +5812,9 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 			inf = skill_get_inf(ud->skillid);
 			inf2 = skill_get_inf2(ud->skillid);
 
-			if((inf&INF_ATTACK_SKILL ||
+			if(inf&INF_ATTACK_SKILL ||
 				(inf&INF_SELF_SKILL && inf2&INF2_NO_TARGET_SELF)) //Combo skills
-			)
-				inf = INF_ATTACK_SKILL; //Offensive skill.
+				inf = BCT_ENEMY; //Offensive skill.
 			else
 				inf = 0;
 
@@ -5824,6 +5823,7 @@ int skill_castend_id (int tid, unsigned int tick, int id, int data)
 					(inf2&INF2_PARTY_ONLY?BCT_PARTY:0)|
 					(inf2&INF2_GUILD_ONLY?BCT_GUILD:0)|
 					(inf2&INF2_ALLOW_ENEMY?BCT_ENEMY:0);
+
 			if (inf && battle_check_target(src, target, inf) <= 0)
 				break;
 		}

+ 22 - 17
src/map/status.c

@@ -1091,6 +1091,10 @@ void status_calc_bl(struct block_list *bl, unsigned long flag);
 static int status_base_atk(struct block_list *bl, struct status_data *status)
 {
 	int flag = 0, str, dex, dstr;
+
+	if(!(bl->type&battle_config.enable_baseatk))
+		return 0;
+
 	if (bl->type == BL_PC)
 	switch(((TBL_PC*)bl)->status.weapon){
 		case W_BOW:
@@ -1116,7 +1120,7 @@ static int status_base_atk(struct block_list *bl, struct status_data *status)
 
 
 //Fills in the misc data that can be calculated from the other status info (except for level)
-void status_calc_misc(struct status_data *status, int level)
+void status_calc_misc(struct status_data *status, int type, int level)
 {
 	status->matk_min = status->int_+(status->int_/7)*(status->int_/7);
 	status->matk_max = status->int_+(status->int_/5)*(status->int_/5);
@@ -1127,7 +1131,11 @@ void status_calc_misc(struct status_data *status, int level)
 	status->mdef2 = status->int_ + (status->vit>>1);
 	
 	status->cri = status->luk*3 + 10;
-	status->flee2 = status->luk + 10;
+
+	if (type&battle_config.enable_perfect_flee)
+		status->flee2 = status->luk + 10;
+	else
+		status->flee2 = 0;
 }
 
 //Skotlex: Calculates the initial status for the given mob
@@ -1258,7 +1266,7 @@ int status_calc_mob(struct mob_data* md, int first)
 	}
 
 	status->batk = status_base_atk(&md->bl, status);
-	status_calc_misc(status, md->level);
+	status_calc_misc(status, BL_MOB, md->level);
 
 	if(flag&4)
 	{	// Strengthen Guardians - custom value +10% / lv
@@ -1281,17 +1289,11 @@ int status_calc_mob(struct mob_data* md, int first)
 		status->aspd_rate -= 100*md->guardian_data->guardup_lv;
 	}
 
-	if(!battle_config.enemy_str)
-		status->batk = 0;
-		
 	if(battle_config.enemy_critical_rate != 100)
 		status->cri = status->cri*battle_config.enemy_critical_rate/100;
 	if (!status->cri && battle_config.enemy_critical_rate)
 		status->cri = 1;
 
-	if (!battle_config.enemy_perfect_flee)
-		status->flee2 = 0;
-
 	//Initial battle status
 	if (!first)
 		status_calc_bl(&md->bl, SCB_ALL);
@@ -1346,17 +1348,14 @@ int status_calc_pet(struct pet_data *pd, int first)
 			status->luk = cap_value(status->luk,1,battle_config.pet_max_stats);
 
 			status->batk = status_base_atk(&pd->bl, &pd->status);
-			status_calc_misc(&pd->status, lv);
-			if (!battle_config.pet_str)
-				status->batk = 0;
+			status_calc_misc(&pd->status, BL_PET, lv);
+
 			if (!first)	//Not done the first time because the pet is not visible yet
 				clif_send_petstatus(sd);
 		}
 	} else if (first) {
 		pd->status.batk = status_base_atk(&pd->bl, &pd->status);
-		status_calc_misc(&pd->status, pd->db->lv);
-		if (!battle_config.pet_str)
-			pd->status.batk = 0;
+		status_calc_misc(&pd->status, BL_PET, pd->db->lv);
 	}
 	
 	//Support rate modifier (1000 = 100%)
@@ -2155,7 +2154,7 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 	status->ele_lv = 1 ;	//[orn]
 	status->race = hd->homunculusDB->race ;	//[orn]
 	status->size = hd->homunculusDB->size ;	//[orn]
-	status->rhw.range = 1 + hd->homunculusDB->size ;	//[orn]
+	status->rhw.range = 1 + status->size;	//[orn]
 	status->mode = MD_CANMOVE|MD_CANATTACK|MD_ASSIST|MD_AGGRESSIVE|MD_CASTSENSOR;	//[orn]
 	status->speed = DEFAULT_WALK_SPEED;
 	status->aspd_rate = 1000;
@@ -2163,7 +2162,13 @@ int status_calc_homunculus(struct homun_data *hd, int first)
 	merc_hom_calc_skilltree(hd->master);
 
 	status_cpy(&hd->battle_status, status);
-	status_calc_misc(status, hd->master->homunculus.level);
+	status_calc_misc(status, BL_HOMUNCULUS, hd->master->homunculus.level);
+
+	if(battle_config.homun_critical_rate != 100)
+		status->cri = status->cri*battle_config.homun_critical_rate/100;
+	if (!status->cri && battle_config.homun_critical_rate)
+		status->cri = 1;
+
 	status_calc_bl(&hd->bl, SCB_ALL); //Status related changes.
 
 	if (memcmp(&b_status, status, sizeof(struct status_data)))

+ 1 - 1
src/map/status.h

@@ -618,7 +618,7 @@ int status_calc_pet(struct pet_data* pd, int first); // [Skotlex]
 int status_calc_pc(struct map_session_data* sd,int first);
 int status_calc_mob(struct mob_data* md, int first); //[Skotlex]
 int status_calc_homunculus(struct homun_data *hd, int first);
-void status_calc_misc(struct status_data *status, int level);
+void status_calc_misc(struct status_data *status, int type, int level);
 
 void status_freecast_switch(struct map_session_data *sd);
 int status_getrefinebonus(int lv,int type);