diff options
author | Roderic Morris <roderic@ccs.neu.edu> | 2008-07-28 22:03:03 +0000 |
---|---|---|
committer | Roderic Morris <roderic@ccs.neu.edu> | 2008-07-28 22:03:03 +0000 |
commit | 0e0986323c6ae8aed1e9efcf8663c11c0bdecad1 (patch) | |
tree | 436eaa3b0f1f429171436890279f26658b0c2181 /src/game-server | |
parent | 30f5a677644fc34fc7e8b3493f7af42056c3285f (diff) | |
download | manaserv-0e0986323c6ae8aed1e9efcf8663c11c0bdecad1.tar.gz manaserv-0e0986323c6ae8aed1e9efcf8663c11c0bdecad1.tar.bz2 manaserv-0e0986323c6ae8aed1e9efcf8663c11c0bdecad1.tar.xz manaserv-0e0986323c6ae8aed1e9efcf8663c11c0bdecad1.zip |
fix crash from last commit, guild fixes, damage calculation fix
Diffstat (limited to 'src/game-server')
-rw-r--r-- | src/game-server/being.cpp | 5 | ||||
-rw-r--r-- | src/game-server/character.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/game-server/being.cpp b/src/game-server/being.cpp index b18914fa..a6ba4023 100644 --- a/src/game-server/being.cpp +++ b/src/game-server/being.cpp @@ -64,21 +64,22 @@ int Being::damage(Object *, Damage const &damage) /* Elemental modifier at 100 means normal damage. At 0, it means immune. And at 200, it means vulnerable (double damage). */ int mod1 = getModifiedAttribute(BASE_ELEM_BEGIN + damage.element); - + HPloss = HPloss * (mod1 / 100); /* Defence is an absolute value which is subtracted from the damage total. */ int mod2 = 0; switch (damage.type) { case DAMAGE_PHYSICAL: mod2 = getModifiedAttribute(BASE_ATTR_PHY_RES); + HPloss = HPloss - mod2; break; case DAMAGE_MAGICAL: mod2 = getModifiedAttribute(BASE_ATTR_MAG_RES); + HPloss = HPloss / (mod2 + 1); break; default: break; } - HPloss = HPloss * (mod1 / 100) - mod2; if (HPloss < 0) HPloss = 0; diff --git a/src/game-server/character.cpp b/src/game-server/character.cpp index b2420c31..46d7f5c5 100644 --- a/src/game-server/character.cpp +++ b/src/game-server/character.cpp @@ -96,7 +96,7 @@ void Character::perform() Damage damage; damage.base = getModifiedAttribute(BASE_ATTR_PHY_ATK_MIN) + - (rand() % getModifiedAttribute(CHAR_SKILL_WEAPON_BEGIN + type)); + (rand() % (getModifiedAttribute(CHAR_SKILL_WEAPON_BEGIN + type) + 1)); damage.delta = getModifiedAttribute(BASE_ATTR_PHY_ATK_DELTA); damage.type = DAMAGE_PHYSICAL; damage.cth = getModifiedAttribute(BASE_ATTR_HIT) + |