Commit 23a38f47c90a43010fa4bf6c3a10c4cadeb28d5f
1 parent
b57f0bae
new passives effect
Showing
3 changed files
with
23 additions
and
3 deletions
 
Show diff stats
src/adv/Adv.lua
| ... | ... | @@ -61,6 +61,7 @@ local function getEventLib(chapterId, level, needEventType) -- needEventType éœ | 
| 61 | 61 | } | 
| 62 | 62 | local eventLib = {} | 
| 63 | 63 | for lib, eventType in pairs(libsToType) do | 
| 64 | + -- init eventLib | |
| 64 | 65 | if type(eventType) == "table" then | 
| 65 | 66 | for _, temp in ipairs(eventType) do | 
| 66 | 67 | eventLib[temp] = {} | 
| ... | ... | @@ -68,6 +69,7 @@ local function getEventLib(chapterId, level, needEventType) -- needEventType éœ | 
| 68 | 69 | else | 
| 69 | 70 | eventLib[eventType] = {} | 
| 70 | 71 | end | 
| 72 | + -- needEventType åªèŽ·å–这个事件类型 | |
| 71 | 73 | if not needEventType or eventLib[needEventType] then | 
| 72 | 74 | for id, data in pairs(csvdb[lib]) do | 
| 73 | 75 | if data.levelchapter == chapter then | 
| ... | ... | @@ -200,7 +202,7 @@ local function randomAdvMap(role, chapterId, level, notNotify) | 
| 200 | 202 | end | 
| 201 | 203 | end | 
| 202 | 204 | end | 
| 203 | - stagePool = {["global"] = {}} | |
| 205 | + local stagePool = {["global"] = {}} | |
| 204 | 206 | for roomId, roomName in pairs(mapData["rooms"]) do | 
| 205 | 207 | stagePool[roomId] = {} | 
| 206 | 208 | advInfo.rooms[roomId] = {event = {}, open = {}} -- 事件, open open == 1 房间内地å—全部开放 | ... | ... | 
src/adv/AdvPassive.lua
| ... | ... | @@ -209,7 +209,7 @@ function Passive:effect2(trigger) | 
| 209 | 209 | trigger:addBuff(self.passiveData.effectValue) | 
| 210 | 210 | end | 
| 211 | 211 | end | 
| 212 | ---3=翻开自己所在格子, | |
| 212 | +--3=翻开自己所在格子 | |
| 213 | 213 | function Passive:effect3() | 
| 214 | 214 | self.owner.battle.adv:openBlock(self.owner.roomId, self.owner.blockId) | 
| 215 | 215 | end | 
| ... | ... | @@ -218,6 +218,15 @@ function Passive:effect4() | 
| 218 | 218 | self.owner.isDead = true --跑了 | 
| 219 | 219 | self.owner.battle.adv:enemyDead(self.owner.roomId,self.owner.blockId, true) | 
| 220 | 220 | end | 
| 221 | - | |
| 221 | +--5=给随机一个敌方增加一个buff | |
| 222 | +function Passive:effect5() | |
| 223 | + local monsters = self.owner.battle.player:getTeam(2) | |
| 224 | + local randomId = math.random( 1, #monsters ) | |
| 225 | + monsters[randomId]:addBuff(self.passiveData.effectValue) | |
| 226 | +end | |
| 227 | +--6=给自己加一個被動技能 | |
| 228 | +function Passive:effect6() | |
| 229 | + self.owner:addPassive({id = self.passiveData.effectValue}) | |
| 230 | +end | |
| 222 | 231 | |
| 223 | 232 | return Passive | 
| 224 | 233 | \ No newline at end of file | ... | ... | 
src/adv/AdvPlayer.lua
| ... | ... | @@ -69,6 +69,15 @@ function BaseObject:clear() | 
| 69 | 69 | self.passives = {} | 
| 70 | 70 | end | 
| 71 | 71 | |
| 72 | +function BaseObject:addPassive(params) | |
| 73 | + local skillId = params.id | |
| 74 | + local skillData = csvdb["adv_skill_passiveCsv"][skillId] | |
| 75 | + if not skillData then return end | |
| 76 | + local level = params.level or 1 | |
| 77 | + if not skillData[level] then return end | |
| 78 | + table.insert(self.passives, Passive.new(self, { id = skillId, level = level })) | |
| 79 | +end | |
| 80 | + | |
| 72 | 81 | function BaseObject:addBuff(buffId, releaser) | 
| 73 | 82 | local buffData = csvdb["adv_buffCsv"][buffId] | 
| 74 | 83 | if not buffData then return end | ... | ... |