local Base = require("Battle/Logic/AI/Decision/Decision_Base") local Decision_UseNormalAttack = class("Decision_UseNormalAttack", Base) --[[ 初始化 --]] function Decision_UseNormalAttack:initialize(entity) --类型 self.Type = LuaConst.DecisionType.UseNormalAttack --瞬时 self.IsOnce = false end function Decision_UseNormalAttack:CanEnter(entity, decisionData, command) return entity.components.target.Target end --[[ 输出指令 --]] function Decision_UseNormalAttack:SetCommand(entity, decisionData, command) if decisionData.StringParam1 == "true" then if self:ShouldBlockAI() then return command end end local comp_SkillBase = entity.components.skillBase command.SkillIndex = comp_SkillBase:GetSkillIndexByKeyPosition(LuaConst.ESkillKeyPosition.Slash) local skillData = comp_SkillBase:GetSkillDataBySkillIndex(command.SkillIndex) if skillData then local skillJoystickData = comp_SkillBase:GetSkillJoystickData(skillData.ID) if skillJoystickData and entity.components.target.Target then entity.components.aiBase:SetAISkillJoystickPos(entity.components.target.Target:GetLogicPos()) end end if command.SkillIndex == 0 then logging.warn(LTAG.WARN, "HYW : AI释放普攻失败,因为没有KeyPosition为1的技能 出问题的CharacterID : ", entity:GetCharacterID(), " decisionData.ID : ", decisionData.ID) end return command end return Decision_UseNormalAttack