コード例 #1
0
        /// <summary>
        /// Add trate to hand
        /// </summary>
        private void AddTrateToHand()
        {
            if (BattleArena.HandCardsCount < Arena.HandLimitCount)
            {
                var trate = BattleArena.GetActivePlayer().TrateBattlePull[0];
                if (trate != null)
                {
                    // add trate to battle hand
                    View.AddTrateToDeck(trate, BattleArena.ActiveSide);

                    AddHistoryLogSignal.Dispatch(new[]
                    {
                        "PLAYER '", BattleArena.GetActivePlayer().Name, "' Add '", trate.SourceTrate.name,
                        "' Trate To Hand"
                    }, LogType.Hand);
                }
            }
            else
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "PLAYER '", BattleArena.GetActivePlayer().Name, "' has add Trate to Hand ERROR! "
                }, LogType.Error);
            }

            BattleArena.GetActivePlayer().TrateBattlePull.RemoveAt(0);
        }
コード例 #2
0
        /// <summary>
        /// Add card to hand
        /// </summary>
        private void OnAddCardToHand()
        {
            if (BattleArena.HandCount < Arena.HandLimitCount)
            {
                var card = BattleArena.GetActivePlayer().CardBattlePull[0];
                if (card != null)
                {
                    // add card to battle hand
                    View.AddCardToDeck(card, BattleArena.ActiveSide);

                    AddHistoryLogSignal.Dispatch(new[]
                    {
                        "PLAYER '", BattleArena.GetActivePlayer().Name, "' Add '", card.SourceCard.name,
                        "' Card to Deck Hand"
                    }, LogType.Hand);
                }
            }
            else
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "PLAYER '", BattleArena.GetActivePlayer().Name, "' has add Card to Hand ERROR! "
                }, LogType.Error);
            }

            // Remove card from pull
            BattleArena.GetActivePlayer().CardBattlePull.RemoveAt(0);
        }
コード例 #3
0
 /// <summary>
 /// Init history
 /// </summary>
 public void InitHistory()
 {
     StateService.InitActiveHistoryTurn();
     _history.Add(StateService.ActiveHistotyTurn);
     AddHistoryLogSignal.Dispatch(new[] { "INIT '", StateService.TurnCount.ToString(), "' TURN!" },
                                  LogType.General);
 }
コード例 #4
0
        public override void Execute()
        {
            var trate        = TrateView.Trate;
            var card         = BattleUnitView.Card;
            var activePlayer = BattleArena.GetActivePlayer();

            if (activePlayer.ManaPull <= 0 ||
                activePlayer.ManaPull < trate.Mana)
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player '", activePlayer.Name, "' Has ERROR! 'Add trate' '",
                    trate.SourceTrate.name,
                    "' to battle card '", card.SourceCard.name, "' 'not enough mana!'"
                }, LogType.Hand);
                BattleArena.ApplyTrate = null;
                InitAttackLineSignal.Dispatch(false);
                return;
            }

            if (BattleUnitView.TrateViews.Count >= BattleCard.MaxTratesCount)
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "PLAYER '", activePlayer.Name, "' has ERROR! Add Trate '",
                    trate.SourceTrate.name, "' to cart 'not enough space'"
                }, LogType.Hand);
                BattleArena.ApplyTrate = null;
                InitAttackLineSignal.Dispatch(false);
                return;
            }

            if (activePlayer.LessManaPull(trate.Mana))
            {
                BattleUnitView.AddTrate(TrateView);
                // add history battle log
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player '", activePlayer.Name, "' Add trate '", trate.SourceTrate.name,
                    "' to battle card '", card.SourceCard.name, "'"
                }, LogType.Hand);
            }
            else
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player '", activePlayer.Name, "' Has ERROR! 'Add trate' '",
                    trate.SourceTrate.name,
                    "' to battle card '", card.SourceCard.name, "' 'not enough mana!'"
                }, LogType.Hand);
                BattleArena.ApplyTrate = null;
                InitAttackLineSignal.Dispatch(false);
                return;
            }

            BattleArena.ApplyTrate = null;
            InitAttackLineSignal.Dispatch(false);
            // Init mana view
            InitManaSignal.Dispatch();
        }
コード例 #5
0
        public override void Execute()
        {
            var activePlayer = BattleArena.GetActivePlayer();
            var sourceCard   = DamageStruct.SourceCardView.Card;
            var damageCard   = DamageStruct.DamageCardView.Card;

            if (sourceCard.TakeDamage(damageCard))
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player '", activePlayer.Name, "' Use Card '", damageCard.SourceCard.name,
                    "' hit CRITICAL on '", sourceCard.CriticalDamage.ToString(), "' to enemy Card '",
                    sourceCard.SourceCard.name, "' "
                }, LogType.Battle);
            }
            else
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player '", activePlayer.Name, "' Use Card '", damageCard.SourceCard.name,
                    "' hit enemy Card '", sourceCard.SourceCard.name, "' take damage '", damageCard.Attack.ToString(),
                    "'"
                }, LogType.Battle);
            }

            // Enemy cart return attack
            damageCard.TakeDamage(sourceCard, false);
            AddHistoryLogSignal.Dispatch(new[]
            {
                "Enemy Card '", sourceCard.SourceCard.name,
                "' return  damage '", sourceCard.Attack.ToString(), "' to '", damageCard.SourceCard.name, "'"
            }, LogType.Battle);


            if (damageCard.Status == BattleStatus.Dead)
            {
                AddHistoryLogSignal.Dispatch(new[] { "Player Card '", damageCard.SourceCard.name, "' has dead!" },
                                             LogType.Battle);
                DamageStruct.DamageCardView.DestroyView();
            }
            else
            {
                damageCard.Status = BattleStatus.Sleep;
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Player card '", damageCard.SourceCard.name, "' has '", damageCard.Health.ToString(),
                    "' Health and '", damageCard.Defence.ToString(), "' Defence"
                }, LogType.Battle);
                DamageStruct.DamageCardView.Init(damageCard);
            }

            if (sourceCard.Status == BattleStatus.Dead)
            {
                AddHistoryLogSignal.Dispatch(new[] { "Enemy Card '", sourceCard.SourceCard.name, "' has dead!" },
                                             LogType.Battle);
                DamageStruct.SourceCardView.DestroyView();
            }
            else
            {
                AddHistoryLogSignal.Dispatch(new[]
                {
                    "Enemy card '", sourceCard.SourceCard.name, "' has '", sourceCard.Health.ToString(),
                    "' Health and '", sourceCard.Defence.ToString(), "' Defence"
                }, LogType.Battle);
                DamageStruct.SourceCardView.Init(sourceCard);
            }

            DamageStruct.DamageCardView.HasAttack = false;
            BattleArena.AttackUnit.HasActive      = false;
            BattleArena.AttackUnit = null;
            InitAttackLineSignal.Dispatch(false);
            RefreshArenaSignal.Dispatch();
        }