Browse Source

- Added battle config settings agi_penalty_target and vit_penalty_target, they define which object types will get vit/flee reductions when multi-targetted and defaults to only players (battle/battle.conf)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7774 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 years ago
parent
commit
e5b4eaaea0
4 changed files with 24 additions and 4 deletions
  1. 3 0
      Changelog-Trunk.txt
  2. 9 1
      conf-tmpl/battle/battle.conf
  3. 10 3
      src/map/battle.c
  4. 2 0
      src/map/battle.h

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ 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/20
+	* Added battle config settings agi_penalty_target and vit_penalty_target,
+	  they define which object types will get vit/flee reductions when
+	  multi-targetted and defaults to only players (battle/battle.conf) [Skotlex]
 	* Added the dummy intravision case for the changeoption packet 0x229
 	  [Skotlex]
 	* Corrected Fog of Wall so that all targetted offensive skills (not only

+ 9 - 1
conf-tmpl/battle/battle.conf

@@ -72,6 +72,10 @@ max_hitrate: 100
 // 2 = agi_penalty_num is reduced from FLEE as an exact amount
 agi_penalty_type: 1
 
+// When agi penalty is enabled, to whom it should apply to? (Note 4)
+// By default, only players get the penalty.
+agi_penalty_target: 1
+
 // Amount of enemies required to be targetting player before FLEE begins to be penalized
 agi_penalty_count: 3
 
@@ -84,7 +88,11 @@ agi_penalty_num: 10
 // 2 = vit_penalty_num is reduced from FLEE as an exact amount
 vit_penalty_type: 1
 
-// Amount of enemies required to be targetting player before VIT defense begins to be penalized
+// When vit penalty is enabled, to whom it should apply to? (Note 4)
+// By default, only players get the penalty.
+vit_penalty_target: 1
+
+// Amount of enemies required to be targetting player before defense begins to be penalized
 vit_penalty_count: 3
 
 // Amount of VIT defense penalized per each attacking monster more than vit_penalty_count

+ 10 - 3
src/map/battle.c

@@ -1043,7 +1043,8 @@ static struct Damage battle_calc_weapon_attack(
 			flee = tstatus->flee,
 			hitrate=80; //Default hitrate
 
-		if(battle_config.agi_penalty_type)
+		if(battle_config.agi_penalty_type &&
+			battle_config.agi_penalty_target&target->type)
 		{	
 			unsigned char target_count; //256 max targets should be a sane max
 			target_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
@@ -1626,7 +1627,8 @@ static struct Damage battle_calc_weapon_attack(
 			short vit_def;
 			signed char def1 = (signed char)status_get_def(target); //Don't use tstatus->def1 due to skill timer reductions.
 			short def2 = (short)tstatus->def2;
-			if(battle_config.vit_penalty_type)
+			if(battle_config.vit_penalty_type &&
+				battle_config.vit_penalty_target&target->type)
 			{
 				unsigned char target_count; //256 max targets should be a sane max
 				target_count = unit_counttargeted(target,battle_config.vit_penalty_count_lv);
@@ -2582,7 +2584,8 @@ struct Damage  battle_calc_misc_attack(
 				flee = tstatus->flee,
 				hitrate=80; //Default hitrate
 
-			if(battle_config.agi_penalty_type)
+			if(battle_config.agi_penalty_type && 
+				battle_config.agi_penalty_target&target->type)
 			{	
 				unsigned char target_count; //256 max targets should be a sane max
 				target_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
@@ -3450,10 +3453,12 @@ static const struct battle_data_short {
 	{ "auto_counter_type",                 &battle_config.auto_counter_type		},
 	{ "min_hitrate",                       &battle_config.min_hitrate	},
 	{ "max_hitrate",                       &battle_config.max_hitrate	},
+	{ "agi_penalty_target",                &battle_config.agi_penalty_target	},
 	{ "agi_penalty_type",                  &battle_config.agi_penalty_type			},
 	{ "agi_penalty_count",                 &battle_config.agi_penalty_count			},
 	{ "agi_penalty_num",                   &battle_config.agi_penalty_num			},
 	{ "agi_penalty_count_lv",              &battle_config.agi_penalty_count_lv		},
+	{ "vit_penalty_target",                &battle_config.vit_penalty_target },
 	{ "vit_penalty_type",                  &battle_config.vit_penalty_type			},
 	{ "vit_penalty_count",                 &battle_config.vit_penalty_count			},
 	{ "vit_penalty_num",                   &battle_config.vit_penalty_num			},
@@ -3857,10 +3862,12 @@ void battle_set_defaults() {
 	battle_config.auto_counter_type = BL_ALL;
 	battle_config.min_hitrate = 5;
 	battle_config.max_hitrate = 100;
+	battle_config.agi_penalty_target = BL_PC;
 	battle_config.agi_penalty_type = 1;
 	battle_config.agi_penalty_count = 3;
 	battle_config.agi_penalty_num = 10;
 	battle_config.agi_penalty_count_lv = ATK_FLEE;
+	battle_config.vit_penalty_target = BL_PC;
 	battle_config.vit_penalty_type = 1;
 	battle_config.vit_penalty_count = 3;
 	battle_config.vit_penalty_num = 5;

+ 2 - 0
src/map/battle.h

@@ -228,9 +228,11 @@ extern struct Battle_Config {
 	unsigned short auto_counter_type;
 	unsigned short min_hitrate;	//[Skotlex]
 	unsigned short max_hitrate;	//[Skotlex]
+	unsigned short agi_penalty_target;
 	unsigned short agi_penalty_type;
 	unsigned short agi_penalty_count;
 	unsigned short agi_penalty_num;
+	unsigned short vit_penalty_target;
 	unsigned short vit_penalty_type;
 	unsigned short vit_penalty_count;
 	unsigned short vit_penalty_num;