Example #1
0
    void ExcuteCounter(COM_ReportActionCounter counter)
    {
        BattleActor caster = Battle.Instance.GetActorByInstId(counter.casterId_);

        BattleActor[] aim   = new BattleActor[] { Battle.Instance.GetActorByIdx((int)counter.targetPosition_) };
        SkillInst     skill = new SkillInst();

        EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_Fanji, caster.ControlEntity.ActorObj.transform.position + caster.ControlEntity.ActorObj.transform.forward, null, null, null, (EffectInst inst, ParamData pData) =>
        {
            EffectAPI.Play((EFFECT_ID)GlobalValue.EFFECT_FanjiCast, caster.ControlEntity.ActorObj, null, null, (int iVal) =>
            {
                skill.Cast(GlobalValue.GetAttackID(caster), 1, caster, aim, new COM_ReportTarget[] { counter.props_ }, null, DealCounterAction, true);
            });
        });
    }
Example #2
0
    void ContinueAction()
    {
        // make counter list
        for (int j = 0; j < reportAction_.counters_.Length; ++j)
        {
            counterLst_.Add(reportAction_.counters_[j]);
        }

        /// add state
        for (int i = 0; i < reportAction_.stateIds_.Length; ++i)
        {
            BattleActor actor = Battle.Instance.GetActorByInstId(reportAction_.stateIds_[i].ownerId_);
            //如果大于1 则延迟加buff
            if (reportAction_.stateIds_[i].addQueue_ > 0)
            {
                //如果目标是自己 加到行动后state列表,否则加到延迟state列表
                if (reportAction_.stateIds_[i].ownerId_ == m_PlayerID)
                {
                    afterActionBuff.Add(reportAction_.stateIds_[i]);
                }
                else
                {
                    actor.ControlEntity.lagStateList.Add(reportAction_.stateIds_[i]);
                }
                continue;
            }
            if (reportAction_.stateIds_[i].add_)
            {
                actor.ControlEntity.AddState(reportAction_.stateIds_[i]);
            }
            else
            {
                actor.ControlEntity.RemoveState((int)reportAction_.stateIds_[i].stateId_);
            }
        }

        /// deal self state.
        ExcuteState(StateInst.ExcuteType.ET_Action, (COM_ReportActionCounter counter) =>
        {
            /// do action
            BattleActor caster = Battle.Instance.GetActorByInstId(reportAction_.casterId_);
            if (caster == null)
            {
                //DealAfterActionState();
                return;
            }
            SkillData data = null;
            data           = SkillData.GetData((int)reportAction_.skill_, (int)reportAction_.skillLevel_);
            /// extra skill
            if (data == null)
            {
                if (reportAction_.status_ == OrderStatus.OS_Weapon)
                {
                    COM_Item inst = new COM_Item();
                    inst.itemId_  = (uint)reportAction_.itemId_;
                    inst.instId_  = (uint)reportAction_.weaponInstId_;
                    if (inst.itemId_ != 0)
                    {
                        Battle.Instance.GetActorByInstId(reportAction_.casterId_).wearEquip(inst);
                    }
                    else
                    {
                        Battle.Instance.GetActorByInstId(reportAction_.casterId_).demontWeapon();
                    }
                }
                DealAfterActionState();
                return;
            }
            else
            {
                if (data._SkillType == SkillType.SKT_DefaultSecPassive || data._SkillType == SkillType.SKT_Passive)
                {
                    DealAfterActionState();
                    return;
                }
                switch (data._Passive_type)
                {
                case PassiveType.PAT_Runaway:
                    RunAway ra = new RunAway();
                    ra.Run(caster, Battle.Instance.GetActorByInstId(reportAction_.babyId_), reportAction_.status_.Equals(OrderStatus.OS_RunawayOk), (ParamData pdata) =>
                    {
                        DealAfterActionState();
                    });
                    return;

                case PassiveType.PAT_Change:
                    ChangePosition cp = new ChangePosition();
                    cp.ChangePos((int)reportAction_.bp0_, (int)reportAction_.bp1_, (ParamData pdata) =>
                    {
                        DealAfterActionState();
                    });
                    return;

                case PassiveType.PAT_BabyInnout:
                    BabyInnOut bio = new BabyInnOut();
                    bio.Excute(caster, reportAction_.status_, reportAction_.babyId_, reportAction_.baby_, DealAfterActionState);
                    ClearState();
                    return;

                case PassiveType.PAT_SecKill:
                    Seckill sk      = new Seckill();
                    SkillData sdata = SkillData.GetData((int)reportAction_.skill_, (int)reportAction_.skillLevel_);
                    if (sdata._Cast_effectID != -1)
                    {
                        EffectAPI.Play((EFFECT_ID)sdata._Cast_effectID, caster.ControlEntity.ActorObj, null, null, (int iVal) =>
                        {
                            if (reportAction_.targets_ == null || reportAction_.targets_.Length == 0)
                            {
                                ClientLog.Instance.Log("Sec Kill has no target!");
                                return;
                            }
                            sk.Do(caster, Battle.Instance.GetActorByIdx((int)reportAction_.targets_[0].position_), DealAfterActionState);
                        });
                    }
                    else
                    {
                        if (reportAction_.targets_ == null || reportAction_.targets_.Length == 0)
                        {
                            ClientLog.Instance.Log("Sec Kill has no target!");
                            return;
                        }
                        sk.Do(caster, Battle.Instance.GetActorByIdx((int)reportAction_.targets_[0].position_), DealAfterActionState);
                    }
                    return;

                default:
                    if (reportAction_.status_ == OrderStatus.OS_None)
                    {
                        DealAfterActionState();
                        return;
                    }
                    else if (reportAction_.status_ == OrderStatus.OS_Zhuachong)
                    {
                        CatchBaby cb = new CatchBaby();
                        cb.Catch(reportAction_, DealAfterActionState);
                        return;
                    }
                    else if (reportAction_.status_ == OrderStatus.OS_Summon)
                    {
//                        List<COM_Entity> entities = new List<COM_Entity>(reportAction_.dynamicEntities_);
//                        Battle.Instance.AddNewActor(entities.ToArray());//, () =>
////							 {
////								DealAfterActionState();
////							 }, reportAction_.dynamicEntities_.Length);
//                        DealAfterActionState();
//                            return;
                        break;
                    }
                    else
                    {
                        break;
                    }
                }
            }

            if (reportAction_.targets_.Length == 0)
            {
                if (reportAction_.status_ == OrderStatus.OS_Summon)
                {
                    mainSkillInst = new SkillInst();
                    mainSkillInst.Cast(reportAction_.skill_, reportAction_.skillLevel_, caster, null, reportAction_.targets_, FinishShow, DealCounterAction);
                }
                else
                {
                    DealAfterActionState();
                }
                return;
            }

            /// normal skill
            List <BattleActor> aims = new List <BattleActor>();
            for (int i = 0; i < reportAction_.targets_.Length; ++i)
            {
                BattleActor item = Battle.Instance.GetActorByIdx((int)reportAction_.targets_[i].position_);
                //				if( null == item || item.isDead ) continue;
                aims.Add(item);
            }

            //TODO for temp
            if (aims.Count == 0)
            {
                aims.Add(Battle.Instance.GetActorByInstId(reportAction_.casterId_));
            }
            ///////
            for (int i = 0; i < aims.Count; ++i)
            {
                if (aims[i] == null)
                {
                    continue;
                }
                aims[i].ForGuardPos = (int)reportAction_.huweiPosition_;
            }
            mainSkillInst = new SkillInst();
            //ClientLog.Instance.Log("宠物 No!  Cast: " + reportAction_.skill_ + "  caster : " + caster.InstName + " aim: " + aims[0].InstName + " len:" + aims.Count + " target: " + reportAction_.targets_[0].position_ + " len:" + reportAction_.targets_.Length);
            mainSkillInst.Cast(reportAction_.skill_, reportAction_.skillLevel_, caster, aims.ToArray(), reportAction_.targets_, FinishShow, DealCounterAction);
        });

        //// 处理需要除掉的actor
        //DealEraseActor();
    }