sm

立即登录 | 账号注册

积分: 0 |用户组: 游客

搜索
服务器租用 传奇3一条龙 996 支付平台源码 无法下载点击此处反馈
查看: 639|回复: 0

[传奇手游源码] 战神引擎明文源码LOST修改攻速mir2.scenes.main.role

[复制链接]

826

主题

36

回帖

23万

积分

霸王教主

积分
236504
发表于 2023-5-15 18:03:46 | 显示全部楼层 |阅读模式
战神引擎明文源码LOST修改攻速mir2.scenes.main.role.hero 客户端明文

  1. local role = import(".role")
  2. local hero = class("hero", role)

  3. table.merge(hero, {
  4.         lastAttackTime = 0,
  5.         lastSpellTime = 0
  6. })

  7. hero.ctor = function (self, params)
  8.         hero.super.ctor(self, params)

  9.         self.sex = nil
  10.         self.job = nil
  11.         self.isHelper = params.isHelper
  12.         self.lastAttackTime = 0
  13.         self.endWarModeAction = nil

  14.         self.initEnd(self)

  15.         if params.isPlayer and main_scene.ui.console.autoRat.enableRat then
  16.                 self.showAutoRatHint(self)
  17.         end

  18.         return
  19. end
  20. hero.showAutoRatHint = function (self)
  21.         if not self.autoRatHintSpr then
  22.                 local x, y = self.node:centerPos()
  23.                 self.autoRatHintSpr = res.get2("pic/console/autoRat.png"):add2(self.node, 1):pos(x, 108)
  24.         end

  25.         return
  26. end
  27. hero.hideAutoRatHint = function (self)
  28.         if self.autoRatHintSpr then
  29.                 self.autoRatHintSpr:removeSelf()

  30.                 self.autoRatHintSpr = nil
  31.         end

  32.         return
  33. end
  34. hero.getParts = function (self, feature)
  35.         local parts = {}
  36.         local sex = feature.get(feature, "sex")
  37.         local weapon = def.role.getHeroWeapon(feature.get(feature, "weapon")*2 + sex)
  38.         local dress = def.role.getHeroDress(feature.get(feature, "dress")*2 + sex)
  39.         local hairImg, hair = def.role.hair(feature)
  40.         self.sex = sex
  41.         self.hair = hair
  42.         local frame = def.role.getDressFrame(0)
  43.         parts.dress = {
  44.                 id = dress.Id,
  45.                 imgid = string.lower(dress.WhichLib or ""),
  46.                 offset = dress.OffSet,
  47.                 frame = frame or {}
  48.         }
  49.         parts.weapon = {
  50.                 id = weapon.Id,
  51.                 imgid = string.lower(weapon.WhichLib or ""),
  52.                 offset = weapon.OffSet,
  53.                 frame = frame or {}
  54.         }

  55.         if self.sex == 1 then
  56.                 parts.weapon.delete = weapon.Id == 1
  57.         else
  58.                 parts.weapon.delete = not weapon.Id
  59.         end

  60.         parts.hair = {
  61.                 id = hair,
  62.                 imgid = hairImg,
  63.                 offset = def.role.humFrame*hair,
  64.                 frame = frame or {},
  65.                 delete = hair == 0
  66.         }

  67.         if dress.WihichEffectLib then
  68.                 parts.humEffect = {
  69.                         blend = true,
  70.                         id = dress.Id,
  71.                         imgid = string.lower(dress.WihichEffectLib or ""),
  72.                         offset = dress.EffectOffSet,
  73.                         offsetEnd = dress.offsetEnd,
  74.                         delay = dress.delay,
  75.                         alwaysPlay = dress.alwaysPlay,
  76.                         frame = frame
  77.                 }
  78.         else
  79.                 parts.humEffect = {
  80.                         delete = true
  81.                 }
  82.         end

  83.         return parts, sex
  84. end
  85. hero.addAct = function (self, params)
  86.         if self.endWarModeAction then
  87.                 self.node:stopAction(self.endWarModeAction)
  88.         end

  89.         if params.type == "hit" or params.type == "spell" or params.type == "heavyHit" or params.type == "bigHit" then
  90.                 if params.type == "spell" then
  91.                         lastSpellTime = socket.gettime()
  92.                 end

  93.                 self.lastAttackTime = socket.gettime()
  94.         elseif params.type == "die" then
  95.                 if self.isPlayer then
  96.                         self.map:setGrayState()
  97.                         main_scene.ui.console.autoRat:stop()
  98.                 end

  99.                 if not params.corpse then
  100.                         sound.playSound(sound.s_man_die + self.sex)
  101.                 end
  102.         end

  103.         hero.super.addAct(self, params)

  104.         return
  105. end
  106. hero.allExecuteEnd = function (self)
  107.         if not self.die and self.last.act then
  108.                 local time = socket.gettime() - self.lastAttackTime

  109.                 if time < 4 then
  110.                         local act = {
  111.                                 type = "warMode",
  112.                                 dir = self.last.act.dir or self.dir
  113.                         }

  114.                         for k, v in pairs(self.sprites) do
  115.                                 v.play(v, act)
  116.                         end

  117.                         _, self.endWarModeAction = self.node:runs({
  118.                                 cc.DelayTime:create(time - 4),
  119.                                 cc.CallFunc:create(function ()
  120.                                         self:addStandAct()

  121.                                         self.endWarModeAction = nil

  122.                                         return
  123.                                 end)
  124.                         })
  125.                 else
  126.                         hero.super.allExecuteEnd(self)
  127.                 end
  128.         end

  129.         self.isExecuteEnd = true

  130.         return
  131. end
  132. hero.getHitTime = function (self)
  133.         local hitSpeed = tonumber(avoidPlugValue(self.hitSpeed, true)) or 0
  134.         local ret = math.max(0, def.role.speed.attack - math.min(850, 850)/1)

  135.         return ret
  136. end
  137. hero.canNextHit = function (self)
  138.         return self.getHitTime(self) < socket.gettime() - self.lastAttackTime
  139. end
  140. hero.getNextMagicDelay = function (self, magicId)
  141.         local time = def.role.speed.spell + g_data.player:getMagicDelay(magicId)/1000

  142.         return (self.lastSpellTime + time) - socket.gettime()
  143. end
  144. hero.canNextSpell = function (self, magicId)
  145.         if self.isLocked(self) then
  146.                 return false
  147.         end

  148.         return self.getNextMagicDelay(self, magicId) <= 0
  149. end

  150. return hero
复制代码
修改过的
  1. local role = import(".role")
  2. local hero = class("hero", role)

  3. table.merge(hero, {
  4.         lastAttackTime = 0,
  5.         lastSpellTime = 0
  6. })

  7. hero.ctor = function (self, params)
  8.         hero.super.ctor(self, params)

  9.         self.sex = nil
  10.         self.job = nil
  11.         self.isHelper = params.isHelper
  12.         self.lastAttackTime = 0
  13.         self.endWarModeAction = nil

  14.         self.initEnd(self)

  15.         if params.isPlayer and main_scene.ui.console.autoRat.enableRat then
  16.                 self.showAutoRatHint(self)
  17.         end

  18.         return
  19. end
  20. hero.showAutoRatHint = function (self)
  21.         if not self.autoRatHintSpr then
  22.                 local x, y = self.node:centerPos()
  23.                 self.autoRatHintSpr = res.get2("pic/console/autoRat.png"):add2(self.node, 1):pos(x, 108)
  24.         end

  25.         return
  26. end
  27. hero.hideAutoRatHint = function (self)
  28.         if self.autoRatHintSpr then
  29.                 self.autoRatHintSpr:removeSelf()

  30.                 self.autoRatHintSpr = nil
  31.         end

  32.         return
  33. end
  34. hero.getParts = function (self, feature)
  35.         local parts = {}
  36.         local sex = feature.get(feature, "sex")
  37.         local weapon = def.role.getHeroWeapon(feature.get(feature, "weapon")*2 + sex)
  38.         local dress = def.role.getHeroDress(feature.get(feature, "dress")*2 + sex)
  39.         local hairImg, hair = def.role.hair(feature)
  40.         self.sex = sex
  41.         self.hair = hair
  42.         local frame = def.role.getDressFrame(0)
  43.         parts.dress = {
  44.                 id = dress.Id,
  45.                 imgid = string.lower(dress.WhichLib or ""),
  46.                 offset = dress.OffSet,
  47.                 frame = frame or {}
  48.         }
  49.         parts.weapon = {
  50.                 id = weapon.Id,
  51.                 imgid = string.lower(weapon.WhichLib or ""),
  52.                 offset = weapon.OffSet,
  53.                 frame = frame or {}
  54.         }

  55.         if self.sex == 1 then
  56.                 parts.weapon.delete = weapon.Id == 1
  57.         else
  58.                 parts.weapon.delete = not weapon.Id
  59.         end

  60.         parts.hair = {
  61.                 id = hair,
  62.                 imgid = hairImg,
  63.                 offset = def.role.humFrame*hair,
  64.                 frame = frame or {},
  65.                 delete = hair == 0
  66.         }

  67.         if dress.WihichEffectLib then
  68.                 parts.humEffect = {
  69.                         blend = true,
  70.                         id = dress.Id,
  71.                         imgid = string.lower(dress.WihichEffectLib or ""),
  72.                         offset = dress.EffectOffSet,
  73.                         offsetEnd = dress.offsetEnd,
  74.                         delay = dress.delay,
  75.                         alwaysPlay = dress.alwaysPlay,
  76.                         frame = frame
  77.                 }
  78.         else
  79.                 parts.humEffect = {
  80.                         delete = true
  81.                 }
  82.         end

  83.         return parts, sex
  84. end
  85. hero.addAct = function (self, params)
  86.         if self.endWarModeAction then
  87.                 self.node:stopAction(self.endWarModeAction)
  88.         end

  89.         if params.type == "hit" or params.type == "spell" or params.type == "heavyHit" or params.type == "bigHit" then
  90.                 if params.type == "spell" then
  91.                         lastSpellTime = socket.gettime()
  92.                 end

  93.                 self.lastAttackTime = socket.gettime()
  94.         elseif params.type == "die" then
  95.                 if self.isPlayer then
  96.                         self.map:setGrayState()
  97.                         main_scene.ui.console.autoRat:stop()
  98.                 end

  99.                 if not params.corpse then
  100.                         sound.playSound(sound.s_man_die + self.sex)
  101.                 end
  102.         end

  103.         hero.super.addAct(self, params)

  104.         return
  105. end
  106. hero.allExecuteEnd = function (self)
  107.         if not self.die and self.last.act then
  108.                 local time = socket.gettime() - self.lastAttackTime

  109.                 if time < 4 then
  110.                         local act = {
  111.                                 type = "warMode",
  112.                                 dir = self.last.act.dir or self.dir
  113.                         }

  114.                         for k, v in pairs(self.sprites) do
  115.                                 v.play(v, act)
  116.                         end

  117.                         _, self.endWarModeAction = self.node:runs({
  118.                                 cc.DelayTime:create(time - 4),
  119.                                 cc.CallFunc:create(function ()
  120.                                         self:addStandAct()

  121.                                         self.endWarModeAction = nil

  122.                                         return
  123.                                 end)
  124.                         })
  125.                 else
  126.                         hero.super.allExecuteEnd(self)
  127.                 end
  128.         end

  129.         self.isExecuteEnd = true

  130.         return
  131. end
  132. hero.getHitTime = function (self)
  133.         local hitSpeed = tonumber(avoidPlugValue(self.hitSpeed, true)) or 0
  134.         local ret = math.max(0, def.role.speed.attack - math.min(600, 600)/1000)

  135.         return ret
  136. end
  137. hero.canNextHit = function (self)
  138.         return self.getHitTime(self) < socket.gettime() - self.lastAttackTime
  139. end
  140. hero.getNextMagicDelay = function (self, magicId)
  141.         local time = def.role.speed.spell + g_data.player:getMagicDelay(magicId)/1000

  142.         return (self.lastSpellTime + time) - socket.gettime()
  143. end
  144. hero.canNextSpell = function (self, magicId)
  145.         if self.isLocked(self) then
  146.                 return false
  147.         end

  148.         return self.getNextMagicDelay(self, magicId) <= 0
  149. end

  150. return hero
复制代码








上一篇:战神引擎地图明文代码mir2.scenes.main.map.map
下一篇:手游战神引擎源码会员挂机等按钮明文代码lua.btnCallbacks
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|美林GM论坛 ( 蜀ICP备2020030293号-2 )|网站地图

禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.如遇版权问题,请及时QQ联系

GMT+8, 2024-5-15 13:57 , Processed in 0.269756 second(s), 47 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表