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 } } }); }
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) } } }); }
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); }