Commit ae9a74b56e09cfe93f91a3631075581d1230de3b

Authored by suhongyang
1 parent d27ad5e0

返回miss,快速战斗逻辑

@@ -102,6 +102,7 @@ AdvBackEventType = { @@ -102,6 +102,7 @@ AdvBackEventType = {
102 DefChange = 12, -- 防御变化 102 DefChange = 12, -- 防御变化
103 Passive = 13, -- 獲得被動 103 Passive = 13, -- 獲得被動
104 TurnEnd = 14, -- 回合结束 104 TurnEnd = 14, -- 回合结束
  105 + Miss = 15, -- miss
105 } 106 }
106 107
107 AdvScoreType = { 108 AdvScoreType = {
@@ -700,7 +700,7 @@ end @@ -700,7 +700,7 @@ end
700 700
701 --战斗 普通攻击 701 --战斗 普通攻击
702 local function clickMonster(self, room, block, params) 702 local function clickMonster(self, room, block, params)
703 - self.battle:battleBegin(room.roomId, block.blockId) 703 + self.battle:battleBegin(room.roomId, block.blockId, params.quick)
704 return true 704 return true
705 end 705 end
706 706
@@ -1044,6 +1044,10 @@ end @@ -1044,6 +1044,10 @@ end
1044 function Adv:backHpChange(enemyId, change, isMax) 1044 function Adv:backHpChange(enemyId, change, isMax)
1045 self:pushBackEvent(AdvBackEventType.HpChange, {enemyId = enemyId, change = change, isMax = isMax}) 1045 self:pushBackEvent(AdvBackEventType.HpChange, {enemyId = enemyId, change = change, isMax = isMax})
1046 end 1046 end
  1047 +
  1048 +function Adv:backMiss(enemyId)
  1049 + self:pushBackEvent(AdvBackEventType.Miss, {enemyId = enemyId})
  1050 +end
1047 -- if is player enemyId is nil 1051 -- if is player enemyId is nil
1048 function Adv:backAtkChange(enemyId, change) 1052 function Adv:backAtkChange(enemyId, change)
1049 self:pushBackEvent(AdvBackEventType.AtkChange, {enemyId = enemyId, change = change}) 1053 self:pushBackEvent(AdvBackEventType.AtkChange, {enemyId = enemyId, change = change})
src/adv/AdvBattle.lua
@@ -112,7 +112,7 @@ function Battle:isBattleEnd() @@ -112,7 +112,7 @@ function Battle:isBattleEnd()
112 end 112 end
113 113
114 --战斗开始 114 --战斗开始
115 -function Battle:battleBegin(roomId, blockId) 115 +function Battle:battleBegin(roomId, blockId, isQuick)
116 self.tempData = {} -- 清理上次战斗数据 116 self.tempData = {} -- 清理上次战斗数据
117 if self.enemy then 117 if self.enemy then
118 self.player:reset(self.adv.advTeam.player) 118 self.player:reset(self.adv.advTeam.player)
@@ -123,7 +123,13 @@ function Battle:battleBegin(roomId, blockId) @@ -123,7 +123,13 @@ function Battle:battleBegin(roomId, blockId)
123 self.enemy = enemy 123 self.enemy = enemy
124 self.player:battleBegin() 124 self.player:battleBegin()
125 self.enemy:battleBegin() 125 self.enemy:battleBegin()
126 - self:doBattleTurn() 126 + if not isQuick then
  127 + self:doBattleTurn()
  128 + return
  129 + end
  130 + while not enemy.isDead and not self.player.isDead do
  131 + self:doBattleTurn()
  132 + end
127 end 133 end
128 end 134 end
129 135
src/adv/AdvPlayer.lua
@@ -232,7 +232,7 @@ function BaseObject:getInjuredValue(value) @@ -232,7 +232,7 @@ function BaseObject:getInjuredValue(value)
232 return math.max(0, (value + injuredChange[0]) * (1 + injuredChange[1]) - self.def) 232 return math.max(0, (value + injuredChange[0]) * (1 + injuredChange[1]) - self.def)
233 end 233 end
234 234
235 ---最终伤害 = [ 敌方攻击 * (1+伤害增加百分比-伤害减少百分比)*(1+受伤增加百分比-受伤减少百分比)+(伤害增加固定值-伤害增加固定值+受伤增加固定值-受伤增加固定值)]*(1+侍宠百分比)-侍宠固定值 235 +--最终伤害 = [ (敌方攻击 - 己方防御) * (1+伤害增加百分比-伤害减少百分比)*(1+受伤增加百分比-受伤减少百分比)+(伤害增加固定值-伤害增加固定值+受伤增加固定值-受伤增加固定值)]*(1+侍宠百分比)-侍宠固定值
236 -- params -- hurtType 1 普攻伤害 2 buff伤害 3 反弹伤害 4 真实伤害 236 -- params -- hurtType 1 普攻伤害 2 buff伤害 3 反弹伤害 4 真实伤害
237 --进入这个方法之前计算好释放者加成的伤害 237 --进入这个方法之前计算好释放者加成的伤害
238 function BaseObject:hurt(value, releaser, params) 238 function BaseObject:hurt(value, releaser, params)
@@ -246,6 +246,7 @@ function BaseObject:hurt(value, releaser, params) @@ -246,6 +246,7 @@ function BaseObject:hurt(value, releaser, params)
246 246
247 local hit = releaser.hit - self.miss --命中率 247 local hit = releaser.hit - self.miss --命中率
248 if hit < math.randomInt(1, 100) then --miss 248 if hit < math.randomInt(1, 100) then --miss
  249 + self.battle.adv:backMiss(self.id)
249 return 250 return
250 end 251 end
251 self:triggerPassive(Passive.SELF_HURT, {trigger = releaser}) 252 self:triggerPassive(Passive.SELF_HURT, {trigger = releaser})