private void FillSurvivalBonusesFromPerks([NotNull, ItemNotNull] ref List <SurvivalStatBonus> bonusList)
        {
            if (EvolutionData == null)
            {
                return;
            }

            var archievedPerks = EvolutionData.GetArchievedPerks();

            foreach (var archievedPerk in archievedPerks)
            {
                var currentLevel       = archievedPerk.CurrentLevel;
                var currentLevelScheme = archievedPerk.Scheme.Levels[currentLevel.Primary];

                if (currentLevelScheme.Rules == null)
                {
                    continue;
                }

                for (var i = 0; i <= currentLevel.Sub; i++)
                {
                    foreach (var rule in currentLevelScheme.Rules)
                    {
                        if (rule.Type == PersonRuleType.Health)
                        {
                            BonusToHealth(rule.Level, PersonRuleDirection.Positive, ref bonusList);
                        }
                    }
                }
            }
        }
        private IEnumerable <IPerk> GetPerksSafe()
        {
            var perks = EvolutionData?.GetArchievedPerks();

            if (perks == null)
            {
                perks = new IPerk[0];
            }

            return(perks);
        }
Beispiel #3
0
        public HumanPerson Create()
        {
            var personScheme = _schemeService.GetScheme <IPersonScheme>("human-person");

            var inventory = new Inventory();

            var evolutionData = new EvolutionData(_schemeService);

            var defaultActScheme = _schemeService.GetScheme <ITacticalActScheme>(personScheme.DefaultAct);

            var person = new HumanPerson(personScheme, defaultActScheme, evolutionData, _survivalRandomSource, inventory);

            var headDropScheme = GetHeads();

            FillSlot(person, headDropScheme, HEAD_SLOT_INDEX);

            var armorDropScheme = GetArmors();

            FillSlot(person, armorDropScheme, BODY_SLOT_INDEX);

            var mainWeaponDropScheme = GetMainWeapons();

            FillSlot(person, mainWeaponDropScheme, MAIN_HAND_SLOT_INDEX);

            var offWeaponDropScheme = GetOffWeapons();

            FillSlot(person, offWeaponDropScheme, OFF_HAND_SLOT_INDEX);

            var startPropDropScheme = GetStartProps();
            var startProps          = _dropResolver.Resolve(new[] { startPropDropScheme });

            foreach (var prop in startProps)
            {
                AddPropToInventory(inventory, prop);
            }

            AddResource(inventory, "packed-food", 1);
            AddResource(inventory, "water-bottle", 1);
            AddResource(inventory, "med-kit", 1);


            return(person);
        }
        /// <summary>
        /// Расчёт бонусов, которые дают перки.
        /// </summary>
        /// <param name="bonusDict"> Текущее состояние бонусов. </param>
        private void CalcPerkBonuses(Dictionary <SkillStatType, float> bonusDict)
        {
            var archievedPerks = EvolutionData.GetArchievedPerks();

            foreach (var archievedPerk in archievedPerks)
            {
                var currentLevel       = archievedPerk.CurrentLevel;
                var currentLevelScheme = archievedPerk.Scheme.Levels[currentLevel.Primary];

                if (currentLevelScheme.Rules == null)
                {
                    continue;
                }

                for (var i = 0; i <= currentLevel.Sub; i++)
                {
                    foreach (var rule in currentLevelScheme.Rules)
                    {
                        CalcRuleBonuses(rule, bonusDict);
                    }
                }
            }
        }
        public HumanPerson Create()
        {
            var personScheme = _schemeService.GetScheme <IPersonScheme>("human-person");

            var inventory = new Inventory();

            var evolutionData = new EvolutionData(_schemeService);

            var defaultActScheme = _schemeService.GetScheme <ITacticalActScheme>(personScheme.DefaultAct);

            var person = new HumanPerson(personScheme, defaultActScheme, evolutionData, _survivalRandomSource, inventory);

            var classRoll = _dice.RollD6();

            switch (classRoll)
            {
            case 1:
                AddEquipment(person.EquipmentCarrier, 2, "short-sword");
                AddEquipment(person.EquipmentCarrier, 1, "steel-armor");
                AddEquipment(person.EquipmentCarrier, 3, "wooden-shield");
                break;

            case 2:
                AddEquipment(person.EquipmentCarrier, 2, "battle-axe");
                AddEquipment(person.EquipmentCarrier, 3, "battle-axe");
                AddEquipment(person.EquipmentCarrier, 0, "highlander-helmet");
                break;

            case 3:
                AddEquipment(person.EquipmentCarrier, 2, "bow");
                AddEquipment(person.EquipmentCarrier, 1, "leather-jacket");
                AddEquipment(inventory, "short-sword");
                AddResource(inventory, "arrow", 10);
                break;

            case 4:
                AddEquipment(person.EquipmentCarrier, 2, "fireball-staff");
                AddEquipment(person.EquipmentCarrier, 1, "scholar-robe");
                AddEquipment(person.EquipmentCarrier, 0, "wizard-hat");
                AddResource(inventory, "mana", 15);
                break;

            case 5:
                AddEquipment(person.EquipmentCarrier, 2, "pistol");
                AddEquipment(person.EquipmentCarrier, 0, "elder-hat");
                AddResource(inventory, "bullet-45", 5);

                AddResource(inventory, "packed-food", 1);
                AddResource(inventory, "water-bottle", 1);
                AddResource(inventory, "med-kit", 1);

                AddResource(inventory, "mana", 5);
                AddResource(inventory, "arrow", 3);
                break;
            }

            AddResource(inventory, "packed-food", 1);
            AddResource(inventory, "water-bottle", 1);
            AddResource(inventory, "med-kit", 1);

            return(person);
        }