Exemplo n.º 1
0
        public static Handcard GetOppositeCard(Playfield p, FightState currentSituation)
        {
            if (p.enemyKingsTower.HP < Apollo.Setting.KingTowerSpellDamagingHealth)
            {
                Handcard hc = AttackKingTowerWithSpell(p);

                if (hc != null)
                {
                    return(hc);
                }
            }

            switch (currentSituation)
            {
            case FightState.UAKTL1:
            case FightState.UAKTL2:
            case FightState.UAPTL1:
            case FightState.UAPTL2:
            case FightState.AKT:
            case FightState.APTL1:
            case FightState.APTL2:
            case FightState.DKT:
            case FightState.DPTL1:
            case FightState.DPTL2:
            {
                BoardObj defender = Decision.GetBestDefender(p);

                if (defender == null)
                {
                    return(null);
                }

                Logger.Debug("BestDefender: {Defender}", defender.ToString());
                opposite spell = KnowledgeBase.Instance.getOppositeToAll(p, defender, Decision.CanWaitDecision(p, currentSituation));

                if (spell != null && spell.hc != null)
                {
                    Logger.Debug("Spell: {Sp} - MissingMana: {MM}", spell.hc.name, spell.hc.missingMana);
                    if (spell.hc.missingMana == 100)         // Oposite-Card is already on the field
                    {
                        return(null);
                    }
                    else if (spell.hc.missingMana > 0)
                    {
                        return(null);
                    }
                    else
                    {
                        return(spell.hc);
                    }
                }
            }
            break;

            case FightState.START:
            case FightState.WAIT:
            default:
                break;
            }
            return(null);
        }