summaryrefslogtreecommitdiff
path: root/src/game-server/character.cpp
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-10-26 21:27:26 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-10-26 21:28:18 +0100
commitb7481331c65a08d54d5e2ae286923627195076ce (patch)
tree62e9a7391f074913652d8d2dedc1cdc28cb53124 /src/game-server/character.cpp
parentecefeb60244e6ad9c5d043f8bdf086ac89889b9e (diff)
downloadmanaserv-b7481331c65a08d54d5e2ae286923627195076ce.tar.gz
manaserv-b7481331c65a08d54d5e2ae286923627195076ce.tar.bz2
manaserv-b7481331c65a08d54d5e2ae286923627195076ce.tar.xz
manaserv-b7481331c65a08d54d5e2ae286923627195076ce.zip
Added optional optimal level mechanic which reduces exp gain of certain sources after a certain skill level.
Diffstat (limited to 'src/game-server/character.cpp')
-rw-r--r--src/game-server/character.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp
index 94bd7465..f351edb3 100644
--- a/src/game-server/character.cpp
+++ b/src/game-server/character.cpp
@@ -48,6 +48,7 @@
const float Character::EXPCURVE_EXPONENT = 3.0f;
const float Character::EXPCURVE_FACTOR = 10.0f;
const float Character::LEVEL_SKILL_PRECEDENCE_FACTOR = 0.75f;
+const float Character::EXP_LEVEL_FLEXIBILITY = 1.0f;
Character::Character(MessageIn &msg):
Being(OBJECT_CHARACTER),
@@ -460,10 +461,17 @@ int Character::levelForExp(int exp)
return int(pow(float(exp) / EXPCURVE_FACTOR, 1.0f / EXPCURVE_EXPONENT));
}
-void Character::receiveExperience(int skill, int experience)
+void Character::receiveExperience(int skill, int experience, int optimalLevel)
{
if (skill >= CHAR_ATTR_END)
{
+ // reduce experience when skill is over optimal level
+ int levelOverOptimum = getAttribute(skill) - optimalLevel;
+ if (optimalLevel && levelOverOptimum > 0)
+ {
+ experience *= EXP_LEVEL_FLEXIBILITY / (levelOverOptimum + EXP_LEVEL_FLEXIBILITY);
+ }
+
// add exp
int oldExp = mExperience[skill];
long int newExp = mExperience[skill] + experience;