コード例 #1
0
ファイル: Creature.cs プロジェクト: hkeeble/GroupProject
        private StatsUShort[] IntMethod(StatsUShort AD, StatsUShort BD, StatsUShort AR, StatsUShort BR)
        {
            StatsUShort[] output = new StatsUShort[2];

            //float recadv = AR.
            int traitD = (AR.Used + BR.Used) / 2;
            int traitR = (AR.Used + BR.Used) / 2;

            if ((traitD > 0.2) && (traitR > traitD))
            {
                output[0].Maximum = (ushort)((AR.Maximum + BR.Maximum) / 2);
                output[0].Used = 0;

                output[1].Maximum = (ushort)((AD.Maximum + BD.Maximum) / 2);
                output[1].Used = (AD.Used + BD.Used) / 2;
            }
            else
            {
                output[0].Maximum = (ushort)((AD.Maximum + BD.Maximum) / 2);
                output[0].Used = 0;

                output[1].Maximum = (ushort)((AR.Maximum + BR.Maximum) / 2);
                output[1].Used = (AR.Used + BR.Used) / 2;
            }

            InitialValues(ref output);

            return output;
        }
コード例 #2
0
ファイル: Creature.cs プロジェクト: hkeeble/GroupProject
        /// <summary>
        /// Generates a creature based on seed value.
        /// </summary>
        /// <param name="Seed">Seed value.</param>
        public Creature(int Seed, Texture2D texture, Vector2 position2D, float moveSpeed, int frameWidth, int frameHeight, int millisecondsBetweenFrame)
            : base(texture, position2D, moveSpeed, frameWidth, frameWidth, millisecondsBetweenFrame)
        {
            _seed = Seed;

            int[] Points = new int[2];
            int[] BDMax = new int[2];
            int[] TUMax = new int[2];

            ushort[,] Stats = new ushort[2, 7];
            ushort[,] BD = new ushort[2, 7];

            StatsBool[,] Toggles = new StatsBool[2, 5];

            Random rand = new Random(Seed);
            for (int y = 0; y < 2; y++)
            {
                Points[y] = 800;
                BDMax[y] = 32;
                TUMax[y] = 32;

                //stats
                for (int i = 0; i < 7; i++)
                {
                    Stats[y, i] = (ushort)rand.Next(Points[y] / (7 - (i)));
                    Points[y] -= Stats[y, i];

                    BD[y, i] = (ushort)rand.Next(BDMax[y] / (7 - (i)));
                    BDMax[y] -= BD[y, i];
                }

                //left over points get allocated
                int looper = 0;
                while (Points[y] != 0)
                {
                    int value = (ushort)rand.Next(1, Points[y]);
                    Stats[y, looper] += (ushort)value;
                    Points[y] -= value;
                    looper = (looper + 1) % 7;
                }

                while (BDMax[y] != 0)
                {
                    int value = (ushort)rand.Next(1, BDMax[y]);
                    BD[y, looper] += (ushort)value;
                    BDMax[y] -= value;
                    looper = (looper + 1) % 7;
                }

                for (int i = 0; i < 5; i++)
                {

                    Toggles[y, i].Active = rand.Next(0, 2) == 0;
                    Toggles[y, i].Used = (ushort)rand.Next(TUMax[y] / (5 - (i)));
                    TUMax[y] -= BD[y, i];
                }

                while (TUMax[y] != 0)
                {
                    looper = (looper + 1) % 5;
                    int value = (ushort)rand.Next(1, TUMax[y]);
                    Toggles[y, looper].Used += value;
                    TUMax[y] -= value;
                }
            }

            StatsUShort[] Health = new StatsUShort[2];
            Health[0].Maximum = Stats[0, 0];
            Health[0].Used = BD[0, 0];
            Health[1].Maximum = Stats[1, 0];
            Health[1].Used = BD[1, 0];
            InitialValues(ref Health);
            StatsUShort[] Weight = new StatsUShort[2];
            Weight[0].Maximum = Stats[0, 1];
            Weight[0].Used = BD[0, 1];
            Weight[1].Maximum = Stats[1, 1];
            Weight[1].Used = BD[1, 1];
            InitialValues(ref Weight);
            StatsUShort[] Size = new StatsUShort[2];
            Size[0].Maximum = Stats[0, 2];
            Size[0].Used = BD[0, 2];
            Size[1].Maximum = Stats[1, 2];
            Size[1].Used = BD[1, 2];
            InitialValues(ref Size);
            StatsUShort[] Strength = new StatsUShort[2];
            Strength[0].Maximum = Stats[0, 3];
            Strength[0].Used = BD[0, 3];
            Strength[1].Maximum = Stats[1, 3];
            Strength[1].Used = BD[1, 3];
            InitialValues(ref Strength);
            StatsUShort[] Dexterity = new StatsUShort[2];
            Dexterity[0].Maximum = Stats[0, 4];
            Dexterity[0].Used = BD[0, 4];
            Dexterity[1].Maximum = Stats[1, 4];
            Dexterity[1].Used = BD[1, 4];
            InitialValues(ref Dexterity);
            StatsUShort[] Endurance = new StatsUShort[2];
            Endurance[0].Maximum = Stats[0, 5];
            Endurance[0].Used = BD[0, 5];
            Endurance[1].Maximum = Stats[1, 5];
            Endurance[1].Used = BD[1, 5];
            InitialValues(ref Endurance);
            StatsUShort[] Speed = new StatsUShort[2];
            Speed[0].Maximum = Stats[0, 6];
            Speed[0].Used = BD[0, 6];
            Speed[1].Maximum = Stats[1, 6];
            Speed[1].Used = BD[1, 6];
            InitialValues(ref Speed);

            Dominant.Health = Health[0];
            Recessive.Health = Health[1];
            Dominant.Weight = Weight[0];
            Recessive.Weight = Weight[1];
            Dominant.Size = Size[0];
            Recessive.Size = Size[1];
            Dominant.Strength = Strength[0];
            Recessive.Strength = Strength[1];
            Dominant.Dexterity = Dexterity[0];
            Recessive.Dexterity = Dexterity[1];
            Dominant.Endurance = Endurance[0];
            Recessive.Endurance = Endurance[1];
            Dominant.Speed = Speed[0];
            Recessive.Speed = Speed[1];

            Dominant.Head = Toggles[0, 0];
            Recessive.Head = Toggles[1, 0];
            Dominant.Legs = Toggles[0, 1];
            Recessive.Legs = Toggles[1, 1];
            Dominant.Arms = Toggles[0, 2];
            Recessive.Arms = Toggles[1, 2];
            Dominant.Wings = Toggles[0, 3];
            Recessive.Wings = Toggles[1, 3];
            Dominant.Claws = Toggles[0, 4];
            Recessive.Claws = Toggles[1, 4];

            this.Health = this.Dominant.Health.Level;

            //Not Yet Implimented
            Dominant.SpinalColumns.Maximum = 8;
            Dominant.TailColumns.Maximum = 4;

            avTacks = new AttackTypes(Dominant);
            CreateModel();
        }
コード例 #3
0
ファイル: Creature.cs プロジェクト: hkeeble/GroupProject
        /// <summary>
        /// Set initial values/levels
        /// </summary>
        /// <param name="input">array size should be 2 for dominant and recessive</param>
        protected void InitialValues(ref StatsUShort[] input)
        {
            int value = (800 / 7);//Total Points avalible divided by amount of statistics

            if (input[0].Maximum <= value)
                input[0].Level = (ushort)(input[0].Maximum * 0.80);
            else
                input[0].Level = (ushort)(input[0].Maximum * 0.70);

            if (input[1].Maximum <= value)
                input[1].Level = (ushort)(input[1].Maximum * 0.80);
            else
                input[1].Level = (ushort)(input[1].Maximum * 0.70);
        }