Commit ae9a74b56e09cfe93f91a3631075581d1230de3b

Authored by suhongyang
1 parent d27ad5e0

返回miss,快速战斗逻辑

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