コード例 #1
0
ファイル: Ability.cs プロジェクト: xantchaNZ/Metallurgy
 public void AddEffect(Effect e)
 {
     e.ParentAbilityProcChance = this.ProcChance;
     Effects.Add(e);
 }
コード例 #2
0
ファイル: Ability.cs プロジェクト: xantchaNZ/Metallurgy
        // This method assumes that the effect must be able to apply to this ability
        public double CalculateBoostBonus(Force myForce, Force enemyForce, Effect boostEffect, bool vsEpic = true)
        {
            var bonus = 0.0;
            if (boostEffect.Type == EffectType.Boost)
            {
                var boostBonus = (boostEffect.ParentAbilityProcChance * (boostEffect.EffectValue * 0.01));
                bonus += (CalculateAverageDamage(myForce, enemyForce, null, vsEpic).Damage * boostBonus);
            }
            else if (boostEffect.Type == EffectType.Rally)
            {
                var abilBonus = boostEffect.ParentAbilityProcChance * boostEffect.EffectValue * ProcChance;
                var flurryEffects = Effects.Where(x => x.Type == EffectType.FlurryDamage).ToList();
                if (flurryEffects.Count > 0)
                {
                    var baseBonus = abilBonus;
                    abilBonus = 0;
                    foreach (var flurryEffect in flurryEffects)
                    {
                        abilBonus += baseBonus * flurryEffect.EffectValue;
                    }
                }
                bonus += abilBonus;
            }

            return Math.Round(bonus, 2, MidpointRounding.AwayFromZero);
        }
コード例 #3
0
ファイル: Unit.cs プロジェクト: xantchaNZ/Metallurgy
        public double CalculateBoostBonus(Force myForce, Force enemyForce, Effect boostEffect, bool vsEpic = true)
        {
            // Find all effects that can boost this unit
            if (IsClassification(boostEffect.TargetType) == false)
            {
                return 0.0;
            }

            var bonus = 0.0;
            foreach (var unitAbility in Abilities)
            {
                bonus += unitAbility.CalculateBoostBonus(myForce, enemyForce, boostEffect, vsEpic);
            }

            return Math.Round(bonus, 2, MidpointRounding.AwayFromZero);
        }