Example #1
0
 public static void DropCreatureCard(Transform c, Transform p, CardInstance cardInst)
 {
     cardInst.state = CardInstance.State.Flatfooted;
     //Execute card special abilities here.
     SetParentForCard(c, p);
     gameManager.currentPlayer.DropCard(cardInst);
 }
Example #2
0
 public void DropCard(CardInstance inst)
 {
     if (handCards.Contains(inst))
     {
         handCards.Remove(inst);
     }
     downCards.Add(inst);
 }
Example #3
0
        public void Battle(CardInstance attacker, CardInstance target)
        {
            // we're attacking a card
            CardElement attackersElement = attacker.viz.card.element;
            CardElement targetsElement   = target.viz.card.element;

            int attackersAttack = attacker.GetAttack();
            int targetsAttack   = target.GetAttack();

            if (attackersElement.Counters(targetsElement))
            {
                attackersAttack = attackersAttack + attacker.GetElementalPower();
            }
            else if (targetsElement.Counters(attackersElement))
            {
                targetsAttack = targetsAttack + target.GetElementalPower();
            }
            attacker.Damage(targetsAttack);
            target.Damage(attackersAttack);
        }
Example #4
0
 public void Battle(CardInstance attacker, Player player)
 {
     player.Damage(attacker.GetAttack());
 }
Example #5
0
        public override void Execute(float d)
        {
            if (Input.GetMouseButtonDown(0))
            {
                List <RaycastResult> results       = Settings.GetUIObjs();
                GameManager          gm            = GameManager.singleton;
                PlayerHolder         currentPlayer = gm.currentPlayer;
                PlayerHolder[]       all_players   = gm.all_players;
                PlayerHolder         otherPlayer   = gm.GetEnemyOf(currentPlayer);

                foreach (RaycastResult r in results)
                {
                    Damageable    target  = r.gameObject.GetComponentInParent(typeof(Damageable)) as Damageable;
                    PlayerStatsUI target2 = r.gameObject.GetComponentInParent(typeof(PlayerStatsUI)) as PlayerStatsUI;
                    if (target == null)
                    {
                        continue;
                    }
                    if (target is Player && target2.player == otherPlayer)
                    {
                        if (attacker != null)
                        {
                            attacker.viz.outline.SetActive(false);
                            attacker.state = CardInstance.State.Tired;
                            //resolveCombat.Battle(attacker,(Player)target);
                            otherPlayer.Damage(attacker.GetAttack());
                            Debug.Log(attacker);
                            Debug.Log(target);
                            attacker = null;
                        }
                    }
                    else if (target is CardInstance)
                    {
                        CardInstance card = (CardInstance)target;
                        if (currentPlayer.downCards.Contains(card))
                        {
                            if (card.CanAttack())
                            {
                                if (attacker != null)                                                                           //if we already have an attacker disable it
                                {
                                    attacker.state = CardInstance.State.Idle;
                                    attacker.viz.outline.SetActive(false);
                                    if (attacker == card)
                                    {
                                        attacker = null;
                                        continue;
                                    }
                                }
                                attacker       = card;
                                attacker.state = CardInstance.State.Attacking;
                                attacker.viz.outline.SetActive(true);
                            }
                        }
                        else if (otherPlayer.downCards.Contains(card))
                        {
                            if (attacker != null)
                            {
                                attacker.viz.outline.SetActive(false);
                                attacker.state = CardInstance.State.Attacking;
                                resolveCombat.Battle(attacker, card);
                                attacker = null;
                            }
                        }
                    }
                }
            }
        }
Example #6
0
 public void Set(CardInstance v)
 {
     value = v;
 }