Exemplo n.º 1
0
        public bool ConvinceRecruit(Mercenary recruit)
        {
            configurationAdapter.LoadConfigs(_configRepository);
            var firstLevelMax       = configurationAdapter.MercenaryConvinceChances[1];
            var convinceValue       = CalculateConvinceValue(recruit.Level);
            var convinceRandomValue = _randomizer.GetRandomValueInRange(1, firstLevelMax.MaxValue, "Recruits_convincing");
            var convinced           = convinceRandomValue <= convinceValue;

            if (convinced)
            {
                AddNewMercenary(recruit.CreateCharacter());
            }

            _gifts.Values.ToList().ForEach(item => _inventoryManagement.RemoveItems(item.Identyficator, item.Amount));
            _gifts.Clear();
            _recruitsRepository.Remove(recruit, _accountManagement.GetLoggedAccount().ID);
            return(convinced);
        }
Exemplo n.º 2
0
        public Mercenary GetMercenaryBaseOnTemplate(string mercenaryName, int mercenaryLevel)
        {
            var newMercenary      = new Mercenary();
            var mercenaryTemplate = _mercenaryTemplateRepository.GetAll().First(x => x.Level == mercenaryLevel.ToString() && x.Name == mercenaryName);

            newMercenary.Hp         = GetRandomValueFromTemplateRange(mercenaryTemplate.HP_range, "Mercenary_Hp");
            newMercenary.Attack_Min = GetRandomValueFromTemplateRange(mercenaryTemplate.Min_Attack_range, "Mercenary_Attack");
            newMercenary.Defence    = GetRandomValueFromTemplateRange(mercenaryTemplate.Defence_range, "Mercenary_Defence");
            newMercenary.Speed      = GetRandomValueFromTemplateRange(mercenaryTemplate.Speed_range, "Mercenary_Speed");

            newMercenary.Attack_Max = newMercenary.Attack_Min + Int32.Parse(mercenaryTemplate.Attack_add_for_max);
            newMercenary.Level      = Int32.Parse(mercenaryTemplate.Level);
            newMercenary.Name       = mercenaryTemplate.Name;
            newMercenary.ID         = $"{Guid.NewGuid().ToString()}_{newMercenary.Level}_{newMercenary.Name}";
            newMercenary.Skills     = mercenaryTemplate.Skills;

            return(newMercenary);
        }