Only give the chest once

This commit is contained in:
Sam 2017-05-27 18:23:53 +01:00
parent ffa2a736ec
commit 5bdcd3474f

View File

@ -70,6 +70,7 @@ public class AlienInvasion extends SoloGame
return 0; return 0;
}; };
private static final String GAME_COMPLETED_STAT = "Alien Invasion Chest Given";
private final List<BeamSource> _sources = new ArrayList<>(); private final List<BeamSource> _sources = new ArrayList<>();
private final List<Location> _targets = new ArrayList<>(); private final List<Location> _targets = new ArrayList<>();
@ -371,6 +372,10 @@ public class AlienInvasion extends SoloGame
// Reward title // Reward title
if (score.Score == _path.size() - 1) if (score.Score == _path.size() - 1)
{ {
if (Manager.GetStatsManager().Get(player).getStat(GAME_COMPLETED_STAT) > 0)
{
Manager.GetStatsManager().incrementStat(player, GAME_COMPLETED_STAT, 1);
Manager.getInventoryManager().addItemToInventory(success -> Manager.getInventoryManager().addItemToInventory(success ->
{ {
if (success) if (success)
@ -383,6 +388,7 @@ public class AlienInvasion extends SoloGame
} }
}, player, "Omega Chest", 1); }, player, "Omega Chest", 1);
}
TrackManager trackManager = Manager.getTrackManager(); TrackManager trackManager = Manager.getTrackManager();
Track track = trackManager.getTrack(AlienInvasionTrack.class); Track track = trackManager.getTrack(AlienInvasionTrack.class);