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); }
public Actor() { SetAttributesToDefault(); this.HPBaseMax = new RPGCalc().GetBaseHP(this); this.MPBaseMax = new RPGCalc().GetBaseMP(this); Name = "Joseph"; BaseSpeed = RPGCalc.DEFAULT_SPEED; CurrentSpeed = BaseSpeed; m_baseAttack = RPGCalc.DEFAULT_BASE_ATTACK; m_baseDefense = RPGCalc.DEFAULT_BASE_DEFENSE; m_baseDamage = RPGCalc.DEFAULT_BASE_DAMAGE; LOSRange = RPGCalc.DEFAULT_LOS_RANGE; inventory = new Inventory(this); m_SpellBook = new RPGSpellBook(); m_QuickBook = new RPGSpellBook(3); lastAttack = System.DateTime.Now; lastDamage = new DateTime(); this.ImpedesWalking = true; Relation = RelationToPC.Neutral; RPGCalc calc = new RPGCalc(); m_Lvl = 1; m_ExpForKill = calc.GetExpForKill(this); AI = new ArtificialIntelligence(this); //AIActive = false; // enemies don't respond. AIActive = true; States = new ActionStates(this); // use all we have so far to calc complex numbers (HP/MP/Att/Def, etc); this.HPBaseMax = calc.GetBaseHP(this); this.MPBaseMax = calc.GetBaseMP(this); this.ResetStats(); }
private void btn_Done_Click(object sender, EventArgs e) { if (m_currentPointsLeft > 0) { DialogResult dr = MessageBox.Show("You have points left to spend, are you sure you are done?", "", MessageBoxButtons.YesNo); if (dr != DialogResult.Yes) { return; } } RPGCalc calc = new RPGCalc(); ThisActor.HPBaseMax = calc.GetBaseHP(ThisActor); ThisActor.MPBaseMax = calc.GetBaseMP(ThisActor); this.ThisActor.ResetStats(); cmd = Game.ExitCommand.Done; this.Close(); }