Add getDroidEffectiveLevel that returns MAX(droidLevel, droidsCmdrLevel).

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3177 4a71c877-e1ca-e34f-864e-861f7616d084
master
Freddie Witherden 2007-12-25 22:06:51 +00:00
parent 2390ed5d63
commit 624825854c
2 changed files with 9 additions and 5 deletions

View File

@ -216,11 +216,7 @@ float droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD weap
actualDamage = damage - armour; actualDamage = damage - armour;
// Retrieve highest, applicable, experience level // Retrieve highest, applicable, experience level
level = getDroidLevel(psDroid); level = getDroidEffectiveLevel(psDroid);
{
unsigned int cmdLevel = cmdGetCommanderLevel(psDroid);
level = MAX(level, cmdLevel);
}
// Reduce damage taken by EXP_REDUCE_DAMAGE % for each experience level // Reduce damage taken by EXP_REDUCE_DAMAGE % for each experience level
actualDamage = (actualDamage * (100 - EXP_REDUCE_DAMAGE * level)) / 100; actualDamage = (actualDamage * (100 - EXP_REDUCE_DAMAGE * level)) / 100;
@ -4149,6 +4145,13 @@ UDWORD getDroidLevel(DROID *psDroid)
return lastRank - 1; return lastRank - 1;
} }
UDWORD getDroidEffectiveLevel(DROID *psDroid)
{
UDWORD level = getDroidLevel(psDroid);
UDWORD cmdLevel = cmdGetCommanderLevel(psDroid);
return MAX(level, cmdLevel);
}
const char *getDroidNameForRank(UDWORD rank) const char *getDroidNameForRank(UDWORD rank)

View File

@ -248,6 +248,7 @@ extern BOOL selectDroidByID(UDWORD id, UDWORD player);
/* Droid experience stuff */ /* Droid experience stuff */
extern UDWORD getDroidLevel(DROID *psDroid); extern UDWORD getDroidLevel(DROID *psDroid);
extern UDWORD getDroidEffectiveLevel(DROID *psDroid);
extern const char *getDroidLevelName(DROID *psDroid); extern const char *getDroidLevelName(DROID *psDroid);
// Get a droid's name. // Get a droid's name.