コード例 #1
0
ファイル: ShopsOnly.cs プロジェクト: NekuSoul/ShopsOnly
        private WeightedSelection <DirectorCard> SceneDirector_GenerateInteractableCardSelection(On.RoR2.SceneDirector.orig_GenerateInteractableCardSelection orig, SceneDirector self)
        {
            if (!RunArtifactManager.instance.IsArtifactEnabled(_content.Artifact))
            {
                return(orig(self));
            }

            var weightedSelection = orig(self);

            var chestChance = 0f;

            for (var i = 0; i < weightedSelection.Count; i++)
            {
                var choiceInfo = weightedSelection.GetChoice(i);
                var prefabName = choiceInfo.value.spawnCard.prefab.name;

                if (!ReplacedChoices.Contains(prefabName))
                {
                    continue;
                }

                chestChance      += choiceInfo.weight;
                choiceInfo.weight = 0f;
                weightedSelection.ModifyChoiceWeight(i, 0);
            }

            for (var i = 0; i < weightedSelection.Count; i++)
            {
                var choiceInfo = weightedSelection.GetChoice(i);
                var prefabName = choiceInfo.value.spawnCard.prefab.name;

                if (prefabName != "TripleShop")
                {
                    continue;
                }

                chestChance       += choiceInfo.weight;
                choiceInfo.weight += chestChance;
                weightedSelection.ModifyChoiceWeight(i, choiceInfo.weight);
            }

            return(weightedSelection);
        }
コード例 #2
0
        private WeightedSelection <DirectorCard> SceneDirector_GenerateInteractableCardSelection(On.RoR2.SceneDirector.orig_GenerateInteractableCardSelection orig, SceneDirector self)
        {
            var retv = orig(self);

            mostRecentDeck = retv;
            return(retv);
        }