Example #1
0
        public void SetKingSpell(byte worldId, int playerId)
        {
            Entry entry = World.Instance(worldId).GameMode.GetEntry(playerId);

            if (entry == null)
            {
                LogHelper.LogError($"Can't find entry in SetKingSpell playerId : {playerId}");
                return;
            }

            NetGameObject netGameObject = NetworkManager.Instance.GetGameObject(entry.mNetworkId, worldId);

            if (netGameObject == null || !(netGameObject is SActor))
            {
                LogHelper.LogError($"netGameObject == null or netGameObject is not SActor playerId : {playerId}, worldId : {worldId}");
                return;
            }

            SActor actor    = netGameObject as SActor;
            var    modeData = ACDC.GameModeData[(int)GetMode()];

            for (int i = 0; i < modeData.ModeSpellIDs.Length; ++i)
            {
                actor.AddSpell(ACDC.SpellData[modeData.ModeSpellIDs[i]], 0);
            }

            if (actor.StateServerSide != ActorState.Ghost)
            {
                actor.ResetHealth(actor.GetCharacterHp(), null);
            }
        }
Example #2
0
        public void AddableSpell(SActor attackPlayer, int attackPlayerId, JSpellData spellData, int applyDamage)
        {
            if (StateServerSide != ActorState.Idle)
            {
                //Log.Information($"can't add spell in state {StateServerSide}");
                return;
            }

            if (buff.IsExist(BuffType.Invincible))
            {
                // 무적일때 스펠도 안걸리고 대미지도 안걸림.
                return;
            }

            // 게임 모드별로 데미지 적용 여부
            // 데미지 안받으면 스펠도 안걸림.
            if (attackPlayerId >= 0) // 추락, 트랩등으로 데미지를 얻을 경우는 제외
            {
                if (World.Instance(WorldId).GameMode.TakableDamage(attackPlayerId, GetPlayerId()) == false)
                {
                    return;
                }
            }

            if (spellData != null)
            {
                if (spellData.ApplyObject == (int)ApplyObject.Oneself)
                {
                    attackPlayer.AddSpell(spellData, applyDamage);
                }
                else
                {
                    AddSpell(spellData, applyDamage);
                }
            }
        }