public GetSkillStateInfo ( ) : |
||
Результат |
private void OnAiSkill(EntityInfo npc, int skillId) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo(); if (null == skillInfo || !skillInfo.IsSkillActivated) { SkillInfo curSkillInfo = npc.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != curSkillInfo) { long curTime = TimeUtility.GetLocalMilliseconds(); if (!curSkillInfo.IsInCd(curTime)) { if (scene.SkillSystem.StartSkill(npc.GetId(), curSkillInfo.ConfigData, 0)) { Msg_RC_NpcSkill skillBuilder = DataSyncUtility.BuildNpcSkillMessage(npc, skillId); LogSystem.Info("Send Msg_RC_NpcSkill, EntityId={0}, SkillId={1}", npc.GetId(), skillId); scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcSkill, skillBuilder); } } } } } }
public 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.skillData.interruptPriority < skillInfo.ConfigData.skillData.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.skillData.cooldown; if (skillInfo.ConfigData.skillData.addsc > 0 && PluginFramework.Instance.IsBattleScene) { //回蓝 entity.Energy += skillInfo.ConfigData.skillData.addsc; entity.EntityManager.FireDamageEvent(actorId, 0, false, false, 0, -skillInfo.ConfigData.skillData.addsc); } } } }
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 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); } } } }
private void CombatHandler(EntityInfo npc, long deltaTime) { if (npc.GetSkillStateInfo().IsSkillActivated()) { return; } AiStateInfo info = npc.GetAiStateInfo(); Vector3 targetPos = info.HomePos; ScriptRuntime.Vector3 srcPos = npc.GetMovementStateInfo().GetPosition3D(); float distSqrToHome = Geometry.DistanceSquare(srcPos, info.HomePos); if (distSqrToHome > npc.GohomeRange * npc.GohomeRange) { NotifyAiStopPursue(npc); ChangeToState(npc, (int)AiStateId.GoHome); return; } /// EntityInfo attackTarget = null; SkillStateInfo currSkInfo = npc.GetSkillStateInfo(); ///找到可以使用的技能 SkillInfo skInfo = AiLogicUtility.NpcFindCanUseSkill(npc, this.GetAiData(npc), true); NotifyAiSelectSkill(npc, skInfo); if (skInfo == null) { //没有可以使用的技能就切换到Idle状态 ChangeToState(npc, (int)AiStateId.Idle); return; } CharacterRelation relation = (skInfo.TargetType == SkillTargetType.Friend || skInfo.TargetType == SkillTargetType.RandFriend) ? CharacterRelation.RELATION_FRIEND : CharacterRelation.RELATION_ENEMY; attackTarget = AiLogicUtility.GetNearstTargetHelper( npc, skInfo.Distance, relation); if (attackTarget != null && null != skInfo) //攻击范围内找到可攻击目标 { info.Target = attackTarget.GetId(); NotifyAiStopPursue(npc); NotifyAiSkill(npc, skInfo.SkillId); //攻击目标 return; } attackTarget = AiLogicUtility.GetNearstTargetHelper( npc, npc.ViewRange, relation); if (attackTarget != null) //视野范围内找到可攻击目标 { NotifyAiPursue(npc, attackTarget.GetMovementStateInfo().GetPosition3D()); // 追赶目标 return; } currSkInfo.SetCurSkillInfo(0); NotifyAiStopPursue(npc); ChangeToState(npc, (int)AiStateId.GoHome); }
private void CombatHandler(EntityInfo npc, long deltaTime) { AiStateInfo aiInfo = npc.GetAiStateInfo(); AiData_Leader aiData = GetAiData(npc); if (npc.GetSkillStateInfo().IsSkillActivated()) { return; } /// SkillStateInfo currSkInfo = npc.GetSkillStateInfo(); ///找到可以使用的技能 SkillInfo skInfo = AiLogicUtility.NpcFindCanUseSkill(npc, this.GetAiData(npc), aiData.IsAutoOperate); NotifyAiSelectSkill(npc, skInfo); if (skInfo == null) { //没有可以使用的技能就切换到Idle状态 ChangeToState(npc, (int)AiStateId.Idle); return; } CharacterRelation relation = (skInfo.TargetType == SkillTargetType.Friend || skInfo.TargetType == SkillTargetType.RandFriend) ? CharacterRelation.RELATION_FRIEND : CharacterRelation.RELATION_ENEMY; EntityInfo attackTarget = AiLogicUtility.GetNearstAttackerHelper(npc, relation, aiData); if (null != attackTarget) { NotifyAiTarget(npc, attackTarget); if (Geometry.DistanceSquare(npc.GetMovementStateInfo().GetPosition3D(), attackTarget.GetMovementStateInfo().GetPosition3D()) < skInfo.Distance * skInfo.Distance) { aiInfo.Target = attackTarget.GetId(); NotifyAiStopPursue(npc); NotifyAiSkill(npc, skInfo.SkillId); return; } } attackTarget = AiLogicUtility.GetNearstTargetHelper(npc, skInfo.Distance, relation); if (attackTarget != null && null != skInfo) { //攻击范围内找到可攻击目标 NotifyAiTarget(npc, attackTarget); aiInfo.Target = attackTarget.GetId(); NotifyAiStopPursue(npc); NotifyAiSkill(npc, skInfo.SkillId); //攻击目标 return; } if (aiData.IsAutoOperate) { attackTarget = AiLogicUtility.GetNearstTargetHelper(npc, npc.ViewRange, relation); if (attackTarget != null && null != skInfo) { //视野内找到可攻击目标 NotifyAiPursue(npc, attackTarget.GetMovementStateInfo().GetPosition3D()); return; } } ///退出战斗模式清理一下手动技能 currSkInfo.SetCurSkillInfo(0); aiData.ManualSkillId = 0; NotifyAiStopPursue(npc); ChangeToState(npc, (int)AiStateId.Idle); }
private void OnAiSelectSkill(EntityInfo npc, SkillInfo skill) { if (skill == null) { npc.GetSkillStateInfo().SetCurSkillInfo(0); } else { npc.GetSkillStateInfo().SetCurSkillInfo(skill.SkillId); } }
internal ImpactInfo SendImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, int impactId, Dictionary <string, object> args) { EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId); if (null != targetObj) { if (null != cfg) { Quaternion hitEffectRotation = Quaternion.Identity; EntityInfo srcObj = m_Scene.EntityManager.GetEntityInfo(srcObjId); var addArgs = new Dictionary <string, object> { { "hitEffectRotation", hitEffectRotation } }; ImpactInfo impactInfo = null; if (impactId <= 0 || impactId >= SkillInstance.c_FirstInnerHitSkillId) { impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.HitSkillCfg); impactId = PredefinedSkill.c_HitSkillId; } else { impactInfo = new ImpactInfo(impactId); } if (null != impactInfo.ConfigData) { if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) { if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) { ImpactInfo oldImpactInfo = targetObj.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId); if (null != oldImpactInfo) { oldImpactInfo.DurationTime += impactInfo.DurationTime; return(oldImpactInfo); } } targetObj.GetSkillStateInfo().AddImpact(impactInfo); SkillInfo skillInfo = targetObj.GetSkillStateInfo().GetCurSkillInfo(); if (null != skillInfo && (cfg.isInterrupt || impactInfo.ConfigData.isInterrupt)) { m_Scene.SkillSystem.StopSkill(targetId, skillInfo.SkillId, 0, true); } m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs); return(impactInfo); } } else { LogSystem.Error("impact {0} config can't found !", impactInfo.ImpactId); } } } return(null); }
internal GfxSkillSenderInfo BuildSkillInfo(int objId, TableConfig.Skill configData, int seq, Scene scene) { GfxSkillSenderInfo ret = null; EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId); if (null != entity && null != configData) { int targetId = 0; if (configData.type == (int)SkillOrImpactType.Skill) { targetId = entity.GetAiStateInfo().Target; } else { ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != impactInfo) { targetId = impactInfo.ImpactSenderId; } } EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId); if (null != targetObj) { ret = new GfxSkillSenderInfo(configData, seq, objId, entity, targetId, targetObj, scene); } else { ret = new GfxSkillSenderInfo(configData, seq, objId, entity, scene); } } return(ret); }
public bool SkillCanFindTarget(int objId, int skillId) { bool ret = false; EntityInfo obj = GetEntityById(objId); if (null != obj) { SkillInfo skillInfo = obj.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { bool find = false; KdTree.QueryWithFunc(obj, skillInfo.Distance, (float distSqr, KdTreeObject _obj) => { EntityInfo target = _obj.Object; if (CharacterRelation.RELATION_ENEMY == EntityInfo.GetRelation(obj, target) && !target.IsDead()) { find = true; return(false); } return(true); }); ret = find; } } return(ret); }
public int GetTrackSendImpact(int targetId, int seq, Dictionary <string, object> args) { int impactId = 0; EntityViewModel view = GetEntityViewById(targetId); if (null != view && null != view.Entity && null != view.Actor) { EntityInfo npc = view.Entity; ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != trackImpactInfo) { int targetImpactId = trackImpactInfo.ImpactToTarget; if (targetImpactId <= 0) { targetImpactId = trackImpactInfo.ConfigData.impact; } if (targetImpactId <= 0) { object v; if (args.TryGetValue("impact", out v)) { targetImpactId = (int)v; } } impactId = targetImpactId; } } return(impactId); }
public bool CastSkill(int objId, int skillId) { bool ret = false; EntityInfo obj = GetEntityById(objId); if (null != obj) { SkillInfo skillInfo = obj.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (!skillInfo.IsInCd(TimeUtility.GetLocalMilliseconds())) { int targetId = 0; if (null != SelectedTarget) { targetId = SelectedTarget.TargetId; } if (!IsBattleState) { Network.NetworkSystem.Instance.SyncPlayerSkill(obj, skillId, targetId, obj.GetMovementStateInfo().GetFaceDir()); } else { AiStateInfo aiInfo = obj.GetAiStateInfo(); aiInfo.Target = targetId; GfxSkillSystem.Instance.StartSkill(objId, skillInfo.ConfigData, 0); } ret = true; } } } return(ret); }
public GfxSkillSenderInfo BuildSkillInfo(int objId, TableConfig.Skill configData, int seq) { GfxSkillSenderInfo ret = null; EntityViewModel view = GetEntityViewById(objId); if (null != view && null != view.Actor && null != view.Entity && null != configData) { EntityInfo entity = view.Entity; int targetId = 0; if (configData.type == (int)SkillOrImpactType.Skill) { targetId = entity.GetAiStateInfo().Target; } else { ImpactInfo impactInfo = entity.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != impactInfo) { targetId = impactInfo.ImpactSenderId; } } UnityEngine.GameObject targetObj = GetGameObject(targetId); if (null != targetObj) { ret = new GfxSkillSenderInfo(configData, seq, objId, view.Actor, targetId, targetObj); } else { ret = new GfxSkillSenderInfo(configData, seq, objId, view.Actor); } } return(ret); }
private void OnAiAddImpact(EntityInfo npc, int impactId) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { ImpactInfo impactInfo = new ImpactInfo(impactId); impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.ImpactSenderId = npc.GetId(); impactInfo.SkillId = 0; if (null != impactInfo.ConfigData) { npc.GetSkillStateInfo().AddImpact(impactInfo); int seq = impactInfo.Seq; if (scene.SkillSystem.StartSkill(npc.GetId(), impactInfo.ConfigData, seq)) { Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact(); addImpactBuilder.sender_id = npc.GetId(); addImpactBuilder.target_id = npc.GetId(); addImpactBuilder.impact_id = impactId; addImpactBuilder.skill_id = -1; addImpactBuilder.duration = impactInfo.DurationTime; scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder); } } } }
internal int GetTrackSendImpact(int targetId, int seq, Dictionary <string, object> args) { int impactId = 0; EntityInfo npc = m_Scene.EntityManager.GetEntityInfo(targetId); if (null != npc) { ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != trackImpactInfo) { int targetImpactId = trackImpactInfo.ImpactToTarget; if (targetImpactId <= 0) { targetImpactId = trackImpactInfo.ConfigData.impact; } if (targetImpactId <= 0) { object v; if (args.TryGetValue("impact", out v)) { targetImpactId = (int)v; } } impactId = targetImpactId; } } return(impactId); }
internal ImpactInfo TrackImpact(TableConfig.Skill cfg, int seq, int curObjId, int srcObjId, int targetId, string emitBone, int emitImpact, Vector3 offset, Dictionary <string, object> args) { EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId); EntityInfo srcObj = m_Scene.EntityManager.GetEntityInfo(srcObjId); if (null != targetObj && !targetObj.IsDead()) { if (null != cfg) { ImpactInfo impactInfo = null; if (emitImpact <= 0 || emitImpact >= SkillInstance.c_FirstInnerEmitSkillId) { impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.EmitSkillCfg); } else { impactInfo = new ImpactInfo(emitImpact); } if (TryInitImpactInfo(impactInfo, cfg, seq, curObjId, srcObjId, args)) { if (null != srcObj) { Vector3 pos = srcObj.GetMovementStateInfo().GetPosition3D(); pos.Y += srcObj.GetRadius(); impactInfo.SenderPosition = pos; } targetObj.GetSkillStateInfo().AddImpact(impactInfo); m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args); return(impactInfo); } } } return(null); }
internal static void SyncBuffListToObserver(EntityInfo obj, Observer observer) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } }
public static void SyncBuffListToObservers(EntityInfo obj, Scene scene) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } }
public static void SyncBuffListToUser(EntityInfo obj, User user) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } }
public static void RefixAttrByImpact(EntityInfo obj) { List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); for (int i = 0; i < impacts.Count; ++i) { ImpactInfo impact = impacts[i]; impact.RefixCharacterProperty(obj); } }
public ImpactInfo TrackSendImpact(int targetId, int impactId, int seq, int impactToTarget, Dictionary <string, object> args) { EntityViewModel view = GetEntityViewById(targetId); if (null != view && null != view.Entity && null != view.Actor && !view.Entity.IsDeadSkillCasting()) { EntityInfo npc = view.Entity; ImpactInfo trackImpactInfo = npc.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != trackImpactInfo && impactId == trackImpactInfo.ImpactId) { ImpactInfo impactInfo = null; if (impactToTarget <= 0 || impactToTarget >= SkillInstance.c_FirstInnerHitSkillId) { impactToTarget = PredefinedSkill.c_HitSkillId; impactInfo = new ImpactInfo(PredefinedSkill.Instance.HitSkillCfg); } var addArgs = new Dictionary <string, object>(); if (null == impactInfo) { impactInfo = new ImpactInfo(impactId); } impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.ImpactSenderId = trackImpactInfo.ImpactSenderId; impactInfo.SenderPosition = trackImpactInfo.SenderPosition; impactInfo.SkillId = trackImpactInfo.SkillId; impactInfo.DurationTime = trackImpactInfo.DurationTime > 0 ? trackImpactInfo.DurationTime : impactInfo.ConfigData.impactData.duration; impactInfo.TargetType = trackImpactInfo.TargetType; impactInfo.DamageData.CopyFrom(trackImpactInfo.DamageData); impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData); if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) { ImpactInfo oldImpactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId); if (null != oldImpactInfo) { oldImpactInfo.DurationTime += impactInfo.DurationTime; return(oldImpactInfo); } } npc.GetSkillStateInfo().AddImpact(impactInfo); GfxSkillSystem.Instance.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs); return(impactInfo); } } return(null); }
private void OnAiRemoveImpact(EntityInfo entity, int impactId) { ImpactInfo impactInfo = entity.GetSkillStateInfo().FindImpactInfoById(impactId); if (null != impactInfo) { GfxSkillSystem.Instance.StopSkill(entity.GetId(), impactId, impactInfo.Seq, false); } }
internal ImpactInfo TrackSendImpact(int targetId, int impactId, int seq, int impactToTarget, Dictionary <string, object> args) { EntityInfo targetObj = m_Scene.EntityManager.GetEntityInfo(targetId); if (null != targetObj && !targetObj.IsDead()) { ImpactInfo trackImpactInfo = targetObj.GetSkillStateInfo().GetImpactInfoBySeq(seq); if (null != trackImpactInfo && impactId == trackImpactInfo.ImpactId) { ImpactInfo impactInfo = null; if (impactToTarget <= 0 || impactToTarget >= SkillInstance.c_FirstInnerHitSkillId) { impactToTarget = PredefinedSkill.c_HitSkillId; impactInfo = new ImpactInfo(m_Scene.SkillSystem.PredefinedSkill.HitSkillCfg); } var addArgs = new Dictionary <string, object>(); if (null == impactInfo) { impactInfo = new ImpactInfo(impactId); } impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.ImpactSenderId = trackImpactInfo.ImpactSenderId; impactInfo.SenderPosition = trackImpactInfo.SenderPosition; impactInfo.SkillId = trackImpactInfo.SkillId; impactInfo.DurationTime = trackImpactInfo.DurationTime > 0 ? trackImpactInfo.DurationTime : impactInfo.ConfigData.duration; impactInfo.TargetType = trackImpactInfo.TargetType; impactInfo.DamageData.CopyFrom(trackImpactInfo.DamageData); impactInfo.DamageData.Merge(impactInfo.ConfigData.damageData); if (impactInfo.ConfigData.type == (int)SkillOrImpactType.Buff) { ImpactInfo oldImpactInfo = targetObj.GetSkillStateInfo().FindImpactInfoById(impactInfo.ImpactId); if (null != oldImpactInfo) { oldImpactInfo.DurationTime += impactInfo.DurationTime; return(oldImpactInfo); } } targetObj.GetSkillStateInfo().AddImpact(impactInfo); m_Scene.SkillSystem.StartSkill(targetId, impactInfo.ConfigData, impactInfo.Seq, args, addArgs); return(impactInfo); } } return(null); }
public bool CastSkill(int objId, int skillId) { bool ret = false; EntityInfo obj = GetEntityById(objId); if (null != obj) { SkillInfo skillInfo = obj.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (obj.Energy >= obj.GetActualProperty().EnergyMax) { if (!skillInfo.IsInCd(TimeUtility.GetLocalMilliseconds())) { int targetId = 0; if (null != SelectedTarget) { targetId = SelectedTarget.TargetId; } if (IsRoomScene) { Network.NetworkSystem.Instance.SyncPlayerSkill(obj, skillId, targetId, obj.GetMovementStateInfo().GetFaceDir()); } else { AiStateInfo aiInfo = obj.GetAiStateInfo(); aiInfo.Target = targetId; if (aiInfo.AiLogic == (int)AiStateLogicId.Entity_Leader) { AiData_Leader data = aiInfo.AiDatas.GetData <AiData_Leader>(); if (null == data) { data = new AiData_Leader(); aiInfo.AiDatas.AddData(data); } data.ManualSkillId = skillId; } else { AiData_General data = aiInfo.AiDatas.GetData <AiData_General>(); if (null == data) { data = new AiData_General(); aiInfo.AiDatas.AddData(data); } data.ManualSkillId = skillId; } aiInfo.ChangeToState((int)AiStateId.SkillCommand); } ret = true; } } } } return(ret); }
public static void RefixAttrByImpact(EntityInfo obj) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); for (int i = 0; i < impacts.Count; ++i) { ImpactInfo impact = impacts[i]; impact.RefixCharacterProperty(obj); } }
private void DestroyEntity(EntityInfo ni) { ni.GetSkillStateInfo().RemoveAllImpact(); OnDestroyEntity(ni); if (ni.IsCombatNpc()) { ni.DeadTime = 0; } DestroyEntityById(ni.GetId()); }
internal static void DoSkillCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic, int skillId) { if (entity.GetMovementStateInfo().IsMoving) { logic.NotifyAiStopPursue(entity); } if (skillId > 0) { AiStateInfo aiInfo = entity.GetAiStateInfo(); SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (aiInfo.Target <= 0) { EntityInfo info; if (skillInfo.ConfigData.targetType == (int)SkillTargetType.Enemy || skillInfo.ConfigData.targetType == (int)SkillTargetType.RandEnemy) { info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY); } else { info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_FRIEND); } if (null != info) { aiInfo.Target = info.GetId(); } } if (aiInfo.Target > 0) { logic.NotifyAiSkill(entity, skillId); } } } else if (!entity.GetSkillStateInfo().IsSkillActivated()) { logic.AiSendStoryMessage(entity, "npc_skill_finish:" + entity.GetUnitId(), entity.GetId()); logic.AiSendStoryMessage(entity, "obj_skill_finish", entity.GetId()); logic.ChangeToState(entity, (int)AiStateId.Idle); } }
private void DestroyEntity(EntityInfo ni) { GfxSkillSystem.Instance.StopAllSkill(ni.GetId(), true, true, true); ni.GetSkillStateInfo().RemoveAllImpact(); OnDestroyEntity(ni); if (ni.IsCombatNpc()) { ni.DeadTime = 0; } EntityViewModelManager.Instance.DestroyEntityView(ni.GetId()); DestroyEntityById(ni.GetId()); }
internal void CancelIfImpact(int actorId, TableConfig.Skill cfg, int seq) { EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(actorId); if (null != entity) { if (cfg.type != (int)SkillOrImpactType.Skill) { entity.GetSkillStateInfo().RemoveImpact(seq); } } }
internal bool CanCastSkill(int objId, TableConfig.Skill configData, int seq) { bool ret = true; if (configData.type == (int)SkillOrImpactType.Skill) { EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId); if (null != entity) { if (entity.GetSkillStateInfo().IsSkillActivated()) { SkillInfo skillInfo = entity.GetSkillStateInfo().GetCurSkillInfo(); if (null != skillInfo && skillInfo.ConfigData.interruptPriority >= configData.interruptPriority) { ret = false; } } } } return(ret); }
public static void SyncBuffListToCaredUsers(EntityInfo obj) { Scene scene = obj.SceneContext.CustomData as Scene; if (null != scene) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } } }
public static void RefixAttrByImpact(EntityInfo obj) { List <ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); for (int i = 0; i < impacts.Count; ++i) { ImpactInfo impact = impacts[i]; if (impact.ConfigData.type == (int)SkillOrImpactType.Buff) { impact.RefixCharacterProperty(obj); } } }
public bool CanCastSkill(int objId, TableConfig.Skill configData, int seq) { bool ret = true; if (configData.type == (int)SkillOrImpactType.Skill) { EntityViewModel view = GetEntityViewById(objId); if (null != view && null != view.Entity) { EntityInfo entity = view.Entity; if (entity.GetSkillStateInfo().IsSkillActivated()) { SkillInfo skillInfo = entity.GetSkillStateInfo().GetCurSkillInfo(); if (null != skillInfo && skillInfo.ConfigData.skillData.interruptPriority >= configData.skillData.interruptPriority) { ret = false; } } } } return(ret); }
private void OnAiAddImpact(EntityInfo entity, int impactId) { ImpactInfo impactInfo = new ImpactInfo(impactId); impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.ImpactSenderId = entity.GetId(); impactInfo.SkillId = 0; if (null != impactInfo.ConfigData) { entity.GetSkillStateInfo().AddImpact(impactInfo); int seq = impactInfo.Seq; if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), impactInfo.ConfigData, seq)) { } } }
private void OnAiAddImpact(EntityInfo npc, int impactId) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { ImpactInfo impactInfo = new ImpactInfo(impactId); impactInfo.StartTime = TimeUtility.GetLocalMilliseconds(); impactInfo.ImpactSenderId = npc.GetId(); impactInfo.SkillId = 0; if (null != impactInfo.ConfigData) { npc.GetSkillStateInfo().AddImpact(impactInfo); int seq = impactInfo.Seq; if (scene.SkillSystem.StartSkill(npc.GetId(), impactInfo.ConfigData, seq)) { Msg_RC_AddImpact addImpactBuilder = new Msg_RC_AddImpact(); addImpactBuilder.sender_id = npc.GetId(); addImpactBuilder.target_id = npc.GetId(); addImpactBuilder.impact_id = impactId; addImpactBuilder.skill_id = -1; addImpactBuilder.duration = impactInfo.DurationTime; scene.NotifyAllUser(RoomMessageDefine.Msg_RC_AddImpact, addImpactBuilder); } } } }
private void OnAiSkill(EntityInfo entity, int skillId) { if (null != entity) { SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (GfxSkillSystem.Instance.StartSkill(entity.GetId(), skillInfo.ConfigData, 0)) { Utility.EventSystem.Publish("ui_skill_cooldown", "ui", entity.GetId(), skillId, skillInfo.ConfigData.cooldown / 1000.0f); } } } }
internal static void SyncBuffListToObservers(EntityInfo obj, Scene scene) { List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } }
internal static void SyncBuffListToCaredUsers(EntityInfo obj) { Scene scene = obj.SceneContext.CustomData as Scene; if (null != scene) { List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } } }
internal static SkillInfo NpcFindCanUseSkill(EntityInfo npc, AiData_General aidata, bool includeManualSkill) { SkillInfo selectSkill = null; SkillStateInfo skStateInfo = npc.GetSkillStateInfo(); int priority = -1; SkillInfo skInfo = null; long curTime = TimeUtility.GetLocalMilliseconds(); if (includeManualSkill && npc.ManualSkillId > 0) { skInfo = skStateInfo.GetSkillInfoById(npc.ManualSkillId); if (null != skInfo && !skInfo.IsInCd(curTime)) { selectSkill = skInfo; } } if (null == selectSkill) { if (npc.AutoSkillIds.Count <= 0) return null; int randIndex = Helper.Random.Next(0, npc.AutoSkillIds.Count); skInfo = skStateInfo.GetSkillInfoById(npc.AutoSkillIds[randIndex]); if (null != skInfo && !skInfo.IsInCd(curTime)) { selectSkill = skInfo; } else { for (int i = 0; i < npc.AutoSkillIds.Count; i++) { skInfo = skStateInfo.GetSkillInfoById(npc.AutoSkillIds[i]); if (null != skInfo && !skInfo.IsInCd(curTime) && skInfo.InterruptPriority > priority) { selectSkill = skInfo; priority = skInfo.InterruptPriority; } } } } if (null != selectSkill) { aidata.LastUseSkillTime = TimeUtility.GetLocalMilliseconds(); } return selectSkill; }
internal static void SyncBuffListToUser(EntityInfo obj, User user) { List<ImpactInfo> impacts = obj.GetSkillStateInfo().GetAllImpact(); foreach (ImpactInfo info in impacts) { } }
internal static void DoSkillCommandState(EntityInfo entity, long deltaTime, AbstractAiStateLogic logic, int skillId) { if (entity.GetMovementStateInfo().IsMoving) { logic.NotifyAiStopPursue(entity); } if (skillId > 0) { AiStateInfo aiInfo = entity.GetAiStateInfo(); SkillInfo skillInfo = entity.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != skillInfo) { if (aiInfo.Target <= 0) { EntityInfo info; if (skillInfo.ConfigData.targetType == (int)SkillTargetType.Enemy || skillInfo.ConfigData.targetType == (int)SkillTargetType.RandEnemy) { info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_ENEMY); } else { info = GetNearstTargetHelper(entity, CharacterRelation.RELATION_FRIEND); } if (null != info) { aiInfo.Target = info.GetId(); } } if (aiInfo.Target > 0) { logic.NotifyAiSkill(entity, skillId); } } } else if(!entity.GetSkillStateInfo().IsSkillActivated()) { logic.AiSendStoryMessage(entity, "npc_skill_finish:" + entity.GetUnitId(), entity.GetId()); logic.AiSendStoryMessage(entity, "obj_skill_finish", entity.GetId()); logic.ChangeToState(entity, (int)AiStateId.Idle); } }
private void OnAiStopSkill(EntityInfo npc) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo(); if (null == skillInfo || skillInfo.IsSkillActivated) { scene.SkillSystem.StopAllSkill(npc.GetId(), true); } Msg_RC_NpcStopSkill skillBuilder = DataSyncUtility.BuildNpcStopSkillMessage(npc); LogSystem.Info("Send Msg_RC_NpcStopSkill, EntityId={0}", npc.GetId()); scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcStopSkill, skillBuilder); } }
private void OnAiSkill(EntityInfo npc, int skillId) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { SkillInfo skillInfo = npc.GetSkillStateInfo().GetCurSkillInfo(); if (null == skillInfo || !skillInfo.IsSkillActivated) { SkillInfo curSkillInfo = npc.GetSkillStateInfo().GetSkillInfoById(skillId); if (null != curSkillInfo) { long curTime = TimeUtility.GetLocalMilliseconds(); if (!curSkillInfo.IsInCd(curTime)) { if (scene.SkillSystem.StartSkill(npc.GetId(), curSkillInfo.ConfigData, 0)) { Msg_RC_NpcSkill skillBuilder = DataSyncUtility.BuildNpcSkillMessage(npc, skillId); LogSystem.Info("Send Msg_RC_NpcSkill, EntityId={0}, SkillId={1}", npc.GetId(), skillId); scene.NotifyAllUser(RoomMessageDefine.Msg_RC_NpcSkill, skillBuilder); } } } } } }
private void OnAiRemoveImpact(EntityInfo npc, int impactId) { Scene scene = npc.SceneContext.CustomData as Scene; if (null != scene) { ImpactInfo impactInfo = npc.GetSkillStateInfo().FindImpactInfoById(impactId); if (null != impactInfo) { Msg_RC_RemoveImpact removeImpactBuilder = new Msg_RC_RemoveImpact(); removeImpactBuilder.obj_id = npc.GetId(); removeImpactBuilder.impact_id = impactId; scene.NotifyAllUser(RoomMessageDefine.Msg_RC_RemoveImpact, removeImpactBuilder); scene.SkillSystem.StopSkill(npc.GetId(), impactId, impactInfo.Seq, false); } } }
private void OnAiRemoveImpact(EntityInfo entity, int impactId) { ImpactInfo impactInfo = entity.GetSkillStateInfo().FindImpactInfoById(impactId); if (null != impactInfo) { GfxSkillSystem.Instance.StopSkill(entity.GetId(), impactId, impactInfo.Seq, false); } }
private void OnAiSelectSkill(EntityInfo npc, SkillInfo skill) { if (skill == null) npc.GetSkillStateInfo().SetCurSkillInfo(0); else npc.GetSkillStateInfo().SetCurSkillInfo(skill.SkillId); }
private void DestroyEntity(EntityInfo ni) { m_SkillSystem.StopAllSkill(ni.GetId(), true, true, true); ni.GetSkillStateInfo().RemoveAllImpact(); OnDestroyEntity(ni); if (ni.IsCombatNpc()) { ni.DeadTime = 0; } DestroyEntityById(ni.GetId()); }