Esempio n. 1
0
        public PartyTurnActor()
        {
            MoveAction     moveAction     = new MoveAction(m_activeActions);
            RotateAction   rotateAction   = new RotateAction(m_activeActions);
            RestAction     restAction     = new RestAction();
            InteractAction interactAction = new InteractAction();
            SelectNextInteractiveObjectAction selectNextInteractiveObjectAction = new SelectNextInteractiveObjectAction();

            m_actions = new BaseAction[4][];
            for (Int32 i = 0; i < m_actions.Length; i++)
            {
                m_actions[i]     = new BaseAction[11];
                m_actions[i][0]  = moveAction;
                m_actions[i][1]  = rotateAction;
                m_actions[i][6]  = restAction;
                m_actions[i][2]  = interactAction;
                m_actions[i][10] = selectNextInteractiveObjectAction;
                m_actions[i][3]  = new MeleeAttackAction(i);
                m_actions[i][4]  = new RangedAttackAction(i);
                m_actions[i][9]  = new CastSpellAction(i);
                m_actions[i][5]  = new ConsumeItemAction(i);
                m_actions[i][8]  = new DefendAction(i);
                m_actions[i][7]  = new EquipAction(i);
            }
        }
Esempio n. 2
0
 private void Defend(DefendAction defendActions)
 {
     Table.TransferPossible = false;
     defendActions.Player.Hand.RemoveAll(c => defendActions.CardsPairs.Select(def => def.DefendCard).Contains(c));
     Table.OpenedCards.AddRange(defendActions.CardsPairs.Select(cp => cp.DefendCard));
     Table.NotCoveredCards = new List <Card>();
 }
Esempio n. 3
0
        public DefendAction Defend()
        {
            var defendAction = new DefendAction(this);

            Console.WriteLine("Select cards to defend. Press 0 to select another action");
            foreach (var notCoveredCard in Table.NotCoveredCards)
            {
                Console.WriteLine(notCoveredCard);
                var input = Console.ReadLine();
                int res;
                while (!int.TryParse(input, out res))
                {
                    Console.WriteLine("Incorrect input, please reneter");
                    input = Console.ReadLine();
                }
                if (res <= 0)
                {
                    return(null);
                }

                if (!defendAction.AddPair(new CardsPair
                {
                    DefendCard = Hand[res - 1],
                    AttackCard = notCoveredCard
                }))
                {
                    Console.WriteLine("You can't select this card. Please try again");
                    return(Defend());
                }
            }
            return(defendAction);
        }
        ///<summary>
        ///</summary>
        ///<param name="defendAction"></param>
        ///<exception cref="ApplicationException"></exception>
        public void SetDefendAction(DefendAction defendAction)
        {
            if (IsImmutable)
            {
                throw new ApplicationException("PendingActions must be mutable to modify actions.");
            }

            DefendAction = defendAction;
        }
Esempio n. 5
0
        private void ExecuteDefendCommand(object selectedItems)
        {
            var cards        = ReadSelectedCards(selectedItems);
            var defendAction = new DefendAction(Player);

            foreach (var notCoveredCard in Table.NotCoveredCards)
            {
                Message = "Выбери карту для " + notCoveredCard;
            }
        }
Esempio n. 6
0
        private static Random random = new Random();  // Random number generator to make the dice appear more random

        public CombatTurnBased(LunchHourGames lhg, CombatSystem combatSystem)
        {
            this.lhg          = lhg;
            this.combatSystem = combatSystem;

            this.chooseAction  = new ChooseAction(lhg, combatSystem, this);
            this.moveAction    = new MoveAction(lhg, combatSystem, this);
            this.attackAction  = new AttackAction(lhg, combatSystem, this);
            this.useAction     = new UseAction(lhg, combatSystem, this);
            this.defendAction  = new DefendAction(lhg, combatSystem, this);
            this.endTurnAction = new EndTurnAction(lhg, combatSystem, this);

            currentAction = null;
            nextAction    = null;
        }
Esempio n. 7
0
        /// <summary>
        ///  <para>
        ///   Method used to command a creature to begin defending against a specific
        ///   target creature.  You can only defend against one creature at a time,
        ///   so only the final call to BeginDefending will actually be used
        ///   in the upcoming turn.
        ///  </para>
        ///  <para>
        ///   Once your creature has finished defending, the DefendCompleted event will
        ///   be fired and your event handler will be called if you provided one.  You
        ///   can use this event to determine the results of your defense.
        ///  </para>
        /// </summary>
        /// <param name="targetAnimal">
        ///  The AnimalState that represents the animal you want to defend against.
        /// </param>
        /// <exception cref="System.ArgumentNullException">
        ///  Thrown if the targetAnimal parameter is null.
        /// </exception>
        public void BeginDefending(AnimalState targetAnimal)
        {
            if (targetAnimal == null)
            {
                throw new ArgumentNullException("targetAnimal", "The argument 'targetAnimal' cannot be null");
            }

            var actionID = GetNextActionID();
            var action   = new DefendAction(ID, actionID, targetAnimal);

            lock (PendingActions)
            {
                PendingActions.SetDefendAction(action);
                InProgressActions.SetDefendAction(action);
            }
        }
Esempio n. 8
0
 private void Awake()
 {
     col    = GetComponent <CircleCollider2D>();
     action = GetComponent <DefendAction>();
 }