コード例 #1
0
ファイル: Orc.cs プロジェクト: Fux90/GodsWill_ASCIIRPG
        protected override AICharacter RandomBuild(Pg.Level level)
        {
            var lvl = ((int)level);

            Name = Name.ValueIfNotNullOrElse("Orc");
            // God - can be null
            Stats = Stats.ValueIfNotNullOrElse(new GodsWill_ASCIIRPG.Stats(
                                                   StatsBuilder.RandomStats(
                                                       new Dictionary <StatsType, int>()
            {
                { StatsType.Strength, 2 },
                { StatsType.Toughness, 2 },
                { StatsType.Mental, -2 },
                { StatsType.InnatePower, -2 },
            })));
            var toughMod = ((Stats)Stats)[StatsType.Toughness].ModifierOfStat();

            MaximumPf = CurrentPf.ValueIfNotNullOrElse(Orc.healthDice.Max
                                                       + Dice.Throws(Orc.healthDice, lvl)
                                                       + lvl * toughMod);
            CurrentPf = MaximumPf.ValueIfNotNullOrElse((int)MaximumPf);
            Hunger    = Hunger.ValueIfNotNullOrElse((Orc.hungerDice.Max
                                                     + Dice.Throws(Orc.hungerDice, lvl))
                                                    * toughMod);
            MyAI               = MyAI.ValueIfNotNullOrElse(new SimpleAI());
            MySensingMethod    = MySensingMethod.ValueIfNotNullOrElse(AI.SensingAlgorythms.AllAround);
            PerceptionDistance = PerceptionDistance.ValueIfNotNullOrElse(5);
            //WornArmor - Can be null
            //EmbracedShield - Can be null
            //HandledWeapon - Can be null
            Backpack    = Backpack.ValueIfNotNullOrElse(new Backpack());
            Symbol      = Symbol.ValueIfNotNullOrElse("o");
            Color       = Color.ValueIfNotNullOrElse(System.Drawing.Color.DarkOliveGreen);
            Description = Description.ValueIfNotNullOrElse("A greenish, smelly human-like creature. Strong, but usually not very smart.");
            Position    = Position.ValueIfNotNullOrElse(new Coord());
            AlliedTo    = AlliedTo.ValueIfNotNullOrElse(Allied.Enemy);

            var orc = new Orc(Name,
                              (int)CurrentPf,
                              (int)MaximumPf,
                              (int)Hunger,
                              MyAI,
                              MySensingMethod,
                              (int)PerceptionDistance,
                              (Stats)Stats,
                              WornArmor,
                              EmbracedShield,
                              HandledWeapon,
                              Backpack,
                              God,
                              Symbol,
                              (System.Drawing.Color)Color,
                              Description,
                              (Coord)Position,
                              (Allied)AlliedTo);

            return(orc);
        }