mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
75d0ad55c8
可以玩玩看
38 lines
952 B
Lua
38 lines
952 B
Lua
-- 针对 lua/server/gamelogic.lua 以及 GameEvent 的测试
|
|
|
|
local croom
|
|
_TestGameLogic = {
|
|
setup = function()
|
|
croom = fk.Room:new()
|
|
croom.players = {
|
|
fk.ServerPlayer:new(1),
|
|
fk.ServerPlayer:new(2),
|
|
fk.ServerPlayer:new(3),
|
|
fk.ServerPlayer:new(4),
|
|
fk.ServerPlayer:new(5),
|
|
}
|
|
end,
|
|
|
|
testTrigger = function()
|
|
---@param room Room
|
|
fk.roomtest(croom, function(room)
|
|
local logic = room.logic
|
|
local p = room:getPlayerById(1)
|
|
room:handleAddLoseSkills(p, table.concat({
|
|
"luoyi", "wansha", "yaoyi", --"dili",
|
|
}, "|"))
|
|
|
|
logic:trigger(fk.GamePrepared)
|
|
GameEvent(GameEvent.DrawInitial):exec()
|
|
GameEvent(GameEvent.Round):exec()
|
|
|
|
-- DMG test
|
|
local victim = room.alive_players[2]
|
|
room:damage{ from = p, to = victim, damage = 20 }
|
|
room:damage{ to = p, from = victim, damage = 20 }
|
|
end)
|
|
end,
|
|
|
|
tearDown = function() croom = nil end
|
|
}
|