private static void BuildDirectorCard() { archWispCharacterSpawnCard = Resources.Load <CharacterSpawnCard>("spawncards/characterspawncards/cscarchwisp"); archWispDirectorCardHolder = new DirectorAPI.DirectorCardHolder(); archWispCharacterSpawnCard.directorCreditCost = 250; archWispCharacterSpawnCard.forbiddenAsBoss = true; archWispDirectorCard = new DirectorCard { allowAmbushSpawn = true, forbiddenUnlockable = "", minimumStageCompletions = 4, preventOverhead = false, requiredUnlockable = "", selectionWeight = 1, spawnCard = archWispCharacterSpawnCard, spawnDistance = DirectorCore.MonsterSpawnDistance.Standard, }; archWispDirectorCardHolder.Card = archWispDirectorCard; archWispDirectorCardHolder.InteractableCategory = InteractableCategory.None; archWispDirectorCardHolder.MonsterCategory = DirectorAPI.MonsterCategory.Minibosses; MonsterActions += delegate(List <DirectorCardHolder> list, DirectorAPI.StageInfo stage) { if (!list.Contains(archWispDirectorCardHolder)) { list.Add(archWispDirectorCardHolder); } }; }
public void ImpShrineActivation(Interactor interactor, float monsterCredit, DirectorCard chosenDirectorCard) { combatDirector.enabled = true; combatDirector.monsterCredit += monsterCredit; combatDirector.maximumNumberToSpawnBeforeSkipping = impCount; combatDirector.OverrideCurrentMonsterCard(chosenDirectorCard); combatDirector.monsterSpawnTimer = 0f; CharacterMaster component = chosenDirectorCard.spawnCard.prefab.GetComponent <CharacterMaster>(); if (component) { CharacterBody component2 = component.bodyPrefab.GetComponent <CharacterBody>(); if (component2) { Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage { subjectAsCharacterBody = interactor.GetComponent <CharacterBody>(), baseToken = "SHRINE_IMP_USE_MESSAGE", paramTokens = new string[] { component2.baseNameToken } }); } } }
public static EliteAffixCard ChooseEliteAffix(DirectorCard monsterCard, double monsterCredit, Xoroshiro128Plus rng) { if (((CharacterSpawnCard)monsterCard.spawnCard).noElites) { return(null); } var eliteSelection = new WeightedSelection <EliteAffixCard>(); foreach (var card in Cards) { var weight = card.GetSpawnWeight(monsterCard); if (weight > 0 && card.isAvailable()) { var cost = monsterCard.cost * card.costMultiplier; if (cost <= monsterCredit) { eliteSelection.AddChoice(card, weight); } } } if (eliteSelection.Count > 0) { var card = eliteSelection.Evaluate(rng.nextNormalizedFloat); return(card); } return(null); }
private void DirectorAPI_monsterActions(System.Collections.Generic.List <DirectorAPI.DirectorCardHolder> cards, DirectorAPI.StageInfo stage) { cards.Clear(); CharacterSpawnCard turkeyCSC = Resources.Load <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscVulture"); DirectorCard turkeyCard = new DirectorCard { allowAmbushSpawn = true, forbiddenUnlockable = "", minimumStageCompletions = 0, preventOverhead = false, requiredUnlockable = "", selectionWeight = 5, spawnDistance = DirectorCore.MonsterSpawnDistance.Standard, spawnCard = turkeyCSC }; var tempCard1 = new DirectorAPI.DirectorCardHolder(); tempCard1.SetCard(turkeyCard); tempCard1.SetInteractableCategory(DirectorAPI.InteractableCategory.None); tempCard1.SetMonsterCategory(DirectorAPI.MonsterCategory.BasicMonsters); cards.Add(tempCard1); var tempCard2 = new DirectorAPI.DirectorCardHolder(); tempCard2.SetCard(turkeyCard); tempCard2.SetInteractableCategory(DirectorAPI.InteractableCategory.None); tempCard2.SetMonsterCategory(DirectorAPI.MonsterCategory.Minibosses); cards.Add(tempCard2); var tempCard3 = new DirectorAPI.DirectorCardHolder(); tempCard3.SetCard(turkeyCard); tempCard3.SetInteractableCategory(DirectorAPI.InteractableCategory.None); tempCard3.SetMonsterCategory(DirectorAPI.MonsterCategory.Champions); cards.Add(tempCard3); }
private void FlameDrone_InteractableActions(List <DirectorCardHolder> arg1, StageInfo arg2) { DirectorCard dcFlameDrone = null; foreach (DirectorCardHolder dch in arg1) { if (dcFlameDrone == null && dch.Card.spawnCard.name.Contains("FlameDrone")) { dcFlameDrone = dch.Card; break; } } if (dcFlameDrone != null) { if (generalCfg.flameDroneWeightAbyssalDepths > 1 && arg2.stage == R2APIStage.AbyssalDepths) { dcFlameDrone.selectionWeight *= generalCfg.flameDroneWeightAbyssalDepths; } else if (generalCfg.flameDroneWeightScorchedAcres > 1 && arg2.stage == R2APIStage.ScorchedAcres) { dcFlameDrone.selectionWeight *= generalCfg.flameDroneWeightScorchedAcres; } } else { Log.Warning("GradiusModPlugin.FlameDrone_InteractableActions: Flame Drone Director Card not found!"); } }
//Combat Shrine private static void ShrineCombatBehavior_AddShrineStack(On.RoR2.ShrineCombatBehavior.orig_AddShrineStack orig, ShrineCombatBehavior self, Interactor interactor) { orig(self, interactor); var characterBody = interactor.GetComponent <CharacterBody>(); if (characterBody) { var inv = characterBody.inventory; if (inv) { if (inv.GetItemCount(ExtraShrineRollItemIndex) > 0 && Util.CheckRoll(ItemProcChance * inv.GetItemCount(ExtraShrineRollItemIndex), characterBody.master)) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/Encounters/MonstersOnShrineUseEncounter"), self.transform.position, Quaternion.identity); UnityEngine.Networking.NetworkServer.Spawn(gameObject); CombatDirector combarDirector = gameObject.GetComponent <CombatDirector>(); float monsterCredit = 100f * Stage.instance.entryDifficultyCoefficient; DirectorCard directorCard = combarDirector.SelectMonsterCardForCombatShrine(monsterCredit); if (directorCard != null) { Chat.AddMessage("<color=\"green\">Lucky Default Sphere <style=cShrine>has spawned an additional set of combat shrine monsters.</style>"); combarDirector.CombatShrineActivation(interactor, monsterCredit, directorCard); return; } UnityEngine.Networking.NetworkServer.Destroy(gameObject); } } } }
/// <summary> /// Initialises the various alias lists and creates the DirectorCard cache /// </summary> private Alias() { BodyAlias.Add("ToolbotBody", new string[] { "MULT", "MUL-T", "ShoppingTrolly" }); BodyAlias.Add("MercBody", new string[] { "Mercenary", "Ninja" }); BodyAlias.Add("MageBody", new string[] { "Artificer" }); BodyAlias.Add("HANDBody", new string[] { "HAN-D" }); BodyAlias.Add("TreebotBody", new string[] { "Treebot", "REX", "PlantBot", "Shrub" }); MasterAlias.Add("DroneBackupMaster", new string[] { "DroneBackup", "BackupDrone" }); MasterAlias.Add("DroneMissileMaster", new string[] { "DroneMissile", "MissileDrone" }); MasterAlias.Add("LemurianBruiserMasterFire", new string[] { "LemurianBruiserFire" }); MasterAlias.Add("LemurianBruiserMasterIce", new string[] { "LemurianBruiserIce" }); MasterAlias.Add("LemurianBruiserMasterPoison", new string[] { "LemurianBruiserPoison", "LemurianBruiserBlight", "LemurianBruisermalechite" }); MasterAlias.Add("MercMonsterMaster", new string[] { "MercMonster" }); Debug.Log($"CardCount: {Resources.LoadAll<CharacterSpawnCard>("SpawnCards/CharacterSpawnCards").Length}"); foreach (CharacterSpawnCard csc in Resources.LoadAll <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards")) { var dCard = new DirectorCard { spawnCard = csc, cost = 600, allowAmbushSpawn = true, forbiddenUnlockable = "", minimumStageCompletions = 0, preventOverhead = true, spawnDistance = DirectorCore.MonsterSpawnDistance.Standard, }; spawnCards.Add(dCard); } }
private static void Arw_Awake() { var archWispSpawnCard = Resources.Load <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/cscArchWisp"); archWispSpawnCard.directorCreditCost = 400; var archWispDirCard = new DirectorCard(); archWispDirCard.allowAmbushSpawn = true; archWispDirCard.forbiddenUnlockable = ""; archWispDirCard.minimumStageCompletions = 6; archWispDirCard.preventOverhead = false; archWispDirCard.requiredUnlockable = ""; archWispDirCard.selectionWeight = 1; archWispDirCard.spawnCard = archWispSpawnCard; archWispDirCard.spawnDistance = DirectorCore.MonsterSpawnDistance.Standard; ArW_dirCard = archWispDirCard; SpawnsCore.monsterEdits += SpawnsCore_monsterEdits1; SpawnsCore.familyEdits += SpawnsCore_familyEdits1; LanguageCore.AddLanguageToken("ARCHWISP_BODY_NAME", "Archaic Wisp"); }
internal static DirectorCard CreateDirectorCard(string bossName, int cost, MapNodeGroup.GraphType nodeGraphType) { CharacterSpawnCard spawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>(); spawnCard.noElites = false; spawnCard.prefab = Resources.Load <GameObject>("prefabs/charactermasters/" + bossName); spawnCard.forbiddenFlags = NodeFlags.NoCharacterSpawn; spawnCard.requiredFlags = NodeFlags.None; spawnCard.hullSize = HullClassification.Human; spawnCard.occupyPosition = false; spawnCard.sendOverNetwork = true; spawnCard.nodeGraphType = nodeGraphType; spawnCard.name = "csc" + bossName.Substring(0, bossName.IndexOf("Master")); DirectorCard directorCard = new DirectorCard(); directorCard.spawnCard = spawnCard; directorCard.cost = cost; directorCard.selectionWeight = 1; directorCard.allowAmbushSpawn = true; directorCard.forbiddenUnlockable = ""; directorCard.minimumStageCompletions = 0; directorCard.preventOverhead = true; directorCard.spawnDistance = DirectorCore.MonsterSpawnDistance.Standard; return(directorCard); }
void PopulateScene(On.RoR2.SceneDirector.orig_PopulateScene orig, SceneDirector sceneDirector) { RoR2.InteractableSpawnCard[] allInteractables = UnityEngine.Resources.LoadAll <RoR2.InteractableSpawnCard>("SpawnCards/InteractableSpawnCard"); foreach (RoR2.InteractableSpawnCard spawnCard in allInteractables) { string interactableName = InteractableCalculator.GetSpawnCardName(spawnCard); if (interactableName == "Lockbox" || interactableName == "ScavBackpack") { DropOdds.UpdateChestTierOdds(spawnCard, interactableName); } else if (interactableName == "CasinoChest") { DropOdds.UpdateDropTableTierOdds(spawnCard, interactableName); } else if (interactableName == "ShrineCleanse") { ExplicitPickupDropTable dropTable = spawnCard.prefab.GetComponent <RoR2.ShopTerminalBehavior>().dropTable as ExplicitPickupDropTable; DropOdds.UpdateDropTableItemOdds(dropTable, interactableName); } } if (ClassicStageInfo.instance != null) { int categoriesLength = ClassicStageInfo.instance.interactableCategories.categories.Length; for (int categoryIndex = 0; categoryIndex < categoriesLength; categoryIndex++) { List <DirectorCard> directorCards = new List <DirectorCard>(); foreach (DirectorCard directorCard in ClassicStageInfo.instance.interactableCategories.categories[categoryIndex].cards) { string interactableName = InteractableCalculator.GetSpawnCardName(directorCard.spawnCard); if (new List <string>() { }.Contains(interactableName)) { } if (playerInteractables.interactablesInvalid.Contains(interactableName)) { } else { DropOdds.UpdateChestTierOdds(directorCard.spawnCard, interactableName); DropOdds.UpdateShrineTierOdds(directorCard, interactableName); directorCards.Add(directorCard); } } DirectorCard[] directorCardArray = new DirectorCard[directorCards.Count]; for (int cardIndex = 0; cardIndex < directorCards.Count; cardIndex++) { directorCardArray[cardIndex] = directorCards[cardIndex]; } if (directorCardArray.Length == 0) { ClassicStageInfo.instance.interactableCategories.categories[categoryIndex].selectionWeight = 0; } ClassicStageInfo.instance.interactableCategories.categories[categoryIndex].cards = directorCardArray; } } orig(sceneDirector); }
void PopulateScene(On.RoR2.SceneDirector.orig_PopulateScene orig, RoR2.SceneDirector sceneDirector) { if (Data.modEnabled) { sceneDirector.interactableCredit = Mathf.FloorToInt(sceneDirector.interactableCredit * Data.interactableMultiplier); List <SpawnCard> spawnCards = new List <SpawnCard>(); List <string> spawnCardNames = new List <string>(); //spawnCardNames = new List<string>() { "ShrineChance" }; //spawnCardNames = new List<string>() { "BrokenDrone1", "BrokenDrone2", "BrokenEmergencyDrone", "BrokenEquipmentDrone", "BrokenFlameDrone", "BrokenMegaDrone", "BrokenMissileDrone", "BrokenTurret1" }; //spawnCardNames = new List<string>() { "Duplicator", "DuplicatorLarge", "DuplicatorMilitary", "DuplicatorWild" }; //spawnCardNames = new List<string>() { "EquipmentBarrel", "TripleShopEquipment" }; RoR2.InteractableSpawnCard[] allInteractables = UnityEngine.Resources.LoadAll <RoR2.InteractableSpawnCard>("SpawnCards/InteractableSpawnCard"); foreach (RoR2.InteractableSpawnCard spawnCard in allInteractables) { string interactableName = ItemDropAPIFixes.InteractableCalculator.GetSpawnCardName(spawnCard); if (spawnCardNames.Contains(interactableName)) { spawnCards.Add(spawnCard); } } if (spawnCardNames.Count > 0) { DirectorCard[] directorCards = new DirectorCard[spawnCards.Count]; for (int cardIndex = 0; cardIndex < spawnCards.Count; cardIndex++) { DirectorCard directorCard = new DirectorCard(); directorCard.spawnCard = spawnCards[cardIndex]; directorCard.selectionWeight = 1; directorCards[cardIndex] = directorCard; } DirectorCardCategorySelection.Category category = new DirectorCardCategorySelection.Category(); category.name = "FORCED"; category.cards = directorCards; category.selectionWeight = 1000; DirectorCardCategorySelection.Category[] categoriesAdjusted = new DirectorCardCategorySelection.Category[ClassicStageInfo.instance.interactableCategories.categories.Length + 1]; for (int categoryIndex = 0; categoryIndex < ClassicStageInfo.instance.interactableCategories.categories.Length; categoryIndex++) { categoriesAdjusted[categoryIndex] = ClassicStageInfo.instance.interactableCategories.categories[categoryIndex]; } categoriesAdjusted[categoriesAdjusted.Length - 1] = category; ClassicStageInfo.instance.interactableCategories.categories = categoriesAdjusted; } ; foreach (int key in Data.allDroneIDs.Keys) { if (!Data.itemsToDrop.Contains(key) && !ItemDropAPIFixes.ItemDropAPIFixes.playerInteractables.interactablesInvalid.Contains(Data.allDroneIDs[key])) { ItemDropAPIFixes.ItemDropAPIFixes.playerInteractables.interactablesInvalid.Add(Data.allDroneIDs[key]); } } } orig(sceneDirector); }
public InteractableInfo(DirectorCard directorCard, Category category, List <string> scenes, InteractableTemplate template, bool multiplayerOnly, int minimumCount) { this.directorCard = directorCard; this.category = category; this.scenes = scenes; this.template = template; this.multiplayerOnly = multiplayerOnly; this.minimumCount = minimumCount; }
public static void Init() { SceneDirector.onGenerateInteractableCardSelection += (director, selection) => { DirectorCardCategorySelection.Category dupCategory = selection.categories.FirstOrDefault(x => x.name == "Duplicator"); if ((dupCategory.cards?.Length ?? 0) > 0) { var copyCard = dupCategory.cards[0]; var copySpawnCard = copyCard.spawnCard; SpawnCard spawnCard = ScriptableObject.CreateInstance <SpawnCard>(); spawnCard.name = "DuplicatorLunar"; spawnCard.directorCreditCost = LunarScrapPlugin.CreditCost.Value; spawnCard.forbiddenFlags = copySpawnCard.forbiddenFlags; spawnCard.hullSize = copySpawnCard.hullSize; spawnCard.nodeGraphType = copySpawnCard.nodeGraphType; spawnCard.occupyPosition = copySpawnCard.occupyPosition; spawnCard.prefab = Object.Instantiate(copySpawnCard.prefab); spawnCard.requiredFlags = copySpawnCard.requiredFlags; spawnCard.sendOverNetwork = copySpawnCard.sendOverNetwork; var lunarCard = new DirectorCard() { spawnCard = spawnCard, selectionWeight = LunarScrapPlugin.SelectionWeight.Value, spawnDistance = copyCard.spawnDistance, allowAmbushSpawn = copyCard.allowAmbushSpawn, preventOverhead = copyCard.preventOverhead, minimumStageCompletions = copyCard.minimumStageCompletions, requiredUnlockableDef = copyCard.requiredUnlockableDef, forbiddenUnlockableDef = copyCard.forbiddenUnlockableDef }; lunarCard.spawnCard.prefab.transform.SetPositionAndRotation(new UnityEngine.Vector3(0, -1000, 0), new UnityEngine.Quaternion()); lunarCard.spawnCard.prefab.GetComponent <PurchaseInteraction>().costType = CostTypeIndex.LunarItemOrEquipment; var shop = lunarCard.spawnCard.prefab.GetComponent <ShopTerminalBehavior>(); shop.itemTier = ItemTier.Lunar; shop.dropTable = ScriptableObject.CreateInstance <LunarDropTable>(); var newCardArray = new DirectorCard[dupCategory.cards.Length + 1]; dupCategory.cards.CopyTo(newCardArray, 0); newCardArray[newCardArray.Length - 1] = lunarCard; dupCategory.cards = newCardArray; for (int i = 0; i < selection.categories.Length; i++) { if (selection.categories[i].name == "Duplicator") { selection.categories[i] = dupCategory; } } } }; }
private void AW_SetupSpawns() { //this.bossEnabled = base.Config.Bind<Boolean>( "Main", "Enable new boss", true, //"Should the new boss spawn in game? Left as an option in case of major bugs or issues with early version of boss." ); HooksCore.RoR2.CharacterSpawnCard.Awake.On += this.Awake_On; var spawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>(); HooksCore.RoR2.CharacterSpawnCard.Awake.On -= this.Awake_On; spawnCard.directorCreditCost = 4000; spawnCard.forbiddenAsBoss = false; spawnCard.forbiddenFlags = RoR2.Navigation.NodeFlags.NoCharacterSpawn; spawnCard.hullSize = HullClassification.Golem; spawnCard.loadout = new SerializableLoadout(); spawnCard.name = "cscwispboss"; spawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Air; spawnCard.noElites = false; spawnCard.occupyPosition = false; spawnCard.prefab = this.AW_master; spawnCard.requiredFlags = RoR2.Navigation.NodeFlags.None; spawnCard.sendOverNetwork = true; var dirCard = new DirectorCard(); dirCard.allowAmbushSpawn = true; dirCard.forbiddenUnlockable = ""; dirCard.minimumStageCompletions = 8; dirCard.preventOverhead = false; dirCard.requiredUnlockable = ""; dirCard.selectionWeight = 1; dirCard.spawnCard = spawnCard; dirCard.spawnDistance = DirectorCore.MonsterSpawnDistance.Standard; this.AW_dirCard = dirCard; // TODO: Director //this.AW_dirCardHolder = new R2API.DirectorAPI.DirectorCardHolder(); //this.AW_dirCardHolder.SetCard(dirCard); // TODO: Director //this.AW_dirCardHolder.SetInteractableCategory(R2API.DirectorAPI.InteractableCategory.None); // TODO: Director //this.AW_dirCardHolder.SetMonsterCategory(R2API.DirectorAPI.MonsterCategory.Champions); #if CFGBOSS if (this.bossEnabled.Value) { #endif SpawnsCore.monsterEdits += this.SpawnsCore_monsterEdits; SpawnsCore.familyEdits += this.SpawnsCore_familyEdits; // TODO: Director //R2API.DirectorAPI.MonsterActions += this.DirectorAPI_MonsterActions; // TODO: Director //R2API.DirectorAPI.FamilyActions += this.DirectorAPI_FamilyActions; #if CFGBOSS } #endif }
/// <summary> /// Get the adjusted spawn weight for this card, taking into account /// both the base weight and cost for this elite, as well as any card-specific multiplier. /// </summary> /// <param name="monsterCard">Card to be spawned</param> /// <returns>Adjusted spawn weight</returns> public float GetSpawnWeight(DirectorCard monsterCard) { //TODO: Integrate with Rein's DirectorCard lib once it's released //Note here that we scale by cost (to favor more expensive elites, when affordable) //We also square this, to better approximate the vanilla game's strong favoring of greater cost via tiers var s = spawnWeight * costMultiplier; return(s * s); }
private static void CCNextBoss(ConCommandArgs args) { //Log.MessageNetworked("This feature is currently not working. We'll hopefully provide an update to this soon.", args); //return; Log.MessageNetworked(Lang.PARTIALIMPLEMENTATION_WARNING, args, LogLevel.MessageClientOnly); if (args.Count == 0) { Log.MessageNetworked(Lang.NEXTBOSS_ARGS, args); } StringBuilder s = new StringBuilder(); if (args.Count >= 1) { try { nextBoss = StringFinder.Instance.GetDirectorCardFromPartial(args[0]); s.AppendLine($"Next boss is: {nextBoss.spawnCard.name}. "); if (args.Count >= 2) { if (!int.TryParse(args[1], out nextBossCount)) { Log.MessageNetworked(Lang.COUNTISNUMERIC, args, LogLevel.MessageClientOnly); nextBossCount = 1; } else { if (nextBossCount > 6) { nextBossCount = 6; } else if (nextBossCount <= 0) { nextBossCount = 1; } s.Append($"Count: {nextBossCount}. "); if (args.Count >= 3) { nextBossElite = StringFinder.GetEnumFromPartial <EliteIndex>(args[2]); s.Append("Elite: " + nextBossElite.ToString()); } } } On.RoR2.CombatDirector.SetNextSpawnAsBoss += Hooks.CombatDirector_SetNextSpawnAsBoss; Log.MessageNetworked(s.ToString(), args); } catch (Exception ex) { Log.MessageNetworked(Lang.OBJECT_NOTFOUND + args[0], args, LogLevel.ErrorClientOnly); Log.MessageNetworked(ex.ToString(), args, LogLevel.ErrorClientOnly); } } }
/// <summary> /// Adds a new interactable to all stages. /// </summary> /// <param name="interactableCard">The DirectorCard for the interactable</param> /// <param name="category">The category of the interactable</param> public static void AddNewInteractable(DirectorCard interactableCard, InteractableCategory category) { DirectorCardHolder card = new DirectorCardHolder { Card = interactableCard, InteractableCategory = category, MonsterCategory = MonsterCategory.None }; InteractableActions += (interactables, currentStage) => { interactables.Add(card); }; }
/// <summary> /// Adds a new monster to all stages. /// </summary> /// <param name="monsterCard">The DirectorCard for the monster</param> /// <param name="category">The category to add the monster to</param> public static void AddNewMonster(DirectorCard monsterCard, MonsterCategory category) { DirectorCardHolder card = new DirectorCardHolder { Card = monsterCard, InteractableCategory = InteractableCategory.None, MonsterCategory = category }; MonsterActions += (monsters, currentStage) => { monsters.Add(card); }; }
public static DirectorCard GenerateDirectorCard(InteractableTemplate interactable, SpawnCard spawnCard) { var interactableDirectorCard = new DirectorCard(); interactableDirectorCard.spawnCard = spawnCard; interactableDirectorCard.selectionWeight = interactable.selectionWeight; interactableDirectorCard.spawnDistance = interactable.spawnDistance; //interactableDirectorCard.allowAmbushSpawn = interactable.allowAmbushSpawn; interactableDirectorCard.preventOverhead = interactable.preventOverhead; interactableDirectorCard.minimumStageCompletions = interactable.minimumStageCompletions; interactableDirectorCard.requiredUnlockableDef = interactable.requiredUnlockableDef; interactableDirectorCard.forbiddenUnlockableDef = interactable.forbiddenUnlockableDef; return(interactableDirectorCard); }
private static void AddOnlyGupTest(ConCommandArgs args) { _myGupSpawnCard = Addressables.LoadAssetAsync <CharacterSpawnCard>(GupCharacterSpawnCard).WaitForCompletion(); _myGupSpawnCard = UnityObject.Instantiate(_myGupSpawnCard); _myGupSpawnCard.directorCreditCost = 1; _myGupDC = new DirectorCard { spawnCard = _myGupSpawnCard, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = 0, spawnDistance = DirectorCore.MonsterSpawnDistance.Standard }; DirectorAPI.MonsterActions += OnlyGup; }
private static void CCNextBoss(ConCommandArgs args) { Log.Message(MagicVars.PARTIAL_IMPLEMENTATION); if (args.Count == 0) { Log.Message(MagicVars.NEXTBOSS_ARGS); } if (args.Count >= 1) { try { RoR2Cheats.nextBoss = Alias.Instance.GetDirectorCardFromPartial(args[0]); Log.Message($"Next boss is: {RoR2Cheats.nextBoss.spawnCard.name}"); if (args.Count >= 2) { if (!int.TryParse(args[1], out nextBossCount)) { Log.Message(MagicVars.COUNTISNUMERIC); return; } else { if (nextBossCount > 6) { nextBossCount = 6; } else if (nextBossCount <= 0) { nextBossCount = 1; } Log.Message("Count: " + nextBossCount); if (args.Count >= 3) { nextBossElite = Alias.GetEnumFromPartial <EliteIndex>(args[2]); Log.Message("Elite: " + nextBossElite.ToString()); } } } nextBossSet = true; } catch (Exception ex) { Log.Message(MagicVars.OBJECT_NOTFOUND + args[0]); Log.Message(ex); } } }
private static void AddInteractableTest(ConCommandArgs args) { _iscCategoryChest2DamageSpawnCard = Addressables.LoadAssetAsync <InteractableSpawnCard>(iscCategoryChest2Damage).WaitForCompletion(); _iscCategoryChest2DamageSpawnCard = UnityObject.Instantiate(_iscCategoryChest2DamageSpawnCard); _iscCategoryChest2DamageSpawnCard.directorCreditCost = 10; _my_iscCategoryChest2DamageDirectorCard = new DirectorCard { spawnCard = _iscCategoryChest2DamageSpawnCard, selectionWeight = 1, preventOverhead = false, minimumStageCompletions = 0, spawnDistance = DirectorCore.MonsterSpawnDistance.Standard }; DirectorAPI.InteractableActions += CustomInteractables; DirectorAPI.StageSettingsActions += CustomStageSettings; }
void SetupSpawnCard() { bulwarkDroneSpawnCard = TinkersSatchelPlugin.resources.LoadAsset <InteractableSpawnCard>("Assets/TinkersSatchel/Prefabs/Characters/BulwarkDrone/iscTkSatBulwarkDrone.asset"); bulwarkDroneDirectorCard = new DirectorCard { spawnCard = bulwarkDroneSpawnCard, minimumStageCompletions = 0, preventOverhead = false, selectionWeight = 4, //equip drone is 2, normal drones are 7 spawnDistance = DirectorCore.MonsterSpawnDistance.Standard }; bulwarkDroneDCH = new DirectorAPI.DirectorCardHolder { Card = bulwarkDroneDirectorCard, InteractableCategory = DirectorAPI.InteractableCategory.Drones, MonsterCategory = DirectorAPI.MonsterCategory.Invalid }; }
public static GameObject CreateGameObject() { GameObject gameObject = null; if (NetworkServer.active) { ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>(); DirectorCard directorCard = CommonUtil.SelectCard(component.interactableSelection, 100); while (!directorCard.spawnCard.name.Contains("Barrel")) { directorCard = CommonUtil.SelectCard(component.interactableSelection, 100); } gameObject = directorCard.spawnCard.DoSpawn(Vector3.zero, Quaternion.identity); } return(gameObject); }
/// <summary> /// Adds a new interactable to all stages. /// </summary> /// <param name="interactableCard">The DirectorCard for the interactable</param> /// <param name="category">The category of the interactable</param> public static void AddNewInteractable(DirectorCard interactableCard, InteractableCategory category) { if (!Loaded) { throw new InvalidOperationException($"{nameof(DirectorAPI)} is not loaded. Please use [{nameof(R2APISubmoduleDependency)}(nameof({nameof(DirectorAPI)})]"); } DirectorCardHolder card = new DirectorCardHolder { Card = interactableCard, InteractableCategory = category, MonsterCategory = MonsterCategory.None }; InteractableActions += (interactables, currentStage) => { interactables.Add(card); }; }
private static bool ApplyConfigModifiers(DirectorCard card) { foreach (InteractableConfig interactableConfig in interactables) { if (card.spawnCard.prefab.name != interactableConfig.Name) { continue; } if (interactableConfig.SpawnWeightModifier <= 0.0f) { return(false); } card.selectionWeight = Mathf.RoundToInt(card.selectionWeight * interactableConfig.SpawnWeightModifier); break; } return(true); }
private static void BuildDirectorCard() { On.RoR2.CharacterSpawnCard.Awake += CharacterSpawnCard_Awake; CharacterSpawnCard characterSpawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>(); On.RoR2.CharacterSpawnCard.Awake -= CharacterSpawnCard_Awake; DirectorAPI.DirectorCardHolder directorCardHolder = new DirectorAPI.DirectorCardHolder(); DirectorCard directorCard = new DirectorCard(); characterSpawnCard.directorCreditCost = 50; characterSpawnCard.forbiddenAsBoss = false; characterSpawnCard.name = "cscClaymanDude"; //characterSpawnCard.forbiddenFlags = RoR2.Navigation.NodeFlags.None; characterSpawnCard.hullSize = HullClassification.Human; characterSpawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Ground; characterSpawnCard.noElites = false; characterSpawnCard.prefab = clayManMaster; characterSpawnCard.occupyPosition = false; characterSpawnCard.sendOverNetwork = true; directorCard.allowAmbushSpawn = true; directorCard.forbiddenUnlockable = ""; directorCard.minimumStageCompletions = 1; directorCard.preventOverhead = false; directorCard.requiredUnlockable = ""; directorCard.selectionWeight = 1; directorCard.spawnCard = characterSpawnCard; directorCard.spawnDistance = DirectorCore.MonsterSpawnDistance.Standard; directorCardHolder.Card = directorCard; directorCardHolder.InteractableCategory = DirectorAPI.InteractableCategory.None; directorCardHolder.MonsterCategory = DirectorAPI.MonsterCategory.BasicMonsters; DirectorAPI.MonsterActions += delegate(List <DirectorAPI.DirectorCardHolder> list, DirectorAPI.StageInfo stage) { if (stage.stage == DirectorAPI.Stage.SkyMeadow || stage.stage == DirectorAPI.Stage.AbandonedAqueduct || stage.stage == DirectorAPI.Stage.RallypointDelta || stage.stage == DirectorAPI.Stage.ScorchedAcres) { if (!list.Contains(directorCardHolder)) { list.Add(directorCardHolder); } } }; }
private static void BuildDirectorCard() { On.RoR2.CharacterSpawnCard.Awake += CharacterSpawnCard_Awake; CharacterSpawnCard characterSpawnCard = ScriptableObject.CreateInstance <CharacterSpawnCard>(); On.RoR2.CharacterSpawnCard.Awake -= CharacterSpawnCard_Awake; DirectorAPI.DirectorCardHolder directorCardHolder = new DirectorAPI.DirectorCardHolder(); DirectorCard directorCard = new DirectorCard(); characterSpawnCard.directorCreditCost = 325; characterSpawnCard.forbiddenAsBoss = false; characterSpawnCard.name = "cscMegaMushrum"; //characterSpawnCard.forbiddenFlags = RoR2.Navigation.NodeFlags.None; characterSpawnCard.hullSize = HullClassification.Golem; characterSpawnCard.loadout = new SerializableLoadout(); characterSpawnCard.nodeGraphType = RoR2.Navigation.MapNodeGroup.GraphType.Ground; characterSpawnCard.noElites = false; characterSpawnCard.occupyPosition = false; characterSpawnCard.prefab = megaMushrumMaster; characterSpawnCard.sendOverNetwork = true; directorCard.allowAmbushSpawn = true; directorCard.forbiddenUnlockable = ""; directorCard.minimumStageCompletions = 4; directorCard.preventOverhead = false; directorCard.requiredUnlockable = ""; directorCard.selectionWeight = 1; directorCard.spawnCard = characterSpawnCard; directorCard.spawnDistance = DirectorCore.MonsterSpawnDistance.Standard; directorCardHolder.Card = directorCard; directorCardHolder.InteractableCategory = DirectorAPI.InteractableCategory.None; directorCardHolder.MonsterCategory = DirectorAPI.MonsterCategory.BasicMonsters; DirectorAPI.MonsterActions += delegate(List <DirectorAPI.DirectorCardHolder> list, DirectorAPI.StageInfo stage) { if (!list.Contains(directorCardHolder) && stage.stage == DirectorAPI.Stage.SkyMeadow) { list.Add(directorCardHolder); } }; }
/// <summary> /// Adds a new interactable to a specific stage. /// For custom stages use Stage.Custom and enter the name of the stage in customStageName. /// </summary> /// <param name="interactableCard">The DirectorCard of the interactable</param> /// <param name="category">The category of the interactable</param> /// <param name="stage">The stage to add the interactable to</param> /// <param name="customStageName">The name of the custom stage</param> public static void AddNewInteractableToStage(DirectorCard interactableCard, InteractableCategory category, Stage stage, string customStageName = "") { DirectorCardHolder card = new DirectorCardHolder { Card = interactableCard, InteractableCategory = category, MonsterCategory = MonsterCategory.None }; InteractableActions += (interactables, currentStage) => { if (currentStage.stage == stage) { if (currentStage.CheckStage(stage, customStageName)) { interactables.Add(card); } } }; }
/// <summary> /// Adds a new monster to a specific stage. /// For custom stages use Stage.Custom and enter the name of the stage in customStageName. /// </summary> /// <param name="monsterCard">The DirectorCard of the monster to add</param> /// <param name="category">The category to add the monster to</param> /// <param name="stage">The stage to add the monster to</param> /// <param name="customStageName">The name of the custom stage</param> public static void AddNewMonsterToStage(DirectorCard monsterCard, MonsterCategory category, Stage stage, string customStageName = "") { DirectorCardHolder card = new DirectorCardHolder { Card = monsterCard, InteractableCategory = InteractableCategory.None, MonsterCategory = category }; MonsterActions += (monsters, currentStage) => { if (currentStage.stage == stage) { if (currentStage.CheckStage(stage, customStageName)) { monsters.Add(card); } } }; }