Exemplo n.º 1
0
        private IEnumerator ToggleFastFocusCoroutine()
        {
            yield return(null);

            yield return(new WaitWhile(() => HeroController.instance == null || HeroController.instance.spellControl == null));

            try
            {
                FsmState           deepFocusSpeed = HeroController.instance.spellControl.GetState("Deep Focus Speed");
                FsmFloat           tpd            = HeroController.instance.spellControl.FsmVariables.FindFsmFloat("Time Per MP Drain");
                PlayerDataBoolTest test           = deepFocusSpeed.GetFirstActionOfType <PlayerDataBoolTest>();
                FloatMultiply      slowFocus      = deepFocusSpeed.GetLastActionOfType <FloatMultiply>();
                if (test == null || slowFocus == null)
                {
                    throw new InvalidOperationException("Unable to find Deep Focus Speed actions.");
                }

                if (Settings.FasterFocus)
                {
                    deepFocusSpeed.Actions = new FsmStateAction[]
                    {
                        new FloatMultiply
                        {
                            floatVariable = tpd,
                            multiplyBy    = Settings.FasterFocusTimeMultipler,
                            everyFrame    = false,
                        },
                        test,
                        slowFocus,
                    };
                }
                else
                {
                    deepFocusSpeed.Actions = new FsmStateAction[] { test, slowFocus };
                }
            }
            catch (Exception e)
            {
                LogError(e);
            }
        }
Exemplo n.º 2
0
        private IEnumerator addCharmStates(HeroController self)
        {
            yield return(new WaitWhile(() => ch.charmIDs.Count < 4));

            var spellFsm    = self.gameObject.LocateMyFSM("Spell Control");
            var spellFsmVar = spellFsm.FsmVariables;

            #region Quick Focus Speeds

            var fmAction = new FloatMultiply();
            fmAction.floatVariable = spellFsmVar.FindFsmFloat("Time Per MP Drain");
            fmAction.multiplyBy    = 2f / 3f;

            spellFsm.CopyState("Set Focus Speed", "Set QuickerFocus Speed");
            spellFsm.RemoveAction("Set QuickerFocus Speed", 0);
            spellFsm.RemoveAction("Set QuickerFocus Speed", 0);
            spellFsm.RemoveAction("Set QuickerFocus Speed", 2);
            spellFsm.GetAction <PlayerDataBoolTest>("Set QuickerFocus Speed", 0).boolName = $"equippedCharm_{ch.charmIDs[0]}";
            spellFsm.AddAction("Set QuickerFocus Speed", fmAction);
            spellFsm.GetAction <FloatMultiply>("Set QuickerFocus Speed", 2).multiplyBy = Mathf.Pow(2f / 3f, 2);

            spellFsm.CopyState("Set Focus Speed", "Set QuickestFocus Speed");
            spellFsm.RemoveAction("Set QuickestFocus Speed", 0);
            spellFsm.RemoveAction("Set QuickestFocus Speed", 0);
            spellFsm.RemoveAction("Set QuickestFocus Speed", 2);
            spellFsm.GetAction <PlayerDataBoolTest>("Set QuickestFocus Speed", 0).boolName = $"equippedCharm_{ch.charmIDs[1]}";
            spellFsm.AddAction("Set QuickestFocus Speed", fmAction);
            spellFsm.GetAction <FloatMultiply>("Set QuickestFocus Speed", 2).multiplyBy = Mathf.Pow(2f / 3f, 3);

            spellFsm.ChangeTransition("Set Focus Speed", "FINISHED", "Set QuickerFocus Speed");
            spellFsm.ChangeTransition("Set QuickerFocus Speed", "FINISHED", "Set QuickestFocus Speed");

            #endregion

            #region Deep Focus Speeds

            spellFsm.CopyState("Deep Focus Speed", "Deeper Focus Speed");
            spellFsm.GetAction <PlayerDataBoolTest>("Deeper Focus Speed", 0).boolName = $"equippedCharm_{ch.charmIDs[2]}";
            spellFsm.GetAction <FloatMultiply>("Deeper Focus Speed", 1).multiplyBy    = Mathf.Pow(1.65f, 2);

            spellFsm.CopyState("Deep Focus Speed", "Deepest Focus Speed");
            spellFsm.GetAction <PlayerDataBoolTest>("Deepest Focus Speed", 0).boolName = $"equippedCharm_{ch.charmIDs[3]}";
            spellFsm.GetAction <FloatMultiply>("Deepest Focus Speed", 1).multiplyBy    = Mathf.Pow(1.65f, 3);

            spellFsm.ChangeTransition("Deep Focus Speed", "FINISHED", "Deeper Focus Speed");
            spellFsm.ChangeTransition("Deeper Focus Speed", "FINISHED", "Deepest Focus Speed");

            #endregion

            #region Hp Amounts

            var iaa2 = new IntAdd
            {
                intVariable = spellFsmVar.FindFsmInt("Health Increase"),
                add         = 2
            };
            var iaa3 = new IntAdd
            {
                intVariable = spellFsmVar.FindFsmInt("Health Increase"),
                add         = 3
            };

            spellFsm.CopyState("Set HP Amount", "Set HP Amount Deeper");
            spellFsm.RemoveAction("Set HP Amount Deeper", 0);
            spellFsm.RemoveAction("Set HP Amount Deeper", 1);
            spellFsm.GetAction <PlayerDataBoolTest>("Set HP Amount Deeper", 0).boolName = $"equippedCharm_{ch.charmIDs[2]}";
            spellFsm.AddAction("Set HP Amount Deeper", iaa2);

            spellFsm.CopyState("Set HP Amount", "Set HP Amount Deepest");
            spellFsm.RemoveAction("Set HP Amount Deepest", 0);
            spellFsm.RemoveAction("Set HP Amount Deepest", 1);
            spellFsm.GetAction <PlayerDataBoolTest>("Set HP Amount Deepest", 0).boolName = $"equippedCharm_{ch.charmIDs[3]}";
            spellFsm.AddAction("Set HP Amount Deepest", iaa3);

            spellFsm.ChangeTransition("Set HP Amount", FsmEvent.Finished.Name, "Set HP Amount Deeper");
            spellFsm.ChangeTransition("Set HP Amount Deeper", FsmEvent.Finished.Name, "Set HP Amount Deepest");

            #endregion
        }