armor no longer affects knife damage

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6887 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
sireus
2012-09-23 16:58:55 +00:00
parent f15733342c
commit b4385a4897
3 changed files with 22 additions and 19 deletions
+1 -1
View File
@@ -896,7 +896,7 @@ void dodamage(int damage, playerent *pl, playerent *actor, int gun, bool gib, bo
audiomgr.playsound(S_PAIN1+rnd(5), pl);
}
if(local) damage = pl->dodamage(damage);
if(local) damage = pl->dodamage(damage, gun);
else if(actor==player1) return;
if(pl==player1)
+20 -17
View File
@@ -344,7 +344,7 @@ public:
}
// just subtract damage here, can set death, etc. later in code calling this
int dodamage(int damage)
int dodamage(int damage, int gun)
{
if(damage == INT_MAX)
{
@@ -353,24 +353,27 @@ public:
return damage;
}
// 4-level armour - tiered approach: 16%, 33%, 37%, 41%
// Please update ./ac_website/htdocs/docs/introduction.html if this changes.
int armoursection = 0;
int ad = damage;
if(armour > 25) armoursection = 1;
if(armour > 50) armoursection = 2;
if(armour > 75) armoursection = 3;
switch(armoursection)
if(gun != GUN_KNIFE)
{
case 0: ad = (int) (16.0f/25.0f * armour); break; // 16
case 1: ad = (int) (17.0f/25.0f * armour) - 1; break; // 33
case 2: ad = (int) (4.0f/25.0f * armour) + 25; break; // 37
case 3: ad = (int) (4.0f/25.0f * armour) + 25; break; // 41
default: break;
// 4-level armour - tiered approach: 16%, 33%, 37%, 41%
// Please update ./ac_website/htdocs/docs/introduction.html if this changes.
int armoursection = 0;
int ad = damage;
if(armour > 25) armoursection = 1;
if(armour > 50) armoursection = 2;
if(armour > 75) armoursection = 3;
switch(armoursection)
{
case 0: ad = (int) (16.0f/25.0f * armour); break; // 16
case 1: ad = (int) (17.0f/25.0f * armour) - 1; break; // 33
case 2: ad = (int) (4.0f/25.0f * armour) + 25; break; // 37
case 3: ad = (int) (4.0f/25.0f * armour) + 25; break; // 41
default: break;
}
int rd = (int) (ad * damage/100.0f);
armour -= rd;
damage -= rd;
}
int rd = (int) (ad * damage/100.0f);
armour -= rd;
damage -= rd;
health -= damage;
return damage;
}
+1 -1
View File
@@ -1442,7 +1442,7 @@ void serverdamage(client *target, client *actor, int damage, int gun, bool gib,
if (!m_demo && !m_coop && !validdamage(target, actor, damage, gun, gib)) return;
if ( m_arena && gun == GUN_GRENADE && arenaroundstartmillis + 2000 > gamemillis && target != actor ) return;
clientstate &ts = target->state;
ts.dodamage(damage);
ts.dodamage(damage, gun);
if(damage < INT_MAX)
{
actor->state.damage += damage;