new armour values

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5695 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2010-09-18 15:14:53 +00:00
parent 189ff26d8e
commit 7d6577d5e3
+17 -5
View File
@@ -329,11 +329,23 @@ public:
// just subtract damage here, can set death, etc. later in code calling this
int dodamage(int damage)
{
/* 4-level armor - continous approach: 28%, 32%, 36%, 40% */
int ad = damage * ( 2400 + 16 * armour ) / 10000; // let armour absorb when possible
if(ad>armour) ad = armour;
armour -= ad;
damage -= ad;
/* 4-level armor - continous approach: 16%, 33%, 37%, 41% */
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 = ad * damage/100.0f;
armour -= rd;
damage -= rd;
health -= damage;
return damage;
}