private bool OnChargeRelease(EvtChargeRelease evt)
 {
     if (evt.isSwitchRelease && Miscs.ArrayContains <string>(this.config.AfterSkillIDs, evt.releaseSkillID))
     {
         base.actor.abilityPlugin.HandleActionTargetDispatch(this.config.Actions, base.instancedAbility, base.instancedModifier, null, evt);
         return(true);
     }
     return(false);
 }
Beispiel #2
0
        private void SkillIDChangedCallback(string from, string to)
        {
            if (this._state == State.Idle)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    if (this.IsTriggerCharging())
                    {
                        this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                        this._monster.SetTrigger(this.config.NextLoopTriggerID);
                        this._state  = State.Before;
                        this._loopIx = 0;
                    }
                    else
                    {
                        this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                        this._monster.SetTrigger(this.config.AfterSkillTriggerID);
                    }
                }
            }
            else if (this._state == State.Before)
            {
                if (to == this.config.ChargeLoopSkillIDs[this._loopIx])
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        MixinEffect effect = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect.EffectPattern);
                        }
                        if (effect.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect.AudioPattern;
                            base.entity.PlayAudio(effect.AudioPattern);
                        }
                    }
                    this._state = State.InLoop;
                    this._chargeTimer.timespan = this.config.ChargeLoopDurations[this._loopIx] * this._chargeTimeRatio;
                    this._chargeTimer.Reset(true);
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.After;
                }
                else if (!Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.InLoop)
            {
                if (Miscs.ArrayContains <string>(this.config.ChargeLoopSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffect(this._chargeEffectPatternIx);
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                        MixinEffect effect2 = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect2.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect2.EffectPattern);
                        }
                        if (effect2.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect2.AudioPattern;
                            base.entity.PlayAudio(effect2.AudioPattern);
                        }
                        if (this.config.ChargeSwitchEffects != null)
                        {
                            base.FireMixinEffect(this.config.ChargeSwitchEffects[this._loopIx - 1], base.entity, false);
                        }
                    }
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    EvtChargeRelease evt = new EvtChargeRelease(base.actor.runtimeID, to)
                    {
                        isSwitchRelease = this._switchTimer.isActive && !this._switchTimer.isTimeUp
                    };
                    Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

                    this._switchTimer.Reset(false);
                    this._chargeTimer.Reset(false);
                    this._state = State.After;
                }
                else
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.After)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to) && this.IsTriggerCharging())
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.SetTrigger(this.config.NextLoopTriggerID);
                    this._state  = State.Before;
                    this._loopIx = 0;
                }
                else
                {
                    this._monster.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._monster.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
        }
        private void SkillIDChangedCallback(string from, string to)
        {
            if (this._state == State.Idle)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this.SkillIDChangedToBefore();
                }
            }
            else if (this._state == State.Before)
            {
                if (to == this.config.ChargeLoopSkillIDs[this._loopIx])
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        MixinEffect effect = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect.EffectPattern);
                        }
                        if (effect.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect.AudioPattern;
                            base.entity.PlayAudio(effect.AudioPattern);
                        }
                    }
                    this._state = State.InLoop;
                    this.OnBeforeToInLoop();
                    if (this.config.ChargeSubTargetAmount != null)
                    {
                        int targetAmount = this.config.ChargeSubTargetAmount[this._loopIx];
                        this.SelectSubTargets(targetAmount);
                    }
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.After;
                }
                else if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, from))
                    {
                        this.SkillIDChangedToBefore();
                    }
                }
                else
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
            }
            else if (this._state == State.InLoop)
            {
                if (Miscs.ArrayContains <string>(this.config.ChargeLoopSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                        MixinEffect effect2 = this.config.ChargeLoopEffects[this._loopIx];
                        if (effect2.EffectPattern != null)
                        {
                            this._chargeEffectPatternIx = base.entity.AttachEffect(effect2.EffectPattern);
                        }
                        if (effect2.AudioPattern != null)
                        {
                            this._chargeAudioLoopName = effect2.AudioPattern;
                            base.entity.PlayAudio(effect2.AudioPattern);
                        }
                        if (this.config.ChargeSwitchEffects != null)
                        {
                            base.FireMixinEffect(this.config.ChargeSwitchEffects[this._loopIx - 1], base.entity, false);
                        }
                    }
                    this._switchTimer.Reset(true);
                }
                else if (Miscs.ArrayContains <string>(this.config.AfterSkillIDs, to))
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    EvtChargeRelease evt = new EvtChargeRelease(base.actor.runtimeID, to)
                    {
                        isSwitchRelease = this._switchTimer.isActive && !this._switchTimer.isTimeUp
                    };
                    Singleton <EventManager> .Instance.FireEvent(evt, MPEventDispatchMode.Normal);

                    this._switchTimer.Reset(false);
                    this._state = State.After;
                    this.OnInLoopToAfter();
                }
                else
                {
                    if (this.config.ChargeLoopEffects != null)
                    {
                        if (this.config.ImmediatelyDetachLoopEffect)
                        {
                            base.entity.DetachEffectImmediately(this._chargeEffectPatternIx);
                        }
                        else
                        {
                            base.entity.DetachEffect(this._chargeEffectPatternIx);
                        }
                        this._chargeEffectPatternIx = -1;
                        if (this._chargeAudioLoopName != null)
                        {
                            base.entity.StopAudio(this._chargeAudioLoopName);
                            this._chargeAudioLoopName = null;
                        }
                    }
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                    this.ClearSubTargets();
                }
            }
            else if (this._state == State.After)
            {
                if (Miscs.ArrayContains <string>(this.config.BeforeSkillIDs, to))
                {
                    this.SkillIDChangedToBefore();
                }
                else
                {
                    this._avatar.ResetTrigger(this.config.AfterSkillTriggerID);
                    this._avatar.ResetTrigger(this.config.NextLoopTriggerID);
                    this._state = State.Idle;
                }
                this.ClearSubTargets();
            }
        }