public override void PerformSetup(Context context, IState previousState) { base.PerformSetup(context, previousState); // Generate Calamity EnemyDefinition calamityType = HackUtil.GetRandomCalamityClass(); _calamity = ClassUtil.CreateCharacter( calamityType.Id, (uint)Guid.NewGuid().GetHashCode(), calamityType.NameGenerator.GetName(), calamityType.CharacterClass, 30u); // Generate Potential Party Members uint partyId = (uint)NewPartyGuid.GetHashCode(); for (int i = 0; i < 5; i++) { uint id = (uint)(i + 1); PlayerClassDefinition randomClass = HackUtil.GetRandomPlayerClass(); string randomName = randomClass.NameGenerator.GetName(); PlayerCharacter playerCharacter = ClassUtil.CreatePlayerCharacter(id, partyId, randomName, randomClass.PlayerClass); _generatedCharacters.Add(playerCharacter); } // Generate (Unequipped) Starting Equipment int weaponCount = RANDOM.Next(3); for (int i = 0; i < weaponCount; i++) { if (HackUtil.GetRandomWeapon() is var newWeapon) { _generatedInventory.Add(newWeapon.Item); } } int armorCount = RANDOM.Next(3); for (int i = 0; i < armorCount; i++) { if (HackUtil.GetRandomArmor() is var newArmor) { _generatedInventory.Add(newArmor.Item); } } int itemCount = RANDOM.Next(5); for (int i = 0; i < itemCount; i++) { if (HackUtil.GetRandomItem() is var newItem) { _generatedInventory.Add(newItem.Item); } } }
public TownData() { HasInn = RANDOM.NextDouble() < 0.75f; InnCost = (uint)(50 + RANDOM.Next(50)); HasDojo = RANDOM.NextDouble() < 0.2f; DojoCost = (uint)(150 + RANDOM.Next(150)); HasItemShop = RANDOM.NextDouble() < 0.75f; ItemShopCost = (float)(0.8f + RANDOM.NextDouble() * 0.4f); if (HasItemShop) { int itemShopInventoryCount = 5 + RANDOM.Next(10); List <ItemDefinition> itemShopInventory = new List <ItemDefinition>(itemShopInventoryCount); for (int i = 0; i < itemShopInventoryCount; i++) { itemShopInventory.Add(HackUtil.GetRandomItem()); } ItemShopInventory = itemShopInventory; } HasWeaponShop = RANDOM.NextDouble() < 0.5f; WeaponShopCost = (float)(0.8f + RANDOM.NextDouble() * 0.4f); if (HasWeaponShop) { int weaponShopInventoryCount = 3 + RANDOM.Next(7); List <ItemDefinition> weaponShopInventory = new List <ItemDefinition>(weaponShopInventoryCount); for (int i = 0; i < weaponShopInventoryCount; i++) { weaponShopInventory.Add(HackUtil.GetRandomWeapon()); } WeaponShopInventory = weaponShopInventory; } HasArmorShop = RANDOM.NextDouble() < 0.5f; ArmorShopCost = (float)(0.8f + RANDOM.NextDouble() * 0.4f); if (HasArmorShop) { int armorShopInventoryCount = 3 + RANDOM.Next(7); List <ItemDefinition> armorShopInventory = new List <ItemDefinition>(armorShopInventoryCount); for (int i = 0; i < armorShopInventoryCount; i++) { armorShopInventory.Add(HackUtil.GetRandomArmor()); } ArmorShopInventory = armorShopInventory; } }