使用Lua modifier來做到這一點
TIPS after 7.07 update:如果游戲更新了良狈,例如修改了每點力量增加的回血炼邀,那就需要修改一下對應的數值趁仙。
modifier_attribute_fix = class({})
-- 每點力量提升1點生命值
function modifier_attribute_fix:GetModifierHealthBonus()
if IsServer() then
return self:GetParent():GetStrength() * -19 -- 默認為20桶癣,每點力量-19則為每點力量1點生命值表箭,以此類推
end
end
-- 每點敏捷提升1點移動速度
function modifier_attribute_fix:GetModifierMoveSpeedBonus_Constant()
if IsServer() then
return self:GetParent():GetAgility()
end
-- 客戶端更新
local attributes = CustomNetTables:GetTableValue("courier_attributes","courier_attributes" .. self:GetParent():GetEntityIndex())
if attributes and attributes.agi then
return attributes.agi
end
end
-- 每點智力提升1點幸運
function modifier_attribute_fix:GetModifierLuckyBonus_Constant()
if IsServer() then
return self:GetParent():GetIntellect()
end
end
function modifier_attribute_fix:IsHidden()
return true
end
function modifier_attribute_fix:IsPurgable()
return false
end
function modifier_attribute_fix:GetPriority()
return MODIFIER_PRIORITY_SUPER_ULTRA
end
function modifier_attribute_fix:DeclareFunctions()
return {
-- 有需要用到的屬性就取消注釋厦章,然后再到對應的函數中去設定數值
-- MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT,
-- MODIFIER_PROPERTY_PHYSICAL_ARMOR_BONUS,
-- MODIFIER_PROPERTY_MANA_REGEN_CONSTANT,
MODIFIER_PROPERTY_HEALTH_REGEN_CONSTANT,
-- MODIFIER_PROPERTY_MANA_BONUS,
-- MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT,
-- MODIFIER_PROPERTY_HEALTH_BONUS,
-- MODIFIER_PROPERTY_BASEATTACK_BONUSDAMAGE,
}
end
-- 移除我們不需要的那些屬性
function modifier_attribute_fix:GetModifierPhysicalArmorBonus()
if IsServer() then
return self:GetParent():GetAgility() * - 0.143
end
-- 客戶端更新
local attributes = CustomNetTables:GetTableValue("courier_attributes","courier_attributes" .. self:GetParent():GetEntityIndex())
if attributes and attributes.agi then
return attributes.agi * -0.143
end
end
function modifier_attribute_fix:GetModifierConstantHealthRegen()
if IsServer() then
-- 如果屬性發(fā)生了改變镇匀,將屬性數據發(fā)送給客戶端
local parent = self:GetParent()
parent.vAttributeForClient_modifier_attribute_fix = parent.vAttributeForClient_modifier_attribute_fix or {}
parent.vAttributeForClient_modifier_attribute_fix.str = parent.vAttributeForClient_modifier_attribute_fix.str or -1
parent.vAttributeForClient_modifier_attribute_fix.agi = parent.vAttributeForClient_modifier_attribute_fix.agi or -1
parent.vAttributeForClient_modifier_attribute_fix.int = parent.vAttributeForClient_modifier_attribute_fix or -1
local u = false
local str, agi, int = parent:GetStrength(), parent:GetAgility(), parent:GetIntellect()
if str ~= parent.vAttributeForClient_modifier_attribute_fix.str then
u = true; parent.vAttributeForClient_modifier_attribute_fix.str = str
end
if agi ~= parent.vAttributeForClient_modifier_attribute_fix.agi then
u = true; parent.vAttributeForClient_modifier_attribute_fix.agi = agi
end
if int ~= parent.vAttributeForClient_modifier_attribute_fix.int then
u = true; parent.vAttributeForClient_modifier_attribute_fix.int = int
end
CustomNetTables:SetTableValue("courier_attributes","courier_attributes" .. self:GetParent():GetEntityIndex(),parent.vAttributeForClient_modifier_attribute_fix)
return self:GetParent():GetStrength() * - 0.03
end
end
function modifier_attribute_fix:GetModifierManaBonus()
if IsServer() then
return self:GetParent():GetIntellect() * - 12
end
end
function modifier_attribute_fix:GetModifierConstantManaRegen()
if IsServer() then
return self:GetParent():GetIntellect() * - 0.035
end
end
function modifier_attribute_fix:GetModifierBaseAttack_BonusDamage()
if IsServer() then
return self:GetParent():GetStrength() * -1
end
end