public static bool addSpell(SActor actor, string Param1, string Param2, string Param3, string Param4) { var spellId = int.Parse(Param1); JSpellData spellData = ACDC.SpellData[spellId]; actor.AddSpell(spellData, 0); return(true); }
void AddSpell(Actor inActor, JSpellData spellData) { #if UNITY_EDITOR || DEBUG Log.Information($"SAreaOfEffect AddSpell {inActor.GetPlayerId()} spellId {mSkillData.spellId}"); #endif SActor sActor = inActor as SActor; if (sActor != null) { sActor.AddableSpell(sActor, sActor.GetPlayerId(), spellData, 0); } }
public void BuffRecovery(Actor actor, JSpellData data) { var entry = GetEntry(actor.GetPlayerId()); if (entry == null) { LogHelper.LogError($"BuffRecovery find entry error {actor.GetPlayerId()}"); return; } LogHelper.LogInfo($"BuffRecovery { World.Instance(actor.WorldId)?.castleList?.Count}, {entry.GetTeam()}"); World.Instance(actor.WorldId).GetCastle(entry.GetTeam())?.BuffRecovery(data); }
public void BuffShield(JSpellData data) { shield_time = Timing.sInstance.GetFrameStartTime() + data.RetentionTime; if (data.AddStatusType == (int)AddStatusType.Absolute) { shield_hp = (ushort)data.AddStatus; } else if (data.AddStatusType == (int)AddStatusType.Relative) { shield_hp = (ushort)(hp * data.AddStatus); } Dirty((uint)ReplicationState.Buff); }
public void ResetHealth(int health, JSpellData data) { mHealth = health; if (GetCharacterHp() < mHealth) { mHealth = GetCharacterHp(); } Dirty((uint)ReplicationState.Health); if (data != null) { buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, GetNetworkId(), GetCharacterHp()); } }
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}"); }
public void BuffRecovery(JSpellData data) { if (data.AddStatusType == (int)AddStatusType.Absolute) { hp += (ushort)data.AddStatus; } else if (data.AddStatusType == (int)AddStatusType.Relative) { hp += (ushort)(hp * data.AddStatus); } // max hp 보다 높을 경우 if (hp > (ushort)mapData.jCastleData[0].castleHP) { hp = (ushort)mapData.jCastleData[0].castleHP; } Dirty((uint)ReplicationState.Health); }
public void Set(JSpellData data, int parentNetworkId, float value) { LogHelper.LogInfo($"create Buff {NetworkId}"); mParentNetworkId = parentNetworkId; mSpellData = data; mSpellId = data.Index; if (mSpellData.AddStatusType == (int)AddStatusType.Absolute) { mAddStatus = mSpellData.AddStatus; } else if (mSpellData.AddStatusType == (int)AddStatusType.Relative) { mAddStatus = value * mSpellData.AddStatus; } mRemainTime = Timing.sInstance.GetFrameStartTime() + mSpellData.RetentionTime; mNextTickTime = Timing.sInstance.GetFrameStartTime() + mSpellData.TickTime; }
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); } } }
public void IncreHealth(int health, JSpellData data) { var lastHealth = mHealth; mHealth += health; if (GetCharacterHp() < mHealth) { mHealth = GetCharacterHp(); } Dirty((uint)ReplicationState.Health); if (data != null) { buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, GetNetworkId(), GetCharacterHp()); } var hp = mHealth - lastHealth; if (hp > 0) { LogHelper.LogInfo($"IncreHealth playerId:{GetPlayerId()}, hp:{hp}"); InvokeClientRpcOnClient(NoticeHealth, GetPlayerId(), hp); } }
public bool AddBuff(Buff buff, JSpellData spellData, int parentNetworkId, float value) { buff.Set(spellData, parentNetworkId, value); return(AddBuff(buff)); }
public void AddSpell(JSpellData data, int damage) { var status = data.AddStatus; switch ((StatusType)data.StatusType) { case StatusType.Damage: { status = damage; } break; case StatusType.Health: { status = mHealth; } break; case StatusType.CharacterSpeed: { status = (int)characterData.Speed; } break; case StatusType.CharacterSkillCooldown: { status = (int)characterData.Bomb1_installCoolTime; } break; case StatusType.CharacterDamage: { status = 1f; } break; } switch ((core.BuffType)data.BuffID) { case core.BuffType.Shield: //방어막 { if (data.ApplyObject == (int)ApplyObject.Castle) // 거점. { World.Instance(WorldId).GameMode.BuffShield(this, data); } else if (data.ApplyObject == (int)ApplyObject.OurTeam) { var player_list = World.Instance(WorldId).GameMode.GetMyTeam(this.Team); foreach (var player in player_list) { if (player.StateServerSide == ActorState.Ghost) { continue; } player.buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, player.GetNetworkId(), mHealth); } } else if (data.ApplyObject == (int)ApplyObject.Oneself) { buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, GetNetworkId(), mHealth); } } break; case core.BuffType.RecoveryHp: // HP회복 { if (data.AddStatusType == (int)AddStatusType.Absolute) { } else if (data.AddStatusType == (int)AddStatusType.Relative) { status = (int)(status * data.AddStatus); } if (data.ApplyObject == (int)ApplyObject.Castle) // 거점. { World.Instance(WorldId).GameMode.BuffRecovery(this, data); } else if (data.ApplyObject == (int)ApplyObject.OurTeam) // 팀 전체 HP 회복 { var player_list = World.Instance(WorldId).GameMode.GetMyTeam(this.Team); foreach (var player in player_list) { if (player.StateServerSide == ActorState.Ghost) { continue; } player.IncreHealth((int)status, data); } } else if (data.ApplyObject == (int)ApplyObject.Oneself) { IncreHealth((int)status, data); } } break; default: { if (data.ApplyObject == (int)ApplyObject.OurTeam) { var player_list = World.Instance(WorldId).GameMode.GetMyTeam(this.Team); foreach (var player in player_list) { if (player.StateServerSide == ActorState.Ghost) { continue; } player.buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, player.GetNetworkId(), status); } } else { buff.AddBuff((Buff)GameObjectRegistry.sInstance.CreateGameObject((UInt32)GameObjectClassId.Buff, true, (byte)WorldId), data, GetNetworkId(), status); } } break; } }
public bool GetItem(int item_id) { //Log.Information($"GetItem item_id:{item_id}, network_id{GetNetworkId()}"); if (StateServerSide == ActorState.Ghost) { Log.Information($"character state is ghost. item_id:{item_id}, network_id{GetNetworkId()}"); return(false); } if (LastStateServerSide == ActorState.Ghost && BeginState + 0.5f > Timing.sInstance.GetFrameStartTime()) { Log.Information($"character state is ghost. item_id:{item_id}, network_id{GetNetworkId()}"); return(false); } var itemData = ACDC.ItemData[item_id]; if (itemData == null) { Log.Information($"cannot find error GetItem item_id:{item_id}, network_id{GetNetworkId()}"); return(false); } JSpellData spellData = null; if ((ITEM_ID_TYPE)item_id == ITEM_ID_TYPE.ADD_ITEM) { spellData = ACDC.SpellData[itemData.SpellID[0]]; } else { spellData = ACDC.SpellData[itemData.SpellID[0]]; } if (spellData == null) { Log.Information($"cannot find error GetSpellData spellId:{itemData.SpellID}, network_id{GetNetworkId()}"); return(false); } // 아이템 획득시 플레이포인트 지급 World.Instance(WorldId).GameMode.OnTrigger(this.GetPlayerId(), PlayPointID.ItemGain); var entry = World.Instance(WorldId).GameMode.GetEntry(this.GetPlayerId()); if (entry != null) { // 일반, 전락 구분 if (itemData.ItemType == (int)ItemType.Normal) { entry.Missions.Increment((int)MissionType.Mission_Get_NorItem, 1); ++World.Instance(WorldId).GameMode.statistics.normal_item; } else if (itemData.ItemType == (int)ItemType.Tactic) { entry.Missions.Increment((int)MissionType.Mission_Get_TacItem, 1); ++World.Instance(WorldId).GameMode.statistics.tactic_item; } } AddSpell(spellData, 0); if (spellData.ApplyObject == (int)ApplyObject.OurTeam || itemData.ItemType == (int)ItemType.Tactic) { var player_list = World.Instance(WorldId).GameMode.GetMyTeam(this.Team); foreach (var player in player_list) { if (player.StateServerSide == ActorState.Ghost) { continue; } player.InvokeClientRpcOnClient(player.GetItemClient, (int)player.GetPlayerId(), item_id); } } else { // 획득한 아이템 클라이언트에 알림 InvokeClientRpcOnClient(GetItemClient, (int)GetPlayerId(), item_id); } return(true); }