public SetEnergy ( Operate_Type opType, int tVal ) : void | ||
opType | Operate_Type | |
tVal | int | |
Résultat | void |
internal void ActivateSkill(int objId, int skillId, int seq) { EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId); if (null != entity) { SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { SkillInfo curSkillInfo = entity.GetSkillStateInfo().GetCurSkillInfo(); if (null != curSkillInfo && (curSkillInfo.ConfigData.interruptPriority < skillInfo.ConfigData.interruptPriority)) { m_Scene.SkillSystem.StopSkill(objId, curSkillInfo.SkillId, 0, true); if (skillId == entity.ManualSkillId) { LogSystem.Warn("ManualSkill {0} interrupt {1}.", skillId, curSkillInfo.SkillId); } } if (skillId == entity.ManualSkillId) { LogSystem.Warn("ManualSkill {0} activate.", skillId); } entity.GetSkillStateInfo().SetCurSkillInfo(skillId); skillInfo.IsSkillActivated = true; skillInfo.CdEndTime = TimeUtility.GetLocalMilliseconds() + (long)skillInfo.ConfigData.cooldown; if (skillInfo.ConfigData.addmp > 0) { //回蓝 entity.SetEnergy(Operate_Type.OT_Relative, skillInfo.ConfigData.addmp); entity.EntityManager.FireDamageEvent(objId, 0, false, false, 0, -skillInfo.ConfigData.addmp); } } } }
internal void ActivateSkill(int actorId, int skillId, int seq) { EntityViewModel view = GetEntityViewById(actorId); if (null != view && null != view.Entity) { EntityInfo entity = view.Entity; SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { SkillInfo curSkillInfo = entity.GetSkillStateInfo().GetCurSkillInfo(); if (null != curSkillInfo && (curSkillInfo.ConfigData.interruptPriority < skillInfo.ConfigData.interruptPriority)) { GfxSkillSystem.Instance.StopSkill(actorId, curSkillInfo.SkillId, 0, true); if (skillId == view.Entity.ManualSkillId) { LogSystem.Warn("ManualSkill {0} interrupt {1}.", skillId, curSkillInfo.SkillId); } } if (skillId == view.Entity.ManualSkillId) { LogSystem.Warn("ManualSkill {0} activate.", skillId); } entity.GetSkillStateInfo().SetCurSkillInfo(skillId); skillInfo.IsSkillActivated = true; skillInfo.CdEndTime = TimeUtility.GetLocalMilliseconds() + (long)skillInfo.ConfigData.cooldown; if (skillInfo.ConfigData.addmp > 0 && !ClientModule.Instance.IsRoomScene) { //回蓝 entity.SetEnergy(Operate_Type.OT_Relative, skillInfo.ConfigData.addmp); entity.EntityManager.FireDamageEvent(actorId, 0, false, false, 0, -skillInfo.ConfigData.addmp); } } } }
internal void EnterScene(User newUser) { Msg_LR_RoomUserInfo lobbyUserData = newUser.LobbyUserData; if (null == lobbyUserData) { return; } TableConfig.Actor cfg = TableConfig.ActorProvider.Instance.GetActor(lobbyUserData.Hero); EntityInfo info = m_EntityMgr.AddEntity(0, lobbyUserData.Camp, cfg, (int)AiStateLogicId.Entity_Leader); info.SetUnitId(EntityInfo.c_StartUserUnitId + info.GetId()); info.GetMovementStateInfo().FormationIndex = 0; if (null != m_SceneConfig) { info.GetMovementStateInfo().SetPosition2D(m_SceneConfig.EnterX + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius, m_SceneConfig.EnterY + (Helper.Random.NextFloat() - 0.5f) * m_SceneConfig.EnterRadius); } newUser.Info = info; AttrCalculator.Calc(info); if (newUser.HaveHpArmor) { info.SetHp(Operate_Type.OT_Absolute, newUser.Hp); info.SetEnergy(Operate_Type.OT_Absolute, newUser.Energy); } else { info.SetHp(Operate_Type.OT_Absolute, newUser.Info.GetActualProperty().HpMax); info.SetEnergy(Operate_Type.OT_Absolute, newUser.Info.GetActualProperty().EnergyMax); } info.SceneContext = m_SceneContext; AddCareList(info); if (newUser.IsEntered) { m_StorySystem.SendMessage("user_enter_scene", info.GetId(), info.GetUnitId(), info.GetCampId(), info.GetMovementStateInfo().PositionX, info.GetMovementStateInfo().PositionZ); } }
private void TickEntities() { m_DeletedEntities.Clear(); for (LinkedListNode <EntityInfo> linkNode = m_EntityMgr.Entities.FirstValue; null != linkNode; linkNode = linkNode.Next) { EntityInfo info = linkNode.Value; info.RetireAttackerInfos(60000); if (info.LevelChanged || info.GetSkillStateInfo().BuffChanged) { AttrCalculator.Calc(info); info.LevelChanged = false; info.GetSkillStateInfo().BuffChanged = false; } if (info.IsBorning) { if (info.BornTime <= 0) { SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.BornSkillId); if (info.BornSkillId > 0 && null != skillInfo) { info.BornTime = TimeUtility.GetLocalMilliseconds(); m_SkillSystem.StartSkill(info.GetId(), skillInfo.ConfigData, 0); } else { info.IsBorning = false; info.BornTime = 0; info.SetAIEnable(true); info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible); } } else if (info.BornTime + info.BornTimeout < TimeUtility.GetLocalMilliseconds()) { info.IsBorning = false; info.BornTime = 0; info.SetAIEnable(true); info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible); } } if (info.IsDead() && !info.NeedDelete) { if (info.DeadTime <= 0) { CalcKillIncome(info); //发送npc死亡消息 Msg_RC_NpcDead npcDeadBuilder = new Msg_RC_NpcDead(); npcDeadBuilder.npc_id = info.GetId(); NotifyAllUser(RoomMessageDefine.Msg_RC_NpcDead, npcDeadBuilder); SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.DeadSkillId); if (info.DeadSkillId > 0 && null != skillInfo) { info.DeadTime = TimeUtility.GetLocalMilliseconds(); m_SkillSystem.StopAllSkill(info.GetId(), true, false, true); m_SkillSystem.StartSkill(info.GetId(), skillInfo.ConfigData, 0); OnEntityKilled(info); } else { if (null == info.CustomData as User) { info.DeadTime = 0; info.NeedDelete = true; OnEntityKilled(info); } else { info.DeadTime = TimeUtility.GetLocalMilliseconds(); } } } else { if (null == info.CustomData as User && info.DeadTime + info.DeadTimeout < TimeUtility.GetLocalMilliseconds()) { info.DeadTime = 0; info.NeedDelete = true; //重新发送npc死亡消息 Msg_RC_NpcDead npcDeadBuilder = new Msg_RC_NpcDead(); npcDeadBuilder.npc_id = info.GetId(); NotifyAllUser(RoomMessageDefine.Msg_RC_NpcDead, npcDeadBuilder); } else if (null != info.CustomData as User && info.DeadTime + info.ReliveTimeout < TimeUtility.GetLocalMilliseconds()) { info.DeadTime = 0; info.SetHp(Operate_Type.OT_Absolute, info.GetActualProperty().HpMax); info.SetEnergy(Operate_Type.OT_Absolute, info.GetActualProperty().EnergyMax); Msg_RC_SyncProperty npcProp = DataSyncUtility.BuildSyncPropertyMessage(info); NotifyAllUser(RoomMessageDefine.Msg_RC_SyncProperty, npcProp); } } } if (info.NeedDelete) { m_DeletedEntities.Add(info); } } if (m_DeletedEntities.Count > 0) { int enemyCt = 0; int friendCt = 0; Msg_RC_DestroyNpc destroyNpcBuilder = new Msg_RC_DestroyNpc(); for (int i = 0; i < m_DeletedEntities.Count; ++i) { EntityInfo ni = m_DeletedEntities[i]; if (CharacterRelation.RELATION_ENEMY == EntityInfo.GetRelation((int)CampIdEnum.Blue, ni.GetCampId())) { ++enemyCt; } else if (CharacterRelation.RELATION_FRIEND == EntityInfo.GetRelation((int)CampIdEnum.Blue, ni.GetCampId())) { ++friendCt; } //发送npc消失消息 destroyNpcBuilder.npc_id = ni.GetId(); NotifyAllUser(RoomMessageDefine.Msg_RC_DestroyNpc, destroyNpcBuilder); DestroyEntity(ni); } TryAllKilledOrAllDied(enemyCt > 0, friendCt > 0); } m_EntityMgr.ExecuteDelayAdd(); }