public void EnemyDrops() { // Debug.Log("checking for enemy drops"); WeaponGenerator weaponGenerator = gameObject.GetComponent <WeaponGenerator>(); ArmorGenerator armorGenerator = gameObject.GetComponent <ArmorGenerator>(); ItemGenerator itemGenerator = gameObject.GetComponent <ItemGenerator>(); CheckItemDrop(); if (isWeaponDrop) { // check for preset weapon chance CheckPresetWeapon(); weaponGenerator.GenerateWeapon(presetWeapon); isWeaponDrop = false; } if (isArmorDrop) { // check for preset armor chance CheckPresetArmor(); armorGenerator.GenerateArmor(); isArmorDrop = false; } if (isItemDrop) { itemGenerator.GenerateItem(); isItemDrop = false; } }
// private ItemGenerator itemGenerator; void Start() { lootManager = GameObject.Find("LootManager"); armorGenerator = lootManager.GetComponent <ArmorGenerator>(); weaponGenerator = lootManager.GetComponent <WeaponGenerator>(); // itemGenerator = lootManager.GetComponent<ItemGenerator>(); }
public static Item GenerateRandomItem() { int result = Engine.RNG.Next(0, 100); if (result <= 17) { return(WeaponGenerator.GenerateRandomWeapon()); } else if (result <= 34) { return(ConsumableGenerator.GeneratePotion()); } else if (result <= 51) { return(ConsumableGenerator.GenerateScroll()); } else if (result <= 68) { return(ArmorGenerator.GenerateRandomArmor()); } else if (result <= 85) { return(MiscItemGenerator.GetRandomItem()); } return(ConsumableGenerator.GenerateFood()); }
public ItemsGenerator(IItemGeneratorConfiguration configuration, IImagesStorage imagesStorage, IAncientSpellsProvider spellsProvider) { var bonusesGenerator = new BonusesGenerator(configuration.BonusesConfiguration); weaponGenerators = new Dictionary <WeaponType, IWeaponGenerator> { { WeaponType.Sword, new WeaponGenerator("Sword", WorldImageNameSword, configuration.WeaponsConfiguration.SwordsConfiguration, configuration.WeaponsConfiguration, bonusesGenerator, imagesStorage) }, { WeaponType.Dagger, new WeaponGenerator("Dagger", WorldImageNameDagger, configuration.WeaponsConfiguration.DaggersConfiguration, configuration.WeaponsConfiguration, bonusesGenerator, imagesStorage) }, { WeaponType.Mace, new WeaponGenerator("Mace", WorldImageNameMace, configuration.WeaponsConfiguration.MacesConfiguration, configuration.WeaponsConfiguration, bonusesGenerator, imagesStorage) }, { WeaponType.Axe, new WeaponGenerator("Axe", WorldImageNameAxe, configuration.WeaponsConfiguration.AxesConfiguration, configuration.WeaponsConfiguration, bonusesGenerator, imagesStorage) }, { WeaponType.Staff, new WeaponGenerator("Staff", WorldImageNameStaff, configuration.WeaponsConfiguration.StaffsConfiguration, configuration.WeaponsConfiguration, bonusesGenerator, imagesStorage) } }; armorGenerator = new ArmorGenerator(configuration.ArmorConfiguration, bonusesGenerator, imagesStorage); shieldGenerator = new ShieldGenerator(configuration.ShieldsConfiguration, bonusesGenerator, imagesStorage); spellBookGenerator = new SpellBookGenerator(configuration.SpellBooksConfiguration, bonusesGenerator, imagesStorage); usableItemsGenerator = new UsableItemsGenerator(imagesStorage, spellsProvider); resourceItemsGenerator = new ResourceItemsGenerator(); foodItemsGenerator = new FoodItemsGenerator(imagesStorage); }
/*public static void WeaponGenerator(WeaponGenerator generator) * { * EditorGUILayout.Separator(); * EditorGUILayout.BeginHorizontal(); * * EditorGUILayout.PrefixLabel("Increasing dmg"); * generator.WeaponDamage = EditorGUILayout.Toggle(generator.WeaponDamage, GUILayout.Width(100)); * if (generator.WeaponDamage) * { * generator.WeaponIncreasingDamageType = (IncresingTypeEnum)EditorGUILayout.EnumPopup(generator.WeaponIncreasingDamageType, GUILayout.Width(100)); * * EditorGUILayout.PrefixLabel("amount"); * generator.WeaponAmount = EditorGUILayout.IntField(generator.WeaponAmount, GUILayout.Width(100)); * } * EditorGUILayout.Separator(); * EditorGUILayout.EndHorizontal(); * if (generator.WeaponDamage) * { * EditorGUILayout.Separator(); * EditorGUILayout.BeginHorizontal(); * EditorGUILayout.LabelField("Damage", generator.GetDamage); * EditorGUILayout.EndHorizontal(); * * } * }*/ public static void ArmorGenerator(ArmorGenerator generator) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Increasing armor"); generator.ArmorClassValue = EditorGUILayout.Toggle(generator.ArmorClassValue, GUILayout.Width(100)); if (generator.ArmorClassValue) { generator.ArmorIncreasingDamageType = (IncresingTypeEnum)EditorGUILayout.EnumPopup(generator.ArmorIncreasingDamageType, GUILayout.Width(100)); EditorGUILayout.PrefixLabel("amount"); generator.ArmorAmount = EditorGUILayout.IntField(generator.ArmorAmount, GUILayout.Width(100)); } EditorGUILayout.EndHorizontal(); if (generator.ArmorClassValue) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Armor", generator.GetArmor); EditorGUILayout.EndHorizontal(); } }
/*public static void WeaponGenerator(WeaponGenerator generator) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Increasing dmg"); generator.WeaponDamage = EditorGUILayout.Toggle(generator.WeaponDamage, GUILayout.Width(100)); if (generator.WeaponDamage) { generator.WeaponIncreasingDamageType = (IncresingTypeEnum)EditorGUILayout.EnumPopup(generator.WeaponIncreasingDamageType, GUILayout.Width(100)); EditorGUILayout.PrefixLabel("amount"); generator.WeaponAmount = EditorGUILayout.IntField(generator.WeaponAmount, GUILayout.Width(100)); } EditorGUILayout.Separator(); EditorGUILayout.EndHorizontal(); if (generator.WeaponDamage) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Damage", generator.GetDamage); EditorGUILayout.EndHorizontal(); } }*/ public static void ArmorGenerator(ArmorGenerator generator) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Increasing armor"); generator.ArmorClassValue = EditorGUILayout.Toggle(generator.ArmorClassValue, GUILayout.Width(100)); if (generator.ArmorClassValue) { generator.ArmorIncreasingDamageType = (IncresingTypeEnum)EditorGUILayout.EnumPopup(generator.ArmorIncreasingDamageType, GUILayout.Width(100)); EditorGUILayout.PrefixLabel("amount"); generator.ArmorAmount = EditorGUILayout.IntField(generator.ArmorAmount, GUILayout.Width(100)); } EditorGUILayout.EndHorizontal(); if (generator.ArmorClassValue) { EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); //EditorGUILayout.LabelField("Armor", generator.GetArmor); EditorGUILayout.EndHorizontal(); } }
static void INSTALL(string inputSeed, bool skipAnimRandomizer = false) { Random random; if (inputSeed == "") { random = new Random(); } else { random = new Random(inputSeed.GetHashCode()); } if (MOD_PATH == null) { MOD_PATH = AskForDir(); } else { Console.WriteLine("\nUse previously-specified game directory? (Y/N)"); bool yes = ReadKey(ConsoleKey.Y, ConsoleKey.N) == ConsoleKey.Y; if (!yes) { MOD_PATH = AskForDir(); } } if (MOD_PATH == null) { Console.WriteLine("No EXE selected. Cancelling installation."); return; } DateTime startTime = DateTime.Now; Console.WriteLine("\nBeginning installation... This will take about one minute."); Console.WriteLine("\n" + SoyPuns.PopRandomElement(random) + "\n"); SoulsMod mod = new SoulsMod( MOD_PATH, ".smbak", Resources.GameData.GameParam_parambnd, Resources.GameData.paramdef_paramdefbnd, Resources.GameData.item_msgbnd, Resources.GameData.menu_msgbnd); mod.LoadPlayerCharacter(); mod.LoadNonPlayerCharacters(); InstallInterrootFolder("event", mod); InstallInterrootFolder("map", mod); InstallInterrootFolder("script", mod); InstallInterrootFolder("sfx", mod); InstallInterrootFolder("sound", mod); PlayerGenerator playerSetup = new PlayerGenerator(mod); #if DEBUG Console.WriteLine("Running player setup..."); #endif playerSetup.Install(); Thread.CurrentThread.Join(0); TextGenerator textSetup = new TextGenerator(mod); #if DEBUG Console.WriteLine("Running text setup..."); #endif textSetup.Install(); Thread.CurrentThread.Join(0); SpEffectGenerator spEffectSetup = new SpEffectGenerator(mod); #if DEBUG Console.WriteLine("Running SpEffect setup..."); #endif spEffectSetup.Install(); Thread.CurrentThread.Join(0); GoodsGenerator goodsSetup = new GoodsGenerator(mod); #if DEBUG Console.WriteLine("Running goods setup..."); #endif goodsSetup.Install(); Thread.CurrentThread.Join(0); SpellGenerator spellSetup = new SpellGenerator(mod, random); #if DEBUG Console.WriteLine("Running spell setup..."); #endif spellSetup.Install(); Thread.CurrentThread.Join(0); WeaponGenerator weaponSetup = new WeaponGenerator(mod, random); #if DEBUG Console.WriteLine("Running weapon setup..."); #endif weaponSetup.Install(); Thread.CurrentThread.Join(0); ArmorGenerator armorSetup = new ArmorGenerator(mod, random); #if DEBUG Console.WriteLine("Running armor setup..."); #endif armorSetup.Install(); Thread.CurrentThread.Join(0); EnemyGenerator enemySetup = new EnemyGenerator(mod, random, weaponSetup, armorSetup); #if DEBUG Console.WriteLine("Running enemy setup..."); #endif enemySetup.Install(); Thread.CurrentThread.Join(0); MapItemLotsGenerator itemLotsSetup = new MapItemLotsGenerator(mod, weaponSetup, armorSetup, random); #if DEBUG Console.WriteLine("Running item lot setup..."); #endif itemLotsSetup.Install(); Thread.CurrentThread.Join(0); EnemyAnimationGenerator animSetup = new EnemyAnimationGenerator(mod, random); #if DEBUG Console.WriteLine("Running animation setup..."); #endif animSetup.Install(skipAnimRandomizer); Thread.CurrentThread.Join(0); // Must be run AFTER weapon/armor setup. CharacterGenerator chrSetup = new CharacterGenerator(mod, random); #if DEBUG Console.WriteLine("Running chr setup..."); #endif chrSetup.Install(); Thread.CurrentThread.Join(0); Console.WriteLine(SoyPuns.PopRandomElement(random) + "\n"); #if DEBUG Console.WriteLine("Installing mod..."); #endif mod.Install(); Thread.CurrentThread.Join(0); #if DEBUG Console.WriteLine($"Installation time: {(DateTime.Now - startTime).TotalSeconds}"); #endif }
static void INSTALL(string inputSeed) { Random random; random = inputSeed == "" ? new Random() : new Random(inputSeed.GetHashCode()); MOD_PATH = GetGameDir(); if (MOD_PATH == null) { Console.WriteLine("No EXE selected. Cancelling installation."); return; } DateTime startTime = DateTime.Now; Console.WriteLine("\nBeginning installation... This will take about one minute."); Console.WriteLine("\n" + SoyPuns.PopRandomElement(random) + "\n"); SoulsMod mod = new SoulsMod( MOD_PATH, ".rsbak", Resources.GameData.GameParam_parambnd, Resources.GameData.paramdef_paramdefbnd, Resources.GameData.item_msgbnd, Resources.GameData.menu_msgbnd); mod.LoadPlayerCharacter(); mod.LoadNonPlayerCharacters(); InstallInterrootFolder("event", mod); InstallInterrootFolder("map", mod); InstallInterrootFolder("script", mod); InstallInterrootFolder("sfx", mod); InstallInterrootFolder("sound", mod); TextGenerator textSetup = new TextGenerator(mod); #if DEBUG Console.WriteLine("Running text setup..."); #else Console.WriteLine("Studying the ancient texts..."); #endif textSetup.Install(); Thread.CurrentThread.Join(0); PlayerGenerator playerSetup = new PlayerGenerator(mod); #if DEBUG Console.WriteLine("Running player setup..."); #else Console.WriteLine("Putting the party together..."); #endif playerSetup.Install(); Thread.CurrentThread.Join(0); SpEffectGenerator spEffectSetup = new SpEffectGenerator(mod); #if DEBUG Console.WriteLine("Running SpEffect setup..."); #else Console.WriteLine("Channeling the powers that be..."); #endif spEffectSetup.Install(); Thread.CurrentThread.Join(0); GoodsGenerator goodsSetup = new GoodsGenerator(mod); #if DEBUG Console.WriteLine("Running goods setup..."); #else Console.WriteLine("Documenting the artifacts..."); #endif goodsSetup.Install(); Thread.CurrentThread.Join(0); SpellGenerator spellSetup = new SpellGenerator(mod, random); #if DEBUG Console.WriteLine("Running spell setup..."); #else Console.WriteLine("Messing with forces beyond our control..."); #endif spellSetup.Install(); Thread.CurrentThread.Join(0); WeaponGenerator weaponSetup = new WeaponGenerator(mod, random); #if DEBUG Console.WriteLine("Running weapon setup..."); #else Console.WriteLine("Spinning up the whetstone..."); #endif #if SKIP_BEHAVIORS Console.WriteLine("WARNING: Skipping weapon behaviors/attacks!"); weaponSetup.SkipBehaviors = true; #endif weaponSetup.Install(); Thread.CurrentThread.Join(0); ArmorGenerator armorSetup = new ArmorGenerator(mod, random); #if DEBUG Console.WriteLine("Running armor setup..."); #else Console.WriteLine("Polishing the armor..."); #endif armorSetup.Install(); Thread.CurrentThread.Join(0); EnemyGenerator enemySetup = new EnemyGenerator(mod, random, weaponSetup, armorSetup); #if DEBUG Console.WriteLine("Running enemy setup..."); #else Console.WriteLine("Opening the bestiary..."); #endif enemySetup.Install(); Thread.CurrentThread.Join(0); EnemyAnimationGenerator animSetup = new EnemyAnimationGenerator(mod, random); #if DEBUG Console.WriteLine("Modifying enemy animations..."); #else Console.WriteLine("Rousing the rabble..."); #endif animSetup.Install(); Thread.CurrentThread.Join(0); MapItemLotsGenerator itemLotsSetup = new MapItemLotsGenerator(mod, weaponSetup, armorSetup, random); #if DEBUG Console.WriteLine("Running item lot setup..."); #else Console.WriteLine("Burying the treasures..."); #endif itemLotsSetup.Install(); Thread.CurrentThread.Join(0); // Must be run AFTER weapon/armor setup. CharacterGenerator chrSetup = new CharacterGenerator(mod, random); #if DEBUG Console.WriteLine("Running character setup..."); #else Console.WriteLine("Assembling the party..."); #endif chrSetup.Install(); Thread.CurrentThread.Join(0); #if DEBUG Console.WriteLine("Installing mod..."); #else Console.WriteLine("Heading forth..."); #endif mod.Install(); Thread.CurrentThread.Join(0); Console.WriteLine("\nInstallation successful! Press ENTER to return to the prompt."); #if DEBUG Console.WriteLine($"Installation time: {(DateTime.Now - startTime).TotalSeconds} seconds"); #endif Console.ReadLine(); }