Beispiel #1
0
    private static AbilityAttribute GetAddedDot(AttackAbility ability)
    {
        int roll         = UnityEngine.Random.Range(0, 4);
        var dotDurations = new List <float> {
            4f, 8f, 8f, 12f
        };
        var dotMultipliers = new List <float> {
            1.5f, 3f, 3f, 4f
        };
        var dotDuration   = dotDurations[roll];
        var dotMultiplier = dotMultipliers[roll];

        return(new AbilityAttribute {
            type = "addedDot",
            parameters = new List <AbilityAttributeParameter> {
                new AbilityAttributeParameter {
                    name = "degree",
                    value = AttackAbilityGenerator.CalculateDamage(ability.points * 0.5f * dotMultiplier)
                },
                new AbilityAttributeParameter {
                    name = "duration",
                    value = dotDuration
                }
            }
        });
    }
Beispiel #2
0
 public void CreateRandomEnemyBuffs(int targetLevel)
 {
     foreach (var enemy in localEnemyTypes)
     {
         var roll = RNG.Int(0, 10);
         if (roll < 5)
         {
             var roll2 = RNG.Int(0, 5);
             if (roll2 == 0)
             {
                 enemyStatBoosts.Add(enemy, RNG.List(allPrimaryStats));
             }
             else if (elementalAffinity != Element.none)
             {
                 enemyBonusAbilities.Add(enemy, AttackAbilityGenerator.Generate(targetLevel, elementalAffinity));
             }
             else
             {
                 enemyBonusAbilities.Add(enemy, AttackAbilityGenerator.Generate(targetLevel));
             }
             if (roll2 == 0)
             {
                 Debug.Log(enemy + "s have +50% " + enemyStatBoosts[enemy]);
             }
             else
             {
                 Debug.Log(enemy + "s have bonus ability " + enemyBonusAbilities[enemy].name);
             }
         }
     }
 }
    private void GenerateCooldownAbility()
    {
        AttackAbility ability = null;

        while (ability == null || ability.cooldown == 0 || WrongStat(ability) || ability.mpUsage > maxMpAvailable)
        {
            ability = AttackAbilityGenerator.Generate();
        }
        attackAbilities2.Add(ability);
    }
Beispiel #4
0
 private static AbilityAttribute GetBlunting(AttackAbility ability)
 {
     return(new AbilityAttribute {
         type = "blunting",
         parameters = new List <AbilityAttributeParameter> {
             new AbilityAttributeParameter {
                 name = "degree",
                 value = AttackAbilityGenerator.CalculateDamage(ability.points * 0.5f)
             }
         }
     });
 }
Beispiel #5
0
    public static Ability Generate(int level = 1)
    {
        var roll = RNG.Int(0, 300);

        if (roll < 100)
        {
            return(PassiveAbilityGenerator.Generate(level));
        }
        else if (roll < 273)
        {
            return(AttackAbilityGenerator.Generate(level));
        }
        else
        {
            return(UtilityAbilityGenerator.Generate(level));
        }
    }
        public void LevelAbilityThenActivateReduceDotTimeNodeThenLevel()
        {
            AttackAbility ability;

            while (true)
            {
                ability = AttackAbilityGenerator.Generate();
                if (FindReduceDotTime(ability) != null)
                {
                    break;
                }
            }
            var node = FindReduceDotTime(ability);

            ability.GainExperience(ExperienceGainer.xpTable[0]);
            node.active = true;
            node.Activate();
            var dotTimeBefore = ability.dotTime;

            ability.GainExperience(ExperienceGainer.xpTable[1]);
            var dotTimeAfter = ability.dotTime;

            Assert.AreEqual(dotTimeBefore, dotTimeAfter);
        }
    public static AttackAbility ScaleAttackAbility(float points, Element element, BaseStat baseStat, float damageRatio, float dotDamageRatio, float dotTime, bool isRanged, float cooldown, float mp, float baseMp, float radius, int icon, int hitEffect, int projectile, int aoe, List <AbilityAttribute> abilityAttributes, AbilitySkillTree skillTree)
    {
        var startingPoints = points;
        List <AbilityAttribute> paralysis = new List <AbilityAttribute>();

        foreach (var attribute in abilityAttributes)
        {
            if (attribute.type == "paralyze")
            {
                paralysis.Add(attribute);
            }
        }
        if (paralysis.Count > 0 && cooldown == 0)
        {
            foreach (var attribute in paralysis)
            {
                abilityAttributes.Remove(attribute);
            }
        }
        var newAbility = new AttackAbility {
            element          = element,
            baseStat         = baseStat,
            dotTime          = dotTime,
            isRanged         = isRanged,
            cooldown         = cooldown,
            mpUsage          = mp,
            baseMpUsage      = baseMp,
            radius           = radius,
            points           = points,
            icon             = icon,
            hitEffect        = hitEffect,
            rangedProjectile = projectile,
            aoe       = aoe,
            level     = AbilityCalculator.GetLevelFromPoints(startingPoints),
            skillTree = skillTree
        };

        ModifyAttackAbilityPointsForQualities(newAbility);
        points = newAbility.points;
        int count = 0;

        foreach (var attribute in abilityAttributes)
        {
            if (attribute.priority >= 50)
            {
                var pointCost = AbilityAttributeAppraiser.Appraise(newAbility, attribute);
                if (count < 4)
                {
                    points -= pointCost;
                }
                if (count < 4 && points >= 0)
                {
                    newAbility.attributes.Add(attribute);
                    newAbility.points -= pointCost;
                }
                else if (count < 4 && points < 0)
                {
                    points += pointCost;
                }
                count++;
            }
            else
            {
                newAbility.attributes.Add(attribute);
            }
        }
        var totalDamage   = AttackAbilityGenerator.CalculateDamage(points);
        var regularDamage = totalDamage * damageRatio / (damageRatio + dotDamageRatio);
        var dotDamage     = totalDamage * dotDamageRatio / (damageRatio + dotDamageRatio);

        newAbility.damage      = regularDamage;
        newAbility.dotDamage   = dotDamage;
        newAbility.name        = AbilityNamer.Name(newAbility);
        newAbility.description = AbilityDescriber.Describe(newAbility);
        newAbility.xp          = GetXpFromLevel(newAbility.level);
        SetMpUsage(newAbility);
        return(newAbility);
    }