summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/mob.c61
-rw-r--r--src/map/npc.c56
2 files changed, 57 insertions, 60 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index f43e049..9710441 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -152,6 +152,33 @@ mutation_scale[MOB_XP_BONUS] =
};
+// The table below indicates the `average' value for each of the statistics, or -1 if there is none.
+// This average is used to determine XP modifications for mutations. The experience point bonus is
+// based on mutation_value and mutation_base as follows:
+// (1) first, compute the percentage change of the attribute (p0)
+// (2) second, determine the absolute stat change
+// (3) third, compute the percentage stat change relative to mutation_base (p1)
+// (4) fourth, compute the XP mofication based on the smaller of (p0, p1).
+static int
+mutation_base[MOB_XP_BONUS] =
+{
+ 30, // MOB_LV
+ -1, // MOB_MAX_HP
+ 20, // MOB_STR
+ 20, // MOB_AGI
+ 20, // MOB_VIT
+ 20, // MOB_INT
+ 20, // MOB_DEX
+ 20, // MOB_LUK
+ -1, // MOB_ATK1
+ -1, // MOB_ATK2
+ -1, // MOB_ADELAY
+ -1, // MOB_DEF
+ 20, // MOB_MDEF
+ -1, // MOB_SPEED
+};
+
+
/*========================================
* Mutates a MOB. For large `direction' values, calling this multiple times will give bigger XP boni.
*----------------------------------------
@@ -161,7 +188,8 @@ mob_mutate(struct mob_data *md, int stat, int intensity) // intensity: positive:
{
int old_stat;
int new_stat;
- int real_intensity;
+ int real_intensity; // relative intensity
+ const int mut_base = mutation_base[stat];
int sign = 1;
if (!md || stat < 0 || stat >= MOB_XP_BONUS || intensity == 0)
@@ -193,7 +221,23 @@ mob_mutate(struct mob_data *md, int stat, int intensity) // intensity: positive:
if (old_stat == 0)
real_intensity = 0;
else
- real_intensity = sign * (((new_stat - old_stat) << 8) / old_stat);
+ real_intensity = (((new_stat - old_stat) << 8) / old_stat);
+
+ if (mut_base != -1) {
+ // Now compute the mutation intensity relative to an absolute value.
+ // Take the lesser of the two effects.
+ int real_intensity2 = (((new_stat - old_stat) << 8) / mut_base);
+
+ if (real_intensity < 0)
+ if (real_intensity2 > real_intensity)
+ real_intensity = real_intensity2;
+
+ if (real_intensity > 0)
+ if (real_intensity2 < real_intensity)
+ real_intensity = real_intensity2;
+ }
+
+ real_intensity *= sign;
md->stats[stat] = new_stat;
@@ -2147,6 +2191,11 @@ int mob_deleteslave(struct mob_data *md)
return 0;
}
+#define DAMAGE_BONUS_COUNT 6 // max. number of players to account for
+const static double damage_bonus_factor[DAMAGE_BONUS_COUNT + 1] = {
+ 1.0, 1.0, 2.0, 2.5, 2.75, 2.9, 3.0
+};
+
/*==========================================
* It is the damage of sd to damage to md.
*------------------------------------------
@@ -2434,6 +2483,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
// 経験値の分配
for(i=0;i<DAMAGELOG_SIZE;i++){
+
int pid,base_exp,job_exp,flag=1;
double per;
struct party *p;
@@ -2451,8 +2501,11 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
if(job_exp < 0) job_exp = 0;
*/
//eAthena's exp formula rather than jAthena's
- per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/(double)max_hp;
- if(per>512) per=512;
+// per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/(double)max_hp;
+ // [Fate] The above is the old formula. We do a more involved computation below.
+ per = (double)md->dmglog[i].dmg * 256 / (double) max_hp; // 256 = 100% of the score
+ per *= damage_bonus_factor[count > DAMAGE_BONUS_COUNT ? DAMAGE_BONUS_COUNT : count]; // Bonus for party attack
+ if(per>512) per=512; // [Fate] Retained from before. The maximum a single individual can get is double the original value.
if(per<1) per=1;
base_exp = ((mob_db[md->class].base_exp * md->stats[MOB_XP_BONUS]) >> MOB_XP_BONUS_SHIFT) * per/256;
diff --git a/src/map/npc.c b/src/map/npc.c
index 31a0c42..849030f 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -259,62 +259,6 @@ int npc_event_export(void *key,void *data,va_list ap)
return 0;
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*==========================================
* 全てのNPCのOn*イベント実行
*------------------------------------------