private bool ConditionsMet(Card.ConditionType condition, int value)
    {
        switch (condition)
        {
        case Card.ConditionType.None:
            return(true);

        case Card.ConditionType.Even:
            return(TurnController.turnController.GetNumerOfCardsPlayedInTurn() % 2 == 0);

        case Card.ConditionType.Odd:
            return(TurnController.turnController.GetNumerOfCardsPlayedInTurn() % 2 == 1);

        default:
            return(false);
        }
    }
Exemple #2
0
    private bool ConditionsMet(GameObject caster, List <Vector2> targets, Card.ConditionType condition, int value)
    {
        List <GameObject> targs = new List <GameObject>();

        switch (condition)
        {
        case Card.ConditionType.None:
            return(true);

        case Card.ConditionType.Even:
            return(TurnController.turnController.GetNumerOfCardsPlayedInTurn() % 2 == 0);

        case Card.ConditionType.Odd:
            return(TurnController.turnController.GetNumerOfCardsPlayedInTurn() % 2 == 1);

        case Card.ConditionType.TargetBroken:
            return(GridController.gridController.GetObjectAtLocation(targets).Any(x => x.GetComponent <HealthController>().GetCurrentShield() == 0));

        case Card.ConditionType.TargetNotBroken:
            return(GridController.gridController.GetObjectAtLocation(targets).Any(x => x.GetComponent <HealthController>().GetCurrentShield() > 0));

        case Card.ConditionType.CasterBroken:
            return(caster.GetComponent <HealthController>().GetCurrentShield() == 0);

        case Card.ConditionType.CasterNotBroken:
            return(caster.GetComponent <HealthController>().GetCurrentShield() > 0);

        case Card.ConditionType.PreviousEffectSuccessful:
            return(card.GetCard().GetPreviousEffectSuccessful());

        case Card.ConditionType.CasterHasHigherShield:
            targs = GridController.gridController.GetObjectAtLocation(targets);
            int minShield = 9999999;
            foreach (GameObject obj in targs)
            {
                if (obj.GetComponent <HealthController>().GetShield() < minShield)
                {
                    minShield = obj.GetComponent <HealthController>().GetShield();
                }
            }
            return(caster.GetComponent <HealthController>().GetShield() > minShield);

        case Card.ConditionType.CasterHasLowerShield:
            targs = GridController.gridController.GetObjectAtLocation(targets);
            int maxshield = 0;
            foreach (GameObject obj in targs)
            {
                if (obj.GetComponent <HealthController>().GetShield() > maxshield)
                {
                    minShield = obj.GetComponent <HealthController>().GetShield();
                }
            }
            return(caster.GetComponent <HealthController>().GetShield() < maxshield);

        case Card.ConditionType.Else:
            return(!card.GetCard().GetPreviousConditionTrue());

        default:
            return(false);
        }
    }