Skip to content

Commit

Permalink
属性系统支持复合属性
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed May 30, 2024
1 parent ae4a0f9 commit 08c8ed4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/business/component/attr_component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ function AttrComponent:__delegate()
return this:set_attr(attr.id, value)
end
if attr.increase then
AttrComponent["add_" .. attr.nick] = function(this, value)
AttrComponent["add_" .. attr.nick] = function(this, value, ncheck)
if value < 0 then
return this:cost_attr(attr.id, value)
return this:cost_attr(attr.id, -value, ncheck)
end
return this:add_attr(attr.id, value)
end
AttrComponent["cost_" .. attr.nick] = function(this, value, ncheck)
if value < 0 then
return this:add_attr(attr.id, value)
return this:add_attr(attr.id, -value)
end
return this:cost_attr(attr.id, value, ncheck)
end
Expand Down

0 comments on commit 08c8ed4

Please sign in to comment.