diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index b0dcc72..f252f7c 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -366,12 +366,12 @@ function _M.wearArtifactRpc(agent, data) local adv = role:getAdvData() - if math.illegalNum(slot, 1, 5) then return end - if not adv:isHaveArtifact(id) then return end - if not adv:isWaitChooseArtifact() then return end + if math.illegalNum(slot, 1, 5) then return 1 end + if not adv:isHaveArtifact(id) then return 2 end + if adv:isWaitChooseArtifact() then return 3 end local status = adv:wearArtifact(slot, id) - if not status then return end + if not status then return 4 end adv:saveDB() SendPacket(actionCodes.Adv_wearArtifactRpc, '') @@ -385,14 +385,15 @@ function _M.upArtifactRpc(agent, data) local id = msg.id local adv = role:getAdvData() + if adv:isWaitChooseArtifact() then return 1 end local curLevel = adv:isHaveArtifact(id) - if not curLevel then return end - if not role:isArtifactOpen(id, adv:isEndless(), curLevel + 1) then return end - local cost = csvdb["adv_artifactCsv"][curLevel].exp:toNumMap() - if not adv:cost(cost, {}, true) then return end + if not curLevel then return 2 end + if not role:isArtifactOpen(id, adv:isEndless(), curLevel + 1) then return 3 end + local cost = csvdb["adv_artifactCsv"][id][curLevel].exp:toNumMap() + if not adv:cost(cost, {}, true) then return 4 end local status = adv:artifactLevelUp(id) - if not status then return end + if not status then return 5 end adv:cost(cost, {}) if status == 1 then -- 现在穿着呢。更新下 @@ -449,6 +450,7 @@ function _M.endBattleRpc(agent, data) local enemyId = msg.enemyId local key = msg.key local player = msg.player + local bySkill = msg.bySkill --死于 技能 if not player or not player.hp or not player.sp or not enemyId or not key then return end local adv = role:getAdvData() @@ -461,7 +463,7 @@ function _M.endBattleRpc(agent, data) adv.__battleCache = nil - local status = adv:clickBlock(roomId, blockId, {player = player}) + local status = adv:clickBlock(roomId, blockId, {player = player, bySkill = bySkill}) if not status then return end SendPacket(actionCodes.Adv_endBattleRpc, MsgPack.pack({events = adv:popBackEvents()})) return true diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 6be0772..7c277ed 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -290,17 +290,28 @@ function _M.idlec(role, pms) return "成功" end -table.insert(helpDes, {"获取冒险内道具", "advit"}) +table.insert(helpDes, {"冒险内可使用道具", "advit", "ALL"}) +table.insert(helpDes, {"冒险内消耗道具", "advit", "itemId", "count"}) function _M.advit(role, pms) local reward = {} - for k, v in pairs(csvdb["adv_itemCsv"]) do - if csvdb["itemCsv"][k] and v.effect ~= 0 then - reward[k] = 1 + if pms.pm1 == "ALL" then + for k, v in pairs(csvdb["adv_itemCsv"]) do + if csvdb["itemCsv"][k] and v.effect ~= 0 then + reward[k] = 1 + end end + for k , v in pairs(csvdb["adv_artifactCsv"]) do + if v.unlock == 0 then + reward[k] = 1 + end + end + else + local itemId = tonum(pms.pm1) + local count = tonum(pms.pm2) + reward[itemId] = count end - for k , v in pairs(csvdb["adv_artifactCsv"]) do - reward[k] = 1 - end + + local adv = role:getAdvData() adv:award(reward) return "成功" diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index be845d9..69096ba 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -273,18 +273,17 @@ function Adv:waitChooseArtifact() table.insert(pool, id) end end - - for i = 1, count do - if len(pool) <= 0 then - table.insert(chooses, {ItemId.AdvPoint, 48}) - else + if #pool == 0 then + self:award({[ItemId.AdvPoint] = 48}) + else + for i = 1, math.min(count, #pool) do local idx = math.randomInt(1, #pool) table.insert(chooses, pool[idx]) table.remove(pool, idx) end + self.waitArtifact = chooses + self:backChooseArtifact() end - self.waitArtifact = chooses - self:backChooseArtifact() end function Adv:isWaitChooseArtifact() @@ -293,9 +292,8 @@ end function Adv:chooseArtifact(index) if not self.waitArtifact or not self.waitArtifact[index] then return end - local itemId = type(self.waitArtifact[index]) == "table" and self.waitArtifact[index][1] or self.waitArtifact[index] - local count = type(self.waitArtifact[index]) == "table" and self.waitArtifact[index][2] or 1 - self:award({[itemId] = count}) + self:award({[self.waitArtifact[index]] = 1}) + self.waitArtifact = nil return true end @@ -308,6 +306,7 @@ function Adv:over(success, isAllPass) local score = self:getScore() local scoreInfo = self.score local reward + self.battle.player:triggerPassive(Passive.ADV_OVER, {score = score, level = self.level}) if success then reward = self.owner:award(self.owner:getProperty("advItems"):toNumMap()) self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) @@ -391,7 +390,7 @@ function Adv:award(gift, params) for itemId, count in pairs(tgift) do if count > 0 then local buffAdd = self.battle.player:getRewardChange(itemId) - count = math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1])) --附加 buff 的影响 + count = math.floor(math.max(0, (count + buffAdd[0]) * (1 + buffAdd[1]))) --附加 buff 的影响 self:scoreChange(AdvScoreType.Item, {itemId, count}) self:checkTask(Adv.TaskType.Item, count, itemId) self:checkAchievement(Adv.AchievType.GetItem, count, itemId) @@ -473,6 +472,7 @@ local function clickOut(self, room, block, params) if params.relay or (not self:isEndless() and (self.level >= levellimit or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1))) then --关卡结束 self:over(true, not self:isEndless() and self.level >= levellimit) else + self.battle.player:triggerPassive(Passive.DOWN_LAYER) self:initByChapter(self.chapterId, self.level + 1, true, true) self:backNext() --下一关 end @@ -616,6 +616,7 @@ end local function clickDrop(self, room, block, params) local reward = {} if not block.event.item then return end + self.battle.player:triggerPassive(Passive.CLICK_DROP) local reward = self:award({[block.event.item[1]] = block.event.item[2]}) -- local reward = self:award({[5801] = 1}) block:clear() @@ -763,7 +764,7 @@ function Adv:clickBlock(roomId, blockId, params) end end if canOpen and not hadMonster then --开放 - room:openBlock(block) + self:getCurMap():openBlock(roomId, blockId, true) status = true end else @@ -1022,6 +1023,7 @@ function Adv:enemyDead(enemy, escape) etype = AdvEventType.Click, id = clickId }) + self.battle.player:triggerPassive(Passive.BATTLE_WIN) else local item = block.event.item if not item then @@ -1036,11 +1038,13 @@ function Adv:enemyDead(enemy, escape) end if item[1] == 0 then block:clear() + self.battle.player:triggerPassive(Passive.BATTLE_WIN) else block:updateEvent({ etype = AdvEventType.Drop, item = item }) + self.battle.player:triggerPassive(Passive.BATTLE_WIN, {count = item[2]}) end end self:checkTask(Adv.TaskType.Kill, 1, enemyId) diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 691d44b..8a82c35 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -196,6 +196,8 @@ function Battle:afterRound() end end + self.player:triggerPassive(Passive.AFTER_ROUND) + if self.player.isDead then self.adv:over(false) end @@ -212,6 +214,9 @@ function Battle:battleBegin(roomId, blockId, params) self.player:effectBattleBuff() self.adv.owner:checkTaskEnter("AdvBattleWin", {id = self.adv.chapterId}) + if params.bySkill then + self.player:triggerPassive(Passive.SKILL_KILL) + end end if player.hp > self.player.hp then self.player:recover(player.hp - self.player.hp, player) diff --git a/src/adv/AdvBlock.lua b/src/adv/AdvBlock.lua index 466d61d..b27ba3d 100644 --- a/src/adv/AdvBlock.lua +++ b/src/adv/AdvBlock.lua @@ -54,6 +54,11 @@ function Block:randomEvent() enemy = adv.battle:addEnemy(room, self, map.mapIdx) end enemy:triggerPassive(Passive.BORN_ONCE) + + adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) + for _, monster in pairs(adv.battle.player:getTeam(2)) do + adv.battle.player:triggerPassive(Passive.OPEN_MONSTER, {trigger = enemy}) + end end randomFunc[AdvEventType.BOSS] = randomFunc[AdvEventType.Monster] --掉落 @@ -107,6 +112,7 @@ function Block:randomEvent() self.room.map.adv:mapItemChange(effect[2]) end end + adv.battle.player:triggerPassive(Passive.CLICK_TRAP) adv:checkAchievement(adv.AchievType.Trap, 1, self.event.id) adv:backTrap() self:clear() @@ -130,6 +136,7 @@ function Block:open() self:randomEvent() adv.owner:checkTaskEnter("AdvOpenBlock") self.isOpen = true + return true end return Block \ No newline at end of file diff --git a/src/adv/AdvBuff.lua b/src/adv/AdvBuff.lua index db758be..1d5e6ad 100644 --- a/src/adv/AdvBuff.lua +++ b/src/adv/AdvBuff.lua @@ -65,7 +65,7 @@ local function commonAttCond(_Buff, attrName) self._changeV = self._changeV - self._changeV / (self.layer + 1) self:_reSetAttr() end - + _Buff._hpChange = function(self) local oldHpMax = self.owner.hpMax self.owner:reSetHpMax() @@ -268,7 +268,7 @@ local BuffFactory = { [Buff.OPEN_BLOCK] = function(_Buff) _Buff._afterRound = function(self) local roomNum = self:effect() - self.owner.battle.adv:openBlockRand(roomNum) + self.owner.battle.adv:getCurMap():openBlockRand(roomNum, not self.owner.monsterId) end _Buff._effectValue = function(self) -- 数量 @@ -345,7 +345,7 @@ local BuffFactory = { _Buff._init = function(self) -- 先给自己的buff 搞一下子 for _, buff in ipairs(self.owner.buffs) do - if not buff.isDel and buff.classify == self.buffData.effectValue1 then + if not buff.isDel and (buff.buffData.classify:find(" " .. self.buffData.effectValue1) or buff.buffData.classify:find(self.buffData.effectValue1 .. " ")) then buff:effectChange() end end @@ -388,6 +388,7 @@ function Buff:ctor(owner, id) self.round = 0 --剩余的回合 self.count = -1 -- 可生效的次数 -1 无次数限制 self.layer = 1 -- 当前buff 层数 + self.releaseId = nil -- 释放的怪物Id if BuffFactory[self.buffData.type] then BuffFactory[self.buffData.type](self) @@ -408,6 +409,7 @@ end function Buff:initNew(release, data) self.release = release or self.owner + self.releaseId = self.release.monsterId or 0 self.round = self.buffData.round self.roundSpace = 0 --生效间隔 self.layer = 1 @@ -427,6 +429,7 @@ function Buff:initByDB(data) self.release = self.owner.battle:getEnemyById(data.rele) end end + self.releaseId = data.releId self.round = data.round self.roundSpace = data.roundSp if data.count then @@ -462,7 +465,7 @@ function Buff:afterRound() self:decRound() end --- 只使用owner 和 buffData +-- 只使用owner 和 buffData 和 releaseId function Buff:checkKeep() if self.buffData.keepTerm == "" then return true end --[[ @@ -473,10 +476,10 @@ function Buff:checkKeep() --]] local checkFunc = {} - checkFunc[1] = function(_, enemyId) + checkFunc[1] = function(_) local enemys = self.owner.battle.player:getTeam(2) for _, enemy in pairs(enemys) do - if enemy.monsterId == enemyId then + if enemy.monsterId == self.releaseId then return true end end @@ -621,7 +624,7 @@ function Buff:effectChange() end function Buff:doEffectChange(effect) - if not self.buffData.classify then return effect end + if self.buffData.classify == "" then return effect end local change = self.owner:getBuffEffectChange(self.buffData.classify) return effect * (1 + change) end @@ -643,6 +646,9 @@ function Buff:getDB() db.count = self.count end db.layer = self.layer + if self.buffData.keepTerm:toArray(true, "=")[1] == 1 then + db.releId = self.releaseId + end return db end diff --git a/src/adv/AdvMap.lua b/src/adv/AdvMap.lua index beb1122..c898532 100644 --- a/src/adv/AdvMap.lua +++ b/src/adv/AdvMap.lua @@ -100,7 +100,7 @@ function Map:addNewMonsterRand(monsterId, where) end -- 随机翻开 num 个 以开放的房间的 地块 -function Map:openBlockRand(num) +function Map:openBlockRand(num, isPlayer) local pool = {} for _, room in pairs(self.rooms) do if room.isShow and not room.isPath then @@ -113,12 +113,12 @@ function Map:openBlockRand(num) end if #pool <= num then for _, temp in ipairs(pool) do - self:openBlock(temp[1], temp[2]) + self:openBlock(temp[1], temp[2], isPlayer) end else for i = 1, num do local idx = math.randomInt(1, #pool) - self:openBlock(pool[idx][1], pool[idx][2]) + self:openBlock(pool[idx][1], pool[idx][2], isPlayer) table.remove(pool, idx) end end @@ -126,15 +126,40 @@ end -- 打开一个地块 -function Map:openBlock(roomId, blockId) +function Map:openBlock(roomId, blockId, isPlayer) local room = self.rooms[roomId] if not room then return end local block = room.blocks[blockId] if not block then return end - room:openBlock(block, self) + room:openBlock(block) + if isPlayer then + self.adv.player:triggerPassive(Passive.OPEN_BLOCK) + end self:backBlockChange(roomId, blockId) end +function Map:openBlockBySize(roomId, blockId, size, isPlayer) + local blocks = self:getBlocksBySize(roomId, blockId, size) + for _, block in pairs(blocks) do + self:openBlock(block.room.roomId, block.blockId, isPlayer) + end +end + +function Map:openBlocksByRoom(roomId, isPlayer) + local room = self.rooms[roomId] + if not room then return end + + for blockId, block in pairs(room.blocks) do + self:openBlock(roomId, blockId, isPlayer) + end +end + +function Map:openAllBlocks(isPlayer) + for roomId, room in pairs(self.rooms) do + self:openBlocksByRoom(room.roomId, isPlayer) + end +end + --获取,某个位置上的 room 和 block function Map:getRBByPos(c, r) diff --git a/src/adv/AdvPassive.lua b/src/adv/AdvPassive.lua index 6481543..9e59977 100644 --- a/src/adv/AdvPassive.lua +++ b/src/adv/AdvPassive.lua @@ -89,10 +89,10 @@ Passive.HP_LOW_SELF = 5 --自身生命值N%时,每回合触发 Passive.HP_UP_TEAM = 8 --敌人生命值>N%时,每回合触发 -Passive.SELF_ATK = 9 --自身攻击N次后,触发1次 -Passive.SELF_HURT = 10 --自身受击N次后,触发1次 -Passive.TEAM_ATK = 11 --队友攻击N次后,触发1次 -Passive.TEAM_HURT = 12 --队友受击N次后,触发1次 +Passive.SELF_ATK = 9 --自身攻击N次后,触发1次 < discard > +Passive.SELF_HURT = 10 --自身受击buff后,触发1次 +Passive.TEAM_ATK = 11 --队友攻击N次后,触发1次 < discard > +Passive.TEAM_HURT = 12 --队友受击buff后,触发1次 Passive.MONSTER_COUNT_UP = 13 --场上存在N个以上怪物,每回合触发 Passive.MONSTER_COUNT_LOW = 14 --场上存在N个以下怪物,每回合触发 Passive.SELF_DEAD = 15 --自身死亡后,触发1次 @@ -100,6 +100,18 @@ Passive.TEAM_DEAD = 16 --队友死亡后,触发1次 Passive.TARGET_SKILL = 17 --目标每使用N次技能,触发1次 Passive.TEAM_SKILL = 18 --队友每使用N次技能,触发1次 +Passive.HAVE_MONSTER = 20 --场上拥有指定怪时 回合触发 +Passive.SKILL_KILL = 21 --技能击杀怪物时 触发1次 +Passive.CLICK_TRAP = 22 --触发陷阱时 触发1次 +Passive.DOWN_LAYER = 23 --下层时 触发1次 +Passive.ADV_OVER = 24 --结算时 触发1次 +Passive.BATTLE_WIN = 25 --战斗胜利x次时 +Passive.CLICK_DROP = 26 --拾取drop x次时 +Passive.AFTER_ROUND = 27 --经过 x回合时 +Passive.GET_BUFF = 28 --获得指定buff +Passive.OPEN_BLOCK = 29 --翻开格子 +Passive.OPEN_MONSTER = 30 --翻开怪物 + -- 不同的开启条件 local PassiveCondFactory = {} @@ -122,21 +134,63 @@ end PassiveCondFactory[Passive.HURT_PERCENT_TEAM] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 PassiveCondFactory[Passive.SELF_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 -PassiveCondFactory[Passive.SELF_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 PassiveCondFactory[Passive.TEAM_ATK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 -PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 PassiveCondFactory[Passive.TARGET_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 PassiveCondFactory[Passive.TEAM_SKILL] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 +PassiveCondFactory[Passive.BATTLE_WIN] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 +PassiveCondFactory[Passive.CLICK_DROP] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 +PassiveCondFactory[Passive.AFTER_ROUND] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 +PassiveCondFactory[Passive.OPEN_BLOCK] = PassiveCondFactory[Passive.HURT_PERCENT_SELF] --逻辑相同 + +PassiveCondFactory[Passive.SELF_HURT] = function(_Passive) + _Passive._trigger = function(self, params) + local buffId = params.buffId + local data = csvdb["adv_map_buffCsv"][buffId] + if data.classify:find(" " .. self.passiveData.value) or data.classify:find(self.passiveData.value .. " ") then + return true + end + end +end +PassiveCondFactory[Passive.TEAM_HURT] = PassiveCondFactory[Passive.SELF_HURT] --逻辑相同 + PassiveCondFactory[Passive.ROOM_SHOW] = function(_Passive) _Passive._trigger = function(self, params) local roomId = params.roomId - if self.roomId == roomId then + if self.owner.roomId == roomId then return true end end end +PassiveCondFactory[Passive.GET_BUFF] = function(_Passive) + _Passive._trigger = function(self, params) + if self.passiveData.value == params.buffId then + return true + end + end +end + + +PassiveCondFactory[Passive.BORN_ONCE] = function(_Passive) + _Passive._afterRound = function(self) + if not self.owner.lock then + self:trigger(Passive.BORN_ONCE) + end + end +end + +PassiveCondFactory[Passive.HAVE_MONSTER] = function(_Passive) + _Passive._afterRound = function(self) + for _, player in ipairs(self.owner.battle.player:getTeam(2)) do + if player.monsterId == self.passiveData.value then + self:trigger(Passive.HAVE_MONSTER) + break + end + end + end +end + PassiveCondFactory[Passive.HP_LOW_SELF] = function(_Passive) _Passive._afterRound = function(self) if self.owner.hp / self.owner.hpMax * 100 < self.passiveData.value then @@ -242,12 +296,16 @@ function Passive:canEffect(effType, effValue) return true end -function Passive:effect(trigger) +function Passive:effect(triggerPms) for _, effect in pairs(self.effects) do local effType = effect[1] local effValue = effect[2] + local otherPms = {} + for i = 3, #effect do + table.insert(otherPms, effect[i]) + end if self:canEffect(effType, effValue) then - self["effect" .. effType](self, effValue, trigger) + self["effect" .. effType](self, effValue, triggerPms, table.unpack(otherPms)) end end @@ -296,7 +354,7 @@ function Passive:trigger(condType, params) --触发检查 if self.round > 0 and self.turn > 0 then -- cd return end - self:effect(params.trigger) + self:effect(params) end function Passive:filter(params) @@ -330,25 +388,39 @@ function Passive:effect1(value) self.owner:addBuff(value, self.owner) end --2=触发目标获得buff -function Passive:effect2(value, trigger) - if trigger then - trigger:addBuff(value, self.owner) +function Passive:effect2(value, triggerPms) + if triggerPms.trigger then + triggerPms.trigger:addBuff(value, self.owner) end end --3=翻开自己所在格子 -function Passive:effect3() - self.owner.battle.adv:openBlock(self.owner.roomId, self.owner.blockId) +function Passive:effect3(value) + if value == 0 then + self.owner.battle.adv:getCurMap():openBlock(self.owner.roomId, self.owner.blockId) + elseif value > 0 then + self.owner.battle.adv:getCurMap():openBlocksBySize(self.owner.roomId, self.owner.blockId, value) + elseif value == -1 then -- 当前房间 + self.owner.battle.adv:getCurMap():openBlocksByRoom(self.owner.roomId) + elseif value == -2 then -- 当前层 + self.owner.battle.adv:getCurMap():openAllBlocks(not self.owner.monsterId) + end end --4=逃跑 function Passive:effect4() self.owner.isDead = 1 --跑了 - -- self.owner.battle.adv:enemyDead(self.owner, true) end ---5=给随机一个敌方增加一个buff -function Passive:effect5(value) + +--5=召唤怪物 +function Passive:effect5(monsterId) + self.owner.battle.adv:getCurMap():addNewMonsterRand(monsterId) +end + +--6=给所有敌方增加一个buff +function Passive:effect6(value) local monsters = self.owner.battle.player:getTeam(2) - local randomId = math.random( 1, #monsters ) - monsters[randomId]:addBuff(value, self.owner) + for _, enemy in ipairs(monsters) do + enemy:addBuff(value, self.owner) + end end --6=给自己加一個被動技能 function Passive:effect6(value) @@ -362,4 +434,31 @@ function Passive:effect7(value) end end +--8=获得drop,直接进入背包 +function Passive:effect8(dropId) + local item = csvdb["event_dropCsv"][dropId]["range"]:randWeight(true) + self.owner.battle.adv:award({[item[1]] = item[2]}) +end + +--9=直接获得item(可在结算触发时使用) +function Passive:effect9(itemId, triggerPms, ratio, max) + local cond = nil + if self.passiveData.value == 0 then + cond = triggerPms.score + elseif self.passiveData.value == 1 then + cond = triggerPms.level + else + return + end + if not cond then return end + self.owner.battle.adv:award({[itemId] = math.floor(math.max(0, math.min(max, cond / ratio)))}) +end + +--10=战斗额外掉落次数 +function Passive:effect10(itemId, triggerPms, count) + if triggerPms.count then + self.owner.battle.adv:award({[triggerPms.itemId] = triggerPms.count * count}) + end +end + return Passive \ No newline at end of file diff --git a/src/adv/AdvPlayer.lua b/src/adv/AdvPlayer.lua index 88b300b..7f50f24 100644 --- a/src/adv/AdvPlayer.lua +++ b/src/adv/AdvPlayer.lua @@ -140,9 +140,11 @@ function BaseObject:addBuff(buffId, releaser) if not Buff.checkKeep({ owner = self, buffData = buffData, + releaseId = releaser.monsterId }) then return end table.insert(self.buffs, Buff.create(self, releaser, {id = buffId})) end + self:triggerPassive(Passive.GET_BUFF, {buffId = buffId}) self.battle.adv:backBuff(self.id, buffId) end @@ -168,7 +170,6 @@ end function BaseObject:delPassiveById(pId) for idx, passive in ipairs(self.passives) do if passive.id == pId then - passive:endPassive() table.remove(self.passives, idx) return passive end @@ -239,11 +240,16 @@ end -- buff 增益 检疫 function BaseObject:getBuffEffectChange(classify) + local classifys = classify:toArray(true, " ") + local had = {} + for _, one in pairs(classifys) do + had[one] = 1 + end local effect = 0 for _, buff in ipairs(self.buffs) do if not buff.isDel and buff:getType() == Buff_EFFECT_CHANGE then local cType, value = buff:effect() - if cType and cType == classify then + if cType and had[cType] then effect = effect + value end end @@ -298,7 +304,7 @@ function BaseObject:reSetHpMax() end end local effect = self:getAttrBuffChange("hp") - self.hpMax = (self.hpMax + effect[0]) * (1 + effect[1])) + self.hpMax = (self.hpMax + effect[0]) * (1 + effect[1]) self.hpMax = math.ceil(math.max(1, self.hpMax)) self.hp = math.min(self.hpMax, self.hp) end @@ -321,22 +327,26 @@ end function BaseObject:hurt(value, releaser, params) params = params or {} if params.hurtType and params.hurtType == 1 then - releaser:triggerPassive(Passive.SELF_ATK) - for _, team in ipairs(releaser:getTeam(1, true)) do - team:triggerPassive(Passive.TEAM_ATK) - end - if self:hadBuff(Buff.IMMNUE_ATK) then return end --无视普通攻击 + -- releaser:triggerPassive(Passive.SELF_ATK) + -- for _, team in ipairs(releaser:getTeam(1, true)) do + -- team:triggerPassive(Passive.TEAM_ATK) + -- end + -- if self:hadBuff(Buff.IMMNUE_ATK) then return end --无视普通攻击 - local hit = releaser.hit - self.miss --命中率 - if hit < math.randomInt(1, 100) then --miss - self.battle.adv:backMiss(self.id) - return - end - self:triggerPassive(Passive.SELF_HURT, {trigger = releaser}) + -- local hit = releaser.hit - self.miss --命中率 + -- if hit < math.randomInt(1, 100) then --miss + -- self.battle.adv:backMiss(self.id) + -- return + -- end + end + + if params.hurtType and (params.hurtType == 2 or params.hurtType == 6) then + self:triggerPassive(Passive.SELF_HURT, {trigger = releaser, buffId = params.buffId}) for _, team in ipairs(self:getTeam(1, true)) do - team:triggerPassive(Passive.TEAM_HURT, {trigger = releaser}) + team:triggerPassive(Passive.TEAM_HURT, {trigger = releaser, buffId = params.buffId}) end end + if params.hurtType ~= 5 and params.hurtType ~= 6 then if not params.hurtType or params.hurtType ~= 4 then value = self:getInjuredValue(value) --减伤计算 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 20c3497..71bb7ed 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -701,9 +701,9 @@ function RolePlugin.bind(Role) if curData.unlock == 1 then -- 获得解锁 return self:getProperty("advAFOpen")[id] and true or false - elseif temp[1].unlock == 2 then -- 特殊神器 不可解锁 + elseif curData.unlock == 2 then -- 特殊神器 不可解锁 return isCheckLevel - elseif temp[1].unlock == 3 then + elseif curData.unlock == 3 then return isEndless end return true -- libgit2 0.21.2