public static Actor CreateRandomThug() { // create fighter-type Actor a = CreateRandomActor(Attribute.Strength, Attribute.Constitution); a.Name = "Thug"; a.SetAlignment(Alignment.Neutral_Evil); a.AI.RunToAttackMelee = true; // add random melee weapon RPGWeapon wpn = RPGWeapon.CreateRandomMeleeWeapon(); if (a.inventory.AddBodyItem(wpn) == false) { a.inventory.AddPackItem(wpn); } // add one piece of armor RPGArmor apiece = RPGArmor.CreateRandomArmorPiece(); a.inventory.AddBodyItem(apiece); return(a); }
private int GetThisDmg(bool critical) { int projDmg = new RPGCalc().RollDmg(this.minDmg, this.maxDmg); if (critical) { projDmg *= 2; } RPGWeapon w = this.Owner.inventory.GetWpn(); if (w == null) { return(projDmg); } if (w.weaponType == RPGWeapon.WeaponType.Launcher) { if (w.minDmg == w.maxDmg) { projDmg += w.minDmg; } else { projDmg += new RPGCalc().RollDmg(w.minDmg, w.maxDmg); } } return(projDmg); }
public static Actor CreateRandomFighter() { Actor a = CreateRandomActor(Attribute.Strength, Attribute.Constitution); a.Name = "Random Fighter"; // equip with fighter gear a.inventory.AddBodyItem(RPGArmor.CreateRandomTorsoArmor()); a.inventory.AddBodyItem(RPGArmor.CreateRandomShield()); // 50/50 for a belt if (new RPGCalc().Roll(100) > 50) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.Belt)); } // boots // 20% heavy, 40% light, 40% none int bootsRoll = new RPGCalc().Roll(100); if (bootsRoll > 80) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.HeavyBoots)); } else if (bootsRoll > 40) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.LightBoots)); } // helm // 20% full, 40% small, 40% none int helmRoll = new RPGCalc().Roll(100); if (helmRoll > 80) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.FullHelm)); } else if (helmRoll > 40) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.SmallHelm)); } // add random melee weapon RPGWeapon wpn = RPGWeapon.CreateRandomMeleeWeapon(); if (a.inventory.AddBodyItem(wpn) == false) { a.inventory.AddPackItem(wpn); } a.AI.RunToAttackMelee = true; return(a); }
public bool AddBodyItem(RPGItem item) { if (item.isOfType(typeof(RPGPotion))) { return(false); } else if (BodyItems[(int)item.Slot] != null) { return(false); } else { // the slot is empty, make sure we CAN set it here // if item is a wpn if (item.Slot == BodySlot.Hand1) { // if wpn is two handed if (((RPGWeapon)item).is2Handed == true) { //make sure 2nd hand is empty too. if (BodyItems[(int)BodySlot.Hand2] != null) { return(false); } } } // if item to be equipped is a shield else if (item.Slot == BodySlot.Hand2) { // make sure 1st hand is not a two handed weapon if (BodyItems[(int)BodySlot.Hand1] != null) { // we have something in the wpn hand, check it. RPGItem itemInHand = BodyItems[(int)BodySlot.Hand1]; if (itemInHand.isOfType(typeof(RPGWeapon))) { RPGWeapon wpn = itemInHand as RPGWeapon; if (wpn.is2Handed) { return(false); } } } } BodyItems[(int)item.Slot] = item; // this could change our stats Owner.UpdateAttack(); Owner.UpdateDefense(); return(true); } }
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 Actor CreateRandomArcher() { Actor a = CreateRandomActor(Attribute.Dexterity, Attribute.Intelligence); a.Name = "Random Archer"; // equip with archer gear a.inventory.AddBodyItem(RPGArmor.CreateRandomTorsoArmor()); a.AI.RunToAttackMelee = false; // 25% for a belt if (new RPGCalc().Roll(100) > 75) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.Belt)); } // boots // 35% light, 65% none int bootsRoll = new RPGCalc().Roll(100); if (bootsRoll > 65) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.LightBoots)); } // helm // 25% small int helmRoll = new RPGCalc().Roll(100); if (helmRoll > 75) { a.inventory.AddBodyItem(new RPGArmor(RPGArmor.ArmorClass.SmallHelm)); } // bow or crossbow or sling RPGWeapon wpn = (RPGWeapon)RPGWeapon.CreateRandomLauncherWeapon(); a.inventory.AddBodyItem(wpn); a.inventory.AddBodyItem(new Projectile(a, wpn.GetProjectileType(), null)); return(a); }
public static Actor CreateRandomRobber() { Actor a = CreateRandomActor(Attribute.Strength, Attribute.Dexterity); a.Name = "Robber"; a.SetAlignment(Alignment.Neutral_Evil); a.AI.RunToAttackMelee = true; // add random melee weapon RPGWeapon wpn = RPGWeapon.CreateRandomMeleeWeapon(); if (a.inventory.AddBodyItem(wpn) == false) { a.inventory.AddPackItem(wpn); } return(a); }
public void AddRandomItem() { AddItem(RPGWeapon.CreateRandomWeapon()); }