public override int CalculateMp5TotalManaSpent()
        {
            var isTotemOfMisery = Modifiers
                                  .Any(x => x.Name == Constants.ModTotemOfMisery && x.IsCheckBoxChecked);
            var isTotemOfForest = Modifiers
                                  .Any(x => x.Name == Constants.ModTotemOfForestGrowth && x.IsCheckBoxChecked);
            var is2PT6 = Modifiers
                         .Any(x => x.Name == Constants.Mod2PT6Bonus && x.IsCheckBoxChecked);

            var manaChainHeal = 793;

            if (isTotemOfForest && is2PT6)
            {
                manaChainHeal = 643;
            }
            else if (isTotemOfForest)
            {
                manaChainHeal = 719;
            }
            else if (is2PT6)
            {
                manaChainHeal = 709;
            }

            var result = Player.Instance.Mp5TotalRiptides * 751 +
                         Player.Instance.Mp5TotalHW * (isTotemOfMisery ? 969 : 1044) +
                         Player.Instance.Mp5TotalLHW * 626 +
                         Player.Instance.Mp5TotalCHCasts * manaChainHeal +
                         Player.Instance.Mp5TotalESHCasts * 626 +
                         Player.Instance.Mp5BloodlustHeroism * 1142 +
                         Player.Instance.Mp5SelectedTotemTotalMana * Player.Instance.Mp5CallOfElements +
                         Player.Instance.Mp5CleanseSpirit * 307;

            return(result);
        }
Exemplo n.º 2
0
        public override double CalculateAvgHpm()
        {
            var mod2Pt7    = Modifiers.FirstOrDefault(x => x.Name == Constants.Mod2PT7Bonus).IsCheckBoxChecked;
            var multiplier = mod2Pt7 ? 5.35 : 4.92;

            // {Rip HIT * [Crtit% / 100 * 1.5 + (1 - Crit% / 100)] + [5 * Rip TICK]} / [751 - (Crit% * 4.92 )]
            var isGlyphOfRiptide = Modifiers
                                   .Any(x => x.Name == Constants.ModGlyphOfRiptide && x.IsCheckBoxChecked);

            var critChance = Player.Instance.CriticalPercent;
            var critValue  = Player.Instance.CriticalMultiplier;

            double?avgHps;

            if (isGlyphOfRiptide)
            {
                avgHps = (((critChance / 100 * critValue) +
                           (1 - critChance / 100)) * Player.Instance.Hit1Avg + (7 * Player.Instance.HotRiptide));
            }
            else
            {
                avgHps = (((critChance / 100 * critValue) +
                           (1 - critChance / 100)) * Player.Instance.Hit1Avg + (5 * Player.Instance.HotRiptide));
            }

            avgHps += Player.Instance.EarthlivingAvgHpsRP;
            avgHps += Player.Instance.AncestralAwaceningAvg * Player.Instance.CriticalPercent / 100;

            avgHps /= 751;

            return(Math.Round(avgHps ?? 0, 1));
        }
        public override int?CalculateAverageHotHPS()
        {
            var is4PT8 = Modifiers.Any(x => x.Name == Constants.Mod4PT8Bonus && x.IsCheckBoxChecked);

            double hasteBorder      = is4PT8 ? 130 : 150;
            double coefficientHaste = is4PT8 ? 0.4347826 : 0.4;

            var hastePercent = (Player.Instance.HastePercent > hasteBorder) ? hasteBorder : Player.Instance.HastePercent;

            var isGlyphOfChainHeal = Modifiers
                                     .Any(x => x.Name == Constants.ModGlyphOfChainHeal && x.IsCheckBoxChecked);

            var formula = (1 + hastePercent / 100)
                          * (Player.Instance.AvgHot1 + Player.Instance.AvgHot2 + Player.Instance.AvgHot3 + Player.Instance.AvgHot4)
                          * 3 * coefficientHaste
                          * Player.Instance.CriticalPercent / 100;

            var is4PT10Equiped = Modifiers
                                 .Any(x => x.Name == Constants.Mod4PT10Bonus && x.IsCheckBoxChecked);

            if (!is4PT10Equiped)
            {
                formula = 0;
            }

            return((int)formula);
        }
        public override double CalculateMp5Diamond()
        {
            var isInsightfulDiamond = Modifiers
                                      .Any(x => x.Name == Constants.ModMetaInsightfulEarthsiegeDiamond && x.IsCheckBoxChecked);

            if (!isInsightfulDiamond)
            {
                return(0);
            }

            var totalSomething = Player.Instance.Mp5TotalHW +
                                 Player.Instance.Mp5TotalLHW +
                                 Player.Instance.Mp5TotalRiptides +
                                 Player.Instance.Mp5TotalCHCasts +
                                 Player.Instance.Mp5BloodlustHeroism +
                                 Player.Instance.Mp5CallOfElements +
                                 Player.Instance.Mp5CleanseSpirit +
                                 Player.Instance.Mp5TotemsCount +
                                 Player.Instance.Mp5TotemicRecall +
                                 Player.Instance.Mp5TotalESHCasts;

            var result = totalSomething * 0.05 * 600;

            return(result);
        }
        public override int?CalculateAverageHPS()
        {
            var is4PT8 = Modifiers.Any(x => x.Name == Constants.Mod4PT8Bonus && x.IsCheckBoxChecked);

            double hasteBorder      = is4PT8 ? 130 : 150;
            double coefficientHaste = is4PT8 ? 0.4347826 : 0.4;

            var hastePercent = (Player.Instance.HastePercent > hasteBorder) ? hasteBorder : Player.Instance.HastePercent;

            var formula = ((Player.Instance.CriticalPercent / 100 * Player.Instance.CriticalMultiplier)
                           + (1 - Player.Instance.CriticalPercent / 100))
                          * Player.Instance.Hit1Avg * coefficientHaste * (1 + hastePercent / 100);

            var isGlyphOfChainHeal = Modifiers
                                     .Any(x => x.Name == Constants.ModGlyphOfChainHeal && x.IsCheckBoxChecked);

            var result = (int)(formula + formula * 0.6 + formula * 0.36 + formula * 0.216);

            if (!isGlyphOfChainHeal)
            {
                result = (int)(formula + formula * 0.6 + formula * 0.36);
            }

            return(result);
        }
Exemplo n.º 6
0
        private string BuildLongDesignator()
        {
            var sb = new StringBuilder();

            sb.Append(Owner.LongDesignator);
            sb.Append(".");

            foreach (var source in Sources)
            {
                sb.Append(source.LongDesignator);
                sb.Append(".");
            }

            sb.Append(Type.LongDesignator);

            if (Modifiers.Any())
            {
                foreach (var mod in Modifiers)
                {
                    sb.Append(".");
                    sb.Append(mod.LongDesignator);
                }
            }

            return(sb.ToString());
        }
Exemplo n.º 7
0
        public virtual int GetScore()
        {
            var wonModifier = Won ? 1 : -1;

            var modifierIsGame = Modifiers.Any(m => m.ModifierType == ModifierType.Valat || m.ModifierType == ModifierType.BarvniValat);

            if (Game == GameType.Berac || Game == GameType.OdprtiBerac || modifierIsGame)
            {
                ScoreDifference = 0;
            }

            if (modifierIsGame)
            {
                Game = 0;
            }

            var result = wonModifier * (int)(ScoreDifference + Game) * (int)ContraFactor;

            foreach (var mod in Modifiers)
            {
                result += (int)mod.Team *
                          (mod.Announced && mod.ModifierType != ModifierType.BarvniValat? 2 : 1) *
                          (int)mod.ModifierType *
                          (int)mod.ContraFactor;
            }

            if (modifierIsGame)
            {
                result = result * (int)ContraFactor;
            }

            return(result);
        }
        public override double CalculateMp5Totems()
        {
            var isGlyphOfManaTideTotem = Modifiers
                                         .Any(x => x.Name == Constants.ModGlyphOfManaTideTotem && x.IsCheckBoxChecked);

            var rezult = Player.Instance.Mana * (isGlyphOfManaTideTotem ? 0.28d : 0.24d) * Player.Instance.Mp5TotemsCount;

            return(Math.Round(rezult));
        }
Exemplo n.º 9
0
        public override int?CalculateAverageAAHPS()
        {
            var is2PT8Equiped = Modifiers
                                .Any(x => x.Name == Constants.Mod2PT8Bonus && x.IsCheckBoxChecked);

            int cooldown = is2PT8Equiped ? 500 : 600;

            var hps = Player.Instance.CriticalPercent * Player.Instance.AncestralAwaceningAvg / cooldown;

            return((int?)hps);
        }
Exemplo n.º 10
0
        public override int?CalculateEarthlivingAvgHpsLHW()
        {
            var isGlyphOfEarthliving = Modifiers
                                       .Any(x => x.Name == Constants.ModGlyphOfEarthliving && x.IsCheckBoxChecked);

            double multiplier = isGlyphOfEarthliving ? 0.25 : 0.2;

            var result = Player.Instance.EarthlivingTick * multiplier * 4;

            return((int?)result);
        }
Exemplo n.º 11
0
        public override int CalculateEarthlivingEHPS()
        {
            var is2PT8Equiped = Modifiers
                                .Any(x => x.Name == Constants.Mod2PT8Bonus && x.IsCheckBoxChecked);

            int cooldown = is2PT8Equiped ? 5 : 6;

            var formula = Player.Instance.EarthlivingAvgHpsRP / cooldown;

            return((int)formula);
        }
        public override double?CalculateCastingTime()
        {
            var is4PT8 = Modifiers.Any(x => x.Name == Constants.Mod4PT8Bonus && x.IsCheckBoxChecked);

            double baseCastingTime = is4PT8 ? 2.3 : 2.5;

            var castingTime = baseCastingTime / (1 + Player.Instance.HastePercent / 100);

            castingTime = Math.Truncate(castingTime * 1000) / 1000;

            return(castingTime);
        }
Exemplo n.º 13
0
        public override string ValidateInternally()
        {
            var sb      = new StringBuilder();
            var changed = Modifiers.Any(modifier => modifier.HasChanged);

            if (!changed)
            {
                sb.AppendLine("Nothing changed\nDo some changes or cancel the operation.");
            }


            return(sb.ToString());
        }
        public override int CalculateEarthlivingEHPS()
        {
            var isTidalWaves = Modifiers.Any(x => x.Name == Constants.ModTidalWavesHaste && x.IsCheckBoxChecked);

            double hasteBorder      = isTidalWaves ? 75 : 150;
            double coefficientHaste = isTidalWaves ? 0.57143 : 0.4;

            var hastePercent = (Player.Instance.HastePercent > hasteBorder) ? hasteBorder : Player.Instance.HastePercent;

            var formula = Player.Instance.EarthlivingAvgHpsHW * (1 + hastePercent / 100) * coefficientHaste;

            return((int)formula);
        }
        public override int?CalculateAverageHOT3()
        {
            var hot = (int)(Player.Instance.Crit3Avg * 0.25 / 3);
            var is4PiecesEquiped = Modifiers
                                   .Any(x => x.Name == Constants.Mod4PT10Bonus && x.IsCheckBoxChecked);

            if (!is4PiecesEquiped)
            {
                hot = 0;
            }

            return(hot);
        }
Exemplo n.º 16
0
        public override int?CalculateAverageHotHPS()
        {
            var is2PT8Equiped = Modifiers
                                .Any(x => x.Name == Constants.Mod2PT8Bonus && x.IsCheckBoxChecked);

            int cooldown      = is2PT8Equiped ? 5 : 6;
            int hotMultiplier = is2PT8Equiped ? 1 : 2;

            var avgHps = (((Player.Instance.CriticalPercent / 100 * Player.Instance.CriticalMultiplier) +
                           (1 - Player.Instance.CriticalPercent / 100)) * Player.Instance.Hit1Avg + (hotMultiplier * Player.Instance.HotRiptide)) / cooldown;

            return((int?)avgHps);;
        }
        public override int CalculateEarthlivingEHPS()
        {
            var is4PT8 = Modifiers.Any(x => x.Name == Constants.Mod4PT8Bonus && x.IsCheckBoxChecked);

            double hasteBorder      = is4PT8 ? 130 : 150;
            double coefficientHaste = is4PT8 ? 0.4347826 : 0.4;

            var hastePercent = (Player.Instance.HastePercent > hasteBorder) ? hasteBorder : Player.Instance.HastePercent;

            var formula = Player.Instance.EarthlivingAvgHpsCH * (1 + hastePercent / 100) * coefficientHaste;

            return((int)formula);
        }
Exemplo n.º 18
0
        public override StringTag Validate(params object[] parameters)
        {
            var sb      = new StringBuilder();
            var changed = Modifiers.Any(modifier => modifier.HasChanged);

            if (!changed)
            {
                sb.AppendLine("Nothing changed\nDo some changes or cancel the operation.");
            }


            return(new StringTag(sb.ToString()));
        }
Exemplo n.º 19
0
        /// <summary>
        /// Calculates the specified values.
        /// </summary>
        public override IEnumerable <Object> Calculate(IEnumerable <Object> values)
        {
            if (values != null && Modifiers.Any())
            {
                var result = new List <Object>();
                foreach (var modifier in Modifiers)
                {
                    result.AddRange(values.SelectMany(node => modifier.ModifySelection(node)));
                }
                return(result);
            }

            return(values);
        }
        public override int?CalculateTarget1HitTo()
        {
            var isSteamcallerTotem = Modifiers
                                     .Any(x => x.Name == Constants.ModSteamcallersTotem && x.IsCheckBoxChecked);
            var isTotemOfTheBay = Modifiers
                                  .Any(x => x.Name == Constants.ModTotemOfTheBay && x.IsCheckBoxChecked);

            int a = isSteamcallerTotem ? 243 : 0;

            a = isTotemOfTheBay ? 102 : a;

            int rounded = (int)((int)(1.342 * Player.Instance.SpellPower + 1205 + a) * 1.32);

            return(rounded);
        }
            public override string ToString()
            {
                var sb = new StringBuilder();

                sb.Append(Text);
                sb.Append(" (");
                sb.Append(Type);
                sb.Append(":");

                sb.Append(Modifiers.Any() ? string.Join("|", Modifiers) : "none");

                sb.Append(")");

                return(sb.ToString());
            }
        public override int?CalculateEarthlivingAvgHpsCH()
        {
            var isGlyphOfChainHeal = Modifiers
                                     .Any(x => x.Name == Constants.ModGlyphOfChainHeal && x.IsCheckBoxChecked);
            var isGlyphOfEarthliving = Modifiers
                                       .Any(x => x.Name == Constants.ModGlyphOfEarthliving && x.IsCheckBoxChecked);

            double a          = isGlyphOfChainHeal ? 4 : 3;
            double b          = isGlyphOfEarthliving ? 0.25 : 0.2;
            double multiplier = a * b;

            // tick * (3 * 0.2) *4
            var result = Player.Instance.EarthlivingTick * multiplier * 4;

            return((int?)result);
        }
        public override int?CalculateAvgGlyphOfHealingWave()
        {
            var isGlyphOfHealingWave = Modifiers
                                       .Any(x => x.Name == Constants.ModGlyphOfHealingWave && x.IsCheckBoxChecked);

            if (!isGlyphOfHealingWave)
            {
                return(0);
            }

            var result = CalculateAverageHPS() * 0.2;

            result *= Player.Instance.CriticalPercent / 100 * Player.Instance.CriticalMultiplier +
                      (1 - Player.Instance.CriticalPercent / 100);

            return((int?)result);
        }
Exemplo n.º 24
0
        public bool HasStrumMode(ChordStrum strum)
        {
            var ret = false;

            if (strum.HasFlag(ChordStrum.High))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumHigh);
            }
            else if (strum.HasFlag(ChordStrum.Mid))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumMed);
            }
            else if (strum.HasFlag(ChordStrum.Low))
            {
                ret = Modifiers.Any(x => x.ModifierType == ChordModifierType.ChordStrumLow);
            }
            return(ret);
        }
Exemplo n.º 25
0
        private static DeclarationOrder?GetDeclarationOrder(MemberDeclarationSyntax member)
        {
            DeclarationOrder?order = null;

            switch (member.Kind())
            {
            case SyntaxKind.MethodDeclaration:
                order = DeclarationOrder.Method;
                break;

            case SyntaxKind.FieldDeclaration:
                if ((member as FieldDeclarationSyntax) !.Modifiers.Any(SyntaxKind.ConstKeyword))
                {
                    order = DeclarationOrder.Constant;
                }
                else
                {
                    order = DeclarationOrder.Field;
                }
                break;
Exemplo n.º 26
0
        public override string ToPovCode()
        {
            string povCode = $"{Type} {{\n ";

            if (Locals.Any())
            {
                povCode += "\n";
                povCode += string.Join("\n", Locals.Select(mod => mod.ToPovCode()));
                povCode += "\n";
            }
            povCode += this.BuildPovCode();
            if (Modifiers.Any())
            {
                povCode += "\n";
                povCode += string.Join("\n", Modifiers.Select(mod => mod.ToPovCode()));
                povCode += "\n";
            }
            povCode += "}";
            return(povCode);
        }
Exemplo n.º 27
0
    /// <inheritdoc cref="CSharpSyntaxRewriter.Visit(SyntaxNode?)"/>
    public MethodDeclarationSyntax?Visit(MethodDeclarationSyntax?node)
    {
        this.currentMethod = node;

        var updatedNode = (MethodDeclarationSyntax?)base.Visit(node) !;

        updatedNode = updatedNode.ReplaceAndTrackType(updatedNode.ReturnType, node !.ReturnType, SemanticModel.For(node), DiscoveredTypes);

        if (node !.Modifiers.Any(m => m.IsKind(SyntaxKind.AsyncKeyword)))
        {
            Diagnostics.Add(AsyncModifierOnMethodOrFunction, node);
        }

        if (node !.Modifiers.Any(m => m.IsKind(SyntaxKind.UnsafeKeyword)))
        {
            Diagnostics.Add(UnsafeModifierOnMethodOrFunction, node);
        }

        if (updatedNode is not null)
        {
            var implicitBlock = Block(this.implicitVariables.Select(static v => LocalDeclarationStatement(v)).ToArray());
        public override double CalculateAvgHpm()
        {
            var isGlyphOfChainHeal = Modifiers.Any(x => x.Name == Constants.ModGlyphOfChainHeal && x.IsCheckBoxChecked);
            var isTotemOfForest    = Modifiers.Any(x => x.Name == Constants.ModTotemOfForestGrowth && x.IsCheckBoxChecked);
            var is2PT6             = Modifiers.Any(x => x.Name == Constants.Mod2PT6Bonus && x.IsCheckBoxChecked);

            var avgHit = Player.Instance.Hit1Avg + Player.Instance.Hit2Avg + Player.Instance.Hit3Avg;

            if (isGlyphOfChainHeal)
            {
                avgHit += Player.Instance.Hit4Avg;
            }

            var manaChainHeal = 793;

            if (isTotemOfForest && is2PT6)
            {
                manaChainHeal = 643;
            }
            else if (isTotemOfForest)
            {
                manaChainHeal = 719;
            }
            else if (is2PT6)
            {
                manaChainHeal = 709;
            }

            var result = avgHit * (Player.Instance.CriticalPercent / 100 * Player.Instance.CriticalMultiplier +
                                   (1 - Player.Instance.CriticalPercent / 100));

            result += Player.Instance.EarthlivingAvgHpsCH;

            result += (Player.Instance.AvgHot1 + Player.Instance.AvgHot2 + Player.Instance.AvgHot3 + Player.Instance.AvgHot4)
                      * 3 * Player.Instance.CriticalPercent / 100;

            result /= manaChainHeal;

            return(Math.Round(result ?? 0, 1));
        }
Exemplo n.º 29
0
            public override string ToString()
            {
                var sb = new StringBuilder();

                sb.Append(Text);
                sb.Append(" (");
                sb.Append(Type);
                sb.Append(":");

                if (Modifiers?.Any() == true)
                {
                    sb.Append(string.Join("|", Modifiers));
                }
                else
                {
                    sb.Append("none");
                }

                sb.Append(")");

                return(sb.ToString());
            }
        /// <summary>
        /// If the given <paramref name="asyncKeyword"/> is default, remove all async keywords, if any.
        /// Otherwise, replace the existing <see cref="AsyncKeyword"/> (the first one) or add a new one.
        /// </summary>
        private protected SyntaxTokenList UpdateAsyncKeyword(SyntaxToken asyncKeyword)
        {
            // Remove *all* async keywords if any, i.e, after this call, AsyncKeyword property should return 'default'.
            if (asyncKeyword == default)
            {
                if (Modifiers.Any(SyntaxKind.AsyncKeyword))
                {
                    return(new SyntaxTokenList(Modifiers.Where(m => !m.IsKind(SyntaxKind.AsyncKeyword))));
                }

                return(Modifiers);
            }

            // add or replace.
            var existingAsync = AsyncKeyword;

            if (existingAsync == default)
            {
                return(Modifiers.Add(asyncKeyword));
            }

            return(Modifiers.Replace(existingAsync, asyncKeyword));
        }