diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index baddc85..026fc23 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -43,6 +43,8 @@ function Battle:initPlayer() end end end + local activeRelation = self.adv.owner:getHeroActiveRelation() + -- todo player.hp = hp player.atk = tonumber(string.format("%0.0f", player.hp * 0.1)) --todo 系数是临时的 player.def = 0 diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 8e6995a..7b45181 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -517,6 +517,33 @@ function RolePlugin.bind(Role) -- self:log("gmAction",{desc = "heartWarning", count = heartWarning}) -- end end + + function Role:getHeroActiveRelation(heros) + local relations = {} + for _, id in pairs(heros or {}) do + local hero = self.heros[id] + if hero then + local job = csvdb["unitCsv"][hero:getProperty("type")].job + relations[job] = (relations[job] or 0) + 1 + end + end + if not next(relations) then return {} end + local result = {} + for _, data in ipairs(csvdb["unit_relationCsv"]) do + local ok = true + for typ, count in pairs(data.relation:toNumMap()) do + if (relations[typ] or 0) < count then + ok = false + end + end + if ok then + for attr, value in pairs(data.effect:toNumMap()) do + result[AttsEnumEx[attr]] = (result[AttsEnumEx[attr]] or 0) + value + end + end + end + return result + end end return RolePlugin \ No newline at end of file -- libgit2 0.21.2