藏宝湾网游单机站

 找回密码
 注册

QQ登录

只需一步,快速开始

★69 元包站 Gm 手游平台★

★69 元包站 Gm 手游平台★

★Gm 游戏平台【无限资源包站平台,真正体验gm和土豪感觉】★

★白嫖放置传奇 玩通关算你赢★

★白嫖放置传奇 玩通关算你赢★

★白嫖长久耐玩型 放置类挂机传奇游戏 充值可打 安全挂机 可交易 无PK★

★@梦幻长久耐玩全新大唐九黎★

★@!!——梦幻长久耐玩全新大唐九黎——!!★

★★新增全新门派九黎城, ★侵烛系统 ★静脉系统 ★赐福系统 ★战斗动作声效系统 ★全场景NPC、召唤兽迭代最新 ★17个副本,完全还原 ★独家PK系统,享受极致免费PK★★

承接推广
★承接推广★

★承接推广★

☆ 六一活动开放-放置传奇☆

★ 六一活动开放-放置传奇★

★可白嫖 上班摸鱼类 放置文字传奇游戏(放置休闲)qq群756025698★

★三职业复古★开局送神装★爆率100%★零氪首选★

★三职业复古★开局送神装★爆率100%★零氪首选★

★〖双线〗〖无忧传奇〗〖每日新区〗〖开局送神装 100%高爆率 装备元宝打怪爆〗★

承接推广

★承接推广★

★承接推广★

承接推广

★承接推广★

★承接推广★

★DNF★全职业平衡★公益服★
★DNF★全职业平衡★公益服★

【dnf86版本】【怀旧服】【全职业平衡】【非变态服】【非商业服】【774031300】

★承接推广★

★承接推广★

★承接推广★

★承接推广★

★承接推广★

★承接推广★

★承接推广★

★承接推广★

★承接推广★

查看: 694|回复: 2

[求助] 魔力宝贝cgmsv

[复制链接]
 楼主| 发表于 2026-2-10 15:06:14 来自手机 | 显示全部楼层 |阅读模式
有没有大佬知道如何修改必杀伤害呀?
回复

使用道具 举报

发表于 2026-2-10 16:17:46 | 显示全部楼层
没玩过,帮顶一下
回复 支持 反对

使用道具 举报

发表于 2026-2-10 23:22:17 | 显示全部楼层
本帖最后由 epyanlove 于 2026-2-10 23:24 编辑


前提是你要看懂写的这些 否则洗洗睡吧
docs.lua里面找到的
---修改暴击时伤害计算
-----@param mode number|boolean 取值: 0 = 普通模式 1 = 倍率模式 2 = 无 true = 普通模式 false = 无
-----@param val number 倍率,默认1.5倍
function NLG.SetCriticalDamageAddition(mode, val) end



或者自己去写个脚本 内容如下

---模块类
local CriticalMod = ModuleBase:createModule('criticalMod')

local comboCount = {}
local comboCriticalDamage = {}
local retributionSide = {}
local retributionRate = {}
local randomshotCount = {}
local randomshotDamage = {0.45,0.30,0.15,0.05}
local billiardDefender = {}
local guardRate1 = {0, 0.1, 0.2, 0.3, 0.4, 0.5}
local guardProb1 = {25, 50, 70, 85, 95, 100}
local guardRate2 = {0, 0.2, 0.3, 0.4, 0.5}
local guardProb2 = {5, 20, 40, 70, 100}

local function Conver_240(num)
        if num >= 240 then
                num = math.floor((num - 240 ) * 0.3 + 240)
        end
        return num
end

local function randomRate(rate, prob)
        local randNum = NLG.Rand(1, 100)
        for i = 1, #rate do
                if prob >= randNum then
                        return rate
                end
        end
end

local function getWeaponType(playerIndex)
        for itemSlot = 2, 3 do
                local itemIndex = Char.GetItemIndex(playerIndex, itemSlot)
                if itemIndex < 0 then
                        goto continue
                end
                local itemType = Item.GetData(itemIndex, CONST.道具_类型)
                if itemType <= CONST.ITEM_TYPE_回力镖 then
                        return itemType
                end
                :: continue ::
        end
end

function CriticalMod:afterBattleTurnEvent(battleIndex)
        for slot = 0, 19 do
                local charIndex = Battle.GetPlayer(battleIndex, slot)
                billiardDefender[charIndex] = nil
                randomshotCount[charIndex] = nil
        end
end

function CriticalMod:criticalDamageCalculateEvent(charIndex, defCharIndex, oriDamage, damage, battleIndex, com1, com2, com3, defCom1, defCom2, defCom3, flg)
        --print('battleIndex', battleIndex)
        --如果是合击则记录合击人数
        if flg == CONST.DamageFlags.Combo or flg == CONST.DamageFlags.ComboCritical then
                comboCount[defCharIndex] = comboCount[defCharIndex] and (comboCount[defCharIndex] + 1) or 1
                --print('comboCount[defCharIndex]', comboCount[defCharIndex])
        end
        --如果是因果则记录第一个防守方side
        if com1 == CONST.BATTLE_COM.BATTLE_COM_RETRIBUTION then
                retributionSide[charIndex] = retributionSide[charIndex] or math.floor((Battle.GetPos(battleIndex, defCharIndex) / 10))
                --print('retributionSide[charIndex]', retributionSide[charIndex])
        end
        --如果是一石二鸟则记录前排
        if com1 == CONST.BATTLE_COM.BATTLE_COM_BILLIARD then
                billiardDefender[charIndex] = billiardDefender[charIndex] or defCharIndex
                --print('billiardDefender[charIndex]', billiardDefender[charIndex])
        end
        --如果是乱射则记录防守方所受箭数
        if com1 == CONST.BATTLE_COM.BATTLE_COM_P_RANDOMSHOT then
                randomshotCount[charIndex] = randomshotCount[charIndex] or {}
                randomshotCount[charIndex][defCharIndex] = randomshotCount[charIndex][defCharIndex] and (randomshotCount[charIndex][defCharIndex] + 1) or 1
                --print('randomshotCount[charIndex][defCharIndex]', charIndex, defCharIndex, randomshotCount[charIndex][defCharIndex])
        end
        --如果不是必杀或伤害很低则返回原值
        if damage <= 0 or (flg ~= CONST.DamageFlags.Critical and flg ~= CONST.DamageFlags.ComboCritical) then
                --print('不是必杀或无伤害')
                return damage
        end
        if damage <= 1 then
                --print('伤害很低')
                return 1
        end
        --如果是合击最后一击,合并合击伤害
        if not Char.GetTempData(charIndex, 'haveCritical') then
                local comboFinalCritical = math.floor(comboCriticalDamage[defCharIndex] * (1 + comboCount[defCharIndex] / 10))
                --print('合击最后一击', comboCriticalDamage[defCharIndex], comboCount[defCharIndex], comboDamage)
                --之前的合击伤害记录清除
                comboCriticalDamage[defCharIndex] = nil
                comboCount[defCharIndex] = nil
                return damage + comboFinalCritical
        end
        --必杀时额外补充原版必杀的一半伤害
        local attackLevel = Char.GetData(charIndex, CONST.对象_等级)
        local defLevel = Char.GetData(defCharIndex, CONST.对象_等级)
        local defDefense = Char.GetData(defCharIndex, CONST.对象_防御力)
        local modDefDefense = Conver_240(defDefense)
        local criticalDamage = math.floor(modDefDefense * attackLevel / defLevel / 4)
        local techDD = Battle.GetTechOption(charIndex, "DD:")
        --print('techDD', techDD)
        --如果是反击(未考虑阳炎反击,因为觉得是bug)
        if Char.GetTempData(charIndex, 'haveCounter') then
                --反击rate
                local counterRate = com1 == CONST.BATTLE_COM.BATTLE_COM_P_CROSSCOUNTER and ((techDD + 100) / 100) or 0.75
                --print('反击rate', damage, criticalDamage, counterRate, math.floor(damage + criticalDamage * counterRate))
                Char.SetTempData(charIndex, 'haveCounter', nil)
                return math.floor(damage + criticalDamage * counterRate)
        end
        --技能倍率rate(气功弹及追月数量修正暂未考虑,因为无法获取发出弹数量)
        local techRate = 1
        --气功弹或者追月rate
        if com1 == CONST.BATTLE_COM.BATTLE_COM_P_SPIRACLESHOT or com1 == CONST.BATTLE_COM.BATTLE_COM_BLASTWAVE then
                techRate = math.min(1, techDD / 100)
                --print('气功弹或者追月rate', techRate)
        --崩击rate
        elseif (defCom1 == CONST.BATTLE_COM.BATTLE_COM_GUARD or defCom1 == CONST.BATTLE_COM.BATTLE_COM_P_SPECIALGARD) and com1 == CONST.BATTLE_COM.BATTLE_COM_P_GUARDBREAK then
                techRate = (1 + techDD / 100) * (1 + techDD / 100)
                --print('崩击rate', techRate)
        --因果报应rate
        elseif com1 == CONST.BATTLE_COM.BATTLE_COM_RETRIBUTION then
                local techIndex = Tech.GetTechIndex(com3)
                local techLv = Tech.GetData(techIndex, CONST.TECH_NECESSARYLV)
                retributionRate[charIndex] = retributionRate[charIndex] or (0.55 * techDD + 100) / 100 * NLG.Rand((4000 - 180 * (10 - techLv)), 6999) / 10000
                techRate = retributionRate[charIndex]
                --print('因果报应rate', techRate)
                if charIndex == defCharIndex or retributionSide[charIndex] ~= math.floor((Battle.GetPos(battleIndex, defCharIndex) / 10)) then
                        techRate = techRate * Battle.GetTechOption(charIndex, "AR:") / 100
                        --print('因果报应自伤rate', techRate)
                        retributionSide[charIndex] = nil
                        retributionRate[charIndex] = nil
                end
        --一石二鸟后排rate
        elseif com1 == CONST.BATTLE_COM.BATTLE_COM_BILLIARD and billiardDefender[charIndex] ~= defCharIndex then
                techRate = Battle.GetTechOption(charIndex, "SR:") / 100
                --print('一石二鸟后排rate', techRate)
        --乱射rate
        elseif com1 == CONST.BATTLE_COM.BATTLE_COM_P_RANDOMSHOT then
                techRate = randomshotDamage[math.min(randomshotCount[charIndex][defCharIndex], 4)]
                --print('乱射rate', techRate)
        --其他情况rate
        else
                local techOption = Tech.GetData(Tech.GetTechIndex(com3), CONST.TECH_OPTION)
                techDD = type(techOption) == 'string' and string.find(techOption, 'DD:') and techDD or (techDD + 1)
                techRate = (techDD + 100) / 100
                --print('其他情况rate', techRate)
        end
        --武器rate
        local weaponRate = 1
        local weaponType = getWeaponType(charIndex)
        --小刀rate
        if weaponType == CONST.ITEM_TYPE_小刀 then
                weaponRate = NLG.Rand(5, 8) * 0.1
        --回力rate,因果无视(此处暂有问题,因为无法获取普攻回力倍率,因此普攻的回力倍率和额外必杀的回力倍率未必一致)
        elseif weaponType == CONST.ITEM_TYPE_回力镖 and com1 ~= CONST.BATTLE_COM.BATTLE_COM_RETRIBUTION then
                weaponRate = NLG.Rand(1, 6) * 0.1
        end
        --print('武器rate', weaponRate)
        --多动rate
        local multipleActionRate = 1
        for itemSlot = 0, 7 do
                local itemIndex = Char.GetItemIndex(charIndex, itemSlot)
                if itemIndex < 0 or Item.GetData(itemIndex, CONST.道具_最小攻击数量) <= 1 or Item.GetData(itemIndex, CONST.道具_最大攻击数量) <= 1 then
                        goto continue
                end
                multipleActionRate = 1 / math.max(Item.GetData(itemIndex, CONST.道具_最小攻击数量), Item.GetData(itemIndex, CONST.道具_最大攻击数量))
                :: continue ::
        end
        --print('多动rate', multipleActionRate)
        --防御rate
        local guardRate = 1
        if defCom1 == CONST.BATTLE_COM.BATTLE_COM_GUARD and com1 ~= CONST.BATTLE_COM.BATTLE_COM_P_GUARDBREAK and Char.GetData(defCharIndex, CONST.对象_类型) == CONST.对象类型_人 and Char.GetData(defCharIndex, CONST.对象_战宠) < 0 then
                guardRate = randomRate(guardRate1, guardProb1)
        elseif defCom1 == CONST.BATTLE_COM.BATTLE_COM_GUARD and com1 ~= CONST.BATTLE_COM.BATTLE_COM_P_GUARDBREAK then
                guardRate = randomRate(guardRate2, guardProb2)
        end
        --print('防御rate', guardRate)
        --圣盾rate
        local specialguardRate = 1
        if defCom1 == CONST.BATTLE_COM.BATTLE_COM_P_SPECIALGARD and com1 ~= CONST.BATTLE_COM.BATTLE_COM_P_GUARDBREAK then
                specialguardRate = 1 - NLG.Rand(Battle.GetTechOption(defCharIndex, "RS:"), Battle.GetTechOption(defCharIndex, "RE:")) / 100
        end
        --print('圣盾rate', specialguardRate)
        --必杀伤害总修正(未考虑精灵变身倍率及制御巫术伤害倍率)
        local modCriticalDamage = math.floor(criticalDamage * weaponRate * multipleActionRate * techRate * guardRate * specialguardRate)
        --print('必杀伤害总修正', criticalDamage, modCriticalDamage)
        --清除必杀标记,以便可以找到合击最后一击
        if (flg == CONST.DamageFlags.Critical and Char.GetTempData(charIndex, 'haveCritical')) or flg == CONST.DamageFlags.ComboCritical then
                Char.SetTempData(charIndex, 'haveCritical', nil)
        end
        --如果是合击必杀则记录本次必杀伤害,最后一击时再合并计算
        if flg == CONST.DamageFlags.ComboCritical then
                comboCriticalDamage[defCharIndex] = comboCriticalDamage[defCharIndex] and (comboCriticalDamage[defCharIndex] + modCriticalDamage) or modCriticalDamage
                --print('记录本次必杀伤害', damage, modCriticalDamage, comboCriticalDamage[defCharIndex])
                return damage
        end
        --print('最终伤害', damage, modCriticalDamage, damage + modCriticalDamage)
        return damage + modCriticalDamage
end

function CriticalMod:battleCounterRateEvent(battleIndex, attIndex, defIndex, rate)
        Char.SetTempData(attIndex, 'haveCounter', defIndex)
end

function CriticalMod:calcCriticalRateEvent(attIndex, defIndex, rate)
        Char.SetTempData(attIndex, 'haveCritical', defIndex)
end

--- 加载模块钩子
function CriticalMod:onLoad()
        self:logInfo('load')
        self:regCallback('DamageCalculateEvent', Func.bind(self.criticalDamageCalculateEvent, self))
        self:regCallback('AfterBattleTurnEvent', Func.bind(self.afterBattleTurnEvent, self))
        self:regCallback('BattleCounterRateEvent', Func.bind(self.battleCounterRateEvent, self))
        self:regCallback('CalcCriticalRateEvent', Func.bind(self.calcCriticalRateEvent, self))
end

--- 卸载模块钩子
function CriticalMod:onUnload()
        self:logInfo('unload')
end

return CriticalMod

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

本站内容如若侵犯到您的权益,请来电来函告知,我们会尽快处理!
联系QQ:1953150286,2251387361,123784736,免责申明

排行榜|联系我们|小黑屋|手机版|Archiver|游戏藏宝湾 |

GMT+8, 2026-6-4 22:19 , Processed in 0.148094 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表