Don't allow Teeka's shots to hurt the player.

This commit is contained in:
Steve 2018-03-06 08:24:45 +00:00
parent 7b915a77a8
commit 1d033cf327
3 changed files with 36 additions and 24 deletions

View File

@ -144,12 +144,11 @@ static void preFire(void)
} }
attack(); attack();
u->shotsToFire--; if (--u->shotsToFire <= 0)
if (u->shotsToFire == 0)
{ {
u->thinkTime = FPS; u->thinkTime = FPS;
u->action = lookForEnemies;
} }
} }

View File

@ -75,6 +75,7 @@ static void tick(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
Bullet *b; Bullet *b;
int canHit;
b = (Bullet*)self; b = (Bullet*)self;
@ -95,30 +96,44 @@ static void touch(Entity *other)
playBattleSound(SND_RICO_2, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y); playBattleSound(SND_RICO_2, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
} }
} }
else if (other != b->owner && (!(other->flags & EF_IGNORE_BULLETS)) && b->owner->type != other->type) else
{ {
swapSelf(other); canHit = (
other->applyDamage(b->damage); other != b->owner &&
swapSelf(other); (!(other->flags & EF_IGNORE_BULLETS)) &&
b->owner->type != other->type
if (other->flags & EF_EXPLODES) );
if (b->owner->type == ET_TEEKA && other->type == ET_BOB)
{ {
playBattleSound(SND_METAL_HIT, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y); canHit = 0;
addSparkParticles(b->x, b->y);
} }
else
if (canHit)
{ {
playBattleSound(SND_FLESH_HIT, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y); swapSelf(other);
other->applyDamage(b->damage);
swapSelf(other);
addSmallFleshChunk(b->x, b->y); if (other->flags & EF_EXPLODES)
} {
playBattleSound(SND_METAL_HIT, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
b->alive = ALIVE_DEAD; addSparkParticles(b->x, b->y);
}
else
{
playBattleSound(SND_FLESH_HIT, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
if (b->owner->type == world.bob->type && (other->type == ET_ENEMY || other->type == ET_BOSS || other->type == ET_DESTRUCTABLE)) addSmallFleshChunk(b->x, b->y);
{ }
game.stats[STAT_SHOTS_HIT]++;
b->alive = ALIVE_DEAD;
if (b->owner->type == world.bob->type && (other->type == ET_ENEMY || other->type == ET_BOSS || other->type == ET_DESTRUCTABLE))
{
game.stats[STAT_SHOTS_HIT]++;
}
} }
} }
} }

View File

@ -269,9 +269,7 @@ static void preFire(void)
u->attack(); u->attack();
u->shotsToFire--; if (--u->shotsToFire == 0)
if (u->shotsToFire == 0)
{ {
u->action = u->walk; u->action = u->walk;
} }