Exemple #1
0
    public void CardBattle(CardController attacker, CardController defender)
    {
        attacker.model.Attack(defender);
        defender.model.Attack(attacker);

        attacker.CheckAlive();
        defender.CheckAlive();
    }
Exemple #2
0
 public void CardBattle(CardController attacker, CardController defender)
 {
     Debug.Log("CardBattle");
     Debug.Log("attacker HP : " + attacker.model.hp);
     Debug.Log("defender HP : " + defender.model.hp);
     attacker.Attack(defender);
     defender.Attack(attacker);
     Debug.Log("attacker HP : " + attacker.model.hp);
     Debug.Log("defender HP : " + defender.model.hp);
     attacker.CheckAlive();
     defender.CheckAlive();
 }
Exemple #3
0
    public void CardBattle(CardController attacker, CardController defender)//カード同士の戦いの処理
    {
        Debug.Log("CardBattle");
        Debug.Log("attacker HP:" + attacker.model.hp);
        Debug.Log("defender HP:" + defender.model.hp);

        attacker.Attack(defender);
        defender.Attack(attacker);

        DamageToHero(attacker, defender);
        ShowHeroHP();

        Debug.Log("attacker HP:" + attacker.model.hp);
        Debug.Log("defender HP:" + defender.model.hp);

        attacker.CheckAlive();
        defender.CheckAlive();
    }
/*
 * 敵がいないのに攻撃しようとしている=> 敵AIのチェックと同様にすればよい
 */

    public void UseSpellTo(CardController target)
    {
        switch (cardModel.spell)
        {
        case SPELL.DAMAGE_ENEMY_CARD:
            // 特定の敵を攻撃する
            if (target == null)
            {
                return;
            }
            if (target.cardModel.isPlayerCard == cardModel.isPlayerCard)
            {
                return;
            }
            Attack(target);
            target.CheckAlive();
            break;

        case SPELL.DAMAGE_ENEMY_CARDS:
            // 相手フィールドの全てのカードに攻撃する
            CardController[] enemyCards = gameManager.GetEnemyFieldCards(this.cardModel.isPlayerCard);
            foreach (CardController enemyCard in enemyCards)
            {
                Attack(enemyCard);
            }
            foreach (CardController enemyCard in enemyCards)
            {
                enemyCard.CheckAlive();
            }
            break;

        case SPELL.DAMAGE_ENEMY_HERO:
            // 敵ヒーローを攻撃する
            gameManager.AttackToHero(this);
            break;

        case SPELL.HEAL_FRIEND_CARD:
            if (target == null)
            {
                return;
            }
            if (target.cardModel.isPlayerCard != cardModel.isPlayerCard)
            {
                return;
            }
            Heal(target);
            break;

        case SPELL.HEAL_FRIEND_CARDS:
            // 相手フィールドの全てのカードに攻撃する
            CardController[] friendCards = gameManager.GetFriendFieldCards(this.cardModel.isPlayerCard);
            foreach (CardController friendCard in friendCards)
            {
                Heal(friendCard);
            }
            break;

        case SPELL.HEAL_FRIEND_HERO:
            gameManager.HealToHero(this);
            break;

        case SPELL.NONE:
            return;
        }
        gameManager.ReducdeManaCost(cardModel.cost, cardModel.isPlayerCard);
        Destroy(this.gameObject);
    }