遗计,默认主公,修同名替换

This commit is contained in:
notify 2023-08-02 21:39:03 +08:00
parent 2aeb872c9d
commit 8bfe087374
5 changed files with 112 additions and 9 deletions

View File

@ -244,7 +244,7 @@ end
local function canUseGeneral(g) local function canUseGeneral(g)
local r = Fk:currentRoom() local r = Fk:currentRoom()
return not table.contains(r.disabled_packs, Fk.generals[g].package.name) and return not table.contains(r.disabled_packs, Fk.generals[g].package.name) and
not table.contains(r.disabled_generals, g) not table.contains(r.disabled_generals, g) and not g.hidden and not g.total_hidden
end end
--- 根据武将名称,获取它的同名武将。 --- 根据武将名称,获取它的同名武将。

View File

@ -90,7 +90,24 @@ function GameLogic:chooseGenerals()
if lord ~= nil then if lord ~= nil then
room.current = lord room.current = lord
local generals = Fk:getGeneralsRandomly(generalNum) local generals = {}
if room.settings.gameMode == "aaa_role_mode" then
for _, general in pairs(Fk:getAllGenerals()) do
if (not general.hidden and not general.total_hidden) and
table.find(general.skills, function(s)
return s.lordSkill
end) and
not table.find(generals, function(g)
return g.trueName == general.trueName
end) then
table.insert(generals, general)
end
end
generals = table.random(generals, 3)
end
table.insertTable(generals, Fk:getGeneralsRandomly(generalNum, Fk:getAllGenerals(), table.map(generals, function (g)
return g.name
end)))
for i = 1, #generals do for i = 1, #generals do
generals[i] = generals[i].name generals[i] = generals[i].name
end end
@ -105,7 +122,23 @@ function GameLogic:chooseGenerals()
end end
room:setPlayerGeneral(lord, lord_general, true) room:setPlayerGeneral(lord, lord_general, true)
room:askForChooseKingdom({lord}) if lord.kingdom == "god" or Fk.generals[lord_general].subkingdom then
local allKingdoms = {}
if lord.kingdom == "god" then
allKingdoms = table.simpleClone(Fk.kingdoms)
local exceptedKingdoms = { "god", "qin" }
for _, kingdom in ipairs(exceptedKingdoms) do
table.removeOne(allKingdoms, kingdom)
end
else
local curGeneral = Fk.generals[lord_general]
allKingdoms = { curGeneral.kingdom, curGeneral.subkingdom }
end
lord.kingdom = room:askForChoice(lord, allKingdoms, "AskForKingdom", "#ChooseInitialKingdom")
room:broadcastProperty(lord, "kingdom")
end
room:broadcastProperty(lord, "general") room:broadcastProperty(lord, "general")
room:setDeputyGeneral(lord, deputy) room:setDeputyGeneral(lord, deputy)
room:broadcastProperty(lord, "deputyGeneral") room:broadcastProperty(lord, "deputyGeneral")

View File

@ -40,6 +40,8 @@ Fk:loadTranslationTable({
[":tiandu"] = "当你的判定牌生效后,你可以获得之。", [":tiandu"] = "当你的判定牌生效后,你可以获得之。",
["yiji"] = "Bequeathed Strategy", ["yiji"] = "Bequeathed Strategy",
[":yiji"] = "每当你受到1点伤害后你可以观看牌堆顶的两张牌并任意分配它们。", [":yiji"] = "每当你受到1点伤害后你可以观看牌堆顶的两张牌并任意分配它们。",
["yiji_active"] = "Bequeathed Strategy",
["#yiji-give"] = "Bequeathed Strategy: You may distribute these cards to any players, or click Cancel to reserve",
["zhenji"] = "Zhen Ji", ["zhenji"] = "Zhen Ji",
["luoshen"] = "Goddess Luo", ["luoshen"] = "Goddess Luo",

View File

@ -52,7 +52,7 @@ Fk:loadTranslationTable{
["xuchu"] = "许褚", ["xuchu"] = "许褚",
["~xuchu"] = "冷,好冷啊……", ["~xuchu"] = "冷,好冷啊……",
["$luoyi1"] = "", ["$luoyi1"] = "",
["$luoyi2"] = "谁来与我大战三百回合?", ["$luoyi2"] = "谁来与我大战三百回合?",
["luoyi"] = "裸衣", ["luoyi"] = "裸衣",
[":luoyi"] = "摸牌阶段,你可以少摸一张牌,若如此做,本回合你使用【杀】或【决斗】对目标角色造成伤害时,此伤害+1。", [":luoyi"] = "摸牌阶段,你可以少摸一张牌,若如此做,本回合你使用【杀】或【决斗】对目标角色造成伤害时,此伤害+1。",
@ -67,6 +67,8 @@ Fk:loadTranslationTable{
["$yiji2"] = "罢了。", ["$yiji2"] = "罢了。",
["yiji"] = "遗计", ["yiji"] = "遗计",
[":yiji"] = "每当你受到1点伤害后你可以观看牌堆顶的两张牌并任意分配它们。", [":yiji"] = "每当你受到1点伤害后你可以观看牌堆顶的两张牌并任意分配它们。",
["yiji_active"] = "遗计",
["#yiji-give"] = "遗计:你可以将这些牌分配给任意角色,点“取消”自己保留",
["zhenji"] = "甄姬", ["zhenji"] = "甄姬",
["~zhenji"] = "悼良会之永绝兮,哀一逝而异乡。", ["~zhenji"] = "悼良会之永绝兮,哀一逝而异乡。",

View File

@ -276,11 +276,80 @@ local yiji = fk.CreateTriggerSkill{
self.cancel_cost = true self.cancel_cost = true
end, end,
on_use = function(self, event, target, player, data) on_use = function(self, event, target, player, data)
-- TODO: yiji logic local room = player.room
player:drawCards(2) local ids = room:getNCards(2)
local fakemove = {
toArea = Card.PlayerHand,
to = player.id,
moveInfo = table.map(ids, function(id) return {cardId = id, fromArea = Card.Void} end),
moveReason = fk.ReasonJustMove,
}
room:notifyMoveCards({player}, {fakemove})
for _, id in ipairs(ids) do
room:setCardMark(Fk:getCardById(id), "yiji", 1)
end
while table.find(ids, function(id) return Fk:getCardById(id):getMark("yiji") > 0 end) do
if not room:askForUseActiveSkill(player, "yiji_active", "#yiji-give", true) then
for _, id in ipairs(ids) do
room:setCardMark(Fk:getCardById(id), "yiji", 0)
end
ids = table.filter(ids, function(id) return room:getCardArea(id) ~= Card.PlayerHand end)
fakemove = {
from = player.id,
toArea = Card.Void,
moveInfo = table.map(ids, function(id) return {cardId = id, fromArea = Card.PlayerHand} end),
moveReason = fk.ReasonGive,
}
room:notifyMoveCards({player}, {fakemove})
room:moveCards({
fromArea = Card.Void,
ids = ids,
to = player.id,
toArea = Card.PlayerHand,
moveReason = fk.ReasonGive,
skillName = self.name,
})
end
end
end,
}
local yiji_active = fk.CreateActiveSkill{
name = "yiji_active",
mute = true,
min_card_num = 1,
target_num = 1,
card_filter = function(self, to_select, selected, targets)
return Fk:getCardById(to_select):getMark("yiji") > 0
end,
target_filter = function(self, to_select, selected, selected_cards)
return #selected == 0
end,
on_use = function(self, room, effect)
local player = room:getPlayerById(effect.from)
local target = room:getPlayerById(effect.tos[1])
room:doIndicate(player.id, {target.id})
for _, id in ipairs(effect.cards) do
room:setCardMark(Fk:getCardById(id), "yiji", 0)
end
local fakemove = {
from = player.id,
toArea = Card.Void,
moveInfo = table.map(effect.cards, function(id) return {cardId = id, fromArea = Card.PlayerHand} end),
moveReason = fk.ReasonGive,
}
room:notifyMoveCards({player}, {fakemove})
room:moveCards({
fromArea = Card.Void,
ids = effect.cards,
to = target.id,
toArea = Card.PlayerHand,
moveReason = fk.ReasonGive,
skillName = self.name,
})
end, end,
} }
local guojia = General:new(extension, "guojia", "wei", 3) local guojia = General:new(extension, "guojia", "wei", 3)
Fk:addSkill(yiji_active)
guojia:addSkill(tiandu) guojia:addSkill(tiandu)
guojia:addSkill(yiji) guojia:addSkill(yiji)
@ -1075,9 +1144,6 @@ local role_mode = fk.CreateGameMode{
name = "aaa_role_mode", -- just to let it at the top of list name = "aaa_role_mode", -- just to let it at the top of list
minPlayer = 2, minPlayer = 2,
maxPlayer = 8, maxPlayer = 8,
countInFunc = function(self, room)
return #room.players >= 5
end,
surrender_func = function(self, playedTime) surrender_func = function(self, playedTime)
local roleCheck = false local roleCheck = false
local roleText = "" local roleText = ""