97 lines
2.8 KiB
Lua
97 lines
2.8 KiB
Lua
--- 模式表
|
||
ModeTable = {};
|
||
|
||
ModeTable.EModeType = {
|
||
Common = 1, -- 普通模式
|
||
Rob = 2, -- 掠夺模式
|
||
};
|
||
|
||
ModeTable.BenefitMinLimit = 0.5;
|
||
|
||
ModeTable.ModeInfo = {
|
||
--- 依次递减
|
||
[ModeTable.EModeType.Common] = {
|
||
---@param InVictim PlayerKey
|
||
---@param InCauserKey PlayerKey
|
||
---@param InAttr table<PlayerKey>
|
||
DeadFunc = function(InAttr, InVictim, InCauserKey)
|
||
local OldAttr = TableHelper.DeepCopyTable(InAttr[InVictim]);
|
||
for i, v in pairs(DefaultSettings.BenefitInto) do
|
||
if v.EnableKill then
|
||
local RawValue = InAttr[InVictim][i];
|
||
if i ~= DefaultSettings.EPawnBenefitType.Shield then
|
||
local AppendValue = 0;
|
||
if RawValue > 3 then
|
||
AppendValue = 2;
|
||
elseif RawValue > 2 then
|
||
-- 减去 1.5 倍
|
||
AppendValue = 1.5;
|
||
elseif RawValue > 1 then
|
||
AppendValue = 1;
|
||
else
|
||
AppendValue = 0.5;
|
||
end
|
||
table.addTableNum(InAttr[InVictim], i, -v.AddValue * DefaultSettings.BenefitInto[i].DefaultValue * AppendValue, ModeTable.BenefitMinLimit);
|
||
else
|
||
table.addTableNum(InAttr[InVictim], i, -v.AddValue, 0);
|
||
end
|
||
end
|
||
end
|
||
return OldAttr;
|
||
end,
|
||
--- 击杀者所赋予的值
|
||
KillerFunc = function(InVictimAttr, InAttr, InVictim, InCauserKey)
|
||
for i, v in pairs(DefaultSettings.BenefitInto) do
|
||
if v.EnableKill then table.addTableNum(InAttr[InCauserKey], i, v.AddValue); end
|
||
end
|
||
end,
|
||
Chinese = '普通',
|
||
},
|
||
|
||
[ModeTable.EModeType.Rob] = {
|
||
--- 剥夺
|
||
DeadFunc = function(InAttr, InVictim, InCauserKey)
|
||
-- 检查大于1 的部分,然后拿取 60%,剩下的;如果小于1,拿取 20%,小于 50% 不拿取,但是可以增长
|
||
local Old = TableHelper.DeepCopyTable(InAttr[InVictim]);
|
||
for i, v in pairs(DefaultSettings.BenefitInto) do
|
||
if v.EnableKill then
|
||
local RawValue = InAttr[InVictim][i];
|
||
if i ~= DefaultSettings.EPawnBenefitType.Shield then
|
||
local AppendValue = 0;
|
||
if RawValue > 1.5 then
|
||
AppendValue = (RawValue - 1) * 0.6;
|
||
else
|
||
AppendValue = 0.2;
|
||
end
|
||
table.addTableNum(InAttr[InVictim], i, -AppendValue, ModeTable.BenefitMinLimit);
|
||
else
|
||
table.addTableNum(InAttr[InVictim], i, -v.AddValue, 0);
|
||
end
|
||
end
|
||
end
|
||
return Old;
|
||
end,
|
||
KillerFunc = function(InVictimAttr, InAttr, InVictim, InCauserKey)
|
||
-- 获取部分
|
||
for i, v in pairs(DefaultSettings.BenefitInto) do
|
||
if v.EnableKill then
|
||
local Raw = InVictimAttr[i];
|
||
if i ~= DefaultSettings.EPawnBenefitType.Shield then
|
||
local Append = 0;
|
||
if Raw > 1.5 then
|
||
Append = (Raw - 1) * 0.6;
|
||
else
|
||
Append = 0.2;
|
||
end
|
||
table.addTableNum(InAttr[InCauserKey], i, Append, DefaultSettings.MaxBodySize);
|
||
else
|
||
table.addTableNum(InAttr[InCauserKey], i, v.AddValue, DefaultSettings.MaxBodySize);
|
||
end
|
||
end
|
||
end
|
||
end,
|
||
Chinese = '掠夺',
|
||
},
|
||
}
|
||
|
||
return ModeTable; |