Beispiel #1
0
        public static void AddToSendRandomEventV3
        (
            this SendRandomEventV3 sre,
            string toState,
            float weight,
            int eventMaxAmount,
            int missedMaxAmount,
            string?eventName = null,
            bool createInt   = true
        )
        {
            var fsm = (PlayMakerFSM)sre.Fsm.Owner;

            string state = sre.State.Name;

            eventName ??= toState.Split(' ').First();

            fsm.GetState(state).AddTransition(eventName, toState);

            sre.events             = sre.events.Append(fsm.GetState(state).Transitions.Single(x => x.FsmEvent.Name == eventName).FsmEvent).ToArray();
            sre.weights            = sre.weights.Append(weight).ToArray();
            sre.trackingInts       = sre.trackingInts.Append(fsm.GetOrCreateInt($"Ms {eventName}")).ToArray();
            sre.eventMax           = sre.eventMax.Append(eventMaxAmount).ToArray();
            sre.trackingIntsMissed = sre.trackingIntsMissed.Append(fsm.GetOrCreateInt($"Ct {eventName}")).ToArray();
            sre.missedMax          = sre.missedMax.Append(missedMaxAmount).ToArray();
        }
Beispiel #2
0
        public void UpdatePhase2(PlayMakerFSM lordFSM)
        {
            SendRandomEventV3 rand = lordFSM.GetAction <SendRandomEventV3>("Attack Choice", 5);

            // DASH, DSTAB, THROW
            // 1, 1, 1 => 1/6
            rand.weights[2].Value /= 10f;
            Log("Updated Phase 2 Lord: " + lordFSM.name);
        }
Beispiel #3
0
        public static void AddToSendRandomEventV3
        (
            this SendRandomEventV3 sre,
            string toState,
            float weight,
            int eventMaxAmount,
            int missedMaxAmount,
            [CanBeNull] string eventName = null,
            bool createInt = true
        )
        {
            var    fsm   = sre.Fsm.Owner as PlayMakerFSM;
            string state = sre.State.Name;

            eventName = eventName ?? toState.Split(' ').First();

            List <FsmEvent> events             = sre.events.ToList();
            List <FsmFloat> weights            = sre.weights.ToList();
            List <FsmInt>   trackingInts       = sre.trackingInts.ToList();
            List <FsmInt>   eventMax           = sre.eventMax.ToList();
            List <FsmInt>   trackingIntsMissed = sre.trackingIntsMissed.ToList();
            List <FsmInt>   missedMax          = sre.missedMax.ToList();

            fsm.AddTransition(state, eventName, toState);

            events.Add(fsm.GetState(state).Transitions.Single(x => x.FsmEvent.Name == eventName).FsmEvent);
            weights.Add(weight);
            trackingInts.Add(fsm.GetOrCreateInt($"Ct {eventName}"));
            eventMax.Add(eventMaxAmount);
            trackingIntsMissed.Add(fsm.GetOrCreateInt($"Ms {eventName}"));
            missedMax.Add(missedMaxAmount);

            sre.events             = events.ToArray();
            sre.weights            = weights.ToArray();
            sre.trackingInts       = trackingInts.ToArray();
            sre.eventMax           = eventMax.ToArray();
            sre.trackingIntsMissed = trackingIntsMissed.ToArray();
            sre.missedMax          = missedMax.ToArray();
        }
Beispiel #4
0
        private IEnumerator addGodSpikes()
        {
            //FsmUtil.changeTransition(grimmFSM, "Move Choice", "PILLARS", "AD Pos");

            SendRandomEventV3 sreV3 = grimmFSM.getState("Move Choice").getActionsOfType <SendRandomEventV3>()[0];

            try
            {
                FsmInt[]   maxEvents          = new FsmInt[sreV3.events.Length - 1];
                FsmEvent[] events             = new FsmEvent[sreV3.events.Length - 1];
                FsmInt[]   missedMax          = new FsmInt[sreV3.events.Length - 1];
                FsmInt[]   trackingInts       = new FsmInt[sreV3.events.Length - 1];
                FsmInt[]   trackingIntsMissed = new FsmInt[sreV3.events.Length - 1];
                FsmFloat[] weights            = new FsmFloat[sreV3.events.Length - 1];
                bool       foundEvent         = false;
                for (int i = 0; i < sreV3.events.Length; i++)
                {
                    infinite_globals.log(sreV3.eventMax[i].Value + ", " + sreV3.events[i].Name + ", " + sreV3.missedMax[i].Value +
                                         ", " + sreV3.trackingInts[i].Value + ", " + sreV3.trackingIntsMissed[i].Value + ", " +
                                         sreV3.weights[i].Value);
                    if (sreV3.events[i].Name == "SPIKES")
                    {
                        foundEvent = true;
                        continue;
                    }
                    if (!foundEvent)
                    {
                        maxEvents[i]          = sreV3.eventMax[i];
                        events[i]             = sreV3.events[i];
                        missedMax[i]          = sreV3.missedMax[i];
                        trackingInts[i]       = sreV3.trackingInts[i];
                        trackingIntsMissed[i] = sreV3.trackingIntsMissed[i];
                        weights[i]            = sreV3.weights[i];
                    }
                    else
                    {
                        maxEvents[i - 1]          = sreV3.eventMax[i];
                        events[i - 1]             = sreV3.events[i];
                        missedMax[i - 1]          = sreV3.missedMax[i];
                        trackingInts[i - 1]       = sreV3.trackingInts[i];
                        trackingIntsMissed[i - 1] = sreV3.trackingIntsMissed[i];
                        weights[i - 1]            = sreV3.weights[i];
                    }
                }

                sreV3.eventMax           = maxEvents;
                sreV3.events             = events;
                sreV3.missedMax          = missedMax;
                sreV3.trackingInts       = trackingInts;
                sreV3.trackingIntsMissed = trackingIntsMissed;
                sreV3.weights            = weights;
            }
            catch (Exception e)
            {
                infinite_globals.log("Unable to remove spike event because (NRE?) " + e);
            }

            //FsmUtil.changeTransition(grimmFSM, "Move Choice", "SPIKES", "Slash Pos");

            yield return(new WaitForSeconds(3f));

            immortalTime = IMMORTALITY_LAG_COMPENSATION;
            prepareGodSpikes();

            StartCoroutine(godSpikeLoop());

            infinite_globals.log("Setup god spikes.");
        }