Beispiel #1
0
 public void StartMainTurn()
 {
     Log("Start main turn for " + ActiveCharacter.ToString());
     IsMainTurn = true;
     foreach (CharacterEnum target in UserDict.Keys.ToList())
     {
         UserDict[target].Write(new ResponseMessage(new MainTurnResponse()));
     }
 }
Beispiel #2
0
        public void StartTurn()
        {
            Log("Start turn for " + ActiveCharacter.ToString());
            IsMainTurn = false;

            // Draw card
            int  damage    = 0;
            Card drawnCard = UserDict[ActiveCharacter].Player.Draw();

            if (drawnCard == null)                                         // Handle if deck is finished
            {
                if (UserDict[ActiveCharacter].Player.Deck.Count == 0)
                {
                    damage = 1;
                }
            }

            // Give mana
            UserDict[ActiveCharacter].Player.Mana += CurrentRound * AmaruConstants.MANA_TURN_FACTOR;

            // Add EP and execute onturnstart for each card on table
            OnTurnStartVisitor OTSVisitor = new OnTurnStartVisitor(ActiveCharacter, AmaruConstants.GAME_PREFIX + Id);
            List <Card>        Modified   = new List <Card>();

            foreach (CreatureCard card in UserDict[ActiveCharacter].Player.Inner)
            {
                card.Energy++;
                card.Visit(OTSVisitor, ActiveCharacter, null);
                Modified.Add(card);
            }
            foreach (CreatureCard card in UserDict[ActiveCharacter].Player.Outer)
            {
                card.Energy++;
                card.Visit(OTSVisitor, ActiveCharacter, null);
                Modified.Add(card);
            }

            // Disable immunity
            if (UserDict[ActiveCharacter].Player.IsImmune)
            {
                UserDict[ActiveCharacter].Player.IsImmune = false;
            }

            UserDict[ActiveCharacter].Write(new ResponseMessage(new NewTurnResponse(CurrentRound, ActiveCharacter, UserDict[ActiveCharacter].Player.Mana, drawnCard, Modified, damage)));
            foreach (CharacterEnum target in CharacterManager.Instance.Others(ActiveCharacter))
            {
                UserDict[target].Write(new ResponseMessage(new NewTurnResponse(CurrentRound, ActiveCharacter, UserDict[ActiveCharacter].Player.Mana, drawnCard != null, Modified, damage)));
            }
        }