コード例 #1
0
        private static ClassicStageInfo.MonsterFamily GetMonsterFamily(MonsterFamilyHolder holder)
        {
            DirectorCardCategorySelection catSel = ScriptableObject.CreateInstance <DirectorCardCategorySelection>();

            catSel.categories    = new DirectorCardCategorySelection.Category[3];
            catSel.categories[0] = new DirectorCardCategorySelection.Category
            {
                name            = "Champions",
                selectionWeight = holder.familyChampionWeight,
                cards           = (holder.familyChampions != null ? holder.familyChampions.ToArray() : Array.Empty <DirectorCard>())
            };
            catSel.categories[1] = new DirectorCardCategorySelection.Category
            {
                name            = "Minibosses",
                selectionWeight = holder.familyMinibossWeight,
                cards           = (holder.familyMinibosses != null ? holder.familyMinibosses.ToArray() : Array.Empty <DirectorCard>())
            };
            catSel.categories[2] = new DirectorCardCategorySelection.Category
            {
                name            = "Basic Monsters",
                selectionWeight = holder.familyBasicMonsterWeight,
                cards           = (holder.familyBasicMonsters != null ? holder.familyBasicMonsters.ToArray() : Array.Empty <DirectorCard>())
            };
            return(new ClassicStageInfo.MonsterFamily
            {
                familySelectionChatString = holder.selectionChatString,
                maximumStageCompletion = holder.maxStageCompletion,
                minimumStageCompletion = holder.minStageCompletion,
                selectionWeight = holder.familySelectionWeight,
                monsterFamilyCategories = catSel
            });
        }
コード例 #2
0
 private static void RemoveScrapperCard(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
 {
     if (Enabled && ZetArtifactsPlugin.DropifactRemoveScrapper.Value)
     {
         dccs.RemoveCardsThatFailFilter(new Predicate <DirectorCard>(NotScrapper));
     }
 }
コード例 #3
0
 internal static void RemoveCleansingPools(SceneDirector _, DirectorCardCategorySelection cardCategorySelection)
 {
     cardCategorySelection.RemoveCardsThatFailFilter(card =>
     {
         return(card.spawnCard.name != "iscShrineCleanse");
     });
 }
コード例 #4
0
        static bool OnGenerateInteractableCardSelection(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
        {
            dccs.RemoveCardsThatFailFilter(card => {
                var obj = card.spawnCard.prefab;
                return(!(
                           obj.GetComponent <ShopTerminalBehavior>() && obj.name != "ShrineCleanse" ||
                           obj.GetComponent <MultiShopController>() ||
                           obj.GetComponent <ScrapperController>()
                           ));
            });

            return(false);
        }
コード例 #5
0
 private bool IsInteractableCategorySelection(DirectorCardCategorySelection categorySelection)
 {
     // categorySelection either contains only interactable or monster category. So it's enough to check the first category
     foreach (DirectorCardCategorySelection.Category category in categorySelection.categories)
     {
         foreach (string interactableCategory in interactablesCategories)
         {
             if (category.name.Equals(interactableCategory))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #6
0
ファイル: UIAMain.cs プロジェクト: DestroyedClone/PoseHelper
 private void RemoveInteractableCardsIfNoPickupAvailable(SceneDirector sceneDirector, DirectorCardCategorySelection dccs)
 {
     if (Run.instance)
     {
         dccs.RemoveCardsThatFailFilter(new Predicate <DirectorCard>(OnGenerateInteractableCardSelection));
     }
 }
コード例 #7
0
        public void Awake()//Code that runs when the game starts
        {
            string[] interactables     = { "iscBrokenDrone1", "iscBrokenDrone2", "iscBrokenMegaDrone", "iscBrokenMissileDrone", "iscBrokenTurret1", "iscBarrel1", "iscEquipmentBarrel", "iscLockbox", "iscChest1", "iscChest1Stealthed", "iscChest2", "iscGoldChest", "iscTripleShop", "iscTripleShopLarge", "iscDuplicator", "iscDuplicatorLarge", "iscDuplicatorMilitary", "iscShrineCombat", "iscShrineBoss", "iscShrineBlood", "iscShrineChance", "iscShrineHealing", "iscShrineRestack", "iscShrineGoldshoresAccess", "iscRadarTower", "iscTeleporter", "iscShopPortal", "iscMSPortal", "iscGoldshoresPortal", "iscGoldshoresBeacon" };
            string[] interactableNames = { "Gunner Drone", "Healing Drone", "Prototype Drone", "Missile Drone", "Broken Turret", "Barrel", "Equipment Barrel", "Rusty Lockbox", "Chest", "Stealthed Chest", "Large Chest", "Legendary Chest", "Triple Shop", "Triple Shop (Red and Green)", "3D Printer", "Large Printer (Green)", "Mili-tech Printer (Red)", "Shrine of Combat", "Shrine of the Mountain", "Shrine of Blood", "Shrine of Chance", "Shrine of the Forest", "Shrine of Order", "Gold Shrine", "Radar", "Teleporter", "Blue Portal", "Celestial Portal", "Gold Portal", "Halycon Beacon" };

            var addRule     = typeof(RuleCatalog).GetMethod("AddRule", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(RuleDef) }, null);
            var addCategory = typeof(RuleCatalog).GetMethod("AddCategory", BindingFlags.Static | BindingFlags.NonPublic, null, new Type[] { typeof(string), typeof(Color), typeof(string), typeof(Func <bool>) }, null);


            addCategory.Invoke(null, new object[] { "Interactables", new Color(219 / 255, 182 / 255, 19 / 255, byte.MaxValue), "", new Func <bool>(() => false) });
            RuleDef iscruleDef3 = new RuleDef("FloodWarning.InteractableScale", "Total interactable scale");

            for (int i = 0; i < 12; i++)
            {
                float myNum = (float)(Math.Pow(2f, i)) / 4f;
                if (i == 0)
                {
                    RuleChoiceDef tempRule = iscruleDef3.AddChoice("0", 0f, false);
                    tempRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                    tempRule.tooltipNameToken = "" + 0f + "x Interactable spawns";
                    tempRule.tooltipBodyToken = "" + 0f + "x The amount of interactables (Shrines, Chests, Buyable drones and turrets) will appear in the world";
                }

                RuleChoiceDef myRule = iscruleDef3.AddChoice("0", myNum, false);
                if (myNum == 1)
                {
                    iscruleDef3.MakeNewestChoiceDefault();
                }
                myRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                myRule.tooltipNameToken = "" + myNum + "x Interactable spawns";
                myRule.tooltipBodyToken = "" + myNum + "x The amount of interactables (Shrines, Chests, Buyable drones and turrets) will appear in the world";
            }
            addRule.Invoke(null, new object[] { iscruleDef3 });

            addCategory.Invoke(null, new object[] { "Weighted Selections", new Color(94 / 255, 82 / 255, 30 / 255, byte.MaxValue), "", new Func <bool>(() => false) });
            for (int i = 0; i < interactables.Length; i++)
            {
                RuleDef ChanceRule = new RuleDef("FloodWarning." + interactables[i] + "Chance", "Chance");

                for (int o = 0; o < 8; o++)
                {
                    float myNum = (float)(Math.Pow(2f, o)) / 4f;
                    if (o == 0)
                    {
                        RuleChoiceDef tempRule = ChanceRule.AddChoice("0", 0f, false);
                        tempRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        tempRule.tooltipNameToken = "0x Chance of " + interactableNames[i];
                        tempRule.tooltipBodyToken = "0x Chance that a given spawned interactable will be of type '" + interactableNames[i] + "'";
                        switch (interactables[i])
                        {
                        case "iscBrokenDrone1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenDrone2":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenMegaDrone":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenMissileDrone":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenTurret1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBarrel1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscEquipmentBarrel":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscLockbox":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest1Stealthed":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest2":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldChest":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTripleShop":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTripleShopLarge":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicator":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicatorLarge":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicatorMilitary":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscShrineCombat":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinecombatsymbol";
                            break;

                        case "iscShrineBoss":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinebosssymbole";
                            break;

                        case "iscShrineBlood":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinebloodsymbol";
                            break;

                        case "iscShrineChance":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinechancesymbol";
                            break;

                        case "iscShrineHealing":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinehealingsymbol";
                            break;

                        case "iscShrineRestack":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinerestacksymbol";
                            break;

                        case "iscShrineGoldshoresAccess":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscRadarTower":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTeleporter":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscShopPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscMSPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldshoresPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldshoresBeacon":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;
                        }
                    }
                    RuleChoiceDef myRule = ChanceRule.AddChoice("0", myNum, false);
                    if (myNum == 1)
                    {
                        ChanceRule.MakeNewestChoiceDefault();
                    }

                    myRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                    myRule.tooltipNameToken = "" + myNum + "x Chance of " + interactableNames[i];
                    myRule.tooltipBodyToken = "" + myNum + "x Chance that a given spawned interactable will be of type '" + interactableNames[i] + "'";
                    switch (interactables[i])
                    {
                    case "iscBrokenDrone1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenDrone2":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenMegaDrone":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenMissileDrone":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenTurret1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBarrel1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscEquipmentBarrel":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscLockbox":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest1Stealthed":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest2":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldChest":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTripleShop":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTripleShopLarge":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicator":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicatorLarge":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicatorMilitary":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscShrineCombat":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinecombatsymbol";
                        break;

                    case "iscShrineBoss":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinebosssymbole";
                        break;

                    case "iscShrineBlood":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinebloodsymbol";
                        break;

                    case "iscShrineChance":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinechancesymbol";
                        break;

                    case "iscShrineHealing":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinehealingsymbol";
                        break;

                    case "iscShrineRestack":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinerestacksymbol";
                        break;

                    case "iscShrineGoldshoresAccess":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscRadarTower":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTeleporter":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscShopPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscMSPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldshoresPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldshoresBeacon":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;
                    }
                }
                addRule.Invoke(null, new object[] { ChanceRule });
            }

            addCategory.Invoke(null, new object[] { "Guarantees", new Color(94 / 255, 82 / 255, 30 / 255, byte.MaxValue), "", new Func <bool>(() => false) });
            for (int i = 0; i < interactables.Length; i++)
            {
                RuleDef GuaranteeRule = new RuleDef("FloodWarning." + interactables[i] + "Guaranteed", "Guaranteed");

                for (int o = 0; o < 8; o++)
                {
                    float myNum = (float)Math.Pow(2f, o);
                    if (o == 0)
                    {
                        RuleChoiceDef tempRule = GuaranteeRule.AddChoice("0", 0f, false);
                        tempRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        tempRule.tooltipNameToken = "0 Guaranteed " + interactableNames[i];
                        tempRule.tooltipBodyToken = "No Guaranteee that any " + interactableNames[i] + " will spawn";
                        switch (interactables[i])
                        {
                        case "iscBrokenDrone1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenDrone2":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenMegaDrone":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenMissileDrone":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBrokenTurret1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscBarrel1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscEquipmentBarrel":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscLockbox":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest1":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest1Stealthed":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscChest2":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldChest":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTripleShop":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTripleShopLarge":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicator":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicatorLarge":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscDuplicatorMilitary":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscShrineCombat":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinecombatsymbol";
                            break;

                        case "iscShrineBoss":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinebosssymbole";
                            break;

                        case "iscShrineBlood":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinebloodsymbol";
                            break;

                        case "iscShrineChance":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinechancesymbol";
                            break;

                        case "iscShrineHealing":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinehealingsymbol";
                            break;

                        case "iscShrineRestack":
                            tempRule.spritePath = "Textures/shrinesymbols/texshrinerestacksymbol";
                            break;

                        case "iscShrineGoldshoresAccess":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscRadarTower":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscTeleporter":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscShopPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscMSPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldshoresPortal":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;

                        case "iscGoldshoresBeacon":
                            tempRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                            break;
                        }
                    }
                    RuleChoiceDef myRule = GuaranteeRule.AddChoice("0", myNum, false);
                    if (myNum == 0)
                    {
                        GuaranteeRule.MakeNewestChoiceDefault();
                    }
                    myRule.spritePath       = "Textures/MiscIcons/texRuleBonusStartingMoney";
                    myRule.tooltipNameToken = "" + myNum + " Guaranteed " + interactableNames[i];
                    myRule.tooltipBodyToken = "" + myNum + " " + interactableNames[i] + "(s) Will always spawn in your world.";
                    switch (interactables[i])
                    {
                    case "iscBrokenDrone1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenDrone2":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenMegaDrone":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenMissileDrone":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBrokenTurret1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscBarrel1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscEquipmentBarrel":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscLockbox":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest1":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest1Stealthed":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscChest2":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldChest":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTripleShop":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTripleShopLarge":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicator":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicatorLarge":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscDuplicatorMilitary":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscShrineCombat":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinecombatsymbol";
                        break;

                    case "iscShrineBoss":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinebosssymbole";
                        break;

                    case "iscShrineBlood":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinebloodsymbol";
                        break;

                    case "iscShrineChance":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinechancesymbol";
                        break;

                    case "iscShrineHealing":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinehealingsymbol";
                        break;

                    case "iscShrineRestack":
                        myRule.spritePath = "Textures/shrinesymbols/texshrinerestacksymbol";
                        break;

                    case "iscShrineGoldshoresAccess":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscRadarTower":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscTeleporter":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscShopPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscMSPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldshoresPortal":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;

                    case "iscGoldshoresBeacon":
                        myRule.spritePath = "Textures/MiscIcons/texRuleBonusStartingMoney";
                        break;
                    }
                }
                addRule.Invoke(null, new object[] { GuaranteeRule });
            }


            bool gotCategory = false;
            DirectorCardCategorySelection myCategorySelection = new DirectorCardCategorySelection();

            Debug.Log("IGNORE THE ABOVE WARNING, THIS IS INTENDED");


            On.RoR2.ClassicStageInfo.GenerateDirectorCardWeightedSelection += (orig, self, categorySelection) =>
            {
                if (!gotCategory)
                {
                    myCategorySelection = categorySelection;
                    gotCategory         = true;
                }

                foreach (DirectorCardCategorySelection.Category category in myCategorySelection.categories)
                {
                    Debug.Log(category.name);

                    float num = myCategorySelection.SumAllWeightsInCategory(category);
                    foreach (DirectorCard directorCard in category.cards)
                    {
                        for (int i = 0; i < interactables.Length; i++)
                        {
                            if (directorCard.spawnCard.name.ToString() == interactables[i])
                            {
                                Debug.Log("Editing weight of " + interactables[i]);
                                directorCard.selectionWeight *= (int)((float)Run.instance.ruleBook.GetRuleChoice(RuleCatalog.FindRuleDef("FloodWarning." + interactables[i] + "Chance")).extraData);
                            }
                        }
                    }
                }

                return(orig(self, categorySelection));
            };

            On.RoR2.SceneDirector.PlaceTeleporter += (orig, self) =>
            {
                int currentCredits = (int)Harmony.AccessTools.Field(Harmony.AccessTools.TypeByName("RoR2.SceneDirector"), "interactableCredit").GetValue(self);
                Harmony.AccessTools.Field(Harmony.AccessTools.TypeByName("RoR2.SceneDirector"), "interactableCredit").SetValue(self, (int)(currentCredits * (float)Run.instance.ruleBook.GetRuleChoice(RuleCatalog.FindRuleDef("FloodWarning.InteractableScale")).extraData));

                orig(self);

                Xoroshiro128Plus rng        = new Xoroshiro128Plus((ulong)Run.instance.stageRng.nextUint);;
                DirectorCore     myDirector = (DirectorCore)Harmony.AccessTools.Field(Harmony.AccessTools.TypeByName("RoR2.SceneDirector"), "directorCore").GetValue(self);
                for (int i = 0; i < interactables.Length; i++)
                {
                    for (int o = 0; o < (float)Run.instance.ruleBook.GetRuleChoice(RuleCatalog.FindRuleDef("FloodWarning." + interactables[i] + "Guaranteed")).extraData; o++)
                    {
                        GameObject myGameObject = myDirector.TrySpawnObject(Resources.Load <SpawnCard>((string)("SpawnCards/InteractableSpawnCard/" + interactables[i])), new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, rng);

                        if (myGameObject.GetComponent <PurchaseInteraction>())
                        {
                            myGameObject.GetComponent <PurchaseInteraction>().cost = Run.instance.GetDifficultyScaledCost(myGameObject.GetComponent <PurchaseInteraction>().cost);
                        }
                    }
                }
            };
        }
コード例 #8
0
 static DirectorCardCategorySelection SwapDccs(DirectorCardCategorySelection vanillaDccs)
 {
     return(_dccsMixEnemyArtifact);
 }
コード例 #9
0
ファイル: RPGMod.cs プロジェクト: ben2882/RPGMod
        public void Awake()
        {
            // Loads the config and assetbundle
            Questing.Config.Load(Config, false);

            var execAssembly = Assembly.GetExecutingAssembly();
            var stream = execAssembly.GetManifestResourceStream("RPGMod.assetbundle");
            Core.assetBundle = AssetBundle.LoadFromStream(stream);

            if (Core.assetBundle == null)
            {
                Debug.LogError("RPGMOD: Failed to load assetbundle");
                return;
            }

            if (Questing.Config.questingEnabled)
            {

                // Runs when the game starts
                On.RoR2.Run.Start += (orig, self) =>
                {
                    GameStarted = true;
                    QuestCooldown = 0;
                    StartClientHandlers();
                    orig(self);
                };

                // Ensures UI is killed when the game ends
                On.RoR2.Run.OnClientGameOver += (orig, self, runReport) =>
                {
                    DestroyUIInstances();
                    orig(self, runReport);
                };

                // When the game is left all mod variables are reset
                On.RoR2.Run.OnDisable += (orig, self) =>
                {
                    GameStarted = false;
                    Questing.ClientMessage.Instances.Clear();
                    Questing.ServerMessage.Instances.Clear();

                    CachedCharacterBody = null;

                    DestroyUIInstances();
                    Core.Reset();

                    orig(self);
                };

                // When a new stage starts all the quests refresh in order to still be achievable
                On.RoR2.Run.BeginStage += (orig, self) =>
                {
                    if (!NetworkServer.active)
                    {
                        return;
                    }

                    foreach (var message in Questing.ClientMessage.Instances)
                    {
                        message.active = false;
                        message.advancingStage = true;
                        message.SendToAll();
                    }

                    if (Core.debugMode)
                    {
                        Debug.Log("Messages removed!");
                    }

                    for (int i = 0; i < Questing.ServerMessage.Instances.Count; i++)
                    {
                        Questing.ServerMessage.Instances[i].awaitingClientMessage = true;
                    }

                    if (Core.debugMode)
                    {
                        Debug.Log("Messages expected!");
                    }

                    QuestCooldown = (Run.instance.GetRunStopwatch() - Questing.Config.questCooldownTime + Questing.Config.questCooldownTimeOnSceneChange);

                    orig(self);
                };

                // Ensures that objects that have died with no body are ignored by the OnCharacterDeath hook
                On.RoR2.HealthComponent.Suicide += (orig, self, killerOverride, inflictorOverride, damageType) =>
                {
                    if (gameObject.GetComponent<CharacterBody>() == null || self.gameObject.GetComponent<CharacterBody>().isBoss)
                    {
                        IgnoreDeath = true;
                    }
                    orig(self, killerOverride, inflictorOverride, damageType);
                };

                // Handles the enemy drops
                On.RoR2.GlobalEventManager.OnCharacterDeath += (orig, self, damageReport) =>
                {
                    IgnoreDeath = Questing.Listener.HookOnCharacterDeath(IgnoreDeath, damageReport);
                    orig(self, damageReport);
                };

                // Questing Listener hooks

                On.RoR2.CharacterMaster.GiveMoney += (orig, self, amount) =>
                {
                    Questing.Listener.UpdateQuest((int)amount, Questing.Type.CollectGold, "Gold");
                    orig(self, amount);
                };

                On.RoR2.ChestBehavior.ItemDrop += (orig, self) =>
                {
                    Questing.Listener.UpdateQuest(1, Questing.Type.OpenChests, "Chests");
                    orig(self);
                };

                On.RoR2.HealthComponent.Heal += (orig, self, amount, procChainMask, nonRegen) =>
                {
                    if (self.body.isPlayerControlled)
                    {
                        Questing.Listener.UpdateQuest((int)amount, Questing.Type.Heal, "Damage");
                    }
                    return orig(self, amount, procChainMask, nonRegen);
                };

                //

            }


            // Injects the spawn percentage into the games director when populating the scene
            On.RoR2.SceneDirector.PopulateScene += (orig, self) =>
            {
                int credit = self.GetFieldValue<int>("interactableCredit");
                self.SetFieldValue("interactableCredit", (int)(credit * Questing.Config.worldSpawnPercentage));
                orig(self);
            };

            if (!Questing.Config.defaultWorldSpawnsEnabled)
            {
                // Handles banned scene spawns
                On.RoR2.ClassicStageInfo.Awake += (orig, self) =>
                {
                    // Gets card catergories using reflection
                    DirectorCardCategorySelection cardSelection = self.GetFieldValue<DirectorCardCategorySelection>("interactableCategories");
                    for (int i = 0; i < cardSelection.categories.Length; i++)
                    {
                        // Makes copy of category to make changes
                        var cardsCopy = cardSelection.categories[i];
                        cardsCopy.cards = cardSelection.categories[i].cards.Where(val => !Questing.Config.bannedDirectorSpawns.Any(val.spawnCard.prefab.name.Contains)).ToArray();

                        // Sets category to new edited version
                        cardSelection.categories[i] = cardsCopy;
                    }
                    // Sets new card categories
                    self.SetFieldValue("interactableCategories", cardSelection);

                    // Runs original function
                    orig(self);
                };
            }

            Debug.Log("RPGMod: Loaded Successfully!");
        }
コード例 #10
0
ファイル: Main.cs プロジェクト: Reinms/RoR2Modding
 private void SpawnsCore_monsterEdits1(ClassicStageInfo stageInfo, Run runInstance, DirectorCardCategorySelection monsterSelection)
 {
     foreach (var m in monsterSelection.categories)
     {
         if (m.name.Contains("ions"))
         {
             foreach (var n in m.cards)
             {
                 //Main.LogW( n.spawnCard.name );
                 if (n.spawnCard.name != "cscBeetleQueen")
                 {
                     n.selectionWeight = 0;
                 }
                 else
                 {
                     var master = (n.spawnCard as CharacterSpawnCard).prefab;
                     foreach (var v in master.GetComponents <RoR2.CharacterAI.AISkillDriver>())
                     {
                         if (v.skillSlot == SkillSlot.Secondary)
                         {
                             v.maxUserHealthFraction = 0f;
                             v.minUserHealthFraction = 0f;
                         }
                     }
                     master.GetComponent <CharacterMaster>().bodyPrefab.AddComponent <TimeThing>();
                 }
             }
         }
         else
         {
             foreach (var n in m.cards)
             {
                 var body = n.spawnCard.prefab.GetComponent <CharacterMaster>().bodyPrefab.GetComponent <CharacterBody>();
                 body.baseDamage  = 0f;
                 body.levelDamage = 0f;
             }
         }
     }
 }
コード例 #11
0
 private void SpawnsCore_monsterEdits(ClassicStageInfo stageInfo, Run runInstance, DirectorCardCategorySelection monsterSelection)
 {
     Log.Warning("edits");
     Log.Warning(monsterSelection.name);
     if (monsterSelection.name == "dccsSkyMeadowMonsters")
     {
         Log.Warning("IsRightMap");
         //monsterSelection.RemoveCardsThatFailFilter( ( card ) => !( card.spawnCard.name.Contains( "Grandparent" ) ) );
         _ = monsterSelection.AddCard(0, this.dirCard);
         _ = monsterSelection.AddCard(1, this.dirCard);
         _ = monsterSelection.AddCard(2, this.dirCard);
     }
 }
コード例 #12
0
ファイル: ArchaicWisp.cs プロジェクト: Reinms/RoR2Modding
        private static void SpawnsCore_monsterEdits1(ClassicStageInfo stageInfo, Run runInstance, DirectorCardCategorySelection monsterSelection)
        {
            if (runInstance.selectedDifficulty < DifficultyIndex.Hard && runInstance is not EclipseRun)
            {
                return;
            }
            for (Int32 i = 0; i < monsterSelection.categories.Length; ++i)
            {
                var category = monsterSelection.categories[i];
                if (category.name.ToLower() != "minibosses")
                {
                    continue;
                }

                var ind = category.cards.Length;
                Array.Resize <DirectorCard>(ref category.cards, ind + 1);
                category.cards[ind] = ArW_dirCard;

                monsterSelection.categories[i] = category;
                break;
            }
        }
コード例 #13
0
ファイル: HappyThings.cs プロジェクト: Reinms/RoR2Modding
 private void SpawnsCore_monsterEdits(ClassicStageInfo stageInfo, Run runInstance, DirectorCardCategorySelection monsterSelection)
 {
     for (Int32 i = 0; i < monsterSelection.categories.Length; ++i)
     {
         ref var cat = ref monsterSelection.categories[i];
         for (Int32 j = 0; j < cat.cards.Length; ++j)
         {
             var card = cat.cards[j];
             if (card.spawnCard is CharacterSpawnCard csc && csc.name?.ToLower() == "cscelectricworm")
             {
                 csc.noElites = false;
             }
         }
     }
コード例 #14
0
        //private void Run_Start(On.RoR2.Run.orig_Start orig, Run self)
        //{
        //    orig(self);
        //    SceneField sc = new SceneField("bazaar");
        //    NetworkManager.singleton.ServerChangeScene(sc);
        //    isFirstBazaarVisit = true;
        //    isFirstStage = true;
        //}

        //private void SceneDirector_Start(On.RoR2.SceneDirector.orig_Start orig, SceneDirector self)
        //{
        //    if (NetworkServer.active)
        //    {
        //        if (Run.instance.stageClearCount == 0)
        //        {
        //            if (isFirstBazaarVisit && SceneManager.GetActiveScene().name.Contains("bazaar"))
        //            {
        //                GiveMoneyToPlayers(-(int)Run.instance.ruleBook.startingMoney);
        //                isFirstBazaarVisit = false;
        //            }
        //            else if (isFirstStage)
        //            {
        //                GiveMoneyToPlayers((int)Run.instance.ruleBook.startingMoney);
        //                isFirstStage = false;
        //            }
        //        }
        //    }
        //    orig(self);
        //}

        private WeightedSelection <DirectorCard> ClassicStageInfo_GenerateDirectorCardWeightedSelection(On.RoR2.ClassicStageInfo.orig_GenerateDirectorCardWeightedSelection orig, ClassicStageInfo self, DirectorCardCategorySelection categorySelection)
        {
            WeightedSelection <DirectorCard> weightedSelection = new WeightedSelection <DirectorCard>(8);

            foreach (DirectorCardCategorySelection.Category category in categorySelection.categories)
            {
                float num = categorySelection.SumAllWeightsInCategory(category);
                if (category.name.Contains("Champion"))
                {
                    foreach (DirectorCard directorCard in category.cards)
                    {
                        directorCard.cost = Mathf.RoundToInt(directorCard.cost * (1 / ModConfig.BossSpawnCostReductionMultiplier.Value));
                        weightedSelection.AddChoice(directorCard, (float)directorCard.selectionWeight / num * category.selectionWeight);
                    }
                }
            }
            return(weightedSelection);
        }