当前位置: 首页>>代码示例>>C#>>正文


C# Stats.Clone方法代码示例

本文整理汇总了C#中Stats.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Stats.Clone方法的具体用法?C# Stats.Clone怎么用?C# Stats.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Stats的用法示例。


在下文中一共展示了Stats.Clone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CharacterCalculationsWarlock

        /// <param name="stats">
        /// This should already have buffStats factored in.
        /// </param>
        public CharacterCalculationsWarlock(Character character, Stats stats, Stats petBuffs)
        {
            Character = character;
            CalcOpts = character.CalculationOptions as CalculationOptionsWarlock;
            BossOpts = character.BossOptions;
            Talents = character.WarlockTalents;
            Stats = stats;
            PreProcStats = Stats.Clone();
            PetBuffs = petBuffs;
            BaseMana = BaseStats.GetBaseStats(character).Mana;
            BaseIntellect = BaseStats.GetBaseStats(character).Intellect;
            Spells = new Dictionary<string, Spell>();
            CastSpells = new Dictionary<string, Spell>();
            HitChance = Math.Min(1f, CalcOpts.GetBaseHitRate() / 100f + CalcSpellHit());

            int temp;
            if (character.SetBonusCount.TryGetValue("Shadowflame Regalia", out temp))
            {
                Warlock_T11_2P = (temp >= 2);
                Warlock_T11_4P = (temp >= 4);
            }

            if (!CalcOpts.Pet.Equals("None") && (Demonology || !CalcOpts.Pet.Equals("Felguard")))
            {
                Type type = Type.GetType("Rawr.Warlock." + CalcOpts.Pet);
                Pet = (Pet)Activator.CreateInstance(type, new object[] { this });
            }

            float personalDps = CalcPersonalDps();
            float petDps = CalcPetDps();
            SubPoints = new float[] { personalDps, petDps };
            OverallPoints = personalDps + petDps;
        }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:36,代码来源:CharacterCalculationsWarlock.cs

示例2: Update

        /// <summary>
        /// Beware when updating: The spells from an earlier returned Rotation are references to the SpellBox from this Estimation.
        /// </summary>
        /// <param name="baseStats"></param>
        /// <param name="procStats"></param>
        /// <param name="talents"></param>
        /// <param name="calcOpts"></param>
        public void Update(Stats baseStats, Stats procStats, ShamanTalents talents, CalculationOptionsElemental calcOpts)
        {
            this.baseStats = baseStats;
            this.procStats = procStats;
            this.talents = talents;
            this.calcOpts = calcOpts;

            Stats addedStats = baseStats.Clone();
            addedStats.Accumulate(procStats);
            CombatFactors combatFactors = new CombatFactors(talents, addedStats, Math.Max(calcOpts.NumberOfTargets - 1, 0), calcOpts.LatencyCast, calcOpts.LatencyGcd, calcOpts.UseFireNova, calcOpts.UseChainLightning, calcOpts.UseDpsTotem);
            spellbox.Update(combatFactors);
        }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:19,代码来源:Estimation.cs

示例3: Update

        /// <summary>
        /// Beware when updating: The spells from an earlier returned Rotation are references to the SpellBox from this Estimation.
        /// </summary>
        /// <param name="baseStats"></param>
        /// <param name="procStats"></param>
        /// <param name="talents"></param>
        /// <param name="calcOpts"></param>
        public void Update(Stats baseStats, Stats procStats, PriestTalents talents, CalculationOptionsShadowPriest calcOpts)
        {
            this.baseStats = baseStats;
            this.procStats = procStats;
            this.talents = talents;
            this.calcOpts = calcOpts;

            Stats addedStats = baseStats.Clone();
            addedStats.Accumulate(procStats);
            CombatFactors combatFactors = new CombatFactors(talents, addedStats, Math.Max(calcOpts.NumberOfTargets - 1, 0), calcOpts.LatencyCast, calcOpts.LatencyGcd);
            spellbox.Update(combatFactors);
        }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:19,代码来源:SolverBase.cs

示例4: GraphForm

        public GraphForm(Character character, bool bStats)
        {
            InitializeComponent();

            if (!bStats)
                Text = "Effective Cooldown Graph";

            // Create ARGB bitmap matching the size of the picturebox and associate with picturebox
            bmp = new Bitmap(pictureBoxGraph.Size.Width, pictureBoxGraph.Size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
            pictureBoxGraph.Image = bmp;

            // Greate & initialise GDI+ graphics object via bitmap
            gfx = Graphics.FromImage(bmp);
            gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            gfx.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            
            #region Coordinates and scaling.
            /* 
             *   +-----------------------------------------------------+-rcBmp  ---
             *   |                                                     |         |EndY
             *   |    ^                                                |        ---
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    |                                                |
             *   |    +--------------------------------------------->  | ---
             *   |                                                     |  |  OrgY
             *   +-----------------------------------------------------+ ---
             *   
             *   |----|OrgX                                         |--|EndX
             * 
             * 
             * 
             */

            // Apply a translateion transformation. We'll move the 0,0 to the 0,0 of the chart we want to display
            // This will make most of the rest of the charting easier since all translation are then done by GDI+
            // It also makes working with 'y' a bit easier as it's just flipped in sign rather than translated also.
            int OrgX = 50;  // Leftmost edge of char
            int OrgY = 50;  // Bottom edge of char
            int EndX = 15;  // Margin right of chart
            int EndY = 15;  // Margin top of chart
            gfx.TranslateTransform(OrgX, pictureBoxGraph.Size.Height - OrgY);

            // Bitmap coordinates translated back into transform
            Rectangle rcBmp = new Rectangle(0, 0, pictureBoxGraph.Size.Width, pictureBoxGraph.Size.Height);
            rcBmp.Offset(-OrgX, -(pictureBoxGraph.Size.Height - OrgY));

            // rcChart is image rectangle, watch out, Y has positive value !
            Rectangle rcChart = new Rectangle(0, 0, pictureBoxGraph.Size.Width - OrgX - EndX, pictureBoxGraph.Size.Height - OrgY - EndY);
            int YAxisValueX = - 5; // Right alignment of values on the Y axis
            int XAxisValueY = + 5; // Top margin of values on the X axis
            int YChartMargin = 5;
            #endregion

            #region Define and calculate charts
            ChartData[] aCharts;
            float DpsMax;
            float DpsMin;
            float DpsScaling;
            if (bStats)
            {
                aCharts = new ChartData[] {
                    new ChartData(rcChart.Width, Color.FromArgb(255, 192, 0, 0), "1 Strength", new Stats() { Strength = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 192, 192, 96), "1.167 Spell Power", new Stats() { SpellPower = 7/6 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 0, 0, 192), "1 Armor Pen.", new Stats() { ArmorPenetrationRating = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 192, 0, 192), "1 Hit Rating", new Stats() { HitRating = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 0, 192, 0), "1 Expertise Rating", new Stats() { ExpertiseRating = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 192, 127, 96), "1 Agility", new Stats() { Agility = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 192, 127, 0), "2 Attack Power", new Stats() { AttackPower = 2 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 96, 127, 192), "1 Crit Rating", new Stats() { CritRating = 1 }),
                    new ChartData(rcChart.Width, Color.FromArgb(255, 0, 0, 0), "1 Haste Rating", new Stats() { HasteRating = 1 }),
                };

                // Calculate charts
                CalculationsRetribution Calc = new CalculationsRetribution();
                DpsMax = 0;
                DpsMin = 999999999;
                foreach (ChartData cd in aCharts)
                {
                    for (int count = 0; count < rcChart.Width; count++)
                    {
                        Stats chartstats = cd.stats.Clone();
                        chartstats *= count - (rcChart.Width / 2);

                        CharacterCalculationsRetribution chartCalc = Calc.GetCharacterCalculations(character, new Item() { Stats = chartstats }) as CharacterCalculationsRetribution;
                        float Dps = chartCalc.DPSPoints;

                        if (Dps > DpsMax)
                            DpsMax = Dps;
                        if (Dps < DpsMin)
//.........这里部分代码省略.........
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:101,代码来源:GraphForm.cs

示例5: GetBaseStats

        public static Stats GetBaseStats(int level, CharacterClass characterClass, CharacterRace characterRace, DruidForm characterForm)
        {   // Health, Mana and some other things are same for every race.
            lock (syncLock)
            {
                #region Cache
                if (level == _lastLevel
                    && characterClass == _lastClass
                    && characterRace == _lastRace
                    && characterForm == _lastForm)
                    return _lastStats.Clone();
                _lastLevel = level;
                _lastClass = characterClass;
                _lastRace = characterRace;
                _lastForm = characterForm;
                #endregion

                Stats S = new Stats();
                #region Race, not class benefit
                // Most Level 85 Race and Class Stats come from:
                // http://code.google.com/p/simulationcraft/source/browse/branches/cataclysm/engine/sc_rating.cpp?r=6207
                // When they were still at 80 as of Jan 01st, 2011

                // From SimCraft
                Stats race = new Stats();
                switch (characterRace)
                {
                    // Alliance
                    case CharacterRace.Human:    race.Strength = 20; race.Agility = 20; race.Stamina = 20; race.Intellect = 20; race.Spirit = 20; break;
                    case CharacterRace.Dwarf:    race.Strength = 25; race.Agility = 16; race.Stamina = 21; race.Intellect = 19; race.Spirit = 19; break;
                    case CharacterRace.NightElf: race.Strength = 16; race.Agility = 24; race.Stamina = 20; race.Intellect = 20; race.Spirit = 20; break;
                    case CharacterRace.Gnome:    race.Strength = 15; race.Agility = 22; race.Stamina = 20; race.Intellect = 24; race.Spirit = 20; break;
                    case CharacterRace.Draenei:  race.Strength = 21; race.Agility = 17; race.Stamina = 20; race.Intellect = 20; race.Spirit = 22; break;
                    case CharacterRace.Worgen:   race.Strength = 23; race.Agility = 22; race.Stamina = 20; race.Intellect = 16; race.Spirit = 19; break;
                    // Horde
                    case CharacterRace.Orc:      race.Strength = 23; race.Agility = 17; race.Stamina = 21; race.Intellect = 17; race.Spirit = 22; break;
                    case CharacterRace.Undead:   race.Strength = 19; race.Agility = 18; race.Stamina = 20; race.Intellect = 18; race.Spirit = 25; break;
                    case CharacterRace.Tauren:   race.Strength = 25; race.Agility = 16; race.Stamina = 21; race.Intellect = 16; race.Spirit = 22; break;
                    case CharacterRace.Troll:    race.Strength = 21; race.Agility = 22; race.Stamina = 20; race.Intellect = 16; race.Spirit = 21; break;
                    case CharacterRace.BloodElf: race.Strength = 17; race.Agility = 22; race.Stamina = 20; race.Intellect = 23; race.Spirit = 18; break;
                    case CharacterRace.Goblin:   race.Strength = 17; race.Agility = 22; race.Stamina = 20; race.Intellect = 23; race.Spirit = 20; break;
                    default: { break; }
                };
                // From Chardev (85)
                //Class           Str Agi Sta Int Spi
                //Druid            76  69  86 136 153
                //Shaman          111  60 128 119 136
                //Death Knight    171 101 154  16  44
                //Hunter           60 178 119  77  88
                //Mage             17  26  43 187 175
                //Paladin         144  77 136  86  97
                //Priest           26  34  51 188 183
                //Rogue           102 186  94  26  53
                //Warlock          43  51  76 161 166
                //Warrior         169 103 153  17  44
                #endregion

                #region Base Stats
                #region All Classes
                S.Miss  = 0.05f;
                S.Block = 0.00f;
                S.Parry = 0.00f;
                #endregion
                switch (characterClass)
                {
                    #region Death Knight
                    case CharacterClass.DeathKnight:
                        Stats dk = new Stats() {
                            Strength = 171, Agility = 101, Stamina = 274, Intellect = 16, Spirit = 44,
                            Health = 43025f,
                            Dodge = 0.05f, Parry = 0.05f, Block = 0.00f,
                            PhysicalCrit = 0.0049f, AttackPower = 595f,
                        };
                        S.Accumulate(race);
                        S.Accumulate(dk);
                        break;
                    #endregion
                    #region Druid
                    case CharacterClass.Druid:
                        Stats druid = new Stats() {
                            Strength = 76, Agility = 69, Stamina = 86, Intellect = 136, Spirit = 153,
                            Health = 39533f, Mana = 18635f,
                            Dodge = 0.03758f, Parry = 0.05f, Block = 0.05f,
                            PhysicalCrit = 0.03192f, AttackPower = 613f,
                            SpellCrit = 0.0185f, Mp5 = 931f,
                        };
                        S.Accumulate(race);
                        S.Accumulate(druid);
                        switch (characterForm)
                        {
                            case DruidForm.Moonkin:
                            case DruidForm.Caster:
                                S.AttackPower = -10;
                                S.PhysicalCrit = 0.0743f;
                                S.Dodge = 0.0556970f; //??
                                break;
                            case DruidForm.Bear:
                                S.AttackPower = 255;
                                S.PhysicalCrit = 0.074755f;
                                S.Dodge = 0.0556970f;
                                S.BonusStaminaMultiplier = 0.2f;
//.........这里部分代码省略.........
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:101,代码来源:BaseStats.cs


注:本文中的Stats.Clone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。