Commit 4f0a5faeacb8e70e036011cc850f53debe3d9aa5
1 parent
faabdf3c
营养剂
Showing
9 changed files
with
324 additions
and
14 deletions
Show diff stats
src/GlobalVar.lua
| ... | ... | @@ -78,6 +78,7 @@ ItemId = { |
| 78 | 78 | EquipUp = 11, -- 装备升级材料 |
| 79 | 79 | DinerCoin = 12, --后勤物资 |
| 80 | 80 | LoveUp = 14, --好感度提升道具 |
| 81 | + OldCoin = 15, --古代金币 | |
| 81 | 82 | DinerSpTask = 20, -- 餐厅任务采购券 |
| 82 | 83 | LoveBreak = 21, --好感度突破道具 |
| 83 | 84 | PvpKey = 22, -- pvp钥匙 |
| ... | ... | @@ -130,6 +131,7 @@ AdvBackEventType = { |
| 130 | 131 | BattleBegin = 16, -- 战斗开始 |
| 131 | 132 | Trap = 17, --陷阱 |
| 132 | 133 | Layer = 18, --切换层 |
| 134 | + MapShow = 19, -- 展示地图 | |
| 133 | 135 | } |
| 134 | 136 | |
| 135 | 137 | AdvScoreType = { | ... | ... |
src/actions/AdvAction.lua
| ... | ... | @@ -281,13 +281,32 @@ end |
| 281 | 281 | function _M.usePotionRpc(agent, data) |
| 282 | 282 | local role = agent.role |
| 283 | 283 | local msg = MsgPack.unpack(data) |
| 284 | - local dishLevel = role.dinerData:getProperty("dishTree"):getv(msg.potionId, 0) | |
| 285 | - if dishLevel == 0 then | |
| 286 | - return | |
| 287 | - end | |
| 284 | + local potionId = msg.potionId -- 营养剂Id | |
| 285 | + local target = msg.target -- {roomId = 1, blockId = 1} 选择的目标 | |
| 286 | + local potionLv = role.dinerData:getProperty("dishTree"):getv(potionId, 0) | |
| 287 | + if potionLv == 0 then return 1 end | |
| 288 | + | |
| 289 | + local potionSet = csvdb["adv_potionCsv"][potionId] | |
| 290 | + if not potionSet then return 2 end | |
| 291 | + | |
| 292 | + local potionData = potionSet[potionLv] | |
| 293 | + if not potionData then return 3 end | |
| 294 | + | |
| 295 | + local potionBag = role:getProperty("potionBag") | |
| 296 | + local own = potionBag[potionId] or 0 | |
| 297 | + if own <= 0 then return 4 end | |
| 298 | + | |
| 288 | 299 | local adv = role:getAdvData() |
| 289 | - local status = adv:usePotion(msg.potionId, dishLevel, msg.target) -- target {roomId = 1, blockId = 1} 选择的目标 | |
| 300 | + | |
| 301 | + local status = adv:doActive(potionData.effect, target) -- target | |
| 290 | 302 | if not status then return end |
| 303 | + | |
| 304 | + potionBag[potionId] = own - 1 | |
| 305 | + role:updateProperty({field = "potionBag", value = potionBag}) | |
| 306 | + adv:afterRound() | |
| 307 | + adv:saveDB() | |
| 308 | + role:checkTaskEnter("AdvUsePotion") | |
| 309 | + | |
| 291 | 310 | SendPacket(actionCodes.Adv_usePotionRpc, MsgPack.pack({events = adv:popBackEvents()})) |
| 292 | 311 | return true |
| 293 | 312 | end | ... | ... |
src/adv/Adv.lua
| ... | ... | @@ -710,7 +710,10 @@ function Adv:clickBlock(roomId, blockId, params) |
| 710 | 710 | local _room, _block = one[1], one[2] |
| 711 | 711 | if _block.isOpen then canOpen = true end |
| 712 | 712 | if _block.isOpen and _block:isMonster() then |
| 713 | - hadMonster = true | |
| 713 | + local enemy = self.battle:getEnemy(_room.roomId, _block.blockId) | |
| 714 | + if not enemy:hadBuff(Buff.DONT_DEFEND) then | |
| 715 | + hadMonster = true | |
| 716 | + end | |
| 714 | 717 | end |
| 715 | 718 | end |
| 716 | 719 | if canOpen and not hadMonster then --开放 |
| ... | ... | @@ -773,10 +776,172 @@ function Adv:useItem(itemId, count, target) |
| 773 | 776 | return true |
| 774 | 777 | end |
| 775 | 778 | |
| 779 | +function Adv:doActive(activeId, target) | |
| 780 | + local activeData = csvdb["adv_activeCsv"][activeId] | |
| 781 | + if not activeData then return end | |
| 782 | + | |
| 783 | + local targers = {} | |
| 784 | + | |
| 785 | + -- 筛选对象 | |
| 786 | + if activeData.usetype == 1 then -- 自己 | |
| 787 | + elseif activeData.usetype == 2 then -- 敌人 | |
| 788 | + if not target or not target.roomId or not target.blockId then return end | |
| 789 | + local block = self:getBlock(target.roomId, target.blockId) | |
| 790 | + if block:isBoss() then return end | |
| 791 | + local enemy = self.battle:getEnemy(target.roomId, target.blockId) | |
| 792 | + if not enemy then return end | |
| 793 | + local blocks = self:getCurMap():getBlocksBySize(target.roomId, target.blockId, activeData.scope) | |
| 794 | + for _, block in pairs(blocks) do | |
| 795 | + if block:isMonster() and not block:isBoss() then | |
| 796 | + local e = self.battle:getEnemy(block.room.roomId, block.blockId) | |
| 797 | + if e then | |
| 798 | + table.insert(targers, e) | |
| 799 | + end | |
| 800 | + end | |
| 801 | + end | |
| 802 | + elseif activeData.usetype == 3 then -- 地板 | |
| 803 | + if not target or not target.roomId or not target.blockId then return end | |
| 804 | + local block = self:getBlock(target.roomId, target.blockId) | |
| 805 | + if block:isBoss() then return end | |
| 806 | + local blocks = self:getCurMap():getBlocksBySize(target.roomId, target.blockId, activeData.scope) | |
| 807 | + for _, block in pairs(blocks) do | |
| 808 | + if not block:isBoss() then | |
| 809 | + table.insert(targers, block) | |
| 810 | + end | |
| 811 | + end | |
| 812 | + elseif activeData.usetype == 4 then -- 自己或者没有目标 | |
| 813 | + elseif activeData.usetype == 5 then -- 空地板 | |
| 814 | + if not target or not target.roomId or not target.blockId then return end | |
| 815 | + local block = self:getBlock(target.roomId, target.blockId) | |
| 816 | + if not block.isOpen or block:getEventType() then return end | |
| 817 | + local blocks = self:getCurMap():getBlocksBySize(target.roomId, target.blockId, activeData.scope) | |
| 818 | + for _, block in pairs(blocks) do | |
| 819 | + if not block:isBoss() then | |
| 820 | + table.insert(targers, block) | |
| 821 | + end | |
| 822 | + end | |
| 823 | + end | |
| 824 | + | |
| 825 | + local doActiveEffect = {} | |
| 826 | + | |
| 827 | + -- 1=map_buff_id:为范围内所有目标附加mapbuff | |
| 828 | + doActiveEffect[1] = function(_, buffId) | |
| 829 | + if not next(targers) and (activeData.usetype == 1 or activeData.usetype == 4)then | |
| 830 | + table.insert(targers, self.battle.player) | |
| 831 | + end | |
| 832 | + | |
| 833 | + for _, target in ipairs(targers) do | |
| 834 | + target:addBuff(buffId, self.battle.player) | |
| 835 | + end | |
| 836 | + | |
| 837 | + return true | |
| 838 | + end | |
| 839 | + -- 2=trader_id:召唤商人 | |
| 840 | + doActiveEffect[2] = function(_, traderId) | |
| 841 | + for _, target in ipairs(targers) do | |
| 842 | + if target.isOpen and not target:getEventType() then | |
| 843 | + target:updateEvent({ | |
| 844 | + etype = AdvEventType.Trader, | |
| 845 | + id = traderId, | |
| 846 | + }) | |
| 847 | + target:randomEvent() | |
| 848 | + self:backBlockChange(target.room.roomId, target.blockId) | |
| 849 | + end | |
| 850 | + end | |
| 851 | + return true | |
| 852 | + end | |
| 853 | + | |
| 854 | + -- 3=monster_id:替换怪物,仅使用方式为2时生效 | |
| 855 | + doActiveEffect[3] = function(_, monsterId) | |
| 856 | + for _, target in ipairs(targers) do | |
| 857 | + if not target.lock and not target.isDead then | |
| 858 | + self.battle:removeEnemyById(target.id) | |
| 859 | + self:getCurMap():addNewMonsterRand(monsterId, {target.roomId, target.blockId}) | |
| 860 | + self:backBlockChange(target.roomId, target.blockId) | |
| 861 | + end | |
| 862 | + end | |
| 863 | + return true | |
| 864 | + end | |
| 865 | + -- 4:显示本层 | |
| 866 | + doActiveEffect[4] = function(_) | |
| 867 | + self:getCurMap():showMap() | |
| 868 | + self:backMapShow() | |
| 869 | + return true | |
| 870 | + end | |
| 871 | + -- 5:放逐目标 | |
| 872 | + doActiveEffect[5] = function(_) | |
| 873 | + for _, target in ipairs(targers) do | |
| 874 | + if not target.lock and not target.isDead then | |
| 875 | + self.battle:removeEnemyById(target.id) | |
| 876 | + local block = self:getBlock(target.roomId, target.blockId) | |
| 877 | + block:clear() | |
| 878 | + self:backBlockChange(target.roomId, target.blockId) | |
| 879 | + end | |
| 880 | + end | |
| 881 | + return true | |
| 882 | + end | |
| 883 | + -- 6=陷阱id:移除陷阱,不填写id则移除所有陷阱 | |
| 884 | + doActiveEffect[6] = function(_, trapId) | |
| 885 | + if not next(targers) and activeData.usetype == 4 then | |
| 886 | + -- 全屏 | |
| 887 | + for _, room in pairs(self:getCurMap().rooms) do | |
| 888 | + for _, block in pairs(room.blocks) do | |
| 889 | + if block:getEventType() == AdvEventType.Trap then | |
| 890 | + block:updateEvent(nil) | |
| 891 | + self:backBlockChange(block.room.roomId, block.blockId) | |
| 892 | + end | |
| 893 | + end | |
| 894 | + end | |
| 895 | + else | |
| 896 | + for _ , target in ipairs(targers) do | |
| 897 | + if target:getEventType() == AdvEventType.Trap then | |
| 898 | + target:updateEvent(nil) | |
| 899 | + self:backBlockChange(target.room.roomId, target.blockId) | |
| 900 | + end | |
| 901 | + end | |
| 902 | + end | |
| 903 | + return true | |
| 904 | + end | |
| 905 | + | |
| 906 | + -- 7=道具燃烧效果 | |
| 907 | + doActiveEffect[7] = function(_) | |
| 908 | + for _ , target in ipairs(targers) do | |
| 909 | + if target:getEventType() == AdvEventType.Drop then | |
| 910 | + target:updateEvent(nil) | |
| 911 | + self:backBlockChange(target.room.roomId, target.blockId) | |
| 912 | + end | |
| 913 | + end | |
| 914 | + return true | |
| 915 | + end | |
| 916 | + | |
| 917 | + -- 8:翻开范围内的方格 | |
| 918 | + doActiveEffect[8] = function(_) | |
| 919 | + for _ , target in ipairs(targers) do | |
| 920 | + if not target.isOpen then | |
| 921 | + target:open() | |
| 922 | + self:backBlockChange(target.room.roomId, target.blockId) | |
| 923 | + end | |
| 924 | + end | |
| 925 | + return true | |
| 926 | + end | |
| 927 | + | |
| 928 | + for _, effect in ipairs(activeData.effect:toArray()) do | |
| 929 | + local cur = effect:toArray(true, "=") | |
| 930 | + if doActiveEffect[cur[1]] then | |
| 931 | + if not doActiveEffect[cur[1]](table.unpack(cur)) then | |
| 932 | + return | |
| 933 | + end | |
| 934 | + end | |
| 935 | + end | |
| 936 | + | |
| 937 | + return true | |
| 938 | +end | |
| 939 | + | |
| 776 | 940 | --使用技能 |
| 777 | 941 | function Adv:usePotion(potionId, potionLevel, target) |
| 778 | 942 | -- cost |
| 779 | 943 | local potionData = csvdb["adv_potionCsv"][potionId][potionLevel] |
| 944 | + | |
| 780 | 945 | local enemy = self.battle:getEnemy(target.roomId, target.blockId) |
| 781 | 946 | if not enemy then return end |
| 782 | 947 | --生效 |
| ... | ... | @@ -788,9 +953,7 @@ function Adv:usePotion(potionId, potionLevel, target) |
| 788 | 953 | else |
| 789 | 954 | return |
| 790 | 955 | end |
| 791 | - self:afterRound() | |
| 792 | - self:saveDB() | |
| 793 | - self.owner:checkTaskEnter("AdvUsePotion") | |
| 956 | + | |
| 794 | 957 | return true |
| 795 | 958 | end |
| 796 | 959 | |
| ... | ... | @@ -934,6 +1097,10 @@ function Adv:backLayer() |
| 934 | 1097 | self:pushBackEvent(AdvBackEventType.Layer, {}) |
| 935 | 1098 | end |
| 936 | 1099 | |
| 1100 | +function Adv:backMapShow() | |
| 1101 | + self:pushBackEvent(AdvBackEventType.MapShow, {}) | |
| 1102 | +end | |
| 1103 | + | |
| 937 | 1104 | function Adv:scoreChange(scoreType, pms) |
| 938 | 1105 | local cutTypes = {} |
| 939 | 1106 | local score = 0 | ... | ... |
src/adv/AdvBattle.lua
| ... | ... | @@ -161,6 +161,18 @@ function Battle:triggerPassive(condType, params, mapIdx) |
| 161 | 161 | end |
| 162 | 162 | end |
| 163 | 163 | |
| 164 | +-- 只是从战斗中移除 从地图中移除 在外面操作 | |
| 165 | +function Battle:removeEnemyById(id) | |
| 166 | + local mapIdx = self.adv:getCurMapIdx() | |
| 167 | + for i = #self.enemys[mapIdx], 1, -1 do | |
| 168 | + if self.enemys[mapIdx][i].id == id then | |
| 169 | + local enemy = table.remove(self.enemys[mapIdx], i) | |
| 170 | + enemy:clear() | |
| 171 | + break | |
| 172 | + end | |
| 173 | + end | |
| 174 | +end | |
| 175 | + | |
| 164 | 176 | --回合 |
| 165 | 177 | function Battle:afterRound() |
| 166 | 178 | local mapIdx = self.adv:getCurMapIdx() | ... | ... |
src/adv/AdvBlock.lua
| ... | ... | @@ -36,8 +36,8 @@ function Block:clear() |
| 36 | 36 | self.event = nil |
| 37 | 37 | end |
| 38 | 38 | |
| 39 | ---事件有需要额外处理的部分 | |
| 40 | -function Block:open() | |
| 39 | + | |
| 40 | +function Block:randomEvent() | |
| 41 | 41 | local room = self.room |
| 42 | 42 | local map = room.map |
| 43 | 43 | local adv = map.adv |
| ... | ... | @@ -118,6 +118,16 @@ function Block:open() |
| 118 | 118 | randomFunc[self:getEventType()]() |
| 119 | 119 | end |
| 120 | 120 | end |
| 121 | +end | |
| 122 | + | |
| 123 | + | |
| 124 | +--事件有需要额外处理的部分 | |
| 125 | +function Block:open() | |
| 126 | + if self.isOpen then return end | |
| 127 | + local room = self.room | |
| 128 | + local map = room.map | |
| 129 | + local adv = map.adv | |
| 130 | + self:randomEvent() | |
| 121 | 131 | adv.owner:checkTaskEnter("AdvOpenBlock") |
| 122 | 132 | self.isOpen = true |
| 123 | 133 | end | ... | ... |
src/adv/AdvBuff.lua
| ... | ... | @@ -21,6 +21,11 @@ Buff.BATTLE_BUFF = 17 -- 切换为战斗中的buff |
| 21 | 21 | Buff.CHANGE_DROP = 18 -- 转换掉落 |
| 22 | 22 | Buff.BATTLE_PASSIVE = 19 -- 切换为战斗中的被动技 |
| 23 | 23 | Buff.EXP_ADD = 20 -- 增加exp(每回合) |
| 24 | +Buff.DONT_DEFEND = 21 -- 不看守地板 -- 怪周围点半可点击 | |
| 25 | + | |
| 26 | +Buff.EXP_UP = 24 -- 杀敌经验提高 | |
| 27 | +Buff.DISABLE_BUFF = 25 -- 禁用固有技 | |
| 28 | +Buff.ATTR_CHANGE_COND = 26 --属性变化(状态)有条件 | |
| 24 | 29 | |
| 25 | 30 | --角色一些属性的变化 |
| 26 | 31 | local function commonAttr(_Buff, attrName) |
| ... | ... | @@ -34,6 +39,28 @@ local function commonAttr(_Buff, attrName) |
| 34 | 39 | self.owner:reSetAttr(attrName) |
| 35 | 40 | end |
| 36 | 41 | end |
| 42 | +local function commonAttCond(_Buff, attrName) | |
| 43 | + _Buff._init = function(self, data) --初始化变化值 | |
| 44 | + local effectCount = 0 | |
| 45 | + if self.buffData.effectValue4 == 0 then | |
| 46 | + effectCount = self.owner.battle.adv.owner:getProperty("advItems"):getv(ItemId.OldCoin, 0) | |
| 47 | + end | |
| 48 | + self._changeV = self.buffData.effectValue2 * effectCount / self.buffData.effectValue5 | |
| 49 | + self.owner:reSetAttr(attrName) | |
| 50 | + end | |
| 51 | + _Buff._initDB = function(self, data) | |
| 52 | + self._changeV = data.cv | |
| 53 | + end | |
| 54 | + _Buff._effectValue = function(self) | |
| 55 | + return self.buffData.effectValue1, self._changeV | |
| 56 | + end | |
| 57 | + _Buff._endBuff = function(self, data) | |
| 58 | + self.owner:reSetAttr(attrName) | |
| 59 | + end | |
| 60 | + _Buff._getDB = function(self) | |
| 61 | + return {cv = self._changeV} | |
| 62 | + end | |
| 63 | +end | |
| 37 | 64 | |
| 38 | 65 | local BuffFactory = { |
| 39 | 66 | [Buff.HP_CHANGE] = function(_Buff) |
| ... | ... | @@ -108,6 +135,13 @@ local BuffFactory = { |
| 108 | 135 | local attrName = AttsEnumEx[_Buff.buffData.effectValue3] |
| 109 | 136 | commonAttr(_Buff, attrName) |
| 110 | 137 | end, |
| 138 | + | |
| 139 | + [Buff.ATTR_CHANGE] = function(_Buff) | |
| 140 | + local attrName = AttsEnumEx[_Buff.buffData.effectValue3] | |
| 141 | + commonAttCond(_Buff, attrName) | |
| 142 | + end, | |
| 143 | + | |
| 144 | + | |
| 111 | 145 | [Buff.BACK_HURT] = function(_Buff) |
| 112 | 146 | _Buff._effectValue = function(self) |
| 113 | 147 | return self.buffData.effectValue1, self.buffData.effectValue2, self.buffData.effectValue3 |
| ... | ... | @@ -122,7 +156,7 @@ local BuffFactory = { |
| 122 | 156 | |
| 123 | 157 | [Buff.INJURED_CHANGE] = function(_Buff) |
| 124 | 158 | _Buff._effectValue = function(self) |
| 125 | - return self.buffData.effectValue1, self.buffData.effectValue2 | |
| 159 | + return self.buffData.effectValue1, self.buffData.effectValue2, self.buffData.effectValue3 | |
| 126 | 160 | end |
| 127 | 161 | end, |
| 128 | 162 | |
| ... | ... | @@ -238,6 +272,18 @@ local BuffFactory = { |
| 238 | 272 | return self.buffData.effectValue1 |
| 239 | 273 | end |
| 240 | 274 | end, |
| 275 | + | |
| 276 | + [Buff.EXP_UP] = function(_Buff) | |
| 277 | + --cType 0 or nil 值 1 百分比 | |
| 278 | + _Buff._effectValue = function(self) | |
| 279 | + return self.buffData.effectValue1, self.buffData.effectValue2 | |
| 280 | + end | |
| 281 | + end, | |
| 282 | + [Buff.DISABLE_BUFF] = function(_Buff) | |
| 283 | + _Buff._effectValue = function(self) | |
| 284 | + return self.buffData.effectValue1 | |
| 285 | + end | |
| 286 | + end, | |
| 241 | 287 | } |
| 242 | 288 | |
| 243 | 289 | function Buff:ctor(owner, id) |
| ... | ... | @@ -314,7 +360,7 @@ function Buff:afterRound() |
| 314 | 360 | end |
| 315 | 361 | |
| 316 | 362 | function Buff:decRound() |
| 317 | - if self.buffData.round == 0 then | |
| 363 | + if self.buffData.round <= 0 then | |
| 318 | 364 | return |
| 319 | 365 | end |
| 320 | 366 | self.round = self.round - 1 | ... | ... |
src/adv/AdvMap.lua
| ... | ... | @@ -17,6 +17,7 @@ function Map:ctor(adv, mapIdx, mapInfo) |
| 17 | 17 | |
| 18 | 18 | self.mapIdx = mapIdx |
| 19 | 19 | self.mapId = mapInfo.mapId |
| 20 | + self.isShow = mapInfo.isShow -- 是否全部展示 -- 客户端用 | |
| 20 | 21 | self.rooms = {} |
| 21 | 22 | self:loadRooms(mapInfo.rooms) |
| 22 | 23 | end |
| ... | ... | @@ -36,6 +37,7 @@ end |
| 36 | 37 | function Map:getDB() |
| 37 | 38 | local map = {} |
| 38 | 39 | map.mapId = self.mapId |
| 40 | + map.isShow = self.isShow | |
| 39 | 41 | map.rooms = {} |
| 40 | 42 | for roomId, room in pairs(self.rooms) do |
| 41 | 43 | map.rooms[roomId] = room:getDB() |
| ... | ... | @@ -43,6 +45,10 @@ function Map:getDB() |
| 43 | 45 | return map |
| 44 | 46 | end |
| 45 | 47 | |
| 48 | +function Map:showMap() | |
| 49 | + self.isShow = true | |
| 50 | +end | |
| 51 | + | |
| 46 | 52 | --结束本层的时候调用 |
| 47 | 53 | function Map:checkOver() |
| 48 | 54 | local mapCsv = csvdb["mapCsv"][self.mapId] |
| ... | ... | @@ -159,6 +165,29 @@ function Map:getAroundBlocks(room, block) |
| 159 | 165 | return blocks |
| 160 | 166 | end |
| 161 | 167 | |
| 168 | +function Map:getBlocksBySize(roomId, blockId, size) | |
| 169 | + local blocks = {} | |
| 170 | + local room = self.rooms[roomId] | |
| 171 | + if not room then return end | |
| 172 | + local block = room.blocks[blockId] | |
| 173 | + if not block then return end | |
| 174 | + | |
| 175 | + local col, row = room:tranLtoG(block.col, block.row) | |
| 176 | + | |
| 177 | + size = math.floor(size / 2) | |
| 178 | + for c = col - size, col + size do | |
| 179 | + for r = row - size, row + size do | |
| 180 | + local rroom, rblock = self:getRBByPos(c, r) | |
| 181 | + if rroom then | |
| 182 | + table.insert(blocks, rblock) | |
| 183 | + end | |
| 184 | + end | |
| 185 | + end | |
| 186 | + return blocks | |
| 187 | +end | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 162 | 191 | -----------------------------随机地图----------------------------- |
| 163 | 192 | |
| 164 | 193 | createMap = function(self, mapId) | ... | ... |
src/adv/AdvPassive.lua
| ... | ... | @@ -235,6 +235,10 @@ function Passive:canEffect(effType, effValue) |
| 235 | 235 | if self.owner.lock and effType ~= 3 then -- 锁定的只能触发翻开自己格子的固有技 |
| 236 | 236 | return |
| 237 | 237 | end |
| 238 | + --禁用被动技 | |
| 239 | + if self.owner:getPassiveIdx(self) <= self.owner:getDisablePassiveCount() then | |
| 240 | + return | |
| 241 | + end | |
| 238 | 242 | return true |
| 239 | 243 | end |
| 240 | 244 | ... | ... |
src/adv/AdvPlayer.lua
| ... | ... | @@ -58,7 +58,6 @@ function BaseObject:afterRound() |
| 58 | 58 | end |
| 59 | 59 | end |
| 60 | 60 | |
| 61 | - | |
| 62 | 61 | function BaseObject:clearRound() |
| 63 | 62 | for i = #self.passives, 1, -1 do |
| 64 | 63 | if self.passives[i].isDel then |
| ... | ... | @@ -102,6 +101,24 @@ function BaseObject:addPassive(params) |
| 102 | 101 | self.battle.adv:backPassive(self.id, skillId) |
| 103 | 102 | end |
| 104 | 103 | |
| 104 | +function BaseObject:getPassiveIdx(passive) | |
| 105 | + for idx, passive_ in ipairs(self.passives) do | |
| 106 | + if passive_ == passive then | |
| 107 | + return idx | |
| 108 | + end | |
| 109 | + end | |
| 110 | +end | |
| 111 | + | |
| 112 | +function BaseObject:getDisablePassiveCount() | |
| 113 | + local count = 0 | |
| 114 | + for _, buff in ipairs(self.buffs) do | |
| 115 | + if not buff.isDel and buff:getType() == Buff.DISABLE_BUFF then | |
| 116 | + count = count + buff:effect() | |
| 117 | + end | |
| 118 | + end | |
| 119 | + return count | |
| 120 | +end | |
| 121 | + | |
| 105 | 122 | function BaseObject:addBuff(buffId, releaser) |
| 106 | 123 | local buffData = csvdb["adv_map_buffCsv"][buffId] |
| 107 | 124 | if not buffData then return end |
| ... | ... | @@ -454,6 +471,10 @@ function Player:initData(data) |
| 454 | 471 | end |
| 455 | 472 | |
| 456 | 473 | function Player:addExp(value) |
| 474 | + -- buff 经验加成 | |
| 475 | + local up = self:getCommonBuffEffect(Buff.EXP_UP) | |
| 476 | + value = math.ceil((value + up[0]) * (1 + up[1])) | |
| 477 | + | |
| 457 | 478 | if value <= 0 then return end |
| 458 | 479 | local newExp = self.exp + value |
| 459 | 480 | local level = self.level | ... | ... |