Ejemplo n.º 1
0
 public override void Display()
 {
     if (whosHurt == null)
     {
         PartyMembers crewShuffed = MainWindow.settings.userStats.crew;
         MyExtensions.Shuffle(crewShuffed.Party);
         bool healthNeedsReduced = true;
         if (healthNeedsReduced)
         {
             foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.good))
             {
                 whosHurt           = member;
                 whosHurt.status    = PlayerStatus.poor;
                 healthNeedsReduced = false;
                 break;
             }
         }
         if (healthNeedsReduced)
         {
             foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.fair))
             {
                 whosHurt           = member;
                 whosHurt.status    = PlayerStatus.veryPoor;
                 healthNeedsReduced = false;
                 break;
             }
         }
         if (healthNeedsReduced)
         {
             foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.poor))
             {
                 whosHurt           = member;
                 whosHurt.status    = PlayerStatus.dead;
                 healthNeedsReduced = false;
                 break;
             }
         }
         if (healthNeedsReduced)
         {
             foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.veryPoor))
             {
                 whosHurt           = member;
                 whosHurt.status    = PlayerStatus.dead;
                 healthNeedsReduced = false;
                 break;
             }
         }
     }
     MessageBox(whosHurt.name + " was exposed\nand is now " + (whosHurt.status == PlayerStatus.dead ? whosHurt.status : "is in " + whosHurt.status + " health") + ".");
     if (loopCount > 5)
     {
         Confirmation();
     }
     else
     {
         loopCount++;
     }
 }
Ejemplo n.º 2
0
        private static void GameOver()
        {
            if (theTimer != null)
            {
                theTimer.Stop();
                if (RandomCrash == 0)
                {
                    Random r = new Random();
                    RandomCrash = r.Next(1, 10);
                }
                switch (RandomCrash)
                {
                case 1:
                    MessageBox("You crashed! Ship was damaged on\nimpact.");
                    break;

                case 2:
                    MessageBox("You crashed! Lost 1 oxygen tank.");
                    break;

                case 3:
                    MessageBox("You crashed! Lost 1 oxygen tank.");
                    break;

                default:
                    if (whosHurt == null)
                    {
                        PartyMembers crewShuffed = MainWindow.settings.userStats.crew;
                        MyExtensions.Shuffle(crewShuffed.Party);
                        bool healthNeedsReduced = true;
                        if (healthNeedsReduced)
                        {
                            foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.good))
                            {
                                whosHurt           = member;
                                whosHurt.status    = PlayerStatus.poor;
                                healthNeedsReduced = false;
                                break;
                            }
                        }
                        if (healthNeedsReduced)
                        {
                            foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.fair))
                            {
                                whosHurt           = member;
                                whosHurt.status    = PlayerStatus.veryPoor;
                                healthNeedsReduced = false;
                                break;
                            }
                        }
                        if (healthNeedsReduced)
                        {
                            foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.poor))
                            {
                                whosHurt           = member;
                                whosHurt.status    = PlayerStatus.dead;
                                healthNeedsReduced = false;
                                break;
                            }
                        }
                        if (healthNeedsReduced)
                        {
                            foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.veryPoor))
                            {
                                whosHurt           = member;
                                whosHurt.status    = PlayerStatus.dead;
                                healthNeedsReduced = false;

                                break;
                            }
                        }
                    }
                    MessageBox("You crashed! " + whosHurt.name + " was\ninjured and is now " + (whosHurt.status == PlayerStatus.dead ? whosHurt.status : "is in\n" + whosHurt.status + " health") + ".");
                    break;
                }
            }
            else
            {
                MessageBox("Nice Job! You survived the meteor\nshower.");
            }
            if (screen.PressSPACEBAR())
            {
                if (theTimer != null)
                {
                    switch (RandomCrash)
                    {
                    case 1:
                        MainWindow.settings.userStats.ShipWorking = false;
                        break;

                    case 2:
                        MainWindow.settings.userStats.inventory.Items.Find(s => s.id == 101).value--;
                        mainTrail.StartAnimation = true;
                        break;

                    case 3:
                        MainWindow.settings.userStats.inventory.Items.Find(s => s.id == 101).value--;
                        mainTrail.StartAnimation = true;
                        break;

                    default:
                        MainWindow.settings.userStats.crew.Party.Find(member => member.name == whosHurt.name).status = whosHurt.status;
                        mainTrail.StartAnimation = true;
                        break;
                    }
                }
                else
                {
                    mainTrail.StartAnimation = true;
                }
                whosHurt    = null;
                RandomCrash = 0;
                AvoidMeteorMiniGame.avoidMeteorState = "Selection";
                MainWindow.settings.currentScreen    = "Main Trail";
                playingGame  = false;
                gameComplete = false;
            }
        }
Ejemplo n.º 3
0
        private static void ReduceHealth(int loopCount = 2)
        {
            List <string> deadPlayers = new List <string>()
            {
            };
            PartyMembers crewShuffed = MainWindow.settings.userStats.crew;

            MyExtensions.Shuffle(crewShuffed.Party);
            for (int c = 0; c < loopCount; c++)
            {
                bool healthNeedsReduced = true;
                if (healthNeedsReduced)
                {
                    foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.good))
                    {
                        MainWindow.settings.userStats.crew.Party.Find(p => p.name == member.name).status = PlayerStatus.fair;
                        healthNeedsReduced = false;
                        break;
                    }
                }
                if (healthNeedsReduced)
                {
                    foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.fair))
                    {
                        MainWindow.settings.userStats.crew.Party.Find(p => p.name == member.name).status = PlayerStatus.poor;
                        healthNeedsReduced = false;
                        break;
                    }
                }
                if (healthNeedsReduced)
                {
                    foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.poor))
                    {
                        MainWindow.settings.userStats.crew.Party.Find(p => p.name == member.name).status = PlayerStatus.veryPoor;
                        healthNeedsReduced = false;
                        break;
                    }
                }
                if (healthNeedsReduced)
                {
                    foreach (PartyMember member in crewShuffed.Party.FindAll(c => c.status == PlayerStatus.veryPoor))
                    {
                        MainWindow.settings.userStats.crew.Party.Find(p => p.name == member.name).status = PlayerStatus.dead;
                        deadPlayers.Add(member.name);
                        healthNeedsReduced = false;
                        c = loopCount;
                        break;
                    }
                }
            }
            if (deadPlayers.Count > 0)
            {
                string whoDead = String.Empty;
                for (int c = 0; c < deadPlayers.Count; c++)
                {
                    whoDead += deadPlayers[c] + " ";
                    if (!(c == deadPlayers.Count - 1))
                    {
                        whoDead += "and ";
                    }
                }
                DisplayNewPopUp(whoDead + (deadPlayers.Count > 1 ? "have" : "has") + " died.");
            }
            CheckForDeadPlayers();
        }