mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 03:32:34 +08:00
修复武将牌堆回流 (role mode下) (#325)
This commit is contained in:
parent
4d94ee8a93
commit
726602873e
18
README.md
18
README.md
|
@ -14,21 +14,11 @@ ___
|
|||
|
||||
新月杀(FreeKill)是一款开源的三国杀游戏,但其目的不在于补完官方所有武将,而是着力于提供一个最适合DIY的框架。
|
||||
|
||||
___
|
||||
|
||||
## 项目文档
|
||||
|
||||
[新月杀文档](https://qsgs-fans.github.io/FreeKill/usr/index.html)
|
||||
|
||||
### 依赖的库
|
||||
|
||||
以下是新月杀运行所必不可少的依赖库:
|
||||
|
||||
* [![](https://img.shields.io/badge/qt6-50D160?style=for-the-badge&logo=qt&logoColor=white)](https://www.qt.io)
|
||||
* [![](https://img.shields.io/badge/lua5.4-030380?style=for-the-badge&logo=lua)](https://www.lua.org)
|
||||
* [![](https://img.shields.io/badge/sqlite3-7ABEEA?style=for-the-badge&logo=sqlite)](https://www.sqlite.org)
|
||||
* [![](https://img.shields.io/badge/libgit2-FFFFFF?style=for-the-badge&logo=git)](https://www.libgit2.org)
|
||||
* [![](https://img.shields.io/badge/openssl-721412?style=for-the-badge&logo=openssl)](https://www.openssl.org)
|
||||
|
||||
新月杀在编译过程中,需要用到cmake, flex, bison, swig。
|
||||
https://fkbook-all-in-one.readthedocs.io/
|
||||
|
||||
___
|
||||
|
||||
|
@ -46,7 +36,7 @@ ___
|
|||
|
||||
## 如何构建
|
||||
|
||||
关于如何从头构建新月杀,详见[编译教程](https://qsgs-fans.github.io/FreeKill/inner/01-compile.html)。
|
||||
https://fkbook-all-in-one.readthedocs.io/zh-cn/latest/develop/02-env.html
|
||||
|
||||
___
|
||||
|
||||
|
|
|
@ -1508,17 +1508,22 @@ end
|
|||
|
||||
--- 把武将牌塞回去(……)
|
||||
---@param g string[] @ 武将名数组
|
||||
---@param position? string @位置,top/bottom,默认bottom
|
||||
---@param position? string @位置,top/bottom/random,默认random
|
||||
---@return boolean @ 是否成功
|
||||
function Room:returnToGeneralPile(g, position)
|
||||
position = position or "bottom"
|
||||
assert(position == "top" or position == "bottom")
|
||||
position = position or "random"
|
||||
assert(position == "top" or position == "bottom" or position == "random")
|
||||
if position == "bottom" then
|
||||
table.insertTable(self.general_pile, g)
|
||||
elseif position == "top" then
|
||||
while #g > 0 do
|
||||
table.insert(self.general_pile, 1, table.remove(g))
|
||||
end
|
||||
elseif position == "random" then
|
||||
while #g > 0 do
|
||||
table.insert(self.general_pile, math.random(1, #self.general_pile),
|
||||
table.remove(g))
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
|
|
|
@ -1132,17 +1132,12 @@ local role_getlogic = function()
|
|||
lord_general = lord_generals
|
||||
lord_generals = {lord_general}
|
||||
end
|
||||
generals = table.filter(generals, function(g)
|
||||
return not table.find(lord_generals, function(lg)
|
||||
return Fk.generals[lg].trueName == Fk.generals[g].trueName
|
||||
end)
|
||||
end)
|
||||
room:returnToGeneralPile(generals)
|
||||
local index = 1
|
||||
while index <= #room.general_pile do
|
||||
local ret = {}
|
||||
for _, gname in ipairs(lord_generals) do
|
||||
if room.general_pile[index] == gname or Fk.generals[room.general_pile[index]].trueName == Fk.generals[gname].trueName then
|
||||
table.insert(ret, table.remove(room.general_pile, index))
|
||||
end
|
||||
end
|
||||
if #ret == 0 then index = index + 1 end
|
||||
end
|
||||
|
||||
room:setPlayerGeneral(lord, lord_general, true)
|
||||
room:askForChooseKingdom({lord})
|
||||
|
@ -1231,17 +1226,12 @@ local role_getlogic = function()
|
|||
p.default_reply = ""
|
||||
end
|
||||
|
||||
generals = table.filter(generals, function(g)
|
||||
return not table.find(selected, function(lg)
|
||||
return Fk.generals[lg].trueName == Fk.generals[g].trueName
|
||||
end)
|
||||
end)
|
||||
room:returnToGeneralPile(generals)
|
||||
local index = 1
|
||||
while index <= #room.general_pile do
|
||||
local ret = {}
|
||||
for _, gname in ipairs(selected) do
|
||||
if room.general_pile[index] == gname or Fk.generals[room.general_pile[index]].trueName == Fk.generals[gname].trueName then
|
||||
table.insert(ret, table.remove(room.general_pile, index))
|
||||
end
|
||||
end
|
||||
if #ret == 0 then index = index + 1 end
|
||||
end
|
||||
|
||||
room:askForChooseKingdom(nonlord)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user