Added function to adjust target value of objectives (such as requiring fewer civs to rescue if some are killed).
This commit is contained in:
parent
09761ccd78
commit
f883423875
|
@ -270,12 +270,20 @@ void doFighter(void)
|
||||||
|
|
||||||
if (!battle.epic)
|
if (!battle.epic)
|
||||||
{
|
{
|
||||||
addHudMessage(colors.red, "Ally has been killed");
|
if (self->flags & EF_CIVILIAN)
|
||||||
|
{
|
||||||
|
addHudMessage(colors.red, "Civilian has been killed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addHudMessage(colors.red, "Ally has been killed");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateObjective(self->name, TT_DESTROY);
|
updateObjective(self->name, TT_DESTROY);
|
||||||
|
adjustObjectiveTargetValue(self->name, TT_ESCAPED, -1);
|
||||||
|
|
||||||
updateCondition(self->name, TT_DESTROY);
|
updateCondition(self->name, TT_DESTROY);
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ extern void addHudMessage(SDL_Color c, char *format, ...);
|
||||||
extern void checkTrigger(char *name, int type);
|
extern void checkTrigger(char *name, int type);
|
||||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||||
extern Entity *spawnEntity(void);
|
extern Entity *spawnEntity(void);
|
||||||
|
extern void adjustObjectiveTargetValue(char *name, int type, int amount);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -113,6 +113,26 @@ void updateObjective(char *name, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void adjustObjectiveTargetValue(char *name, int type, int amount)
|
||||||
|
{
|
||||||
|
Objective *o;
|
||||||
|
|
||||||
|
for (o = battle.objectiveHead.next ; o != NULL ; o = o->next)
|
||||||
|
{
|
||||||
|
if (o->active && !o->isCondition && o->targetType == type && o->currentValue < o->targetValue && strcmp(o->targetName, name) == 0)
|
||||||
|
{
|
||||||
|
o->targetValue += amount;
|
||||||
|
o->currentValue = MIN(o->currentValue, o->targetValue);
|
||||||
|
|
||||||
|
if (o->currentValue >= o->targetValue)
|
||||||
|
{
|
||||||
|
o->status = OS_COMPLETE;
|
||||||
|
addHudMessage(colors.green, "%s - Objective Complete!", o->description);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void updateCondition(char *name, int type)
|
void updateCondition(char *name, int type)
|
||||||
{
|
{
|
||||||
Objective *o;
|
Objective *o;
|
||||||
|
|
Loading…
Reference in New Issue