Exemple #1
0
    private void OnShowSideEffect(ShowSideEffectTriggeredRequest r)
    {
        ClientPlayer cp = GetPlayerByClientId(r.ExecutorInfo.ClientId);

        if (r.ExecutorInfo.IsPlayerBuff) //PlayerBuff
        {
            ClientLog.Instance.Print("Playerbuff ");
            return;
        }

        if (r.ExecutorInfo.MechId != ExecutorInfo.EXECUTE_INFO_NONE) //随从触发
        {
            //if (r.ExecutorInfo.EquipId == ExecutorInfo.EXECUTE_INFO_NONE)
            //{
            cp.BattlePlayer.BattleGroundManager.GetMech(r.ExecutorInfo.MechId).OnShowEffects(r.TriggerTime, r.TriggerRange);
            //}
            //else
            //{
            //    cp.BattlePlayer.BattleGroundManager.GetEquip(r.ExecutorInfo.MechId, r.ExecutorInfo.EquipId).OnShowEffects(r.TriggerTime, r.TriggerRange);
            //}
        }
        else if (r.ExecutorInfo.CardInstanceId != ExecutorInfo.EXECUTE_INFO_NONE) //手牌触发
        {
            //Todo 手牌SE效果
        }
    }
Exemple #2
0
 public void OnSETriggered(ShowSideEffectTriggeredRequest request)
 {
     Broadcast_AddRequestToOperationResponse(request);
 }
Exemple #3
0
    private void Trigger(SideEffectExecute see, ExecutorInfo ei, SideEffectExecute.TriggerTime tt, SideEffectExecute.TriggerRange tr)
    {
        if (see.M_ExecuteSetting.TriggerDelayTimes > 0) //TriggerDelayTimes decreases and trigger the event when it's 0
        {
            see.M_ExecuteSetting.TriggerDelayTimes--;
            return;
        }
        else
        {
            if (see.M_ExecuteSetting.TriggerTimes > 0) //TriggerTimes decreases every time it triggers and stop when it's 0
            {
                //Trigger's trigger  -- which triggers when other events are being triggered.
                bool isTriggerTrigger = false;
                if (tt == SideEffectExecute.TriggerTime.OnTrigger) //Give sideeffect executing info to trigger's trigger for modifying.
                {
                    foreach (SideEffectBase se in see.SideEffectBases)
                    {
                        if (se is PlayerBuffSideEffects buffSEE)
                        {
                            foreach (SideEffectBase sub_se in buffSEE.Sub_SideEffect)
                            {
                                if (sub_se is ITrigger triggerSEE)
                                {
                                    triggerSEE.PeekSEE = InvokeStack.Peek();
                                    if (triggerSEE.IsTrigger(ei))
                                    {
                                        isTriggerTrigger = true;
                                    }
                                }
                            }
                        }
                    }
                }

                if (tt == SideEffectExecute.TriggerTime.OnTrigger && !isTriggerTrigger)
                {
                    return;
                }
                //Trigger's trigger End

                see.M_ExecuteSetting.TriggerTimes--;
                ShowSideEffectTriggeredRequest request = new ShowSideEffectTriggeredRequest(see.M_ExecutorInfo, tt, tr); //Send request to client
                OnEventInvokeHandler(request);

                InvokeStack.Push(see);
                Invoke(SideEffectExecute.TriggerTime.OnTrigger, ei);
                foreach (SideEffectBase se in see.SideEffectBases)
                {
                    se.Execute(ei);
                }

                InvokeStack.Pop();
            }
            else if (see.M_ExecuteSetting.TriggerTimes == 0)
            {
                if (!ObsoleteSEEs.ContainsKey(see.ID))
                {
                    ObsoleteSEEs.Add(see.ID, see);
                }
            }
        }
    }