コード例 #1
0
ファイル: Quest.cs プロジェクト: dcmorse/phial
 public void TakeCasualty(Companion c)
 {
     if (c is Gandalf)
     {
         GandalfDeadTheFirstTime = true;
     }
     Fellowship = Fellowship.RemoveCompanion(c);
 }
コード例 #2
0
 public Fellowship RemoveCompanion(Companion casualty)
 {
     if (casualty.IsRemovable())
     {
         if (Companions.Length == 1)
         {
             Companion[] gollums = { new Gollum() };
             return(new Fellowship(gollums));
         }
         else
         {
             return(new Fellowship(Companions.Where(companion => companion != casualty).ToArray()));
         }
     }
     else
     {
         return(this);
     }
 }
コード例 #3
0
ファイル: Quest.cs プロジェクト: dcmorse/phial
 public void ResolveTileWithCasualty(Companion companion, int tileValue, bool reveal, Tile tile)
 {
     if (tileValue > 0)
     {
         int damage = Math.Max(0, tileValue - companion.Level());
         // more companion separation here.
         Corruption += damage;
         if (companion.IsRemovable())
         {
             Log.Log($"    {companion} falls to {tileValue} damage");
             TakeCasualty(companion);
         }
     }
     else
     {
         Corruption = Math.Max(0, Corruption + tileValue); // heal from hunt tiles
         if (tileValue < 0)
         {
             Log.Log($"    Frodo heals to {Corruption} corruption");
         }
     }
     Revealed = Revealed || reveal;
 }