コード例 #1
0
 public override void Play(Player cardLayer, Player other)
 {
     if (other.GetDefence() == 0)
     {
         UI.Write("@8" + cardLayer.GetName() + " blasts " + other.GetName() + ", who takes @0" + this.value + "@8 damage!\n");
         other.SetHealth(other.GetHealth() - this.value);
         SFX.Play("Explosion");
     }
     //If the attack is greater than the current defence...
     else if (other.GetDefence() <= this.value)
     {
         UI.Write("@8" + cardLayer.GetName() + " shoots down " + other.GetName() + "'s Laser Grid!\n");
         other.SetDefence(0);
         SFX.Play("LaserGridDown");
     }
     //Otherwise...
     else if (other.GetDefence() > this.value)
     {
         UI.Write("@8" + cardLayer.GetName() + " blasts " + other.GetName() + "'s Laser Grid for @0" + this.value + "@8 damage!\n");
         //...Just subtract from the defence the damage to take.
         other.SetDefence(other.GetDefence() - this.value);
         SFX.Play("Gun");
     }
     //We can't have negative health!
     if (other.GetHealth() < 0)
     {
         other.SetHealth(0);
     }
 }
コード例 #2
0
 public override void Play(Player cardLayer, Player other)
 {
     UI.Write("@8" + cardLayer.GetName() + " repairs its RoboBody using @2" + this.value + "@8 supercapacitors!\n");
     cardLayer.SetHealth(cardLayer.GetHealth() + this.value);
     SFX.Play("Repair");
 }
コード例 #3
0
 public override void Play(Player cardLayer, Player other)
 {
     UI.Write("@8" + cardLayer.GetName() + " malfunctions and blasts itself!\n");
     cardLayer.SetHealth(cardLayer.GetHealth() - 1);
     SFX.Play("Death");
 }
コード例 #4
0
 private static void TestForVictory(Player player)
 {
     if (player.GetHealth() == 0)
     {
         UI.Write("@0V@9I@1C@0T@9O@1R@0Y@9!@1!@0!@9!@1!@0!@9!"); //Victory!!!!!!
         SFX.Play("Skrillex");
         UI.waitForConfirmation();
     }
     else
     {
         UI.Write("@8DEFEAT...");
         SFX.Play("LongExplosion");
         Thread.Sleep(2000);
         UI.waitForConfirmation();
     }
 }
コード例 #5
0
        private static void ServerGameLoop(Socket handler, string name, string newName)
        {
            Player Host = new Player(name, 200);
            Player Client = new Player(newName.Substring(0, newName.IndexOf("<EOF>")));
            MultiplayerBattle scuffle = new MultiplayerBattle(Host, Client);
            scuffle.Begin();

            //-----------------------------------------------------------------------
            //This is the magic, the game loop.

            while ((Client.GetHealth() != 0) && (Host.GetHealth() != 0))
            {
                SendCard(handler, scuffle.Fight());

                if ((Client.GetHealth() != 0) && (Host.GetHealth() != 0))
                {
                    scuffle.CardPlayed(RecieveCard(handler));
                }
            }
            TestForVictory(Client);
        }