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 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(); }
public static RPGSpellBook CreateTestSpellbook() { RPGCalc calc = new RPGCalc(); int size = DEFAULT_MAX_SPELL_COUNT * 2; RPGSpellBook book = new RPGSpellBook(size); int count = size; for (int i = 0; i < count; i++) { book.AddSpell(RPGSpell.CreateRandomSpell()); } return(book); }
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 LoadSpellBookIntoGrid(DataGridView grid, RPGSpellBook book) { DataTable data = SetupSpellDataTable(); for (int i = 0; i < book.SpellCountMax; i++) { RPGSpell s = book.GetSpellAtIndex(i); // if we don't have a spell, just add a blank row if (s == null) { data.Rows.Add(data.NewRow()); continue; } AddSpellToDataTable(data, s); } grid.DataSource = data; }
public void LoadActor(Actor a) { //set Labels lblName.Text = "Name: " + a.Name; lblHP.Text = "HP: " + a.HPCurrent + " / " + a.HPCurrentMax; lblMP.Text = "MP: " + a.MPCurrent + " / " + a.MPCurrentMax; lblAttDef.Text = "Att: " + a.CurrentAttack + " / Def: " + a.CurrentDefense; //load Buttons - quick items RPGItem[] quickItems = a.inventory.GetQuickItems(); for (int i = 0; i < quickItems.Length; i++) { LoadQuickItem(i, quickItems[i]); } // load Buttons - quick spells RPGSpellBook quickSpells = a.QuickSpellBook; for (int i = 0; i < quickSpells.SpellCountMax; i++) { LoadQuickSpell(i, quickSpells.GetSpellAtIndex(i)); } }