From 66263396d92edeaa08fc326f9e62bb2ec34a9886 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 24 May 2016 16:16:34 +0100 Subject: [PATCH] Added REVENGE trophy. --- data/trophies/trophies.json | 6 ++++++ src/battle/bullets.c | 10 ++++++++++ src/defs.h | 1 + 3 files changed, 17 insertions(+) diff --git a/data/trophies/trophies.json b/data/trophies/trophies.json index dc3a5a3..a437901 100644 --- a/data/trophies/trophies.json +++ b/data/trophies/trophies.json @@ -305,5 +305,11 @@ "stat" : "STAT_ENEMIES_SURRENDERED", "statValue" : 50, "hidden" : 1 + }, + { + "id" : "REVENGE", + "title" : "Revenge", + "description" : "During an epic battle, kill an enemy that previously killed you", + "value" : "TROPHY_BRONZE" } ] diff --git a/src/battle/bullets.c b/src/battle/bullets.c index be4b90d..a451ce2 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -230,6 +230,16 @@ static void checkCollisions(Bullet *b) awardTrophy("BODYGUARD"); } } + + if (e == player) + { + b->owner->flags |= EF_KILLED_PLAYER; + } + + if (b->owner == player && e->flags & EF_KILLED_PLAYER) + { + awardTrophy("REVENGE"); + } } if (b->owner == player && b->type == BT_MISSILE) diff --git a/src/defs.h b/src/defs.h index 85010a0..3881be3 100644 --- a/src/defs.h +++ b/src/defs.h @@ -110,6 +110,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define EF_DROPS_ITEMS (2 << 24) #define EF_COMMON_FIGHTER (2 << 25) #define EF_SURRENDERED (2 << 26) +#define EF_KILLED_PLAYER (2 << 27) #define AIF_NONE 0 #define AIF_FOLLOWS_PLAYER (2 << 0)