Add getDroidEffectiveLevel that returns MAX(droidLevel, droidsCmdrLevel).
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3177 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
2390ed5d63
commit
624825854c
13
src/droid.c
13
src/droid.c
|
@ -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)
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in New Issue