summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-11 17:09:09 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-11 17:09:09 +0000
commit4fc4f271eb042514ea22dd84b993b3bf288526a9 (patch)
tree8f1656e573d76c4d77d01015328c9cf1730bf14d
parent41f42674bbc627216b96cefea6b4a4d10c010799 (diff)
downloadhercules-4fc4f271eb042514ea22dd84b993b3bf288526a9.tar.gz
hercules-4fc4f271eb042514ea22dd84b993b3bf288526a9.tar.bz2
hercules-4fc4f271eb042514ea22dd84b993b3bf288526a9.tar.xz
hercules-4fc4f271eb042514ea22dd84b993b3bf288526a9.zip
Re-phrased the attacker flee/def penalty config descs
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10530 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--conf-tmpl/battle/battle.conf20
-rw-r--r--src/map/battle.c20
-rw-r--r--src/map/map.h7
-rw-r--r--src/map/unit.c35
5 files changed, 44 insertions, 40 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 519fd41a7..350eded0f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,8 @@ 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.
2007/05/11
+ * Re-phrased the attacker flee/def penalty config descs [ultramage]
+ Ref: http://www.eathena.ws/board/index.php?showtopic=150918
* Attempt to fix unwanted teleporting of immobile mobs [Playtester]
2007/05/10
* Adapted the shortlist to use a static array instead of a linked list and
diff --git a/conf-tmpl/battle/battle.conf b/conf-tmpl/battle/battle.conf
index 59284580c..51bcd17de 100644
--- a/conf-tmpl/battle/battle.conf
+++ b/conf-tmpl/battle/battle.conf
@@ -123,18 +123,18 @@ weapon_defense_type: 0
//MDEFTame as above....(MDEF*value)
magic_defense_type: 0
-// How to count the number of the enemies who do an agi penalty...
-// 1 or less: It is a count altogether.
-// 2: Full evasion exclusion
-// 3: Full evasion and evasion exclusion
-// 4 or more: Except all.
+// How to count the number of attackers when applying agi penalty ? (choose one)
+// 1-: Count every attack attempt (even those that were dodged/lucky-dodged)
+// 2 : Count every non-lucky-dodged attack attempt
+// 3 : Count only attacks that actually connect
+// 4+: None of the above, count will always be 0
agi_penalty_count_lv: 2
-// How to count the number of the enemies who do a vit penalty
-// 1 or less: It is a count altogether.
-// 2: Full evasion exclusion
-// 3: Full evasion and evasion exclusion
-// Four or more: Except all.
+// How to count the number of attackers when applying vit penalty ? (choose one)
+// 1-: Count every attack attempt (even those that were dodged/lucky-dodged)
+// 2 : Count every non-lucky-dodged attack attempt
+// 3 : Count only attacks that actually connect
+// 4+: None of the above, count will always be 0
vit_penalty_count_lv: 3
// Change attacker's direction to face opponent on every attack? (Note 4)
diff --git a/src/map/battle.c b/src/map/battle.c
index 38be508dd..f13125bb7 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -1102,14 +1102,14 @@ static struct Damage battle_calc_weapon_attack(
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);
- if(target_count >= battle_config.agi_penalty_count)
+ unsigned char attacker_count; //256 max targets should be a sane max
+ attacker_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
+ if(attacker_count >= battle_config.agi_penalty_count)
{
if (battle_config.agi_penalty_type == 1)
- flee = (flee * (100 - (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
+ flee = (flee * (100 - (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
else //asume type 2: absolute reduction
- flee -= (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
+ flee -= (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
if(flee < 1) flee = 1;
}
}
@@ -2585,14 +2585,14 @@ struct Damage battle_calc_misc_attack(
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);
- if(target_count >= battle_config.agi_penalty_count)
+ unsigned char attacker_count; //256 max targets should be a sane max
+ attacker_count = unit_counttargeted(target,battle_config.agi_penalty_count_lv);
+ if(attacker_count >= battle_config.agi_penalty_count)
{
if (battle_config.agi_penalty_type == 1)
- flee = (flee * (100 - (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
+ flee = (flee * (100 - (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100;
else //asume type 2: absolute reduction
- flee -= (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
+ flee -= (attacker_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num;
if(flee < 1) flee = 1;
}
}
diff --git a/src/map/map.h b/src/map/map.h
index fc7affdf3..d7ebb3d6c 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -1033,7 +1033,12 @@ struct pet_data {
struct map_session_data *msd;
};
-enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // 囲まれペナルティ計算用
+// state of a single attack attempt; used in flee/def penalty calculations when mobbed
+enum {
+ ATK_LUCKY=1, // attack was lucky-dodged
+ ATK_FLEE, // attack was dodged
+ ATK_DEF // attack connected
+};
struct map_data {
char name[MAP_NAME_LENGTH];
diff --git a/src/map/unit.c b/src/map/unit.c
index 182133f9b..f8f6daa59 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1521,15 +1521,14 @@ void unit_dataset(struct block_list *bl) {
}
/*==========================================
- * 自分をロックしているユニットの数を数える(foreachclient)
- *------------------------------------------
- */
-static int unit_counttargeted_sub(struct block_list *bl, va_list ap)
+ * Returns 1 if this unit is attacking target 'id'
+ *------------------------------------------*/
+static int unit_counttargeted_sub(struct block_list* bl, va_list ap)
{
- int id, target_lv;
- struct unit_data *ud;
- id = va_arg(ap,int);
- target_lv = va_arg(ap,int);
+ int id = va_arg(ap, int);
+ int target_lv = va_arg(ap, int); // extra condition
+ struct unit_data* ud;
+
if(bl->id == id)
return 0;
@@ -1542,6 +1541,15 @@ static int unit_counttargeted_sub(struct block_list *bl, va_list ap)
}
/*==========================================
+ * Counts the number of units attacking 'bl'
+ *------------------------------------------*/
+int unit_counttargeted(struct block_list* bl, int target_lv)
+{
+ nullpo_retr(0, bl);
+ return (map_foreachinrange(unit_counttargeted_sub, bl, AREA_SIZE, BL_CHAR, bl->id, target_lv));
+}
+
+/*==========================================
*
*------------------------------------------
*/
@@ -1554,17 +1562,6 @@ int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int
return status_fix_damage(src,target,damage+damage2,clif_damage(target,target,tick,sdelay,ddelay,damage,div,type,damage2));
}
-/*==========================================
- * 自分をロックしている対象の数を返す
- * 戻りは整数で0以上
- *------------------------------------------
- */
-int unit_counttargeted(struct block_list *bl,int target_lv)
-{
- nullpo_retr(0, bl);
- return (map_foreachinrange(unit_counttargeted_sub, bl, AREA_SIZE, BL_CHAR,
- bl->id, target_lv));
-}
/*==========================================
* 見た目のサイズを変更する