Example #1
0
        public void InitFrom(Actor inShooter, JSkillData skillData)
        {
            mDamage   = inShooter.GetDamage(skillData.skillId, GameObjectClassId.Actor);
            mSiegeAtk = inShooter.GetDamage(skillData.skillId, GameObjectClassId.Prop);

            inShooter.LastBombNetworkId = GetNetworkId();
            LogHelper.LogInfo($"create enter {GetNetworkId()}, {inShooter.LastBombNetworkId}, skill_id:{skillData.skillId}, explosionID:{skillData.explosionID}");

            SetPlayerId(inShooter.GetPlayerId());
            mParentNetworkId = inShooter.GetNetworkId();

            Vector3 loc = inShooter.GetLocation();

            loc.y = inShooter.floor;
            SetLocation(loc);

            mDirection = inShooter.GetRotation();

            JExplosionData a_kExplosionData = ACDC.ExplosionData[skillData.explosionID];

            mExplodeTime = Timing.sInstance.GetFrameStartTime() + a_kExplosionData.time;
            mSkillId     = skillData.skillId;

            var player = World.Instance(WorldId).GameMode.GetEntry(inShooter.GetPlayerId());

            if (player != null)
            {
                mTeam = (byte)player.GetTeam();
            }
        }
Example #2
0
        public override void ActionResult(byte actionToken, List <int> objectList, Vector3 bombedPos)
        {
            if (ActionTokens.ContainsKey(actionToken) == false)
            {
                //Log.Information($"ActionResult already execute ({string.Join(",", objectList)}), {actionToken}");
                return;
            }

            //if(objectList.Count > 0)
            //    Log.Information($"ActionResult ({string.Join(",", objectList)}), {actionToken}");

            JSkillData skillData = ACDC.SkillData[ActionTokens[actionToken].SkillId];

            NetGameObject obj;

            for (int i = 0; i < objectList.Count; ++i)
            {
                obj = NetworkManagerServer.sInstance.GetGameObject(objectList[i], WorldId);
                if (obj == null)
                {
                    continue;
                }

                var applyDamage = obj.OnExplode((int)GetPlayerId(), GetNetworkId(), GetDamage(ActionTokens[actionToken].SkillId, (GameObjectClassId)obj.GetClassId()));

                // add spell
                SActor actor = obj as SActor;
                if (actor != null && skillData != null)
                {
                    //actor.AddableSpell((int)GetPlayerId(), skillData.spellId);

                    //Log.Information($"ActionResult AddSpell {skillData.spellId}");
                    foreach (int nSpellID in skillData.spellId)
                    {
                        actor.AddableSpell(this, (int)GetPlayerId(), nSpellID, applyDamage);
                    }
                }
            }

            // Link Skill
            if (skillData != null && skillData.linkSkillId != 0)
            {
                var linkSkillData = ACDC.SkillData[skillData.linkSkillId];

                if (linkSkillData != null && linkSkillData.skillType == (int)SkillType.InstallAreaOfEffect)
                {
                    AreaOfEffect aoe = (AreaOfEffect)GameObjectRegistry.sInstance.CreateGameObject((uint)GameObjectClassId.AreaOfEffect, true, WorldId);
                    aoe.InitFrom(this, (ushort)linkSkillData.skillId, bombedPos);
                }
            }

            ActionTokens.Remove(actionToken);
        }
        public override void PropExplodeResult(List <int> objectList)
        {
#if UNITY_EDITOR || DEBUG
            if (objectList.Count > 0)
            {
                Log.Information($"Prop PropExplodeResult ({string.Join(",", objectList)})");
            }
#endif

            // 프랍이 제거될때 폭발하는 데미지 얻어서 처리
            JMapObjectData mapData;
            int            damage   = 0;
            int            siegeAtk = 0;
            if (core.World.mapGameObject.TryGetValue(mapObjectId, out mapData) == true)
            {
                if (mapData.jDestroyBombData.Length > 0)
                {
                    if (mapData.jDestroyBombData[0].skillID != 0)
                    {
                        JSkillData skillData = ACDC.SkillData[mapData.jDestroyBombData[0].skillID];
                        if (skillData != null)
                        {
                            damage   = (int)skillData.Damage;
                            siegeAtk = (int)skillData.SiegeAtk;
                        }
                    }
                }
            }

            NetGameObject obj;
            for (int i = 0; i < objectList.Count; ++i)
            {
                obj = NetworkManagerServer.sInstance.GetGameObject(objectList[i], WorldId);
                if (obj == null)
                {
                    continue;
                }

                if (obj.GetClassId() == (byte)GameObjectClassId.Actor ||
                    obj.GetClassId() == (byte)GameObjectClassId.Castle)
                {
                    obj.OnExplode((int)ReservedPlayerId.Trap, GetNetworkId(), damage);
                }
                else
                {
                    obj.OnExplode((int)ReservedPlayerId.Trap, GetNetworkId(), siegeAtk);
                }
            }

            SetDoesWantToDie(true);
        }
Example #4
0
        public void InitFrom(Actor inShooter, ushort skillId, Vector3 bomedPos)
        {
            Vector3 loc = bomedPos;

            LogHelper.LogInfo($"Area bombed {bomedPos.y} Loc {loc.y}");
            SetLocation(loc);
            SkillId = skillId;
            SetPlayerId((int)inShooter.GetPlayerId());
            mParentNetworkId = inShooter.GetNetworkId();

            mSkillData       = ACDC.SkillData[skillId];
            m_kExplosionData = ACDC.ExplosionData[mSkillData.explosionID];
            mDamage          = inShooter.GetDamage(skillId, GameObjectClassId.Actor);
            mSiegeAtk        = inShooter.GetDamage(skillId, GameObjectClassId.Prop);
            mTeam            = (byte)inShooter.Team;
            // 주의 사항 ---- 같은 서브타입이 두개 이상 존재하면 마지막 것으로 초기화 됨
            if (mSkillData.spellId != null)
            {
                for (int i = 0; i < mSkillData.spellId.Length; ++i)
                {
                    var spell = ACDC.SpellData[mSkillData.spellId[i]];
                    if (spell == null)
                    {
                        continue;
                    }

                    if (spell.SpellSubType == (int)SpellSubType.FinishTime)
                    {
                        mFinishSpell = spell;
                    }
                    else if (spell.SpellSubType == (int)SpellSubType.MiddleTime)
                    {
                        mMiddleSpell = spell;
                    }
                }
            }

            mDirection     = inShooter.GetRotation();
            mDurationTime  = Timing.sInstance.GetFrameStartTime() + mSkillData.durationTime;
            mExplosionType = (eExplosionType)m_kExplosionData.type;
            SetCollisionRadius(m_kExplosionData.range[0]);
            if (m_kExplosionData.range.Count() > 1)
            {
                heightHalf = m_kExplosionData.range[1];
            }
            LogHelper.LogInfo($"InitFrom NID {GetNetworkId()} bomedPos {bomedPos.y} Pos {GetLocation().y} explosionType {mExplosionType}");
        }
Example #5
0
        //public void InitFrom(Trap inShooter, JSkillData skillData)
        public void InitFrom(Trap inShooter, JSkillData skillData)
        {
            mDamage          = (int)skillData.Damage;
            mParentNetworkId = inShooter.GetNetworkId();

            Vector3 loc = inShooter.GetLocation();

            loc.y = inShooter.GetLocation().y + 1;
            SetLocation(loc);
            // 맵에서 생성시 (int)ReservedPlayerId.Trap 로 사용
            mPlayerId   = (int)ReservedPlayerId.Trap;
            mapObjectId = inShooter.mapObjectId;

            mDirection = inShooter.GetRotation();

            JExplosionData a_kExplosionData = ACDC.ExplosionData[skillData.explosionID];

            mExplodeTime = Timing.sInstance.GetFrameStartTime() + a_kExplosionData.time;
        }
Example #6
0
        public override void ShootDashSkillServer(byte actionToken, bool IsBasicAttack, Vector3 targetPos, Vector3 dir)
        {
            if (StateServerSide != ActorState.Idle)
            {
                Log.Information($"ShootDashSkillServer wrong state {StateServerSide}, networkID{GetNetworkId()}");
                return;
            }

            // 패킷을 송신한 유저를 제외하고 리스트 구성
            var player_list = World.Instance(WorldId).playerList.Keys.Where(x => x != mActorController.ControllPlayerId).ToList();


            // 검증을 위해 ActionToken을 등록해둔다.
            ActionTokens[actionToken] = new ActionInfo()
            {
                SkillId = GetSkillId(IsBasicAttack), hitIndex = new HashSet <byte>()
            };

            JSkillData data = ACDC.SkillData[ActionTokens[actionToken].SkillId];

            float duration = 0f;

            if (data != null)
            {
                duration = data.durationTime;
            }

            //Log.Information($"ShootDashSkillServer player ({string.Join(",", player_list)}), {targetPos}, {dir} duration {duration}");

            mActorStateMachine.ChangeState(this, mActorStateMachine.UpdateDash, ActorState.Dash, duration);
            TargetPos = targetPos;

            Vector2 direction = new Vector2(targetPos.x - GetLocation().x, targetPos.z - GetLocation().z);

            degree       = direction.Angle();
            lastVelocity = new Vector3(direction.x, 0, direction.y) * 0.1f;

            InvokeClientRpc(ShootDashRamClient, player_list, actionToken, IsBasicAttack, targetPos, dir);
        }
Example #7
0
        public override void ShootPushServer(byte actionToken, bool IsBasicAttack, Vector3 targetPos)
        {
            if (StateServerSide != ActorState.Idle)
            {
                LogHelper.LogInfo($"ShootPushServer wrong state {StateServerSide}, networkID{GetNetworkId()}");
                return;
            }

            // 패킷을 송신한 유저를 제외하고 리스트 구성
            var player_list = World.Instance(WorldId).playerList.Keys.Where(x => x != mActorController.ControllPlayerId).ToList();

            //Log.Information($"ShootPushServer player ({string.Join(",", player_list)}), {targetPos}");

            // 검증을 위해 ActionToken을 등록해둔다.
            ActionTokens[actionToken] = new ActionInfo()
            {
                SkillId = GetSkillId(IsBasicAttack)
            };

            InvokeClientRpc(ShootPushClient, player_list, actionToken, IsBasicAttack, targetPos);

            JSkillData skillData = ACDC.SkillData[ActionTokens[actionToken].SkillId];

            // Link Skill
            if (skillData != null && skillData.linkSkillId != 0)
            {
                var linkSkillData = ACDC.SkillData[skillData.linkSkillId];
                // 폭팔 아이디가 있는 경우만 폭탄 설치
                // 스킬에 폭탄 구분이 어려워 차후 추가되면 해당 값으로 예외처리
                if (linkSkillData != null && linkSkillData.skillType == (int)SkillType.InstallSkill)
                {
                    var bomb = (core.Bomb)GameObjectRegistry.sInstance.CreateGameObject((uint)GameObjectClassId.Bomb, true, WorldId);
                    bomb.InitFrom(this, linkSkillData);
                }
            }
        }
Example #8
0
        public override void ActionResult2(byte actionToken, List <int> objectList, int hitProjectileIdx)
        {
            ActionInfo actionInfo = null;

            //Log.Information($"ActionResult2 ({string.Join(",", objectList)}), {actionToken}, {hitProjectileIdx}");

            if (ActionTokens.TryGetValue(actionToken, out actionInfo))
            {
                if (actionInfo.hitIndex == null)
                {
                    //Log.Information($"ActionResult2 hitIndex is null ({string.Join(",", objectList)}), {actionToken}, {hitProjectileIdx}");
                    return;
                }

                if (actionInfo.hitIndex.Contains((byte)hitProjectileIdx))
                {
                    //Log.Information($"ActionResult2 already hit execute ({string.Join(",", objectList)}), {actionToken}, {hitProjectileIdx}, hitIndex:({string.Join(",", actionInfo.hitIndex)})");
                    return;
                }
            }
            else
            {
                //Log.Information($"ActionResult2 already execute ({string.Join(",", objectList)}), {actionToken}, {hitProjectileIdx}");
                return;
            }

            //Log.Information($"ActionResult2 OK objectList:({string.Join(",", objectList)}), actionToken:{actionToken}, {hitProjectileIdx}, ({string.Join(",", actionInfo.hitIndex)})");

            JSkillData skillData = ACDC.SkillData[actionInfo.SkillId];

            NetGameObject obj;

            for (int i = 0; i < objectList.Count; ++i)
            {
                obj = NetworkManagerServer.sInstance.GetGameObject(objectList[i], WorldId);
                if (obj == null)
                {
                    continue;
                }

                var applyDamage = obj.OnExplode((int)GetPlayerId(), GetNetworkId(), GetDamage(ActionTokens[actionToken].SkillId, (GameObjectClassId)obj.GetClassId()));

                // add spell
                SActor actor = obj as SActor;
                if (actor != null && skillData != null)
                {
                    //Log.Information($"ActionResult AddSpell {skillData.spellId}");
                    //actor.AddableSpell((int)GetPlayerId(), skillData.spellId);
                    foreach (int nSpellID in skillData.spellId)
                    {
                        actor.AddableSpell(this, (int)GetPlayerId(), nSpellID, applyDamage);
                    }
                }
            }

            actionInfo.hitIndex.Add((byte)hitProjectileIdx);
            if (skillData.projectileNum.Aggregate(1, (a, b) => a * b) <= actionInfo.hitIndex.Count)
            {
                //Log.Information($"ActionResult2 remove ({string.Join(",", objectList)}), {actionToken}, {hitProjectileIdx}, {string.Join(", ", actionInfo.hitIndex)}");
                ActionTokens.Remove(actionToken);
            }
        }