public void SetUp()
        {
            _personScheme = new TestPersonScheme();

            var survivalRandomSourceMock = new Mock <ISurvivalRandomSource>();

            _survivalRandomSource = survivalRandomSourceMock.Object;
        }
예제 #2
0
        public static IPersonScheme CreatePersonScheme()
        {
            var personScheme = new TestPersonScheme
            {
                SurvivalStats = new[]
                {
                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Satiety,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0,
                        KeyPoints  = new[]
                        {
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Lesser,
                                Start = 0.25f,
                                End   = 0.75f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Strong,
                                Start = 0.12f,
                                End   = 0.25f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Max,
                                Start = 0,
                                End   = 0.12f
                            }
                        }
                    },

                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Hydration,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0,
                        KeyPoints  = new[]
                        {
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Lesser,
                                Start = 0.25f,
                                End   = 0.75f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Strong,
                                Start = 0.12f,
                                End   = 0.25f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Max,
                                Start = 0,
                                End   = 0.12f
                            }
                        }
                    }
                }
            };

            return(personScheme);
        }
예제 #3
0
        public void SetUp()
        {
            _personScheme = new TestPersonScheme
            {
                SurvivalStats = new[] {
                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Satiety,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0,
                        KeyPoints  = new [] {
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Lesser,
                                Start = 0.25f,
                                End   = 0.75f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Strong,
                                Start = 0.12f,
                                End   = 0.25f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Max,
                                Start = 0,
                                End   = 0.12f
                            }
                        }
                    },

                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Hydration,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0,
                        KeyPoints  = new [] {
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Lesser,
                                Start = 0.25f,
                                End   = 0.75f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Strong,
                                Start = 0.12f,
                                End   = 0.25f
                            },
                            new TestPersonSurvivalStatKeySegmentSubScheme
                            {
                                Level = PersonSurvivalStatKeypointLevel.Max,
                                Start = 0,
                                End   = 0.12f
                            }
                        }
                    }
                }
            };

            var survivalRandomSourceMock = new Mock <ISurvivalRandomSource>();

            _survivalRandomSource = survivalRandomSourceMock.Object;
        }
예제 #4
0
        public void HumanPerson_EquipPropWithHungerResistance_DownPassOfSatietyDescreased()
        {
            // ARRANGE

            const int START_PERSON_HP   = 10;
            const int EXPECTED_DOWNPASS = 2;



            var personScheme = new TestPersonScheme
            {
                Hp    = START_PERSON_HP,
                Slots = new[] {
                    new PersonSlotSubScheme
                    {
                        Types = EquipmentSlotTypes.Aux
                    }
                },

                SurvivalStats = new[]
                {
                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Satiety,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0
                    },

                    new TestPersonSurvivalStatSubScheme
                    {
                        Type       = PersonSurvivalStatType.Hydration,
                        MinValue   = -100,
                        MaxValue   = 100,
                        StartValue = 0
                    }
                }
            };

            var defaultAct = new TestTacticalActScheme
            {
                Stats = new TestTacticalActStatsSubScheme
                {
                    Efficient = new Roll(6, 1)
                }
            };

            var evolutionDataMock = new Mock <IEvolutionData>();
            var evolutionData     = evolutionDataMock.Object;

            var survivalRandomSourceMock = new Mock <ISurvivalRandomSource>();
            var survivalRandomSource     = survivalRandomSourceMock.Object;

            var person = new HumanPerson(personScheme, defaultAct, evolutionData, survivalRandomSource);

            var armorPropScheme = new TestPropScheme
            {
                Equip = new TestPropEquipSubScheme
                {
                    Rules = new[]
                    {
                        new PersonRule(EquipCommonRuleType.HungerResistance, PersonRuleLevel.Normal)
                    },
                    SlotTypes = new[]
                    {
                        EquipmentSlotTypes.Aux
                    }
                }
            };

            var satietyStat = person.Survival.Stats.SingleOrDefault(x => x.Type == SurvivalStatType.Satiety);

            var armorProp = new Equipment(armorPropScheme);



            // ACT
            person.EquipmentCarrier[0] = armorProp;



            // ASSERT
            satietyStat.DownPassRoll.Should().Be(EXPECTED_DOWNPASS);
        }
예제 #5
0
        public void HumanPerson_EquipPropWithHpBonusWithNoHalfHp_HpStays()
        {
            // ARRANGE

            const int START_PERSON_HP = 10;
            const int NORMAL_HP_BONUS = 3;

            const int EXPECTED_PERSON_HP     = 6;
            const int EXPECTED_PERSON_MAX_HP = START_PERSON_HP + NORMAL_HP_BONUS;

            var personScheme = new TestPersonScheme
            {
                Hp    = START_PERSON_HP,
                Slots = new[] {
                    new PersonSlotSubScheme
                    {
                        Types = EquipmentSlotTypes.Body
                    }
                }
            };

            var defaultAct = new TestTacticalActScheme
            {
                Stats = new TestTacticalActStatsSubScheme
                {
                    Efficient = new Roll(6, 1)
                }
            };

            var evolutionDataMock = new Mock <IEvolutionData>();
            var evolutionData     = evolutionDataMock.Object;

            var survivalRandomSourceMock = new Mock <ISurvivalRandomSource>();
            var survivalRandomSource     = survivalRandomSourceMock.Object;

            var person = new HumanPerson(personScheme, defaultAct, evolutionData, survivalRandomSource);

            var armorPropScheme = new TestPropScheme
            {
                Equip = new TestPropEquipSubScheme
                {
                    Rules = new[]
                    {
                        new PersonRule(EquipCommonRuleType.Health, PersonRuleLevel.Normal)
                    },
                    SlotTypes = new[]
                    {
                        EquipmentSlotTypes.Body
                    }
                }
            };

            var armorProp = new Equipment(armorPropScheme, new ITacticalActScheme[0]);

            var hpStat = person.Survival.Stats.SingleOrDefault(x => x.Type == SurvivalStatType.Health);

            person.Survival.DecreaseStat(SurvivalStatType.Health, hpStat.Value / 2);



            // ACT
            person.EquipmentCarrier[0] = armorProp;



            // ASSERT
            hpStat.Range.Max.Should().Be(EXPECTED_PERSON_MAX_HP);
            hpStat.Value.Should().Be(EXPECTED_PERSON_HP);
        }
예제 #6
0
        public void HumanPerson_MultipleDifferentArmor_AllArmorsInStats()
        {
            // ARRANGE

            var personScheme = new TestPersonScheme
            {
                Slots = new[] {
                    new PersonSlotSubScheme
                    {
                        Types = EquipmentSlotTypes.Head
                    },
                    new PersonSlotSubScheme
                    {
                        Types = EquipmentSlotTypes.Body
                    }
                }
            };

            var defaultAct = new TestTacticalActScheme
            {
                Stats = new TestTacticalActStatsSubScheme
                {
                    Efficient = new Roll(6, 1)
                }
            };

            var evolutionDataMock = new Mock <IEvolutionData>();
            var evolutionData     = evolutionDataMock.Object;

            var survivalRandomSourceMock = new Mock <ISurvivalRandomSource>();
            var survivalRandomSource     = survivalRandomSourceMock.Object;

            var person = new HumanPerson(personScheme, defaultAct, evolutionData, survivalRandomSource);

            var armorHeadPropScheme = new TestPropScheme
            {
                Equip = new TestPropEquipSubScheme
                {
                    Armors = new IPropArmorItemSubScheme[]
                    {
                        new TestPropArmorItemSubScheme {
                            Impact          = ImpactType.Kinetic,
                            ArmorRank       = 1,
                            AbsorbtionLevel = PersonRuleLevel.Lesser
                        },
                        new TestPropArmorItemSubScheme {
                            Impact          = ImpactType.Psy,
                            ArmorRank       = 10,
                            AbsorbtionLevel = PersonRuleLevel.Normal
                        }
                    },
                    SlotTypes = new[] {
                        EquipmentSlotTypes.Head
                    }
                }
            };

            var armorBodyPropScheme = new TestPropScheme
            {
                Equip = new TestPropEquipSubScheme
                {
                    Armors = new IPropArmorItemSubScheme[]
                    {
                        new TestPropArmorItemSubScheme {
                            Impact          = ImpactType.Kinetic,
                            ArmorRank       = 18,
                            AbsorbtionLevel = PersonRuleLevel.Normal
                        }
                    },
                    SlotTypes = new[] {
                        EquipmentSlotTypes.Body
                    }
                }
            };

            var armorHeadProp = new Equipment(armorHeadPropScheme, new ITacticalActScheme[0]);
            var armorBodyProp = new Equipment(armorBodyPropScheme, new ITacticalActScheme[0]);



            // ACT
            person.EquipmentCarrier[0] = armorHeadProp;
            person.EquipmentCarrier[1] = armorBodyProp;



            // ASSERT
            person.CombatStats.DefenceStats.Armors[0].Impact.Should().Be(ImpactType.Kinetic);
            person.CombatStats.DefenceStats.Armors[0].ArmorRank.Should().Be(1 + 9 + 6);
            person.CombatStats.DefenceStats.Armors[0].AbsorbtionLevel.Should().Be(PersonRuleLevel.Lesser);

            person.CombatStats.DefenceStats.Armors[1].Impact.Should().Be(ImpactType.Psy);
            person.CombatStats.DefenceStats.Armors[1].ArmorRank.Should().Be(10);
            person.CombatStats.DefenceStats.Armors[1].AbsorbtionLevel.Should().Be(PersonRuleLevel.Normal);
        }