コード例 #1
0
ファイル: GameState.cs プロジェクト: UncleGus/dracula
 public bool ResolveLightning(List<Hunter> huntersEncountered, UserInterface ui)
 {
     Logger.WriteToDebugLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Lightning");
     Logger.WriteToGameLog("Hunter" + (huntersEncountered.Count() > 0 ? "s" : "") + " encountered Lightning");
     ui.TellUser(huntersEncountered.First().Name + " ");
     for (int i = 1; i < huntersEncountered.Count(); i++)
     {
         ui.TellUser("and " + huntersEncountered[i].Name + " ");
     }
     ui.TellUser("encountered Lightning");
     for (int i = 0; i < huntersEncountered.Count(); i++)
     {
         int answer = ui.GetHunterHolyItems(huntersEncountered[i].Name);
         if (answer > 0)
         {
             Logger.WriteToDebugLog(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
             Logger.WriteToGameLog(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
             ui.TellUser(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
             return true;
         }
     }
     for (int i = 0; i < huntersEncountered.Count(); i++)
     {
         Logger.WriteToDebugLog(huntersEncountered[i].Name + " loses 2 health and discards 1 item");
         Logger.WriteToGameLog(huntersEncountered[i].Name + " loses 2 health and discards 1 item");
         ui.TellUser(huntersEncountered[i].Name + " loses 2 health and discards 1 item");
         huntersEncountered[i].Health -= 2;
     }
     ui.TellUser("Don't forget to tell me what was discarded");
     return !HandlePossibleHunterDeath(ui);
 }
コード例 #2
0
ファイル: GameState.cs プロジェクト: UncleGus/dracula
 public bool ResolveNewVampire(List<Hunter> huntersEncountered, out bool discard, UserInterface ui)
 {
     if (TimeIndex < 3)
     {
         ui.TellUser(huntersEncountered[0].Name + " encountered a New Vampire and disposed of it during the day");
         discard = true;
         return true;
     }
     else
     {
         EventDetail draculaEventCard = Dracula.PlaySeductionCard(this);
         DiscardEventFromDracula("Seduction");
         ui.TellUser("Dracula played Seduction");
         int dieRoll;
         if (draculaEventCard != null)
         {
             int hunterPlayingGoodluck = ui.AskWhichHunterIsUsingGoodLuckToCancelEvent();
             if (hunterPlayingGoodluck > -1)
             {
                 DiscardEventFromHunterAtIndex("Good Luck", hunterPlayingGoodluck, ui);
                 dieRoll = ui.GetDieRoll();
             }
             else
             {
                 dieRoll = 4;
             }
         }
         else
         {
             dieRoll = ui.GetDieRoll();
         }
         if (dieRoll < 4)
         {
             ui.TellUser("The Vampire attempts to bite you");
             for (int i = 0; i < huntersEncountered.Count(); i++)
             {
                 int answer;
                 if (draculaEventCard != null)
                 {
                     answer = 0;
                 }
                 else
                 {
                     answer = ui.GetHunterHolyItems(huntersEncountered[i].Name);
                 }
                 if (answer > 0)
                 {
                     Logger.WriteToDebugLog(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
                     Logger.WriteToGameLog(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
                     ui.TellUser(huntersEncountered[i].Name + " negated the encounter with " + (answer == 1 ? "a crucifix" : "a heavenly host"));
                     discard = true;
                     return true;
                 }
             }
             foreach (Hunter h in huntersEncountered)
             {
                 Logger.WriteToDebugLog(h.Name + " is bitten");
                 Logger.WriteToGameLog(h.Name + " is bitten");
                 ui.TellUser(h.Name + " is bitten");
                 discard = true;
                 return (!HandlePossibleHunterDeath(ui));
             }
             discard = true;
             return true;
         }
         else
         {
             ui.TellUser("The Vampire attempts to escape");
             for (int i = 0; i < huntersEncountered.Count(); i++)
             {
                 int answer = ui.GetHunterSharpItems(huntersEncountered[i].Name);
                 if (answer > 0)
                 {
                     Logger.WriteToDebugLog(huntersEncountered[i].Name + " prevented the Vampire escaping with " + (answer == 1 ? "a Knife" : "a Stake"));
                     Logger.WriteToGameLog(huntersEncountered[i].Name + " prevented the Vampire escaping with " + (answer == 1 ? "a Knife" : "a Stake"));
                     ui.TellUser(huntersEncountered[i].Name + " prevented the Vampire escaping with " + (answer == 1 ? "a Knife" : "a Stake"));
                     ui.TellUser("Don't forget to discard the item");
                     discard = true;
                     return true;
                 }
             }
             ui.TellUser("The Vampire escaped");
             discard = false;
             return true;
         }
     }
 }
コード例 #3
0
ファイル: Dracula.cs プロジェクト: UncleGus/dracula
 public void TakeStartOfTurnActions(GameState g, UserInterface ui)
 {
     if (g.NameOfDraculaAlly() == "Quincey P. Morris")
     {
         Hunter victim = logic.DecideWhichHunterToAttackWithQuincey(g.GetHunters());
         ui.TellUser("Dracula has chosen " + victim.Name + " to affect with Quincey P. Morris");
         switch (ui.GetHunterHolyItems(victim.Name)) {
             case 0:
                 ui.TellUser(victim.Name + " loses 1 health");
                 victim.Health--;
                 g.HandlePossibleHunterDeath(ui);
                 break;
             case 1:
                 if (victim.ItemsKnownToDracula.FindIndex(item => item.Name == "Crucifix") == -1)
                 {
                     g.AddToHunterItemsKnownToDracula(victim, "Crucifix");
                 }
                 ui.TellUser("No effect from Quincey P. Morris");
                 break;
             case 2:
                 if (victim.ItemsKnownToDracula.FindIndex(item => item.Name == "Heavenly Host") == -1)
                 {
                     g.AddToHunterItemsKnownToDracula(victim, "Heavenly Host");
                 }
                 ui.TellUser("No effect from Quincey P. Morris");
                 break;
         }
     }
     Logger.WriteToDebugLog("Deciding what to do with Catacombs locations");
     for (int i = 0; i < 3; i++)
     {
         if (Catacombs[i] != null)
         {
             Logger.WriteToDebugLog("Deciding what to do with location " + Catacombs[i].Name);
             if (logic.DecideToDiscardCatacombLocation(g, this))
             {
                 Logger.WriteToDebugLog("Discarding " + Catacombs[i].Name);
                 while (Catacombs[i].Encounters.Count() > 0)
                 {
                     Logger.WriteToDebugLog("Putting encounter " + Catacombs[i].Encounters.First().name + " back into the encounter pool");
                     g.AddEncounterToEncounterPool(Catacombs[i].Encounters.First());
                     Catacombs[i].Encounters.Remove(Catacombs[i].Encounters.First());
                 }
                 Logger.WriteToDebugLog("Emptying " + Catacombs[i].Name + " from Catacombs");
                 Catacombs[i] = null;
             }
         }
     }
 }