Commit e50d0caef26bc42b9c45b6be88fcf1f1763197cc
1 parent
03c619fb
计算电波塔层数的加成效果
Showing
3 changed files
with
49 additions
and
12 deletions
Show diff stats
src/actions/GmAction.lua
... | ... | @@ -483,13 +483,25 @@ function _M.advit(role, pms) |
483 | 483 | end |
484 | 484 | |
485 | 485 | |
486 | -table.insert(helpDes, {"爬塔到指定层", "tower", "层数"}) | |
486 | +table.insert(helpDes, {"爬塔到指定层", "tower", "塔id", "层数"}) | |
487 | 487 | function _M.tower(role, pms) |
488 | - local level = tonum(pms.pm1, 1) | |
489 | - if not csvdb["tower_battleCsv"][level] then return "不存在" end | |
490 | - role:updateProperty({field = "towerInfo", value = {c = globalCsv.tower_count_limit, l = level}}) | |
491 | - | |
492 | - role:mylog("gm_action", {desc = "tower", int1 = level, key1 = pms.sender}) | |
488 | + local tType = tonum(pms.pm1, 1) | |
489 | + local level = tonum(pms.pm2, 1) | |
490 | + local layer = (tType - 1) * 10000 + level | |
491 | + if not csvdb["tower_battleCsv"][tType][level] then return "不存在" end | |
492 | + local values = role:getProperty("towerInfo") | |
493 | + if tType == 1 then | |
494 | + values.l = level | |
495 | + elseif tType == 2 then | |
496 | + values.l1 = level | |
497 | + elseif tType == 3 then | |
498 | + values.l2 = level | |
499 | + elseif tType == 4 then | |
500 | + values.l3 = level | |
501 | + end | |
502 | + role:updateProperty({field = "towerInfo", value = values}) | |
503 | + | |
504 | + role:mylog("gm_action", {desc = "tower", int1 = tType, int2 = layer, key1 = pms.sender}) | |
493 | 505 | |
494 | 506 | return "成功" |
495 | 507 | end | ... | ... |
src/actions/TowerAction.lua
... | ... | @@ -185,7 +185,7 @@ function _M.activeTowerBonusRpc(agent, data) |
185 | 185 | local tType = msg.tower |
186 | 186 | local id = msg.id |
187 | 187 | |
188 | - local bnousCsv = csvdb["tower_bnousCsv"] | |
188 | + local bnousCsv = csvdb["tower_battle_additionCsv"] | |
189 | 189 | |
190 | 190 | if not tType or not id or not bnousCsv[tType] then return 0 end |
191 | 191 | local bnousData = bnousCsv[tType][id] | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -2168,15 +2168,40 @@ function RolePlugin.bind(Role) |
2168 | 2168 | local towerInfo = role:getProperty("towerInfo") |
2169 | 2169 | local towerLevel = {towerInfo.l or 1, towerInfo.l1 or 10001, towerInfo.l2 or 20001, towerInfo.l3 or 30001} |
2170 | 2170 | local towerBnous = self:getProperty("towerBnous") |
2171 | - local bnousCsv = csvdb["tower_bnousCsv"] | |
2171 | + local bnousCsv = csvdb["tower_battle_additionCsv"] | |
2172 | 2172 | self.towerBnousActive = {} |
2173 | - for towerIdx, Set in ipairs(towerLevel) do | |
2174 | - for id, data in pairs(Set) do | |
2175 | - if (towerLevel[towerIdx] - 1) >= data.level then | |
2176 | - self.towerBnousActive[data.type] = (self.towerBnousActive[data.type] or 0) + data.value | |
2173 | + | |
2174 | + for towerIdx, Set in pairs(towerBnous) do | |
2175 | + for id, _ in pairs(Set) do | |
2176 | + local data = bnousCsv[towerIdx][id] | |
2177 | + local effects = data.effect:toTableArray(true) | |
2178 | + for _, effect in pairs(effects) do | |
2179 | + local pm1, pm2 = effect[1], effect[2] | |
2180 | + if not self.towerBnousActive[pm1] then | |
2181 | + self.towerBnousActive[pm1] = {} | |
2182 | + end | |
2183 | + if pm1 == SystemBnousType.TowerBuff then | |
2184 | + if not self.towerBnousActive[pm1][pm2] then | |
2185 | + self.towerBnousActive[pm1][pm2] = {} | |
2186 | + end | |
2187 | + table.insert(self.towerBnousActive[pm1][pm2],effect[3]) | |
2188 | + elseif pm1 == SystemBnousType.Adv then | |
2189 | + if not self.towerBnousActive[pm1][effect[4]] then | |
2190 | + self.towerBnousActive[pm1][effect[4]] = {} | |
2191 | + end | |
2192 | + self.towerBnousActive[pm1][effect[4]][pm2] = (self.towerBnousActive[pm1][effect[4]][pm2] or 0) + effect[3] | |
2193 | + elseif pm1 == SystemBnousType.HangTime then | |
2194 | + if type(self.towerBnousActive[pm1]) == "table" then | |
2195 | + self.towerBnousActive[pm1] = 0 | |
2196 | + end | |
2197 | + self.towerBnousActive[pm1] = self.towerBnousActive[pm1] + pm2 | |
2198 | + else | |
2199 | + self.towerBnousActive[pm1][pm2] = (self.towerBnousActive[pm1][pm2] or 0) + effect[3] | |
2200 | + end | |
2177 | 2201 | end |
2178 | 2202 | end |
2179 | 2203 | end |
2204 | + | |
2180 | 2205 | return self.towerBnousActive |
2181 | 2206 | end |
2182 | 2207 | ... | ... |