コード例 #1
0
ファイル: Program.cs プロジェクト: majeretft/Talented
        public static void Main(string[] args)
        {
            var idr = new InitialDataReader();
            var talents = idr.GetTalents();
            var toons = idr.GetToons();

            var c = new Calculator(toons, talents);

            var cas = new CastleRuntime
            {
                Toon = new Guid("dfa1673e-4c53-4f63-97df-876948b8b3a7"),
                CastleStatDistribution = new Dictionary<StatTypeEnum, byte>(),
                TalentLevelDistribution = new Dictionary<Guid, byte>()
            };

            cas.CastleStatDistribution.Add(StatTypeEnum.Agility, 42);

            cas.TalentLevelDistribution.Add(new Guid("6f779e8f-11d6-4e10-965d-6eeabf465d49"), 5);

            var bat = new BattleRuntime
            {
                IsMaxScore = true,
                IsMaxTime = true,
                TerrainType = TerrainTypeEnum.Foreign | TerrainTypeEnum.Neutral
            };

            var result = c.Calculate(cas, bat);
        }
コード例 #2
0
ファイル: Calculator.cs プロジェクト: majeretft/Talented
        /// <summary>
        /// Calculate all data
        /// </summary>
        /// <param name="castle">Current castle context</param>
        /// <param name="battle">Current battle context</param>
        /// <returns>Calculated data</returns>
        public CalculationResult Calculate(CastleRuntime castle, BattleRuntime battle)
        {
            if (castle == null)
                throw new ArgumentNullException("castle");

            var cr = new CalculationResult();
            var currentToon = GetUsedToon(castle.Toon);

            // Calculate and append stats provided by talents and its bonuses
            var talc = new TalentCalculator(commonFunctions.ApplyStatValue);
            talc.Calculate(GetUsedTalents(castle.TalentLevelDistribution), castle.TalentLevelDistribution, battle, cr);

            // Calculate and append stats provided by toon and talents might
            var toonc = new ToonCalculator(commonFunctions.ApplyStatValue);
            toonc.Calculate(currentToon, cr);

            // Calculate and append stats distributed in castle (such as guild bonuses, stats for character level, ect.)
            var sdc = new StatDistributionCalculator(commonFunctions.ApplyStatValue);
            sdc.Calculate(castle.CastleStatDistribution, cr);

            // Calculate and append values of dependent properties
            var dpc = new DependentPropertiesCaclulator();
            dpc.Calculate(cr, currentToon.MainAttackStat, currentToon.AttackModifier);

            return cr;
        }