local Base = require "Battle/Logic/Entity/State/State_Node" local State_Attack = class("State_Attack",Base) local LuaConst=LuaConst local string_isNilOrEmpty=string.isNilOrEmpty --[[ 进入该State --]] function State_Attack:StateIn(entity, skillID, animName, command) Base.StateIn(self, entity, skillID, animName, command) local comp_SkillBase = entity.components.skillBase local skillData = nil for i,value in ipairs(comp_SkillBase.CurSkillDataList) do if skillID == value.ID then skillData = entity:GetSkillData(skillID) break end end if not skillData then return end BattleEventSystem.OnEntityAttackStateIn(entity,skillData) local moveType = skillData.IsMoveByHandle and LuaConst.MoveMode.ByMoveManual or LuaConst.MoveMode.ByAnimation local comp_Anim = entity.components.anim comp_SkillBase:SetCurSkillID(skillID) comp_Anim:SetCurAnimID(skillData.AnimName, moveType) local timeScale = entity.components.timeScale:GetCurTimeScale() comp_SkillBase.CurPassTime:Reset():Sub(LuaConst.TimeSpanMs):Mul(timeScale) -- GWS : 策划需要技能事件触发要闭区间[0,后摇时间] comp_SkillBase.CurLastPassTime:Reset(comp_SkillBase.CurPassTime) -- 释放无双技能 if string_isNilOrEmpty(skillData.BlackRoom) or (LogicUpdateManager._curEntity ~= entity and not LevelManager.IsSyncLevel()) then --主视角safe, 因为SystemManager.OnSkillInterCut是视图代码 SystemManager.OnAttackEnter(entity, skillData, true) else SystemManager.OnSkillInterCut(entity, skillData) end end --[[ 退出该State --]] function State_Attack:StateOut(entity, skillID, animName, command) SystemManager.OnAttackQuit(entity) BattleEventSystem.OnEntitySkillQuit(entity, entity.components.skillBase:GetCurSkillData()) entity.components.skillBase:SetCurSkillID(-1) end --在进入了后摇阶段后 ,无cmd输入时 function State_Attack:StateUpdateNoCmd(entity) local stateType = LuaConst.StateType.None if entity.components.anim.IsCurAnimOver then if entity.components.buff and entity.components.buff:CheckHasBuffState(LuaConst.SpecialBuffs.InRiding) then if entity.components.move.RideSpeedRate == FP.Const.Zero then stateType = LuaConst.StateType.Idle else stateType = LuaConst.StateType.Move end else stateType = LuaConst.StateType.Idle end end return stateType end function State_Attack:OffHorse(entity) --如果正在释放马技能时下马,需要处理技能的后摇 if not entity.components.skillBase.CanSwitchAll then local curSkillData = entity.components.skillBase.CurSkillData local curSkillKeyPos = curSkillData and curSkillData.KeyPosition or -1 if curSkillKeyPos == LuaConst.HorseIdleSkillKeyPos or curSkillKeyPos == LuaConst.HorseRunSkillKeyPos then SystemManager.ChangeToSwitchAll(entity) SystemManager.SetNextState(LuaConst.StateType.Idle, entity) end end end return State_Attack