robot_new/game_web/robot_mgr/build/test/take_hp.lua

10 lines
273 B
Lua
Raw Permalink Normal View History

2025-12-18 19:52:18 +08:00
local reward_hp = tonumber(redis.call('get', KEYS[1]))
local hp = tonumber(ARGV[1])
local tag_hp = 0
if hp > 0 and reward_hp < hp then
return 3
else
reward_hp = redis.call('incrBy',KEYS[1],-hp)
tag_hp = redis.call('hincrBy',KEYS[2],'hp',hp)
end
return {reward_hp,tag_hp}