Exemplo n.º 1
0
        public override void Process(string scene, Object changeObj)
        {
            if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName ||
                fsm.gameObject.name != _objectName)
            {
                return;
            }

            FsmState pdBool      = fsm.GetState("PD Bool?");
            FsmState charm       = fsm.GetState("Charm?");
            FsmState bigItem     = fsm.GetState("Big Item?");
            FsmState bigGetFlash = fsm.GetState("Big Get Flash");
            FsmState trinkFlash  = fsm.GetState("Trink Flash");
            FsmState giveTrinket = fsm.GetState("Store Key");

            // Remove actions that stop shiny from spawning
            pdBool.RemoveActionsOfType <StringCompare>();

            // Change pd bool test to our new bool
            pdBool.RemoveActionsOfType <PlayerDataBoolTest>();
            pdBool.AddAction(
                new RandomizerExecuteLambda(() => fsm.SendEvent(
                                                ItemChanger.instance.Settings.CheckObtained(_ilp.id) ? "COLLECTED" : null
                                                )));


            // Charm must be preserved as the entry point for AddYNDialogueToShiny
            charm.ClearTransitions();
            charm.AddTransition("FINISHED", "Big Item?");

            // Check whether next item should be normal or big popup
            bigItem.ClearTransitions();
            bigItem.AddFirstAction(new RandomizerExecuteLambda(() => bigItem.AddTransition("FINISHED", GetNextAdditiveItem(_ilp).item.type != _Item.ItemType.Big ? "Trink Flash" : "Big Get Flash")));

            // normal path
            trinkFlash.ClearTransitions();
            trinkFlash.AddTransition("FINISHED", "Store Key");
            fsm.GetState("Trinket Type").ClearTransitions();
            trinkFlash.AddTransition("FINISHED", "Store Key");
            giveTrinket.RemoveActionsOfType <SetPlayerDataBool>();
            giveTrinket.AddAction(new RandomizerExecuteLambda(() => GiveItem(_ilp)));
            giveTrinket.AddFirstAction(new RandomizerExecuteLambda(
                                           () =>
            {
                giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = GetNextAdditiveItem(_ilp).item.nameKey;
                giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = GetNextAdditiveItem(_ilp).item.sprite;
            }));

            // Normal path for big items. Set bool and show the popup after the flash
            bigGetFlash.AddAction(new RandomizerExecuteLambda(() => BigItemPopup.Show(GetNextAdditiveItem(_ilp).item, fsm.gameObject, "GET ITEM MSG END")));

            // set the pickup
            bigGetFlash.AddAction(new RandomizerExecuteLambda(() => GiveItem(_ilp)));

            // Exit the fsm after the popup
            bigGetFlash.ClearTransitions();
            bigGetFlash.AddTransition("GET ITEM MSG END", "Hero Up");
            bigGetFlash.AddTransition("HERO DAMAGED", "Finish");
        }
 public override void SendMessage(MessageType type, Action callback)
 {
     if ((type & MessageType.Big) == MessageType.Big)
     {
         BigItemPopup.Show(SpriteManager.GetSprite(bigSpriteKey), takeKey, nameKey, buttonKey, descOneKey, descTwoKey, callback);
     }
     else
     {
         base.SendMessage(type, callback);
     }
 }
Exemplo n.º 3
0
        public override void Process(string scene, Object changeObj)
        {
            if (scene != _sceneName || !(changeObj is PlayMakerFSM fsm) || fsm.FsmName != _fsmName ||
                fsm.gameObject.name != _objectName)
            {
                return;
            }

            FsmState pdBool      = fsm.GetState("PD Bool?");
            FsmState charm       = fsm.GetState("Charm?");
            FsmState bigItem     = fsm.GetState("Big Item?");
            FsmState bigGetFlash = fsm.GetState("Big Get Flash");
            FsmState trinkFlash  = fsm.GetState("Trink Flash");
            FsmState giveTrinket = fsm.GetState("Store Key");

            // Remove actions that stop shiny from spawning
            pdBool.RemoveActionsOfType <StringCompare>();

            // Change pd bool test to our new bool
            pdBool.RemoveActionsOfType <PlayerDataBoolTest>();
            pdBool.AddAction(
                new RandomizerExecuteLambda(() => fsm.SendEvent(
                                                RandomizerMod.Instance.Settings.CheckLocationFound(_location) ? "COLLECTED" : null
                                                )));


            // Charm must be preserved as the entry point for AddYNDialogueToShiny
            charm.ClearTransitions();
            charm.AddTransition("FINISHED", "Big Item?");

            // Check if each additive item has already been obtained. Give 100 geo instead of popup if so.
            bigItem.ClearTransitions();
            bigItem.AddFirstAction(new RandomizerExecuteLambda(() => bigItem.AddTransition("FINISHED", BigItemPopup.AdditiveMaxedOut(_itemDefs) ? "Trink Flash" : "Big Get Flash"))); // if we have duplicates, the last item is not a big popup

            // give 300 geo for last duplicate
            trinkFlash.ClearTransitions();
            trinkFlash.AddTransition("FINISHED", "Store Key");
            fsm.GetState("Trinket Type").ClearTransitions();
            trinkFlash.AddTransition("FINISHED", "Store Key");
            giveTrinket.RemoveActionsOfType <SetPlayerDataBool>();
            giveTrinket.AddAction(new RandomizerExecuteLambda(() => GiveItem(GiveItemActions.GiveAction.AddGeo, _item, _location, 300)));
            giveTrinket.GetActionsOfType <GetLanguageString>().First().convName     = _itemDefs.Last().NameKey;
            giveTrinket.GetActionsOfType <SetSpriteRendererSprite>().First().sprite = RandomizerMod.GetSprite(Randomization.LogicManager.GetItemDef(_itemDefs.Last().Name).shopSpriteKey);

            // Normal path for big items. Set bool and show the popup after the flash
            bigGetFlash.AddAction(new RandomizerCallStaticMethod(
                                      typeof(BigItemPopup),
                                      nameof(BigItemPopup.ShowAdditive),
                                      _itemDefs,
                                      fsm.gameObject,
                                      "GET ITEM MSG END"));

            // Don't actually need to set the skill here, that happens in BigItemPopup
            // Maybe change that at some point, it's not where it should happen
            bigGetFlash.AddAction(new RandomizerExecuteLambda(() => GiveItem(_action, _item, _location)));

            // Exit the fsm after the popup
            bigGetFlash.ClearTransitions();
            bigGetFlash.AddTransition("GET ITEM MSG END", "Hero Up");
            bigGetFlash.AddTransition("HERO DAMAGED", "Finish");
        }