2023-04-09 13:35:35 +08:00
|
|
|
-- SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2022-03-28 22:24:30 +08:00
|
|
|
local extension = Package:new("standard")
|
2022-03-31 13:29:23 +08:00
|
|
|
extension.metadata = require "packages.standard.metadata"
|
2024-10-22 00:10:53 +08:00
|
|
|
|
|
|
|
local pkgprefix = "packages/"
|
|
|
|
if UsingNewCore then pkgprefix = "packages/freekill-core/" end
|
|
|
|
dofile(pkgprefix .. "standard/game_rule.lua")
|
|
|
|
dofile(pkgprefix .. "standard/aux_skills.lua")
|
|
|
|
dofile(pkgprefix .. "standard/aux_poxi.lua")
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2024-04-19 21:35:29 +08:00
|
|
|
Fk:appendKingdomMap("god", {"wei", "shu", "wu", "qun"})
|
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local jianxiong = fk.CreateTriggerSkill{
|
|
|
|
name = "jianxiong",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "masochism",
|
2023-01-22 00:49:11 +08:00
|
|
|
events = {fk.Damaged},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2024-06-10 15:19:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and data.card and player.room:getCardArea(data.card) == Card.Processing
|
2023-01-22 00:49:11 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
2023-08-02 21:50:47 +08:00
|
|
|
player.room:obtainCard(player.id, data.card, true, fk.ReasonJustMove)
|
2023-01-22 00:49:11 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-04-15 12:06:24 +08:00
|
|
|
|
2023-12-03 00:21:52 +08:00
|
|
|
local hujia = fk.CreateTriggerSkill{
|
2023-04-15 12:06:24 +08:00
|
|
|
name = "hujia$",
|
|
|
|
anim_type = "defensive",
|
2023-12-03 00:21:52 +08:00
|
|
|
events = {fk.AskForCardUse, fk.AskForCardResponse},
|
2023-04-15 12:06:24 +08:00
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-03 00:21:52 +08:00
|
|
|
return target == player and player:hasSkill(self) and
|
|
|
|
(data.cardName == "jink" or (data.pattern and Exppattern:Parse(data.pattern):matchExp("jink|0|nosuit|none"))) and
|
|
|
|
(data.extraData == nil or data.extraData.hujia_ask == nil) and
|
|
|
|
not table.every(player.room.alive_players, function(p)
|
|
|
|
return p == player or p.kingdom ~= "wei"
|
|
|
|
end)
|
2023-04-15 12:06:24 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
for _, p in ipairs(room:getOtherPlayers(player)) do
|
2023-12-03 00:21:52 +08:00
|
|
|
if p:isAlive() and p.kingdom == "wei" then
|
|
|
|
local cardResponded = room:askForResponse(p, "jink", "jink", "#hujia-ask:" .. player.id, true, {hujia_ask = true})
|
2023-04-15 12:06:24 +08:00
|
|
|
if cardResponded then
|
|
|
|
room:responseCard({
|
|
|
|
from = p.id,
|
|
|
|
card = cardResponded,
|
|
|
|
skipDrop = true,
|
|
|
|
})
|
|
|
|
|
2023-12-03 00:21:52 +08:00
|
|
|
if event == fk.AskForCardUse then
|
|
|
|
data.result = {
|
|
|
|
from = player.id,
|
|
|
|
card = Fk:cloneCard('jink'),
|
|
|
|
}
|
|
|
|
data.result.card:addSubcards(room:getSubcardsByRule(cardResponded, { Card.Processing }))
|
|
|
|
data.result.card.skillName = self.name
|
|
|
|
|
|
|
|
if data.eventData then
|
|
|
|
data.result.toCard = data.eventData.toCard
|
|
|
|
data.result.responseToEvent = data.eventData.responseToEvent
|
|
|
|
end
|
|
|
|
else
|
|
|
|
data.result = Fk:cloneCard('jink')
|
|
|
|
data.result:addSubcards(room:getSubcardsByRule(cardResponded, { Card.Processing }))
|
|
|
|
data.result.skillName = self.name
|
|
|
|
end
|
|
|
|
return true
|
2023-04-15 12:06:24 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2022-03-28 22:24:30 +08:00
|
|
|
local caocao = General:new(extension, "caocao", "wei", 4)
|
2023-01-22 00:49:11 +08:00
|
|
|
caocao:addSkill(jianxiong)
|
2023-04-15 12:06:24 +08:00
|
|
|
caocao:addSkill(hujia)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local guicai = fk.CreateTriggerSkill{
|
|
|
|
name = "guicai",
|
|
|
|
anim_type = "control",
|
|
|
|
events = {fk.AskForRetrial},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return player:hasSkill(self) and not player:isKongcheng()
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_cost = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
local prompt = "#guicai-ask::" .. target.id
|
2024-04-07 00:51:29 +08:00
|
|
|
local card = room:askForCard(player, 1, 1, false, self.name, true, ".|.|.|hand", prompt)
|
|
|
|
if #card > 0 then
|
|
|
|
self.cost_data = card[1]
|
2023-01-29 18:11:41 +08:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
2024-04-07 00:51:29 +08:00
|
|
|
player.room:retrial(Fk:getCardById(self.cost_data), player, data, self.name)
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-01-07 15:20:44 +08:00
|
|
|
local fankui = fk.CreateTriggerSkill{
|
|
|
|
name = "fankui",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "masochism",
|
2023-01-07 15:20:44 +08:00
|
|
|
events = {fk.Damaged},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if target == player and player:hasSkill(self) and data.from and not data.from.dead then
|
2023-07-11 21:15:38 +08:00
|
|
|
if data.from == player then
|
|
|
|
return #player.player_cards[Player.Equip] > 0
|
|
|
|
else
|
|
|
|
return not data.from:isNude()
|
|
|
|
end
|
|
|
|
end
|
2023-01-07 15:20:44 +08:00
|
|
|
end,
|
2023-01-16 21:04:28 +08:00
|
|
|
on_use = function(self, event, target, player, data)
|
2023-01-07 15:20:44 +08:00
|
|
|
local room = player.room
|
2023-02-15 19:54:35 +08:00
|
|
|
local from = data.from
|
2023-08-03 15:26:52 +08:00
|
|
|
local flag = from == player and "e" or "he"
|
2023-07-11 21:15:38 +08:00
|
|
|
local card = room:askForCardChosen(player, from, flag, self.name)
|
|
|
|
room:obtainCard(player.id, card, false, fk.ReasonPrey)
|
2023-01-07 15:20:44 +08:00
|
|
|
end
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local simayi = General:new(extension, "simayi", "wei", 3)
|
2023-01-29 18:11:41 +08:00
|
|
|
simayi:addSkill(guicai)
|
2023-01-07 15:20:44 +08:00
|
|
|
simayi:addSkill(fankui)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local ganglie = fk.CreateTriggerSkill{
|
|
|
|
name = "ganglie",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "masochism",
|
2023-01-22 00:49:11 +08:00
|
|
|
events = {fk.Damaged},
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
2023-02-15 19:54:35 +08:00
|
|
|
local from = data.from
|
2023-07-11 21:15:38 +08:00
|
|
|
if from and not from.dead then room:doIndicate(player.id, {from.id}) end
|
2023-01-22 00:49:11 +08:00
|
|
|
local judge = {
|
2023-02-15 19:54:35 +08:00
|
|
|
who = player,
|
2023-01-22 00:49:11 +08:00
|
|
|
reason = self.name,
|
2023-05-13 13:23:18 +08:00
|
|
|
pattern = ".|.|^heart",
|
2023-01-22 00:49:11 +08:00
|
|
|
}
|
|
|
|
room:judge(judge)
|
2023-07-11 21:15:38 +08:00
|
|
|
if judge.card.suit ~= Card.Heart and from and not from.dead then
|
2023-02-15 19:54:35 +08:00
|
|
|
local discards = room:askForDiscard(from, 2, 2, false, self.name, true)
|
2023-01-22 00:49:11 +08:00
|
|
|
if #discards == 0 then
|
|
|
|
room:damage{
|
2023-02-15 19:54:35 +08:00
|
|
|
from = player,
|
|
|
|
to = from,
|
2023-01-22 00:49:11 +08:00
|
|
|
damage = 1,
|
|
|
|
skillName = self.name,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local xiahoudun = General:new(extension, "xiahoudun", "wei", 4)
|
2023-01-22 00:49:11 +08:00
|
|
|
xiahoudun:addSkill(ganglie)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local tuxi = fk.CreateTriggerSkill{
|
|
|
|
name = "tuxi",
|
|
|
|
anim_type = "control",
|
|
|
|
events = {fk.EventPhaseStart},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and player.phase == Player.Draw and
|
2024-06-10 15:19:47 +08:00
|
|
|
table.find(player.room:getOtherPlayers(player, false), function(p) return not p:isKongcheng() end)
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_cost = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
2024-06-10 15:19:47 +08:00
|
|
|
local targets = table.map(table.filter(room:getOtherPlayers(player, false), function(p)
|
2023-12-09 21:57:47 +08:00
|
|
|
return not p:isKongcheng() end), Util.IdMapper)
|
2023-01-29 18:11:41 +08:00
|
|
|
|
|
|
|
local result = room:askForChoosePlayers(player, targets, 1, 2, "#tuxi-ask", self.name)
|
|
|
|
if #result > 0 then
|
2024-10-22 00:10:53 +08:00
|
|
|
room:sortPlayersByAction(result)
|
|
|
|
self.cost_data = {tos = result}
|
2023-01-29 18:11:41 +08:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
2024-10-22 00:10:53 +08:00
|
|
|
for _, id in ipairs(self.cost_data.tos) do
|
|
|
|
if player.dead then break end
|
2023-01-29 18:11:41 +08:00
|
|
|
local p = room:getPlayerById(id)
|
2024-04-07 00:45:55 +08:00
|
|
|
if not p.dead and not p:isKongcheng() then
|
2023-07-11 21:15:38 +08:00
|
|
|
local c = room:askForCardChosen(player, p, "h", self.name)
|
|
|
|
room:obtainCard(player.id, c, false, fk.ReasonPrey)
|
|
|
|
end
|
2023-01-29 18:11:41 +08:00
|
|
|
end
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local zhangliao = General:new(extension, "zhangliao", "wei", 4)
|
2023-01-29 18:11:41 +08:00
|
|
|
zhangliao:addSkill(tuxi)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local luoyi = fk.CreateTriggerSkill{
|
|
|
|
name = "luoyi",
|
|
|
|
anim_type = "offensive",
|
|
|
|
events = {fk.DrawNCards},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and data.n > 0
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
data.n = data.n - 1
|
|
|
|
end,
|
2023-07-11 21:15:38 +08:00
|
|
|
}
|
|
|
|
local luoyi_trigger = fk.CreateTriggerSkill{
|
|
|
|
name = "#luoyi_trigger",
|
|
|
|
mute = true,
|
|
|
|
events = {fk.DamageCaused},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
|
|
|
return target == player and player:usedSkillTimes("luoyi", Player.HistoryTurn) > 0 and
|
2024-04-19 21:35:29 +08:00
|
|
|
data.card and (data.card.trueName == "slash" or data.card.name == "duel") and data.by_user
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
2023-12-09 21:57:47 +08:00
|
|
|
on_cost = Util.TrueFunc,
|
2023-07-11 21:15:38 +08:00
|
|
|
on_use = function(self, event, target, player, data)
|
2023-01-29 18:11:41 +08:00
|
|
|
local room = player.room
|
2023-08-24 21:37:24 +08:00
|
|
|
player:broadcastSkillInvoke("luoyi")
|
2023-07-11 21:15:38 +08:00
|
|
|
room:notifySkillInvoked(player, "luoyi")
|
2023-01-29 18:11:41 +08:00
|
|
|
data.damage = data.damage + 1
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local xuchu = General:new(extension, "xuchu", "wei", 4)
|
2023-07-11 21:15:38 +08:00
|
|
|
luoyi:addRelatedSkill(luoyi_trigger)
|
2023-01-29 18:11:41 +08:00
|
|
|
xuchu:addSkill(luoyi)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local tiandu = fk.CreateTriggerSkill{
|
|
|
|
name = "tiandu",
|
2023-07-11 21:15:38 +08:00
|
|
|
anim_type = "drawcard",
|
2023-01-29 18:11:41 +08:00
|
|
|
events = {fk.FinishJudge},
|
2023-07-11 21:15:38 +08:00
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and player.room:getCardArea(data.card) == Card.Processing
|
2023-07-11 21:15:38 +08:00
|
|
|
end,
|
2023-01-29 18:11:41 +08:00
|
|
|
on_use = function(self, event, target, player, data)
|
2023-07-11 21:15:38 +08:00
|
|
|
player.room:obtainCard(player.id, data.card, true, fk.ReasonJustMove)
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2024-02-05 11:07:09 +08:00
|
|
|
local yiji_active = fk.CreateActiveSkill{
|
|
|
|
name = "yiji_active",
|
|
|
|
expand_pile = function(self)
|
|
|
|
return type(Self:getMark("yiji_cards")) == "table" and Self:getMark("yiji_cards") or {}
|
|
|
|
end,
|
|
|
|
min_card_num = 1,
|
|
|
|
target_num = 1,
|
|
|
|
card_filter = function(self, to_select, selected, targets)
|
|
|
|
local ids = Self:getMark("yiji_cards")
|
|
|
|
return type(ids) == "table" and table.contains(ids, to_select)
|
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected, selected_cards)
|
|
|
|
return #selected == 0 and to_select ~= Self.id
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local yiji = fk.CreateTriggerSkill{
|
|
|
|
name = "yiji",
|
|
|
|
anim_type = "masochism",
|
|
|
|
events = {fk.Damaged},
|
|
|
|
on_trigger = function(self, event, target, player, data)
|
|
|
|
self.cancel_cost = false
|
2023-12-03 00:21:52 +08:00
|
|
|
for _ = 1, data.damage do
|
|
|
|
if self.cancel_cost or not player:hasSkill(self) then break end
|
2023-01-29 18:11:41 +08:00
|
|
|
self:doCost(event, target, player, data)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_cost = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
if room:askForSkillInvoke(player, self.name, data) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
self.cancel_cost = true
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
2023-08-02 21:39:03 +08:00
|
|
|
local room = player.room
|
|
|
|
local ids = room:getNCards(2)
|
2024-02-05 11:07:09 +08:00
|
|
|
while true do
|
|
|
|
room:setPlayerMark(player, "yiji_cards", ids)
|
|
|
|
local _, ret = room:askForUseActiveSkill(player, "yiji_active", "#yiji-give", true, nil, true)
|
|
|
|
room:setPlayerMark(player, "yiji_cards", 0)
|
|
|
|
if ret then
|
|
|
|
for _, id in ipairs(ret.cards) do
|
|
|
|
table.removeOne(ids, id)
|
2023-08-02 21:39:03 +08:00
|
|
|
end
|
2024-06-10 15:19:47 +08:00
|
|
|
room:moveCardTo(ret.cards, Card.PlayerHand, room:getPlayerById(ret.targets[1]), fk.ReasonGive,
|
|
|
|
self.name, nil, false, player.id, nil, player.id)
|
2024-02-05 11:07:09 +08:00
|
|
|
if #ids == 0 then break end
|
|
|
|
if player.dead then
|
|
|
|
room:moveCards({
|
|
|
|
ids = ids,
|
|
|
|
toArea = Card.DiscardPile,
|
|
|
|
moveReason = fk.ReasonJustMove,
|
|
|
|
skillName = self.name,
|
|
|
|
})
|
|
|
|
break
|
|
|
|
end
|
|
|
|
else
|
|
|
|
room:moveCardTo(ids, Player.Hand, player, fk.ReasonGive, self.name, nil, false, player.id)
|
|
|
|
break
|
2023-08-02 21:39:03 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2022-05-01 18:37:13 +08:00
|
|
|
local guojia = General:new(extension, "guojia", "wei", 3)
|
2023-08-02 21:39:03 +08:00
|
|
|
Fk:addSkill(yiji_active)
|
2023-01-29 18:11:41 +08:00
|
|
|
guojia:addSkill(tiandu)
|
|
|
|
guojia:addSkill(yiji)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local luoshen = fk.CreateTriggerSkill{
|
|
|
|
name = "luoshen",
|
|
|
|
anim_type = "drawcard",
|
|
|
|
events = {fk.EventPhaseStart},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and player.phase == Player.Start
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
while true do
|
|
|
|
local judge = {
|
|
|
|
who = player,
|
|
|
|
reason = self.name,
|
2023-07-11 21:15:38 +08:00
|
|
|
pattern = ".|.|spade,club",
|
2023-01-29 18:11:41 +08:00
|
|
|
}
|
|
|
|
room:judge(judge)
|
2023-08-03 15:26:52 +08:00
|
|
|
if judge.card.color ~= Card.Black or player.dead or not room:askForSkillInvoke(player, self.name) then
|
2023-01-29 18:11:41 +08:00
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2023-08-03 15:26:52 +08:00
|
|
|
local luoshen_obtain = fk.CreateTriggerSkill{
|
|
|
|
name = "#luoshen_obtain",
|
|
|
|
mute = true,
|
|
|
|
frequency = Skill.Compulsory,
|
|
|
|
events = {fk.FinishJudge},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-03 00:21:52 +08:00
|
|
|
return target == player and not player.dead and data.reason == "luoshen" and data.card.color == Card.Black and
|
|
|
|
player.room:getCardArea(data.card) == Card.Processing
|
|
|
|
end,
|
2023-08-03 15:26:52 +08:00
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
player.room:obtainCard(player.id, data.card)
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
luoshen:addRelatedSkill(luoshen_obtain)
|
2023-01-29 18:11:41 +08:00
|
|
|
local qingguo = fk.CreateViewAsSkill{
|
|
|
|
name = "qingguo",
|
|
|
|
anim_type = "defensive",
|
|
|
|
pattern = "jink",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
|
|
|
return Fk:getCardById(to_select).color == Card.Black
|
2023-08-03 15:26:52 +08:00
|
|
|
and Fk:currentRoom():getCardArea(to_select) == Player.Hand
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("jink")
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-29 18:11:41 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
|
|
|
}
|
2023-01-09 19:15:18 +08:00
|
|
|
local zhenji = General:new(extension, "zhenji", "wei", 3, 3, General.Female)
|
2023-01-29 18:11:41 +08:00
|
|
|
zhenji:addSkill(luoshen)
|
|
|
|
zhenji:addSkill(qingguo)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local rende = fk.CreateActiveSkill{
|
|
|
|
name = "rende",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#rende-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "support",
|
|
|
|
card_filter = function(self, to_select, selected)
|
2023-08-02 21:50:47 +08:00
|
|
|
return Fk:currentRoom():getCardArea(to_select) == Card.PlayerHand
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected)
|
|
|
|
return #selected == 0 and to_select ~= Self.id
|
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 1,
|
|
|
|
min_card_num = 1,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2023-01-29 18:11:41 +08:00
|
|
|
local target = room:getPlayerById(effect.tos[1])
|
|
|
|
local player = room:getPlayerById(effect.from)
|
|
|
|
local cards = effect.cards
|
2023-07-11 21:15:38 +08:00
|
|
|
local marks = player:getMark("_rende_cards-phase")
|
2023-08-02 21:50:47 +08:00
|
|
|
room:moveCardTo(cards, Player.Hand, target, fk.ReasonGive, self.name, nil, false, player.id)
|
2023-07-11 21:15:38 +08:00
|
|
|
room:addPlayerMark(player, "_rende_cards-phase", #cards)
|
2023-12-03 00:21:52 +08:00
|
|
|
if marks < 2 and marks + #cards >= 2 and not player.dead and player:isWounded() then
|
2023-01-29 18:11:41 +08:00
|
|
|
room:recover{
|
2023-02-15 19:54:35 +08:00
|
|
|
who = player,
|
2023-01-29 18:11:41 +08:00
|
|
|
num = 1,
|
2023-07-11 21:15:38 +08:00
|
|
|
recoverBy = player,
|
2023-01-29 18:11:41 +08:00
|
|
|
skillName = self.name
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2023-04-15 12:06:24 +08:00
|
|
|
|
|
|
|
local jijiang = fk.CreateViewAsSkill{
|
|
|
|
name = "jijiang$",
|
|
|
|
anim_type = "offensive",
|
|
|
|
pattern = "slash",
|
2023-12-09 21:57:47 +08:00
|
|
|
card_filter = Util.FalseFunc,
|
2023-04-15 12:06:24 +08:00
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 0 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("slash")
|
|
|
|
c.skillName = self.name
|
|
|
|
return c
|
|
|
|
end,
|
2023-12-10 18:55:16 +08:00
|
|
|
before_use = function(self, player, use)
|
2023-04-15 12:06:24 +08:00
|
|
|
local room = player.room
|
2023-12-10 18:55:16 +08:00
|
|
|
if use.tos then
|
|
|
|
room:doIndicate(player.id, TargetGroup:getRealTargets(use.tos))
|
|
|
|
end
|
|
|
|
|
2023-04-15 12:06:24 +08:00
|
|
|
for _, p in ipairs(room:getOtherPlayers(player)) do
|
|
|
|
if p.kingdom == "shu" then
|
2023-07-14 22:17:54 +08:00
|
|
|
local cardResponded = room:askForResponse(p, "slash", "slash", "#jijiang-ask:" .. player.id, true)
|
2023-04-15 12:06:24 +08:00
|
|
|
if cardResponded then
|
|
|
|
room:responseCard({
|
|
|
|
from = p.id,
|
|
|
|
card = cardResponded,
|
|
|
|
skipDrop = true,
|
|
|
|
})
|
|
|
|
|
2023-12-10 18:55:16 +08:00
|
|
|
use.card = cardResponded
|
|
|
|
return
|
2023-04-15 12:06:24 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-10-07 03:22:57 +08:00
|
|
|
room:setPlayerMark(player, "jijiang-failed-phase", 1)
|
2023-12-10 18:55:16 +08:00
|
|
|
return self.name
|
2023-04-15 12:06:24 +08:00
|
|
|
end,
|
2023-12-10 18:55:16 +08:00
|
|
|
enabled_at_play = function(self, player)
|
|
|
|
return player:getMark("jijiang-failed-phase") == 0 and not table.every(Fk:currentRoom().alive_players, function(p)
|
|
|
|
return p == player or p.kingdom ~= "shu"
|
|
|
|
end)
|
2023-04-15 12:06:24 +08:00
|
|
|
end,
|
2023-12-10 18:55:16 +08:00
|
|
|
enabled_at_response = function(self, player)
|
|
|
|
return not table.every(Fk:currentRoom().alive_players, function(p)
|
|
|
|
return p == player or p.kingdom ~= "shu"
|
|
|
|
end)
|
2023-04-15 12:06:24 +08:00
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2022-03-28 22:24:30 +08:00
|
|
|
local liubei = General:new(extension, "liubei", "shu", 4)
|
2023-01-29 18:11:41 +08:00
|
|
|
liubei:addSkill(rende)
|
2023-04-15 12:06:24 +08:00
|
|
|
liubei:addSkill(jijiang)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-16 19:13:07 +08:00
|
|
|
local wusheng = fk.CreateViewAsSkill{
|
|
|
|
name = "wusheng",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "offensive",
|
2023-01-16 19:13:07 +08:00
|
|
|
pattern = "slash",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
|
|
|
return Fk:getCardById(to_select).color == Card.Red
|
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("slash")
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-16 19:13:07 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local guanyu = General:new(extension, "guanyu", "shu", 4)
|
2023-01-16 19:13:07 +08:00
|
|
|
guanyu:addSkill(wusheng)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local paoxiaoAudio = fk.CreateTriggerSkill{
|
|
|
|
name = "#paoxiaoAudio",
|
2023-08-24 21:37:06 +08:00
|
|
|
visible = false,
|
2023-01-29 18:11:41 +08:00
|
|
|
refresh_events = {fk.CardUsing},
|
|
|
|
can_refresh = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and
|
2023-03-07 10:21:56 +08:00
|
|
|
data.card.trueName == "slash" and
|
2023-01-29 18:11:41 +08:00
|
|
|
player:usedCardTimes("slash") > 1
|
|
|
|
end,
|
|
|
|
on_refresh = function(self, event, target, player, data)
|
2023-08-24 21:37:24 +08:00
|
|
|
player:broadcastSkillInvoke("paoxiao")
|
2023-01-29 18:11:41 +08:00
|
|
|
player.room:doAnimate("InvokeSkill", {
|
|
|
|
name = "paoxiao",
|
|
|
|
player = player.id,
|
|
|
|
skill_type = "offensive",
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
local paoxiao = fk.CreateTargetModSkill{
|
|
|
|
name = "paoxiao",
|
2023-08-24 21:37:06 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-06-20 13:37:03 +08:00
|
|
|
bypass_times = function(self, player, skill, scope)
|
2023-12-09 21:57:47 +08:00
|
|
|
if player:hasSkill(self) and skill.trueName == "slash_skill"
|
2023-01-29 18:11:41 +08:00
|
|
|
and scope == Player.HistoryPhase then
|
2023-06-19 00:20:50 +08:00
|
|
|
return true
|
2023-01-29 18:11:41 +08:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
paoxiao:addRelatedSkill(paoxiaoAudio)
|
2022-03-28 22:24:30 +08:00
|
|
|
local zhangfei = General:new(extension, "zhangfei", "shu", 4)
|
2023-01-29 18:11:41 +08:00
|
|
|
zhangfei:addSkill(paoxiao)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local guanxing = fk.CreateTriggerSkill{
|
|
|
|
name = "guanxing",
|
|
|
|
anim_type = "control",
|
|
|
|
events = {fk.EventPhaseStart},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and
|
2023-01-29 18:11:41 +08:00
|
|
|
player.phase == Player.Start
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
room:askForGuanxing(player, room:getNCards(math.min(5, #room.alive_players)))
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
local kongchengAudio = fk.CreateTriggerSkill{
|
|
|
|
name = "#kongchengAudio",
|
|
|
|
refresh_events = {fk.AfterCardsMove},
|
|
|
|
can_refresh = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if not player:hasSkill(self) then return end
|
2023-01-29 18:11:41 +08:00
|
|
|
if not player:isKongcheng() then return end
|
|
|
|
for _, move in ipairs(data) do
|
|
|
|
if move.from == player.id then
|
|
|
|
for _, info in ipairs(move.moveInfo) do
|
|
|
|
if info.fromArea == Card.PlayerHand then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_refresh = function(self, event, target, player, data)
|
2023-08-24 21:37:24 +08:00
|
|
|
player:broadcastSkillInvoke("kongcheng")
|
2023-07-11 21:15:38 +08:00
|
|
|
player.room:notifySkillInvoked(player, "kongcheng", "defensive")
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-01-22 00:49:11 +08:00
|
|
|
local kongcheng = fk.CreateProhibitSkill{
|
|
|
|
name = "kongcheng",
|
2023-06-11 12:45:12 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-01-22 00:49:11 +08:00
|
|
|
is_prohibited = function(self, from, to, card)
|
2023-12-09 21:57:47 +08:00
|
|
|
if to:hasSkill(self) and to:isKongcheng() then
|
2023-07-11 21:15:38 +08:00
|
|
|
return card.trueName == "slash" or card.trueName == "duel"
|
2023-01-22 00:49:11 +08:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
kongcheng:addRelatedSkill(kongchengAudio)
|
2022-03-28 22:24:30 +08:00
|
|
|
local zhugeliang = General:new(extension, "zhugeliang", "shu", 3)
|
2023-01-29 18:11:41 +08:00
|
|
|
zhugeliang:addSkill(guanxing)
|
2023-01-22 00:49:11 +08:00
|
|
|
zhugeliang:addSkill(kongcheng)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local longdan = fk.CreateViewAsSkill{
|
|
|
|
name = "longdan",
|
|
|
|
pattern = "slash,jink",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
2023-05-13 13:23:18 +08:00
|
|
|
local _c = Fk:getCardById(to_select)
|
|
|
|
local c
|
|
|
|
if _c.trueName == "slash" then
|
|
|
|
c = Fk:cloneCard("jink")
|
|
|
|
elseif _c.name == "jink" then
|
|
|
|
c = Fk:cloneCard("slash")
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
2023-08-25 08:11:25 +08:00
|
|
|
return (Fk.currentResponsePattern == nil and Self:canUse(c)) or (Fk.currentResponsePattern and Exppattern:Parse(Fk.currentResponsePattern):match(c))
|
2023-01-22 00:49:11 +08:00
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local _c = Fk:getCardById(cards[1])
|
|
|
|
local c
|
2023-03-07 10:21:56 +08:00
|
|
|
if _c.trueName == "slash" then
|
2023-01-22 00:49:11 +08:00
|
|
|
c = Fk:cloneCard("jink")
|
|
|
|
elseif _c.name == "jink" then
|
|
|
|
c = Fk:cloneCard("slash")
|
|
|
|
end
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-22 00:49:11 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local zhaoyun = General:new(extension, "zhaoyun", "shu", 4)
|
2023-01-22 00:49:11 +08:00
|
|
|
zhaoyun:addSkill(longdan)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-04 14:21:29 +08:00
|
|
|
local mashu = fk.CreateDistanceSkill{
|
|
|
|
name = "mashu",
|
2023-06-11 12:45:12 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-01-04 14:21:29 +08:00
|
|
|
correct_func = function(self, from, to)
|
2023-12-09 21:57:47 +08:00
|
|
|
if from:hasSkill(self) then
|
2023-01-04 14:21:29 +08:00
|
|
|
return -1
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local tieqi = fk.CreateTriggerSkill{
|
|
|
|
name = "tieqi",
|
|
|
|
anim_type = "offensive",
|
|
|
|
events = {fk.TargetSpecified},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and
|
2023-03-07 10:21:56 +08:00
|
|
|
data.card.trueName == "slash"
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
|
|
|
local judge = {
|
|
|
|
who = player,
|
|
|
|
reason = self.name,
|
|
|
|
pattern = ".|.|heart,diamond",
|
|
|
|
}
|
|
|
|
room:judge(judge)
|
|
|
|
if judge.card.color == Card.Red then
|
|
|
|
data.disresponsive = true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local machao = General:new(extension, "machao", "shu", 4)
|
2023-01-04 14:21:29 +08:00
|
|
|
machao:addSkill(mashu)
|
2023-01-29 18:11:41 +08:00
|
|
|
machao:addSkill(tieqi)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local jizhi = fk.CreateTriggerSkill{
|
|
|
|
name = "jizhi",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "drawcard",
|
2023-01-22 00:49:11 +08:00
|
|
|
events = {fk.CardUsing},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self) and data.card:isCommonTrick() and
|
2023-08-25 08:11:25 +08:00
|
|
|
(not data.card:isVirtual() or #data.card.subcards == 0)
|
2023-01-22 00:49:11 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
player:drawCards(1, self.name)
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local qicai = fk.CreateTargetModSkill{
|
|
|
|
name = "qicai",
|
2023-06-11 12:45:12 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-07-11 21:15:38 +08:00
|
|
|
bypass_distances = function(self, player, skill, card)
|
2023-12-09 21:57:47 +08:00
|
|
|
return player:hasSkill(self) and card and card.type == Card.TypeTrick
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-01-09 19:15:18 +08:00
|
|
|
local huangyueying = General:new(extension, "huangyueying", "shu", 3, 3, General.Female)
|
2023-01-22 00:49:11 +08:00
|
|
|
huangyueying:addSkill(jizhi)
|
2023-01-29 18:11:41 +08:00
|
|
|
huangyueying:addSkill(qicai)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2022-09-14 13:01:10 +08:00
|
|
|
local zhiheng = fk.CreateActiveSkill{
|
|
|
|
name = "zhiheng",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#zhiheng-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "drawcard",
|
|
|
|
can_use = function(self, player)
|
2023-07-11 21:15:38 +08:00
|
|
|
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 0,
|
|
|
|
min_card_num = 1,
|
2023-12-09 21:57:47 +08:00
|
|
|
card_filter = function(self, to_select)
|
|
|
|
return not Self:prohibitDiscard(Fk:getCardById(to_select))
|
|
|
|
end,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2022-12-20 12:51:54 +08:00
|
|
|
local from = room:getPlayerById(effect.from)
|
2023-07-11 21:15:38 +08:00
|
|
|
room:throwCard(effect.cards, self.name, from, from)
|
2023-12-03 00:21:52 +08:00
|
|
|
if from:isAlive() then
|
|
|
|
from:drawCards(#effect.cards, self.name)
|
|
|
|
end
|
|
|
|
end,
|
2022-09-14 13:01:10 +08:00
|
|
|
}
|
2023-04-15 12:06:24 +08:00
|
|
|
|
|
|
|
local jiuyuan = fk.CreateTriggerSkill{
|
|
|
|
name = "jiuyuan$",
|
|
|
|
anim_type = "support",
|
2023-06-04 19:39:20 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-04-15 12:06:24 +08:00
|
|
|
events = {fk.PreHpRecover},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
|
|
|
return
|
|
|
|
target == player and
|
2023-12-09 21:57:47 +08:00
|
|
|
player:hasSkill(self) and
|
2023-04-15 12:06:24 +08:00
|
|
|
data.card and
|
|
|
|
data.card.trueName == "peach" and
|
|
|
|
data.recoverBy and
|
|
|
|
data.recoverBy.kingdom == "wu" and
|
|
|
|
data.recoverBy ~= player
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
data.num = data.num + 1
|
|
|
|
end,
|
|
|
|
}
|
|
|
|
|
2022-03-28 22:24:30 +08:00
|
|
|
local sunquan = General:new(extension, "sunquan", "wu", 4)
|
2022-09-14 13:01:10 +08:00
|
|
|
sunquan:addSkill(zhiheng)
|
2023-04-15 12:06:24 +08:00
|
|
|
sunquan:addSkill(jiuyuan)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local qixi = fk.CreateViewAsSkill{
|
|
|
|
name = "qixi",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "control",
|
2023-01-22 00:49:11 +08:00
|
|
|
pattern = "dismantlement",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
|
|
|
return Fk:getCardById(to_select).color == Card.Black
|
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("dismantlement")
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-22 00:49:11 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
2024-04-07 00:45:55 +08:00
|
|
|
enabled_at_response = function (self, player, response)
|
|
|
|
return not response
|
|
|
|
end
|
2023-01-22 00:49:11 +08:00
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local ganning = General:new(extension, "ganning", "wu", 4)
|
2023-01-22 00:49:11 +08:00
|
|
|
ganning:addSkill(qixi)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local keji = fk.CreateTriggerSkill{
|
|
|
|
name = "keji",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "defensive",
|
2023-01-22 00:49:11 +08:00
|
|
|
events = {fk.EventPhaseChanging},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if target == player and player:hasSkill(self) and data.to == Player.Discard then
|
2023-12-03 00:21:52 +08:00
|
|
|
local room = player.room
|
2024-04-02 00:56:04 +08:00
|
|
|
local play_ids = {}
|
|
|
|
player.room.logic:getEventsOfScope(GameEvent.Phase, 1, function (e)
|
|
|
|
if e.data[2] == Player.Play and e.end_id then
|
|
|
|
table.insert(play_ids, {e.id, e.end_id})
|
2023-12-03 00:21:52 +08:00
|
|
|
end
|
2024-04-02 00:56:04 +08:00
|
|
|
return false
|
|
|
|
end, Player.HistoryTurn)
|
|
|
|
if #play_ids == 0 then return true end
|
|
|
|
local function PlayCheck (e)
|
|
|
|
local in_play = false
|
|
|
|
for _, ids in ipairs(play_ids) do
|
|
|
|
if e.id > ids[1] and e.id < ids[2] then
|
|
|
|
in_play = true
|
|
|
|
break
|
|
|
|
end
|
2023-12-03 00:21:52 +08:00
|
|
|
end
|
2024-04-02 00:56:04 +08:00
|
|
|
return in_play and e.data[1].from == player.id and e.data[1].card.trueName == "slash"
|
2023-12-03 00:21:52 +08:00
|
|
|
end
|
2024-04-02 00:56:04 +08:00
|
|
|
return #player.room.logic:getEventsOfScope(GameEvent.UseCard, 1, PlayCheck, Player.HistoryTurn) == 0
|
|
|
|
and #player.room.logic:getEventsOfScope(GameEvent.RespondCard, 1, PlayCheck, Player.HistoryTurn) == 0
|
2023-12-03 00:21:52 +08:00
|
|
|
end
|
2023-01-22 00:49:11 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local lvmeng = General:new(extension, "lvmeng", "wu", 4)
|
2023-01-22 00:49:11 +08:00
|
|
|
lvmeng:addSkill(keji)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-08 14:57:42 +08:00
|
|
|
local kurou = fk.CreateActiveSkill{
|
|
|
|
name = "kurou",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#kurou-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "drawcard",
|
2024-06-10 15:19:47 +08:00
|
|
|
card_filter = Util.FalseFunc,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2023-01-08 14:57:42 +08:00
|
|
|
local from = room:getPlayerById(effect.from)
|
|
|
|
room:loseHp(from, 1, self.name)
|
2023-01-08 15:05:52 +08:00
|
|
|
if from:isAlive() then
|
2023-07-11 21:15:38 +08:00
|
|
|
from:drawCards(2, self.name)
|
2023-01-08 15:05:52 +08:00
|
|
|
end
|
2023-01-08 14:57:42 +08:00
|
|
|
end
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local huanggai = General:new(extension, "huanggai", "wu", 4)
|
2023-01-08 14:57:42 +08:00
|
|
|
huanggai:addSkill(kurou)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local yingzi = fk.CreateTriggerSkill{
|
|
|
|
name = "yingzi",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "drawcard",
|
2023-01-22 00:49:11 +08:00
|
|
|
events = {fk.DrawNCards},
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
data.n = data.n + 1
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local fanjian = fk.CreateActiveSkill{
|
|
|
|
name = "fanjian",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#fanjian-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
can_use = function(self, player)
|
2023-12-03 00:21:52 +08:00
|
|
|
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
2024-04-07 00:45:55 +08:00
|
|
|
card_filter = Util.FalseFunc,
|
2023-01-29 18:11:41 +08:00
|
|
|
target_filter = function(self, to_select, selected)
|
|
|
|
return #selected == 0 and to_select ~= Self.id
|
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 1,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2023-01-29 18:11:41 +08:00
|
|
|
local player = room:getPlayerById(effect.from)
|
|
|
|
local target = room:getPlayerById(effect.tos[1])
|
|
|
|
local choice = room:askForChoice(target, {"spade", "heart", "club", "diamond"}, self.name)
|
|
|
|
local card = room:askForCardChosen(target, player, 'h', self.name)
|
2023-07-11 21:15:38 +08:00
|
|
|
room:obtainCard(target.id, card, true, fk.ReasonPrey)
|
2023-12-03 00:21:52 +08:00
|
|
|
if Fk:getCardById(card):getSuitString() ~= choice and target:isAlive() then
|
2023-01-29 18:11:41 +08:00
|
|
|
room:damage{
|
2023-02-15 19:54:35 +08:00
|
|
|
from = player,
|
|
|
|
to = target,
|
2023-01-29 18:11:41 +08:00
|
|
|
damage = 1,
|
|
|
|
skillName = self.name,
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local zhouyu = General:new(extension, "zhouyu", "wu", 3)
|
2023-01-22 00:49:11 +08:00
|
|
|
zhouyu:addSkill(yingzi)
|
2023-01-29 18:11:41 +08:00
|
|
|
zhouyu:addSkill(fanjian)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local guose = fk.CreateViewAsSkill{
|
|
|
|
name = "guose",
|
|
|
|
anim_type = "control",
|
|
|
|
pattern = "indulgence",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
|
|
|
return Fk:getCardById(to_select).suit == Card.Diamond
|
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("indulgence")
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-29 18:11:41 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
2024-04-07 00:45:55 +08:00
|
|
|
enabled_at_response = function (self, player, response)
|
|
|
|
return not response
|
|
|
|
end
|
2023-01-29 18:11:41 +08:00
|
|
|
}
|
|
|
|
local liuli = fk.CreateTriggerSkill{
|
|
|
|
name = "liuli",
|
|
|
|
anim_type = "defensive",
|
|
|
|
events = {fk.TargetConfirming},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
local ret = target == player and player:hasSkill(self) and
|
2023-03-07 10:21:56 +08:00
|
|
|
data.card.trueName == "slash"
|
2023-01-29 18:11:41 +08:00
|
|
|
if ret then
|
|
|
|
local room = player.room
|
2023-08-02 21:50:47 +08:00
|
|
|
local from = room:getPlayerById(data.from)
|
|
|
|
for _, p in ipairs(room.alive_players) do
|
|
|
|
if p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and not from:isProhibited(p, data.card) then
|
|
|
|
return true
|
2023-01-29 18:11:41 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_cost = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
2023-02-26 15:01:14 +08:00
|
|
|
local prompt = "#liuli-target"
|
2023-08-02 21:50:47 +08:00
|
|
|
local targets = {}
|
|
|
|
local from = room:getPlayerById(data.from)
|
|
|
|
for _, p in ipairs(room.alive_players) do
|
|
|
|
if p ~= player and p.id ~= data.from and player:inMyAttackRange(p) and not from:isProhibited(p, data.card) then
|
|
|
|
table.insert(targets, p.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if #targets == 0 then return false end
|
|
|
|
local plist, cid = room:askForChooseCardAndPlayers(player, targets, 1, 1, nil, prompt, self.name, true)
|
2023-02-26 15:01:14 +08:00
|
|
|
if #plist > 0 then
|
|
|
|
self.cost_data = {plist[1], cid}
|
2023-01-29 18:11:41 +08:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
local room = player.room
|
2023-02-26 15:01:14 +08:00
|
|
|
local to = self.cost_data[1]
|
|
|
|
room:doIndicate(player.id, { to })
|
|
|
|
room:throwCard(self.cost_data[2], self.name, player, player)
|
2023-12-03 00:21:52 +08:00
|
|
|
AimGroup:cancelTarget(data, player.id)
|
|
|
|
AimGroup:addTargets(room, data, to)
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-01-09 19:15:18 +08:00
|
|
|
local daqiao = General:new(extension, "daqiao", "wu", 3, 3, General.Female)
|
2023-01-29 18:11:41 +08:00
|
|
|
daqiao:addSkill(guose)
|
|
|
|
daqiao:addSkill(liuli)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-22 00:49:11 +08:00
|
|
|
local qianxun = fk.CreateProhibitSkill{
|
|
|
|
name = "qianxun",
|
2023-06-11 12:45:12 +08:00
|
|
|
frequency = Skill.Compulsory,
|
2023-01-22 00:49:11 +08:00
|
|
|
is_prohibited = function(self, from, to, card)
|
2023-12-09 21:57:47 +08:00
|
|
|
if to:hasSkill(self) then
|
2023-01-22 00:49:11 +08:00
|
|
|
return card.name == "indulgence" or card.name == "snatch"
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local lianying = fk.CreateTriggerSkill{
|
|
|
|
name = "lianying",
|
|
|
|
anim_type = "drawcard",
|
|
|
|
events = {fk.AfterCardsMove},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if not player:hasSkill(self) then return end
|
2023-01-29 18:11:41 +08:00
|
|
|
if not player:isKongcheng() then return end
|
|
|
|
for _, move in ipairs(data) do
|
|
|
|
if move.from == player.id then
|
|
|
|
for _, info in ipairs(move.moveInfo) do
|
|
|
|
if info.fromArea == Card.PlayerHand then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
player:drawCards(1, self.name)
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local luxun = General:new(extension, "luxun", "wu", 3)
|
2023-01-22 00:49:11 +08:00
|
|
|
luxun:addSkill(qianxun)
|
2023-01-29 18:11:41 +08:00
|
|
|
luxun:addSkill(lianying)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local xiaoji = fk.CreateTriggerSkill{
|
|
|
|
name = "xiaoji",
|
|
|
|
anim_type = "drawcard",
|
|
|
|
events = {fk.AfterCardsMove},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if not player:hasSkill(self) then return end
|
2023-01-29 18:11:41 +08:00
|
|
|
for _, move in ipairs(data) do
|
|
|
|
if move.from == player.id then
|
|
|
|
for _, info in ipairs(move.moveInfo) do
|
|
|
|
if info.fromArea == Card.PlayerEquip then
|
2023-08-03 15:26:52 +08:00
|
|
|
return true
|
2023-01-29 18:11:41 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_trigger = function(self, event, target, player, data)
|
2023-08-03 15:26:52 +08:00
|
|
|
local i = 0
|
|
|
|
for _, move in ipairs(data) do
|
|
|
|
if move.from == player.id then
|
|
|
|
for _, info in ipairs(move.moveInfo) do
|
|
|
|
if info.fromArea == Card.PlayerEquip then
|
|
|
|
i = i + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2023-01-29 18:11:41 +08:00
|
|
|
end
|
2023-08-03 15:26:52 +08:00
|
|
|
self.cancel_cost = false
|
2023-12-03 00:21:52 +08:00
|
|
|
for _ = 1, i do
|
|
|
|
if self.cancel_cost or not player:hasSkill(self) then break end
|
2023-08-03 15:26:52 +08:00
|
|
|
self:doCost(event, target, player, data)
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_cost = function(self, event, target, player, data)
|
|
|
|
if player.room:askForSkillInvoke(player, self.name) then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
self.cancel_cost = true
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
player:drawCards(2, self.name)
|
|
|
|
end,
|
|
|
|
}
|
2023-01-09 19:15:18 +08:00
|
|
|
local jieyin = fk.CreateActiveSkill{
|
|
|
|
name = "jieyin",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#jieyin-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "support",
|
|
|
|
can_use = function(self, player)
|
2023-07-11 21:15:38 +08:00
|
|
|
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
2023-01-09 19:15:18 +08:00
|
|
|
card_filter = function(self, to_select, selected)
|
2023-12-09 21:57:47 +08:00
|
|
|
return #selected < 2 and Fk:currentRoom():getCardArea(to_select) == Player.Hand and not Self:prohibitDiscard(Fk:getCardById(to_select))
|
2023-01-09 19:15:18 +08:00
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected)
|
|
|
|
local target = Fk:currentRoom():getPlayerById(to_select)
|
2024-04-07 00:45:55 +08:00
|
|
|
return target:isWounded() and target:isMale() and #selected < 1 and to_select ~= Self.id
|
2023-01-09 19:15:18 +08:00
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 1,
|
|
|
|
card_num = 2,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2023-01-09 19:15:18 +08:00
|
|
|
local from = room:getPlayerById(effect.from)
|
2023-12-03 00:21:52 +08:00
|
|
|
local target = room:getPlayerById(effect.tos[1])
|
2023-07-11 21:15:38 +08:00
|
|
|
room:throwCard(effect.cards, self.name, from, from)
|
2023-12-03 00:21:52 +08:00
|
|
|
if target:isAlive() and target:isWounded() then
|
|
|
|
room:recover({
|
|
|
|
who = room:getPlayerById(effect.tos[1]),
|
|
|
|
num = 1,
|
|
|
|
recoverBy = from,
|
|
|
|
skillName = self.name
|
|
|
|
})
|
|
|
|
end
|
|
|
|
if from:isAlive() and from:isWounded() then
|
2023-01-09 19:15:18 +08:00
|
|
|
room:recover({
|
2023-08-03 15:26:52 +08:00
|
|
|
who = from,
|
2023-01-09 19:15:18 +08:00
|
|
|
num = 1,
|
2023-08-03 15:26:52 +08:00
|
|
|
recoverBy = from,
|
2023-01-09 19:15:18 +08:00
|
|
|
skillName = self.name
|
|
|
|
})
|
|
|
|
end
|
2023-08-02 21:50:47 +08:00
|
|
|
end
|
2023-01-09 19:15:18 +08:00
|
|
|
}
|
|
|
|
local sunshangxiang = General:new(extension, "sunshangxiang", "wu", 3, 3, General.Female)
|
2023-01-29 18:11:41 +08:00
|
|
|
sunshangxiang:addSkill(xiaoji)
|
2023-01-09 19:15:18 +08:00
|
|
|
sunshangxiang:addSkill(jieyin)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-01-29 18:11:41 +08:00
|
|
|
local qingnang = fk.CreateActiveSkill{
|
|
|
|
name = "qingnang",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#qingnang-active",
|
2023-01-29 18:11:41 +08:00
|
|
|
anim_type = "support",
|
|
|
|
can_use = function(self, player)
|
2023-07-11 21:15:38 +08:00
|
|
|
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
card_filter = function(self, to_select, selected, targets)
|
2023-12-03 00:21:52 +08:00
|
|
|
return #selected == 0 and Fk:currentRoom():getCardArea(to_select) == Player.Hand and
|
|
|
|
not Self:prohibitDiscard(Fk:getCardById(to_select))
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected, cards)
|
|
|
|
return #selected == 0 and Fk:currentRoom():getPlayerById(to_select):isWounded()
|
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 1,
|
|
|
|
card_num = 1,
|
2023-02-15 19:54:35 +08:00
|
|
|
on_use = function(self, room, effect)
|
2023-01-29 18:11:41 +08:00
|
|
|
local from = room:getPlayerById(effect.from)
|
2024-04-02 00:56:04 +08:00
|
|
|
local to = room:getPlayerById(effect.tos[1])
|
2024-06-10 15:19:47 +08:00
|
|
|
room:throwCard(effect.cards, self.name, from, from)
|
2024-04-02 00:56:04 +08:00
|
|
|
if to:isAlive() and to:isWounded() then
|
2023-12-03 00:21:52 +08:00
|
|
|
room:recover({
|
2024-04-02 00:56:04 +08:00
|
|
|
who = to,
|
2023-12-03 00:21:52 +08:00
|
|
|
num = 1,
|
|
|
|
recoverBy = from,
|
|
|
|
skillName = self.name
|
|
|
|
})
|
|
|
|
end
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
|
|
|
local jijiu = fk.CreateViewAsSkill{
|
|
|
|
name = "jijiu",
|
|
|
|
anim_type = "support",
|
|
|
|
pattern = "peach",
|
|
|
|
card_filter = function(self, to_select, selected)
|
|
|
|
if #selected == 1 then return false end
|
|
|
|
return Fk:getCardById(to_select).color == Card.Red
|
|
|
|
end,
|
|
|
|
view_as = function(self, cards)
|
|
|
|
if #cards ~= 1 then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
local c = Fk:cloneCard("peach")
|
2023-04-02 12:56:29 +08:00
|
|
|
c.skillName = self.name
|
2023-01-29 18:11:41 +08:00
|
|
|
c:addSubcard(cards[1])
|
|
|
|
return c
|
|
|
|
end,
|
2024-04-07 00:45:55 +08:00
|
|
|
enabled_at_play = Util.FalseFunc,
|
|
|
|
enabled_at_response = function(self, player, res)
|
|
|
|
return player.phase == Player.NotActive and not res
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local huatuo = General:new(extension, "huatuo", "qun", 3)
|
2023-01-29 18:11:41 +08:00
|
|
|
huatuo:addSkill(qingnang)
|
|
|
|
huatuo:addSkill(jijiu)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-03-06 01:07:54 +08:00
|
|
|
local wushuang = fk.CreateTriggerSkill{
|
|
|
|
name = "wushuang",
|
|
|
|
anim_type = "offensive",
|
|
|
|
frequency = Skill.Compulsory,
|
|
|
|
events = {fk.TargetSpecified, fk.TargetConfirmed},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
if not player:hasSkill(self) then
|
2023-03-06 01:07:54 +08:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
if event == fk.TargetSpecified then
|
2023-05-26 20:53:26 +08:00
|
|
|
return target == player and table.contains({ "slash", "duel" }, data.card.trueName)
|
2023-03-06 01:07:54 +08:00
|
|
|
else
|
2023-07-11 21:15:38 +08:00
|
|
|
return data.to == player.id and data.card.trueName == "duel"
|
2023-03-06 01:07:54 +08:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
|
|
|
data.fixedResponseTimes = data.fixedResponseTimes or {}
|
2023-03-07 10:21:56 +08:00
|
|
|
if data.card.trueName == "slash" then
|
2023-03-06 01:07:54 +08:00
|
|
|
data.fixedResponseTimes["jink"] = 2
|
|
|
|
else
|
|
|
|
data.fixedResponseTimes["slash"] = 2
|
|
|
|
data.fixedAddTimesResponsors = data.fixedAddTimesResponsors or {}
|
|
|
|
table.insert(data.fixedAddTimesResponsors, (event == fk.TargetSpecified and data.to or data.from))
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
}
|
2022-03-28 22:24:30 +08:00
|
|
|
local lvbu = General:new(extension, "lvbu", "qun", 4)
|
2023-03-06 01:07:54 +08:00
|
|
|
lvbu:addSkill(wushuang)
|
2022-03-28 22:24:30 +08:00
|
|
|
|
2023-02-21 13:44:24 +08:00
|
|
|
local lijian = fk.CreateActiveSkill{
|
|
|
|
name = "lijian",
|
2024-06-10 15:19:47 +08:00
|
|
|
prompt = "#lijian-active",
|
2023-02-21 13:44:24 +08:00
|
|
|
anim_type = "offensive",
|
|
|
|
can_use = function(self, player)
|
2023-07-11 21:15:38 +08:00
|
|
|
return player:usedSkillTimes(self.name, Player.HistoryPhase) == 0
|
2023-02-21 13:44:24 +08:00
|
|
|
end,
|
|
|
|
card_filter = function(self, to_select, selected)
|
2023-12-03 00:21:52 +08:00
|
|
|
return #selected == 0 and not Self:prohibitDiscard(Fk:getCardById(to_select))
|
2023-02-21 13:44:24 +08:00
|
|
|
end,
|
|
|
|
target_filter = function(self, to_select, selected)
|
2023-12-03 00:21:52 +08:00
|
|
|
if #selected < 2 and to_select ~= Self.id then
|
2024-06-10 15:19:47 +08:00
|
|
|
local target = Fk:currentRoom():getPlayerById(to_select)
|
|
|
|
return target:isMale() and (#selected == 0 or
|
|
|
|
target:canUseTo(Fk:cloneCard("duel"), Fk:currentRoom():getPlayerById(selected[1])))
|
2023-12-03 00:21:52 +08:00
|
|
|
end
|
2023-02-21 13:44:24 +08:00
|
|
|
end,
|
2023-02-26 15:01:14 +08:00
|
|
|
target_num = 2,
|
|
|
|
min_card_num = 1,
|
2023-02-21 13:44:24 +08:00
|
|
|
on_use = function(self, room, use)
|
2023-07-11 21:15:38 +08:00
|
|
|
local player = room:getPlayerById(use.from)
|
|
|
|
room:throwCard(use.cards, self.name, player, player)
|
2023-02-21 13:44:24 +08:00
|
|
|
local duel = Fk:cloneCard("duel")
|
2023-04-02 12:56:29 +08:00
|
|
|
duel.skillName = self.name
|
2023-07-11 21:15:38 +08:00
|
|
|
local new_use = { ---@type CardUseStruct
|
|
|
|
from = use.tos[2],
|
|
|
|
tos = { { use.tos[1] } },
|
|
|
|
card = duel,
|
|
|
|
prohibitedCardNames = { "nullification" },
|
|
|
|
}
|
2023-02-21 13:44:24 +08:00
|
|
|
room:useCard(new_use)
|
|
|
|
end,
|
2024-11-09 19:27:41 +08:00
|
|
|
target_tip = function(self, to_select, selected, _, __, selectable, ____)
|
|
|
|
if not selectable then return end
|
|
|
|
if #selected == 0 or (#selected > 0 and selected[1] == to_select) then
|
|
|
|
return "lijian_tip_1"
|
|
|
|
else
|
|
|
|
return "lijian_tip_2"
|
|
|
|
end
|
|
|
|
end,
|
2023-02-21 13:44:24 +08:00
|
|
|
}
|
2023-01-29 18:11:41 +08:00
|
|
|
local biyue = fk.CreateTriggerSkill{
|
|
|
|
name = "biyue",
|
|
|
|
anim_type = "drawcard",
|
|
|
|
events = {fk.EventPhaseStart},
|
|
|
|
can_trigger = function(self, event, target, player, data)
|
2023-12-09 21:57:47 +08:00
|
|
|
return target == player and player:hasSkill(self)
|
2023-01-29 18:11:41 +08:00
|
|
|
and player.phase == Player.Finish
|
|
|
|
end,
|
|
|
|
on_use = function(self, event, target, player, data)
|
2023-07-11 21:15:38 +08:00
|
|
|
player:drawCards(1, self.name)
|
2023-01-29 18:11:41 +08:00
|
|
|
end,
|
|
|
|
}
|
2023-01-09 19:15:18 +08:00
|
|
|
local diaochan = General:new(extension, "diaochan", "qun", 3, 3, General.Female)
|
2023-02-21 13:44:24 +08:00
|
|
|
diaochan:addSkill(lijian)
|
2023-01-29 18:11:41 +08:00
|
|
|
diaochan:addSkill(biyue)
|
2023-02-27 10:23:48 +08:00
|
|
|
|
2023-09-27 21:02:22 +08:00
|
|
|
local role_getlogic = function()
|
|
|
|
local role_logic = GameLogic:subclass("role_logic")
|
|
|
|
|
|
|
|
function role_logic:chooseGenerals()
|
|
|
|
local room = self.room ---@class Room
|
|
|
|
local generalNum = room.settings.generalNum
|
|
|
|
local n = room.settings.enableDeputy and 2 or 1
|
|
|
|
local lord = room:getLord()
|
|
|
|
local lord_generals = {}
|
|
|
|
local lord_num = 3
|
|
|
|
|
|
|
|
if lord ~= nil then
|
|
|
|
room.current = lord
|
2024-04-02 00:56:04 +08:00
|
|
|
local a1 = #room.general_pile
|
2024-04-07 00:51:29 +08:00
|
|
|
local a2 = #room.players * generalNum
|
2024-04-02 00:56:04 +08:00
|
|
|
if a1 < a2 then
|
|
|
|
room:sendLog{
|
|
|
|
type = "#NoEnoughGeneralDraw",
|
|
|
|
arg = a1,
|
|
|
|
arg2 = a2,
|
|
|
|
toast = true,
|
|
|
|
}
|
|
|
|
room:gameOver("")
|
|
|
|
end
|
2024-04-07 00:51:29 +08:00
|
|
|
lord_num = math.min(a1 - a2, lord_num)
|
2023-09-27 21:02:22 +08:00
|
|
|
local generals = table.connect(room:findGenerals(function(g)
|
2024-04-19 21:35:29 +08:00
|
|
|
return table.contains(Fk.lords, g)
|
2023-09-27 21:02:22 +08:00
|
|
|
end, lord_num), room:getNGenerals(generalNum))
|
|
|
|
lord_generals = room:askForGeneral(lord, generals, n)
|
|
|
|
local lord_general, deputy
|
|
|
|
if type(lord_generals) == "table" then
|
|
|
|
deputy = lord_generals[2]
|
|
|
|
lord_general = lord_generals[1]
|
|
|
|
else
|
|
|
|
lord_general = lord_generals
|
|
|
|
lord_generals = {lord_general}
|
|
|
|
end
|
2024-02-27 16:33:00 +08:00
|
|
|
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)
|
2023-09-27 21:02:22 +08:00
|
|
|
room:returnToGeneralPile(generals)
|
|
|
|
|
2024-06-10 15:19:47 +08:00
|
|
|
room:prepareGeneral(lord, lord_general, deputy, true)
|
|
|
|
|
2023-09-27 21:02:22 +08:00
|
|
|
room:askForChooseKingdom({lord})
|
|
|
|
room:broadcastProperty(lord, "kingdom")
|
2024-01-25 03:13:57 +08:00
|
|
|
|
|
|
|
-- 显示技能
|
|
|
|
local canAttachSkill = function(player, skillName)
|
|
|
|
local skill = Fk.skills[skillName]
|
|
|
|
if not skill then
|
|
|
|
fk.qCritical("Skill: "..skillName.." doesn't exist!")
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
if skill.lordSkill and (player.role ~= "lord" or #room.players < 5) then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
if #skill.attachedKingdom > 0 and not table.contains(skill.attachedKingdom, player.kingdom) then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
local lord_skills = {}
|
|
|
|
for _, s in ipairs(Fk.generals[lord.general].skills) do
|
|
|
|
if canAttachSkill(lord, s.name) then
|
|
|
|
table.insertIfNeed(lord_skills, s.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _, sname in ipairs(Fk.generals[lord.general].other_skills) do
|
|
|
|
if canAttachSkill(lord, sname) then
|
|
|
|
table.insertIfNeed(lord_skills, sname)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
local deputyGeneral = Fk.generals[lord.deputyGeneral]
|
|
|
|
if deputyGeneral then
|
|
|
|
for _, s in ipairs(deputyGeneral.skills) do
|
|
|
|
if canAttachSkill(lord, s.name) then
|
|
|
|
table.insertIfNeed(lord_skills, s.name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _, sname in ipairs(deputyGeneral.other_skills) do
|
|
|
|
if canAttachSkill(lord, sname) then
|
|
|
|
table.insertIfNeed(lord_skills, sname)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for _, skill in ipairs(lord_skills) do
|
|
|
|
room:doBroadcastNotify("AddSkill", json.encode{
|
|
|
|
lord.id,
|
|
|
|
skill
|
|
|
|
})
|
|
|
|
end
|
2023-09-27 21:02:22 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
local nonlord = room:getOtherPlayers(lord, true)
|
2024-11-09 19:27:41 +08:00
|
|
|
local req = Request:new(nonlord, "AskForGeneral")
|
2024-06-10 15:19:47 +08:00
|
|
|
local generals = table.random(room.general_pile, #nonlord * generalNum)
|
2023-09-27 21:02:22 +08:00
|
|
|
for i, p in ipairs(nonlord) do
|
|
|
|
local arg = table.slice(generals, (i - 1) * generalNum + 1, i * generalNum + 1)
|
2024-11-09 19:27:41 +08:00
|
|
|
req:setData(p, { arg, n })
|
|
|
|
req:setDefaultReply(p, table.random(arg, n))
|
2023-09-27 21:02:22 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
for _, p in ipairs(nonlord) do
|
2024-11-09 19:27:41 +08:00
|
|
|
local result = req:getResult(p)
|
|
|
|
local general, deputy = result[1], result[2]
|
2024-06-10 15:19:47 +08:00
|
|
|
room:findGeneral(general)
|
|
|
|
room:findGeneral(deputy)
|
|
|
|
room:prepareGeneral(p, general, deputy)
|
2023-09-27 21:02:22 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
room:askForChooseKingdom(nonlord)
|
|
|
|
end
|
|
|
|
|
|
|
|
return role_logic
|
|
|
|
end
|
|
|
|
|
2023-03-14 00:12:02 +08:00
|
|
|
local role_mode = fk.CreateGameMode{
|
|
|
|
name = "aaa_role_mode", -- just to let it at the top of list
|
|
|
|
minPlayer = 2,
|
|
|
|
maxPlayer = 8,
|
2023-09-27 21:02:22 +08:00
|
|
|
logic = role_getlogic,
|
2024-11-09 19:27:41 +08:00
|
|
|
main_mode = "role_mode",
|
2023-08-03 21:08:01 +08:00
|
|
|
is_counted = function(self, room)
|
|
|
|
return #room.players >= 5
|
|
|
|
end,
|
2023-07-02 20:47:10 +08:00
|
|
|
surrender_func = function(self, playedTime)
|
|
|
|
local roleCheck = false
|
|
|
|
local roleText = ""
|
|
|
|
local roleTable = {
|
|
|
|
{ "lord" },
|
|
|
|
{ "lord", "rebel" },
|
|
|
|
{ "lord", "rebel", "renegade" },
|
|
|
|
{ "lord", "loyalist", "rebel", "renegade" },
|
|
|
|
{ "lord", "loyalist", "rebel", "rebel", "renegade" },
|
|
|
|
{ "lord", "loyalist", "rebel", "rebel", "rebel", "renegade" },
|
|
|
|
{ "lord", "loyalist", "loyalist", "rebel", "rebel", "rebel", "renegade" },
|
|
|
|
{ "lord", "loyalist", "loyalist", "rebel", "rebel", "rebel", "rebel", "renegade" },
|
|
|
|
}
|
|
|
|
|
|
|
|
roleTable = roleTable[#Fk:currentRoom().players]
|
|
|
|
|
|
|
|
if Self.role == "renegade" then
|
2023-07-16 19:18:43 +08:00
|
|
|
local rebelNum = #table.filter(roleTable, function(role)
|
|
|
|
return role == "rebel"
|
|
|
|
end)
|
|
|
|
|
|
|
|
for _, p in ipairs(Fk:currentRoom().players) do
|
|
|
|
if p.role == "rebel" then
|
|
|
|
if not p.dead then
|
|
|
|
break
|
|
|
|
else
|
|
|
|
rebelNum = rebelNum - 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
roleCheck = rebelNum == 0
|
|
|
|
roleText = "left lord and loyalist alive"
|
2023-07-02 20:47:10 +08:00
|
|
|
elseif Self.role == "rebel" then
|
|
|
|
local rebelNum = #table.filter(roleTable, function(role)
|
|
|
|
return role == "rebel"
|
|
|
|
end)
|
|
|
|
|
|
|
|
local renegadeDead = not table.find(roleTable, function(role)
|
|
|
|
return role == "renegade"
|
|
|
|
end)
|
|
|
|
for _, p in ipairs(Fk:currentRoom().players) do
|
|
|
|
if p.role == "renegade" and p.dead then
|
|
|
|
renegadeDead = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if p ~= Self and p.role == "rebel" then
|
2023-07-02 22:13:51 +08:00
|
|
|
if not p.dead then
|
2023-07-02 20:47:10 +08:00
|
|
|
break
|
|
|
|
else
|
|
|
|
rebelNum = rebelNum - 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
roleCheck = renegadeDead and rebelNum == 1
|
|
|
|
roleText = "left one rebel alive"
|
|
|
|
else
|
|
|
|
if Self.role == "loyalist" then
|
|
|
|
return { { text = "loyalist never surrender", passed = false } }
|
|
|
|
else
|
|
|
|
if #Fk:currentRoom().alive_players == 2 then
|
|
|
|
roleCheck = true
|
|
|
|
else
|
|
|
|
local lordNum = #table.filter(roleTable, function(role)
|
|
|
|
return role == "lord" or role == "loyalist"
|
|
|
|
end)
|
|
|
|
|
|
|
|
local renegadeDead = not table.find(roleTable, function(role)
|
|
|
|
return role == "renegade"
|
|
|
|
end)
|
|
|
|
for _, p in ipairs(Fk:currentRoom().players) do
|
|
|
|
if p.role == "renegade" and p.dead then
|
|
|
|
renegadeDead = true
|
|
|
|
end
|
|
|
|
|
|
|
|
if p ~= Self and (p.role == "lord" or p.role == "loyalist") then
|
2023-07-02 22:13:51 +08:00
|
|
|
if not p.dead then
|
2023-07-02 20:47:10 +08:00
|
|
|
break
|
|
|
|
else
|
|
|
|
lordNum = lordNum - 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
roleCheck = renegadeDead and lordNum == 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
roleText = "left you alive"
|
|
|
|
end
|
|
|
|
|
|
|
|
return {
|
2023-07-02 20:53:42 +08:00
|
|
|
{ text = "time limitation: 5 min", passed = playedTime >= 300 },
|
2023-07-02 20:47:10 +08:00
|
|
|
{ text = roleText, passed = roleCheck },
|
|
|
|
}
|
|
|
|
end,
|
2023-03-14 00:12:02 +08:00
|
|
|
}
|
|
|
|
extension:addGameMode(role_mode)
|
2023-07-02 20:47:10 +08:00
|
|
|
Fk:loadTranslationTable{
|
2023-12-09 21:57:47 +08:00
|
|
|
["time limitation: 5 min"] = "游戏时长达到5分钟",
|
2023-07-16 19:18:43 +08:00
|
|
|
["left lord and loyalist alive"] = "仅剩你和主忠方存活",
|
2023-07-02 20:47:10 +08:00
|
|
|
["left one rebel alive"] = "反贼仅剩你存活且不存在存活内奸",
|
|
|
|
["left you alive"] = "主忠方仅剩你存活且其他阵营仅剩一方",
|
|
|
|
["loyalist never surrender"] = "忠臣永不投降!",
|
|
|
|
}
|
2023-03-14 00:12:02 +08:00
|
|
|
|
2023-04-23 21:10:07 +08:00
|
|
|
local anjiang = General(extension, "anjiang", "unknown", 5)
|
|
|
|
anjiang.gender = General.Agender
|
|
|
|
anjiang.total_hidden = true
|
|
|
|
|
|
|
|
Fk:loadTranslationTable{
|
|
|
|
["anjiang"] = "暗将",
|
|
|
|
}
|
|
|
|
|
2023-02-27 10:23:48 +08:00
|
|
|
-- load translations of this package
|
2024-10-22 00:10:53 +08:00
|
|
|
dofile(pkgprefix .. "standard/i18n/init.lua")
|
2022-03-28 22:24:30 +08:00
|
|
|
|
|
|
|
return extension
|