Replace magic numbers scattered around the code by defines.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2145 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
c8b99f0ae0
commit
d39bee2955
|
@ -177,7 +177,7 @@ BOOL cmdGetDroidMultiExpBoost()
|
|||
// get the maximum group size for a command droid
|
||||
unsigned int cmdDroidMaxGroup(DROID *psCommander)
|
||||
{
|
||||
return getDroidLevel(psCommander) * 2 + 6;
|
||||
return getDroidLevel(psCommander) * 2 + MIN_CMD_GROUP_DROIDS;
|
||||
}
|
||||
|
||||
// update the kills of a command droid if psKiller is in a command group
|
||||
|
|
11
src/combat.c
11
src/combat.c
|
@ -297,14 +297,9 @@ void combFire(WEAPON *psWeap, BASE_OBJECT *psAttacker, BASE_OBJECT *psTarget, in
|
|||
// hitMod = hitMod + hitMod * cmdDroidHitMod((DROID *)psAttacker) / 100;
|
||||
level = getDroidLevel((DROID *)psAttacker);
|
||||
cmdLevel = cmdGetCommanderLevel((DROID *)psAttacker);
|
||||
if (level > cmdLevel)
|
||||
{
|
||||
hitInc += 5 * level;
|
||||
}
|
||||
else
|
||||
{
|
||||
hitInc += 5 * cmdLevel;
|
||||
}
|
||||
|
||||
// increase accuracy by EXP_ACCURACY_BONUS_PCT % for each experience level
|
||||
hitInc += EXP_ACCURACY_BONUS_PCT * MAX(level,cmdLevel);
|
||||
}
|
||||
|
||||
// subtract the defenders experience modifier
|
||||
|
|
|
@ -223,8 +223,8 @@ SDWORD droidDamage(DROID *psDroid, UDWORD damage, UDWORD weaponClass, UDWORD wea
|
|||
level = MAX(level, cmdLevel);
|
||||
}
|
||||
|
||||
// Reduce damage taken by 6% for each experience level
|
||||
actualDamage = (actualDamage * (100 - 6 * level)) / 100;
|
||||
// Reduce damage taken by EXP_REDUCE_DAMAGE_PCT % for each experience level
|
||||
actualDamage = (actualDamage * (100 - EXP_REDUCE_DAMAGE_PCT * level)) / 100;
|
||||
|
||||
debug( LOG_ATTACK, " penetrated: %d\n", actualDamage);
|
||||
}
|
||||
|
|
14
src/droid.h
14
src/droid.h
|
@ -56,6 +56,17 @@ extern DROID_TEMPLATE *apsDroidTemplates[MAX_PLAYERS];
|
|||
//used to stop structures being built too near the edge and droids being placed down - pickATile
|
||||
#define TOO_NEAR_EDGE 3
|
||||
|
||||
/* Define max number of allowed droids per droid type */
|
||||
#define MAX_COMMAND_DROIDS 10 // max number of commanders a player can have
|
||||
#define MAX_CONSTRUCTOR_DROIDS 15 // max number of constructors a player can have
|
||||
|
||||
/* Experience modifies */
|
||||
#define EXP_REDUCE_DAMAGE_PCT 6 // damage of a droid is reduced by this value per experience level, in %
|
||||
#define EXP_ACCURACY_BONUS_PCT 5 // accuracy of a droid is increased by this value per experience level, in %
|
||||
|
||||
/* Minumum number of droids a commander can control in its group */
|
||||
#define MIN_CMD_GROUP_DROIDS 6
|
||||
|
||||
/* Info stored for each droid neighbour */
|
||||
typedef struct _naybor_info
|
||||
{
|
||||
|
@ -104,9 +115,6 @@ extern DROID* buildDroid(DROID_TEMPLATE *pTemplate, UDWORD x, UDWORD y,
|
|||
/* Set the asBits in a DROID structure given it's template. */
|
||||
extern void droidSetBits(DROID_TEMPLATE *pTemplate,DROID *psDroid);
|
||||
|
||||
// calculate the experience level of a droid
|
||||
extern SDWORD droidCalcExp(DROID *psDroid);
|
||||
|
||||
/* Calculate the weight of a droid from it's template */
|
||||
extern UDWORD calcDroidWeight(DROID_TEMPLATE *psTemplate);
|
||||
|
||||
|
|
|
@ -2913,14 +2913,14 @@ static BOOL maxDroidsByTypeReached(STRUCTURE *psStructure)
|
|||
CHECK_STRUCTURE(psStructure);
|
||||
|
||||
if ( (droidTemplateType((DROID_TEMPLATE *)psFact->psSubject) == DROID_COMMAND) &&
|
||||
(getNumCommandDroids(psStructure->player) >= 10) )
|
||||
(getNumCommandDroids(psStructure->player) >= MAX_COMMAND_DROIDS) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ( (droidTemplateType((DROID_TEMPLATE *)psFact->psSubject) == DROID_CONSTRUCT ||
|
||||
droidTemplateType((DROID_TEMPLATE *)psFact->psSubject) == DROID_CYBORG_CONSTRUCT) &&
|
||||
(getNumConstructorDroids(psStructure->player) >= 15) )
|
||||
(getNumConstructorDroids(psStructure->player) >= MAX_CONSTRUCTOR_DROIDS) )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue