Beispiel #1
0
    public void ReceiveDame(int damage, CardInBattle attacker = null)
    {
        if (card.defense.type == DefenseType.Deduction)
        {
            currentHp -= Mathf.Max(1, (damage - currentDef));
        }
        else if (card.defense.type == DefenseType.Exceed)
        {
            currentHp -= Mathf.Min(card.defense.value2, damage);
        }
        else
        {
            Mathf.Min(card.defense.value2, Mathf.Max(1, (damage - currentDef)));
        }

        if (attacker != null)
        {
            if (card.id == 53 || card.id == 54)
            {
                attacker.ReceiveDame(3);
            }
            else if (card.id == 55 || card.id == 56)
            {
                attacker.ReceiveDame(3);
            }
        }

        if (currentHp <= 0)
        {
            if (card.rebirthTo != 0)
            {
                Card newCard = SceneController.instance.GetCardByID(card.rebirthTo);
                new CardInBattle(newCard);
                //this = new CardInBattle(
            }
        }
    }
Beispiel #2
0
    public void UpDateSkill(Team myTeam, Team enemyTeam, int pos)
    {
        if (currentCooldown <= 0)
        {
            currentCooldown = card.skill.cooldown;
            switch (card.skill.skillType)
            {
            case SkillType.Heal:
                currentHp += card.skill.value1;
                break;

            case SkillType.HealAll:
                foreach (CardInBattle c in myTeam.cardinfield)
                {
                    c.ReceiveHP(card.skill.value1);
                }
                break;

            case SkillType.AddArmor:
                currentDef += card.skill.value1;
                break;

            case SkillType.AddDame:
                currentDame += card.skill.value1;
                break;

            case SkillType.Hit:
                enemyTeam.cardinfield[enemyTeam.GetNearestAttacked(pos)].ReceiveDame(card.skill.value1);
                break;

            case SkillType.HitAll:
                foreach (CardInBattle c in enemyTeam.cardinfield)
                {
                    c.ReceiveDame(card.skill.value1);
                }
                break;

            case SkillType.HitRandom:
                enemyTeam.GetRandomCard().ReceiveDame(currentDame);
                break;

            case SkillType.HitWeakest:
                enemyTeam.GetWeakestCard().ReceiveDame(currentDame);
                break;

            case SkillType.ReducesAllDame:
                foreach (CardInBattle c in enemyTeam.cardinfield)
                {
                    c.currentDame = Math.Max(1, c.currentDame - card.skill.value1);
                }
                break;

            case SkillType.AddDameRandom:
                myTeam.GetRandomCard().currentDame += card.skill.value1;
                break;

            case SkillType.ReducesRandomDame_AndHeal:
                CardInBattle ca1 = enemyTeam.GetRandomCard();
                ca1.currentDame = Math.Max(1, ca1.currentDame - card.skill.value1);
                ReceiveHP(card.skill.value1);
                //enemyTeam.GetRandomCard().currentDame += card.skill.value1;
                break;

            case SkillType.ReducesDameRandom:
                CardInBattle ca2 = enemyTeam.GetRandomCard();
                ca2.currentDame = Math.Max(1, ca2.currentDame - card.skill.value1);
                break;

            case SkillType.AddDameAll:
                foreach (CardInBattle c in myTeam.cardinfield)
                {
                    c.currentDame += card.skill.value1;
                }
                break;
            }
        }
        else if (card.skill.skillType != SkillType.None)
        {
            card.skill.cooldown -= 1;
        }
    }