Ejemplo n.º 1
0
        public StatsComponent()
        {
            Clock            = HitIntervalLastTicks = 0;
            Strength         = Constants.Stats.DEFAULT_STRENGTH;
            Dexterity        = Constants.Stats.DEFAULT_DEXTERITY;
            Intelligence     = Constants.Stats.DEFAULT_INTELLIGENCE;
            Constitution     = Constants.Stats.DEFAULT_CONSTITUTION;
            Spirit           = Constants.Stats.DEFAULT_SPIRIT;
            Experience       = Constants.Stats.DEFAULT_EXPERIENCE;
            ExperienceReward = Constants.Stats.DEFAULT_REWARD;
            Level            = Constants.Stats.DEFAULT_LEVEL;
            IntervalModifier = Constants.Stats.INTERVAL_MODIFIER_CONSTANT * Dexterity;
            Vision           = Constants.NPC.DEFAULT_VISION;
            ItemStrength     = 0;
            ItemDexterity    = 0;
            ItemIntelligence = 0;
            ItemConstitution = 0;
            ItemSpirit       = 0;
            ItemDamage       = 0;
            ItemHp           = 0;
            ItemRange        = 0;
            LearningPoints   = 0;

            StatsProcessor.ApplyBonuses(this);
            StatsProcessor.CalculateStats(this);
        }
Ejemplo n.º 2
0
 public void Update(float deltaTime, List <GameObject> nearbyNPC, GameMap map)
 {
     PhysicsProcessor.Update(deltaTime, nearbyNPC, map, this);
     StatsProcessor.Update(deltaTime, StatsComponent);
     SpriteProcessor.Update(deltaTime, SpriteComponent);
     AnimationProcessor.SwitchToFrameCategory(this);
 }
Ejemplo n.º 3
0
        public StatsComponent(int strength, int dexterity, int intelligence, int constitution, int spirit)
        {
            Clock            = HitIntervalLastTicks = 0;
            Strength         = strength;
            Dexterity        = dexterity;
            Intelligence     = intelligence;
            Constitution     = constitution;
            Spirit           = spirit;
            Experience       = Constants.Stats.DEFAULT_EXPERIENCE;
            ExperienceReward = Constants.Stats.DEFAULT_REWARD;
            Level            = Constants.Stats.DEFAULT_LEVEL;
            IntervalModifier = Constants.Stats.INTERVAL_MODIFIER_CONSTANT * Dexterity;
            Vision           = Constants.NPC.DEFAULT_VISION;
            ItemStrength     = 0;
            ItemDexterity    = 0;
            ItemIntelligence = 0;
            ItemConstitution = 0;
            ItemSpirit       = 0;
            ItemDamage       = 0;
            ItemHp           = 0;
            ItemRange        = 0;
            LearningPoints   = 0;

            StatsProcessor.ApplyBonuses(this);
            StatsProcessor.CalculateStats(this);
        }
Ejemplo n.º 4
0
        public StatsComponent(int range, int damage, int hp, int experience, int level, int strength, int dexterity, int intelligence, int constitution, int spirit)
        {
            Clock            = HitIntervalLastTicks = 0;
            Strength         = strength;
            Dexterity        = dexterity;
            Intelligence     = intelligence;
            Constitution     = constitution;
            Spirit           = spirit;
            Vision           = Constants.NPC.DEFAULT_VISION;
            Range            = range;
            Damage           = damage;
            CurrentHP        = HP = hp;
            IntervalModifier = Constants.Stats.INTERVAL_MODIFIER_CONSTANT * Dexterity;
            Experience       = experience;
            ExperienceReward = Constants.Stats.DEFAULT_REWARD;
            Level            = level;
            ItemStrength     = 0;
            ItemDexterity    = 0;
            ItemIntelligence = 0;
            ItemConstitution = 0;
            ItemSpirit       = 0;
            ItemDamage       = 0;
            ItemHp           = 0;
            ItemRange        = 0;
            LearningPoints   = 0;

            StatsProcessor.ApplyBonuses(this);
        }
Ejemplo n.º 5
0
        private CallabilityMetricsComputer(ILogger logger, CallabilityCalculator callability)
        {
            _logger      = logger;
            _callability = callability;
            var metricsCollection = new StatCalculatorCollection <ReferenceInterval>
            {
                _callability,
            };

            _bedProcessor = new StatsProcessor <ReferenceInterval>(metricsCollection);
        }
Ejemplo n.º 6
0
        public async Task GetDailyStatsAsyncCallsAllProviders()
        {
            var provider1 = Substitute.For <IStatsProvider>();
            var provider2 = Substitute.For <IStatsProvider>();

            provider1.When(x => x.GetStatsAsync(Arg.Is <Dictionary <string, TeamStats> >(x => x.Keys.Count == 0))).Do(Callback.First(x => x.Arg <Dictionary <string, TeamStats> >().Add("test", null)));
            var providers      = new[] { provider1, provider2 };
            var statsProcessor = new StatsProcessor(providers);
            var results        = await statsProcessor.GetDailyStatsAsync();

            await provider1.Received(1).GetStatsAsync(Arg.Is <Dictionary <string, TeamStats> >(x => x.ContainsKey("test")));
        }
Ejemplo n.º 7
0
        public void RemoveDeadGameObjects()
        {
            var npcsToRemove = new List <GameObject>();

            foreach (var npc in npcs)
            {
                if (!StatsProcessor.CheckIfAlive(npc.StatsComponent))
                {
                    npcsToRemove.Add(npc);
                }
            }

            npcsToRemove.ForEach(n => npcs.Remove(n));
        }
Ejemplo n.º 8
0
        public FfdbEngine(
            IAppLogger logger,
            IServiceProvider serviceProvider,
            IDatabaseProvider databaseProvider,
            LatestWeekValue latestWeekValue,
            IWebRequestClient webRequestClient)
        {
            _serviceProvider  = serviceProvider;
            _databaseProvider = databaseProvider;
            _latestWeekValue  = latestWeekValue;
            _webRequestClient = webRequestClient;

            Stats  = new StatsProcessor(serviceProvider);
            Team   = new TeamProcessor(serviceProvider);
            Player = new PlayerProcessor(serviceProvider);
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> SearchUsername(SearchViewModel searchViewModel)
        {
            if (ModelState.IsValid)
            {
                FindUser      findUser      = new FindUser(searchViewModel.Username);
                EpicNameModel epicNameModel = await findUser.FindUserID();

                StatsProcessor statsProcessor = new StatsProcessor();
                EpicStatsModel epicStatsModel = await statsProcessor.LoadStats(epicNameModel);

                if (epicStatsModel.Global_Stats != null & epicStatsModel.Name != null)
                {
                    ViewBag.name       = epicStatsModel.Name;
                    ViewBag.statistics = epicStatsModel.Global_Stats;
                    return(View());
                }
                ViewBag.name = "User does not exist.";
            }
            return(View());
        }
Ejemplo n.º 10
0
        private bool Attack(GameObject unit, GameObject objective)
        {
            if (unit.StatsComponent.Clock > unit.StatsComponent.HitIntervalLastTicks + Constants.Unit.DEFAULT_UNIT_HIT_INTERVAL - unit.StatsComponent.IntervalModifier)
            {
                var targetPosition = unit.PhysicsComponent.position;

                switch (unit.PhysicsComponent.FacingDirection)
                {
                case FacingDirections.UP:
                    targetPosition -= new Vector2(0, Constants.TILESIZE);
                    break;

                case FacingDirections.DOWN:
                    targetPosition += new Vector2(0, Constants.TILESIZE);
                    break;

                case FacingDirections.LEFT:
                    targetPosition -= new Vector2(Constants.TILESIZE, 0);
                    break;

                case FacingDirections.RIGHT:
                    targetPosition += new Vector2(Constants.TILESIZE, 0);
                    break;
                }

                if (objective != null && StatsProcessor.CheckIfAlive(objective.StatsComponent) && PhysicsProcessor.GetDistanceFromUnit(unit.PhysicsComponent, objective.PhysicsComponent) <= 1)
                {
                    AudioProcessor.PlaySoundEffect(Constants.SoundEffects.FXSounds.HIT);
                    unit.StatsComponent.HitIntervalLastTicks = unit.StatsComponent.Clock;
                    StatsProcessor.TakeDamage(objective.StatsComponent, unit.StatsComponent.Damage);
                    ParticlesProcessor.NewParticleStreamAt(Constants.Particles.DEFAULT_ATTACK_PARTICLES_AMMOUNT, objective.PhysicsComponent.position, Constants.Particles.ParticlesStyle.ATTACK);
                    UIProcessor.SetFloatingText(Constants.UI.DEFAULT_FLOATING_TEXT_DURATION, "-" + unit.StatsComponent.Damage, objective.PhysicsComponent.position, Color.Red);
                    if (!StatsProcessor.CheckIfAlive(objective.StatsComponent))
                    {
                        StatsProcessor.GainExperience(unit, objective.StatsComponent.ExperienceReward);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 11
0
        private static void Init()
        {
            var auth = new SingleUserAuthorizer
            {
                CredentialStore = new SingleUserInMemoryCredentialStore
                {
                    ConsumerKey       = ConfigurationManager.AppSettings["consumerKey"],
                    ConsumerSecret    = ConfigurationManager.AppSettings["consumerSecret"],
                    AccessToken       = ConfigurationManager.AppSettings["accessToken"],
                    AccessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"]
                }
            };

            Context = new TwitterContext(auth);

            serializer = new JsonSerializer();
            serializer.NullValueHandling = NullValueHandling.Ignore;

            var counter = new LettersCounterFactory().GetCounter();

            processor = new StatsProcessor(counter);
        }