Ejemplo n.º 1
0
        public static Actor CreateRandomActor(Actor.Attribute PrimaryAttribute, Actor.Attribute SecondaryAttribute)
        {
            RPGCalc calc = new RPGCalc();

            Actor newActor = new Actor();

            int[] rolls = calc.RollAttributes();

            // order int array by value
            Array.Sort(rolls, 0, rolls.Length);

            // clear actor's current attributes
            for (int i = 0; i < newActor.BaseAttributes.Length; i++)
            {
                newActor.BaseAttributes[i] = 0;
            }

            // fill important attributes with values
            int next = 5;

            newActor.BaseAttributes[(int)PrimaryAttribute]   = rolls[next--];
            newActor.BaseAttributes[(int)SecondaryAttribute] = rolls[next--];

            // fill rest
            for (int i = 0; i < newActor.BaseAttributes.Length; i++)
            {
                // find blank and fill with next
                if (newActor.BaseAttributes[i] == 0)
                {
                    newActor.BaseAttributes[i] = rolls[next--];
                }
            }

            newActor.Name = "Random Actor";

            // set current stats to match
            newActor.ResetAttributes();
            newActor.HPBaseMax = calc.GetBaseHP(newActor);
            newActor.MPBaseMax = calc.GetBaseMP(newActor);
            newActor.ResetStats();

            newActor.BaseSpeed    = RPGCalc.DEFAULT_SPEED;
            newActor.CurrentSpeed = newActor.BaseSpeed;
            newActor.lastAttack   = System.DateTime.Now;
            newActor.lastDamage   = new DateTime();

            newActor.SetAlignment(calc.RollAlignment());

            newActor.inventory.AddPackItem(RPGPotion.CreateRandomPotion());

            //newActor.SpellBook = RPGSpellBook.CreateRandomSpellbook();
            newActor.SpellBook = RPGSpellBook.CreateTestSpellbook();

            return(newActor);
        }
Ejemplo n.º 2
0
        public PlayerCharacter()
        {
            inventory.AddBodyItem(RPGWeapon.CreateRandomMeleeWeapon());
            //for (int i = 0; i < 3; i++)
            //{
            inventory.AddPackItem(RPGPotion.CreatePotionHealingSmall());
            //}

            this.AI.RunToAttackMelee = false;

            // for testing only:
            //SpellBook = RPGSpellBook.CreateRandomSpellbook();
            SpellBook = RPGSpellBook.CreateTestSpellbook();
        }