Пример #1
0
    protected void S2C_OnAbilityWarnning(Pt _info)
    {
        pt_scene_skill_aleret_c021 msg = _info as pt_scene_skill_aleret_c021;

        if (msg != null)
        {
            ObjectType type = (ObjectType)msg.obj_sort;
            SmartActor user = null;
            switch (type)
            {
            case ObjectType.Player:
                if ((int)msg.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    user = GameCenter.curMainPlayer;
                }
                else
                {
                    user = GameCenter.curGameStage.GetOtherPlayer((int)msg.oid) as SmartActor;
                }
                break;

            case ObjectType.MOB:
                user = GameCenter.curGameStage.GetMOB((int)msg.oid) as SmartActor;
                break;

            case ObjectType.Entourage:
                user = GameCenter.curGameStage.GetEntourage((int)msg.oid) as EntourageBase;
                break;

            default:
                break;
            }
            if (user != null)
            {
                AbilityInstance instance = new AbilityInstance(msg, user);
                user.UseAbility(instance);
            }
        }
    }
Пример #2
0
    public override bool Exec(Actor _actor)
    {
        SmartActor smartActor = (_actor as SmartActor);

        if (abilityInstance.thisSkillMode == SkillMode.NORMALSKILL && smartActor.IsProtecting)
        {
            return(false);
        }
        if (smartActor == null || smartActor.isRigidity)
        {
            return(false);
        }
        if (abilityInstance == null)
        {
            return(true);
        }

        if (GameCenter.curGameStage == null || !GameCenter.sceneMng.EnterSucceed)
        {
            return(false);
        }

        if (smartActor.isDead)
        {
            return(true);                  //如果自己死了,什么也不干了
        }
        if (target == null)
        {
            if (abilityInstance.NeedTarget)
            {
                return(true);
            }
            smartActor.UseAbility(abilityInstance);//没目标或者目标死了,直接放技能,策划的要求  by吴江
            return(true);
        }


        Actor targetActor = target as Actor;

        if (targetActor != null && targetActor.isDead) //没目标或者目标死了,直接放技能,策划的要求  by吴江
        {
            smartActor.UseAbility(abilityInstance);
            return(true);
        }
        //==========修改,非普通攻击的技能可以空放!
        if (abilityInstance.thisSkillMode == SkillMode.NORMALSKILL)
        {
            if (!abilityInstance.NeedTarget || abilityInstance.CanUseFor(target))
            {
                smartActor.UseAbility(abilityInstance);
                return(true);
            }
            else
            {
                PlayerBase p = smartActor as PlayerBase;
                if (p != null)
                {
                    p.FaceTo(target.transform.position);
                    //p.UseAbility(p.LoseHitAbility);
                }
                return(true);
            }
        }
        else
        {
            smartActor.UseAbility(abilityInstance);
        }
        return(true);
    }
Пример #3
0
    protected void S2C_AbilityResult(Pt _info)
    {
        if (GameCenter.sceneMng == null || !GameCenter.sceneMng.EnterSucceed)
        {
            return;
        }
        pt_scene_skill_effect_c006 pt = _info as pt_scene_skill_effect_c006;

        if (pt != null)
        {
            //Debug.Log("effectSort:"+(AbilityResultCAUSEType)pt.effect_sort+",targetID:"+pt.target_id+",ObjectType:"+(ObjectType)pt.obj_sort);
            SmartActor     user           = null;
            ObjectType     type           = (ObjectType)pt.obj_sort;
            MainPlayerInfo mainPlayerInfo = GameCenter.mainPlayerMng.MainPlayerInfo;
            switch (type)
            {
            case ObjectType.Player:
                if ((int)pt.oid == mainPlayerInfo.ServerInstanceID)
                {
                    user = GameCenter.curMainPlayer;
                }
                else
                {
                    user = GameCenter.curGameStage.GetOtherPlayer((int)pt.oid) as SmartActor;
                }
                break;

            case ObjectType.MOB:
                user = GameCenter.curGameStage.GetMOB((int)pt.oid) as SmartActor;
                break;

            case ObjectType.Entourage:
                user = GameCenter.curGameStage.GetEntourage((int)pt.oid) as EntourageBase;
                break;

            default:
                break;
            }


            for (int i = 0; i < pt.effect_list.Count; i++)
            {
                st.net.NetBase.skill_effect ef = pt.effect_list[i];
                ActorInfo info = null;
                type = (ObjectType)ef.target_sort;
                //if (user == GameCenter.curMainPlayer)
                //{
                //    if ((AttackResultType)ef.atk_sort != AttackResultType.ATT_SORT_DODGE)
                //    {
                //        if (OnContinuCountUpdate != null)
                //        {
                //            OnContinuCountUpdate(Time.time);
                //        }
                //    }
                //}
                switch (type)
                {
                case ObjectType.Player:
                    if (ef.target_id == mainPlayerInfo.ServerInstanceID)
                    {
                        mainPlayerInfo.Update(ef);
                        if ((DefResultType)ef.def_sort != DefResultType.DEF_SORT_ADDMP && (DefResultType)ef.def_sort != DefResultType.DEF_SORT_TREAT) //如果是非增益后果
                        {
                            if (OnMainPlayerBeHit != null && user != null)                                                                            //主角被打的事件
                            {
                                OnMainPlayerBeHit(user);
                            }
                            OtherPlayer other = user as OtherPlayer;
                            if (other != null && mainPlayerInfo.CurSceneType == SceneType.SCUFFLEFIELD)
                            {
                                if (!abilityResultUserDic.ContainsKey(other.id) || Time.time - abilityResultUserDic[other.id] > 5f)                                       //被玩家攻击提示,5秒不重复
                                {
                                    abilityResultUserDic[other.id] = Time.time;
                                    GameCenter.messageMng.AddClientMsg((mainPlayerInfo.KillingValue > 1000 || mainPlayerInfo.IsCounterAttack)?434:433, new string[1] {
                                        other.ActorName
                                    });
                                    if (OnMainPlayerBeAttack != null)
                                    {
                                        OnMainPlayerBeAttack(other);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        info = GameCenter.sceneMng.GetOPCInfo((int)ef.target_id) as OtherPlayerInfo;
                        if (info != null)
                        {
                            info.Update(ef);
                        }
                    }
                    break;

                case ObjectType.MOB:
                    info = GameCenter.sceneMng.GetMobInfo((int)ef.target_id) as MonsterInfo;
                    if (info != null)
                    {
                        info.Update(ef);
                    }
                    break;

                case ObjectType.Entourage:
                    if (GameCenter.mercenaryMng.curMercernaryInfo != null && ef.target_id == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID)
                    {
                        GameCenter.mercenaryMng.curMercernaryInfo.Update(ef);
                    }
                    else
                    {
                        info = GameCenter.sceneMng.GetEntourageInfo((int)ef.target_id) as MercenaryInfo;
                        if (info != null)
                        {
                            info.Update(ef);
                        }
                    }
                    break;
                }
            }


            AbilityInstance instance = null;

            if ((int)pt.oid == GameCenter.curMainPlayer.id || (GameCenter.curMainEntourage != null && (int)pt.oid == GameCenter.curMainEntourage.id))
            {
                if (waitServerConfirmAbilityDic.ContainsKey(pt.seq))
                {
                    instance = waitServerConfirmAbilityDic[pt.seq] as AbilityInstance;
                    if (instance != null)
                    {
                        instance.AbilityResult(pt);
                        instance.OnTringEnd -= OnAbilityInstanceTringEnd;
                        waitServerConfirmAbilityDic.Remove(pt.seq);
                    }
                }
                else
                {
                    if (pt.seq != 0)
                    {
                        GameSys.LogError("找不到等待技能 " + pt.seq);
                    }
                    else
                    {
                        if (user != null)
                        {
                            if (pt.skill == 0)
                            {
                                Debug.LogError(user.name + "使用技能ID为0的技能");
                            }
                            else
                            {
                                instance = new AbilityInstance(pt, user);
                            }
                        }
                    }
                }
            }
            else
            {
                bool useSkill = (pt.effect_sort == 2);
                if (user != null)
                {
                    if (user.curTryUseAbility != null && user.curTryUseAbility.AbilityID == pt.skill && user.curTryUseAbility.RuneID == pt.rune &&
                        user.curTryUseAbility.Level == pt.lev && user.curTryUseAbility.NeedPrepare && !user.curTryUseAbility.HasServerConfirm)
                    {
                        instance = user.curTryUseAbility;
                    }
                    else
                    {
                        instance = new AbilityInstance(pt, user);
                        if ((ObjectType)pt.obj_sort == ObjectType.Player)                       //这里的判断不能用type
                        {
                            //技能动作完成了才继续放技能,否则其他大风车技能会瞬移  by邓成
                            //这种处理同时导致了,法师动作比特效慢,因为一个技能放完,实际还在isCasting
                            if (useSkill)
                            {
                                user.UseAbility(instance);
                            }
                        }
                        else
                        {
                            if (useSkill)                           //怪物也需要加这个,否则SkillReportID出现两次
                            {
                                user.UseAbility(instance);
                            }
                        }
                    }
                }
                else
                {
                    instance = new AbilityInstance(pt, null);
                }
                instance.AbilityResult(pt);
            }
            if (instance != null && user != null)
            {
                switch (instance.CurClientShowType)
                {
                case ClientShowType.Lightingskill:
                    user.fxCtrl.CastLightingShake(instance);
                    break;
                }
            }
        }
    }