Esempio n. 1
0
    public override IEffectDescription Generate()
    {
        DrawEffectDescription desc = new DrawEffectDescription();

        desc.drawModifier = ProceduralUtils.GetRandomValue <DrawModifier>(random, model);

        // Find the bounds of card amounts
        int max = ProceduralUtils.GetUpperBound(desc, ref desc.amount, MIN_CARDS, MAX_CARDS, maxAllocatedBudget);
        int min = ProceduralUtils.GetLowerBound(desc, ref desc.amount, MIN_CARDS, max, minAllocatedBudget);

        Assert.IsTrue(max >= min);
        desc.amount = random.Next(min, max);

        // Attempt to narrow down the qualifier pool
        SortedSet <QualifierType> allowableQualifiers = CardEnums.GetValidFlags <QualifierType>(EffectType.DRAW_CARDS);

        QualifierType qualifier = ProceduralUtils.GetRandomValue(random, model, allowableQualifiers);

        if (qualifier != QualifierType.NONE)
        {
            IProceduralQualifierGenerator qualifierGen = ProceduralUtils.GetProceduralGenerator(qualifier);
            qualifierGen.SetupParameters(random, model, minAllocatedBudget / desc.PowerLevel(), maxAllocatedBudget / desc.PowerLevel());
            desc.cardQualifier = qualifierGen.Generate();
        }

        return(desc);
    }
    public override IModifierDescription Generate()
    {
        ManaCostModifierDescription desc = new ManaCostModifierDescription(positive);

        int max = ProceduralUtils.GetUpperBound(desc, ref desc.manaCost, MIN_STATS, MAX_STATS, maxAllocatedBudget);
        int min = ProceduralUtils.GetLowerBound(desc, ref desc.manaCost, MIN_STATS, MAX_STATS, minAllocatedBudget);

        desc.manaCost = random.Next(min, max + 1);

        return(desc);
    }
Esempio n. 3
0
    public override ITargettingDescription Generate()
    {
        TargetXDescription desc = new TargetXDescription(targetType, alignment);

        // Find the bounds of card amounts
        int max = ProceduralUtils.GetUpperBound(desc, ref desc.amount, MinTargets(), MaxTargets(), maxAllocatedBudget);
        int min = ProceduralUtils.GetLowerBound(desc, ref desc.amount, MinTargets(), max, minAllocatedBudget);

        Assert.IsTrue(max >= min);
        desc.amount = random.Next(min, max);

        return(desc);
    }
Esempio n. 4
0
    public override IEffectDescription Generate()
    {
        DamageEffectDescription desc = new DamageEffectDescription(heal);

        // Find the bounds of damage amounds
        int max = ProceduralUtils.GetUpperBound(desc, ref desc.amount, MIN_DAMAGE, MAX_DAMAGE, maxAllocatedBudget);
        int min = ProceduralUtils.GetLowerBound(desc, ref desc.amount, MIN_DAMAGE, max, minAllocatedBudget);

        Assert.IsTrue(max >= min);
        desc.amount = random.Next(min, max + 1);

        return(desc);
    }
Esempio n. 5
0
    public override IEffectDescription Generate()
    {
        SummonEffectDescription desc = new SummonEffectDescription();

        desc.tokenType = ProceduralUtils.GetRandomValue <CreatureType>(random, model);
        desc.manaCost  = creatureModelIndex.GetToken(desc.tokenType).manaCost;

        // Find the bounds of card amounts
        int max = ProceduralUtils.GetUpperBound(desc, ref desc.amount, MIN_SUMMONS, MAX_SUMMONS, maxAllocatedBudget);
        int min = ProceduralUtils.GetLowerBound(desc, ref desc.amount, MIN_SUMMONS, max, minAllocatedBudget);

        Assert.IsTrue(max >= min);
        desc.amount = random.Next(min, max);

        return(desc);
    }
    public override IModifierDescription Generate()
    {
        StatModifierDescription desc = new StatModifierDescription(positive);

        int singleMax = ProceduralUtils.GetUpperBound(desc, ref desc.atk, MIN_STATS, MAX_STATS, maxAllocatedBudget);
        int singleMin = ProceduralUtils.GetLowerBound(desc, ref desc.atk, MIN_STATS, MAX_STATS, minAllocatedBudget);

        int doubleMax = ProceduralUtils.GetUpperBound(desc, ref desc.atk, ref desc.def, MIN_STATS, MAX_STATS, maxAllocatedBudget);
        int doubleMin = ProceduralUtils.GetLowerBound(desc, ref desc.atk, ref desc.def, MIN_STATS, MAX_STATS, minAllocatedBudget);

        bool single = random.NextDouble() > 0.5;
        bool atk    = random.NextDouble() > 0.5;

        if (!single && singleMax == 1)
        {
            single = true;
        }
        else if (single && doubleMin * 2 > singleMax)
        {
            single = false;
        }

        if (single)
        {
            int value = random.Next(singleMin, singleMax + 1);

            if (atk)
            {
                desc.atk = value;
            }
            else
            {
                desc.def = value;
            }
        }
        else
        {
            int value = random.Next(doubleMin, doubleMax + 1);
            desc.atk = value;
            desc.def = value;
        }

        return(desc);
    }