Added killedBy, for easier stat counting.
This commit is contained in:
parent
f9d02696fd
commit
e7190150bf
|
@ -203,10 +203,9 @@ static void checkCollisions(Bullet *b)
|
|||
}
|
||||
|
||||
/* assuming that health <= 0 will always mean killed */
|
||||
if (e->health <= 0 && b->owner == player && (!(e->flags & EF_NO_KILL_INC)))
|
||||
if (e->health <= 0)
|
||||
{
|
||||
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
||||
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
||||
e->killedBy = b->owner;
|
||||
}
|
||||
|
||||
if (b->owner == player && b->type == BT_MISSILE)
|
||||
|
|
|
@ -517,6 +517,16 @@ static void die(void)
|
|||
self->action = simpleDie;
|
||||
break;
|
||||
}
|
||||
|
||||
if (self->killedBy == player && (!(self->flags & EF_NO_KILL_INC)))
|
||||
{
|
||||
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
||||
|
||||
if (battle.isEpic)
|
||||
{
|
||||
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void immediateDie(void)
|
||||
|
|
|
@ -104,6 +104,11 @@ static void lookForFighters(void)
|
|||
|
||||
static void die(void)
|
||||
{
|
||||
if (self->killedBy == player)
|
||||
{
|
||||
battle.stats[STAT_MINES_DESTROYED]++;
|
||||
}
|
||||
|
||||
addMineExplosion();
|
||||
|
||||
doSplashDamage();
|
||||
|
|
|
@ -33,4 +33,5 @@ extern void damageFighter(Entity *e, int amount, long flags);
|
|||
extern void playBattleSound(int id, int x, int y);
|
||||
|
||||
extern Battle battle;
|
||||
extern Entity *player;
|
||||
extern Entity *self;
|
||||
|
|
|
@ -146,6 +146,7 @@ struct Entity {
|
|||
Entity *target;
|
||||
Entity *leader;
|
||||
Entity *owner;
|
||||
Entity *killedBy;
|
||||
void (*action)(void);
|
||||
void (*draw)(void);
|
||||
void (*die)(void);
|
||||
|
|
Loading…
Reference in New Issue