base lord skills (#119)

主公技
This commit is contained in:
Ho-spair 2023-04-15 12:06:24 +08:00 committed by GitHub
parent 13b77e4c36
commit 4d0d0c1d60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 205 additions and 8 deletions

View File

@ -34,6 +34,7 @@ function Skill:initialize(name, frequency)
self.package = { extensionName = "standard" } self.package = { extensionName = "standard" }
self.frequency = frequency self.frequency = frequency
self.visible = true self.visible = true
self.lordSkill = false
self.mute = false self.mute = false
self.anim_type = "" self.anim_type = ""
self.related_skills = {} self.related_skills = {}
@ -44,6 +45,10 @@ function Skill:initialize(name, frequency)
if string.sub(name, 1, 1) == "#" then if string.sub(name, 1, 1) == "#" then
self.visible = false self.visible = false
end end
if string.sub(name, #name) == "$" then
self.name = string.sub(name, 1, #name - 1)
self.lordSkill = true
end
self.attached_equip = nil self.attached_equip = nil
end end

View File

@ -172,12 +172,12 @@ GameEvent.functions[GameEvent.UseCard] = function(self)
cardUseEvent.card.skill:onUse(self, cardUseEvent) cardUseEvent.card.skill:onUse(self, cardUseEvent)
end end
sendCardEmotionAndLog(self, cardUseEvent)
if self.logic:trigger(fk.PreCardUse, self:getPlayerById(cardUseEvent.from), cardUseEvent) then if self.logic:trigger(fk.PreCardUse, self:getPlayerById(cardUseEvent.from), cardUseEvent) then
self.logic:breakEvent() self.logic:breakEvent()
end end
sendCardEmotionAndLog(self, cardUseEvent)
if not cardUseEvent.extraUse then if not cardUseEvent.extraUse then
self:getPlayerById(cardUseEvent.from):addCardUseHistory(cardUseEvent.card.trueName, 1) self:getPlayerById(cardUseEvent.from):addCardUseHistory(cardUseEvent.card.trueName, 1)
end end
@ -251,11 +251,20 @@ GameEvent.functions[GameEvent.RespondCard] = function(self)
moveReason = fk.ReasonResonpse, moveReason = fk.ReasonResonpse,
}) })
if self.logic:trigger(fk.PreCardRespond, self:getPlayerById(cardResponseEvent.from), cardResponseEvent) then
self.logic:breakEvent()
end
playCardEmotionAndSound(self, self:getPlayerById(from), card) playCardEmotionAndSound(self, self:getPlayerById(from), card)
for _, event in ipairs({ fk.PreCardRespond, fk.CardResponding, fk.CardRespondFinished }) do self.logic:trigger(fk.CardResponding, self:getPlayerById(cardResponseEvent.from), cardResponseEvent)
self.logic:trigger(event, self:getPlayerById(cardResponseEvent.from), cardResponseEvent) end
end
GameEvent.cleaners[GameEvent.RespondCard] = function(self)
local cardResponseEvent = table.unpack(self.data)
local self = self.room
self.logic:trigger(fk.CardRespondFinished, self:getPlayerById(cardResponseEvent.from), cardResponseEvent)
local realCardIds = self:getSubcardsByRule(cardResponseEvent.card, { Card.Processing }) local realCardIds = self:getSubcardsByRule(cardResponseEvent.card, { Card.Processing })
if #realCardIds > 0 and not cardResponseEvent.skipDrop then if #realCardIds > 0 and not cardResponseEvent.skipDrop then

View File

@ -143,13 +143,21 @@ function GameLogic:prepareForStart()
self.room:setCardArea(id, Card.DrawPile, nil) self.room:setCardArea(id, Card.DrawPile, nil)
end end
local addRoleModSkills = function(player, skillName)
local skill = Fk.skills[skillName]
if skill.lordSkill and (player.role ~= "lord" or #room.players < 5) then
return
end
room:handleAddLoseSkills(player, skillName, nil, false)
end
for _, p in ipairs(room.alive_players) do for _, p in ipairs(room.alive_players) do
local skills = Fk.generals[p.general].skills local skills = Fk.generals[p.general].skills
for _, s in ipairs(skills) do for _, s in ipairs(skills) do
room:handleAddLoseSkills(p, s.name, nil, false) addRoleModSkills(p, s.name)
end end
for _, sname in ipairs(Fk.generals[p.general].other_skills) do for _, sname in ipairs(Fk.generals[p.general].other_skills) do
room:handleAddLoseSkills(p, sname, nil, false) addRoleModSkills(p, sname)
end end
end end

View File

@ -14,6 +14,8 @@ Fk:loadTranslationTable{
["caocao"] = "曹操", ["caocao"] = "曹操",
["jianxiong"] = "奸雄", ["jianxiong"] = "奸雄",
[":jianxiong"] = "当你受到伤害后,你可以获得对你造成伤害的牌。", [":jianxiong"] = "当你受到伤害后,你可以获得对你造成伤害的牌。",
["hujia"] = "护驾",
[":hujia"] = "主公技,当你需要使用或打出【闪】时,你可以令其他蜀势力角色选择是否打出一张【闪】(视为由你使用或打出)。",
["simayi"] = "司马懿", ["simayi"] = "司马懿",
["guicai"] = "鬼才", ["guicai"] = "鬼才",
@ -50,6 +52,8 @@ Fk:loadTranslationTable{
["liubei"] = "刘备", ["liubei"] = "刘备",
["rende"] = "仁德", ["rende"] = "仁德",
[":rende"] = "出牌阶段你可以将至少一张手牌任意分配给其他角色。你于本阶段内以此法给出的手牌首次达到两张或更多后你回复1点体力。", [":rende"] = "出牌阶段你可以将至少一张手牌任意分配给其他角色。你于本阶段内以此法给出的手牌首次达到两张或更多后你回复1点体力。",
["jijiang"] = "激将",
[":jijiang"] = "主公技,当你需要使用或打出【杀】时,你可以令其他蜀势力角色选择是否打出一张【杀】(视为由你使用或打出)。",
["guanyu"] = "关羽", ["guanyu"] = "关羽",
["wusheng"] = "武圣", ["wusheng"] = "武圣",
@ -84,6 +88,8 @@ Fk:loadTranslationTable{
["sunquan"] = "孙权", ["sunquan"] = "孙权",
["zhiheng"] = "制衡", ["zhiheng"] = "制衡",
[":zhiheng"] = "阶段技,你可以弃置至少一张牌然后摸等量的牌。", [":zhiheng"] = "阶段技,你可以弃置至少一张牌然后摸等量的牌。",
["jiuyuan"] = "救援",
[":jiuyuan"] = "主公技,其他吴势力角色使用【桃】令你回复体力时,回复值+1。",
["ganning"] = "甘宁", ["ganning"] = "甘宁",
["qixi"] = "奇袭", ["qixi"] = "奇袭",

View File

@ -22,8 +22,80 @@ local jianxiong = fk.CreateTriggerSkill{
room:obtainCard(player.id, data.card, false) room:obtainCard(player.id, data.card, false)
end, end,
} }
local hujia = fk.CreateViewAsSkill{
name = "hujia$",
anim_type = "defensive",
pattern = "jink",
card_filter = function(self, to_select, selected)
return false
end,
view_as = function(self, cards)
if #cards ~= 0 then
return nil
end
local c = Fk:cloneCard("jink")
c.skillName = self.name
return c
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player)
return not table.every(Fk:currentRoom().alive_players, function(p)
return p == player or p.kingdom ~= "wei"
end)
end,
}
local hujiaResponse = fk.CreateTriggerSkill{
name = "#hujiaResponse",
events = {fk.PreCardUse, fk.PreCardRespond},
mute = true,
priority = 10,
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name, true) and table.contains(data.card.skillNames, "hujia")
end,
on_cost = function(self, event, target, player, data)
local room = player.room
room:doIndicate(player.id, TargetGroup:getRealTargets(data.tos))
return true
end,
on_use = function(self, event, target, player, data)
local room = player.room
for _, p in ipairs(room:getOtherPlayers(player)) do
if p.kingdom == "wei" then
local cardResponded = room:askForResponse(p, "jink", "jink", "#hujia-ask:%s", player.id)
if cardResponded then
room:responseCard({
from = p.id,
card = cardResponded,
skipDrop = true,
})
data.card = cardResponded
return false
end
end
end
if event == fk.PreCardUse and player.phase == Player.Play then
room:setPlayerMark(player, "hujia-failed-phase", 1)
end
return true
end,
refresh_events = {fk.CardUsing},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name, true) and player:getMark("hujia-failed-phase") > 0
end,
on_refresh = function(self, event, target, player, data)
player.room:setPlayerMark(player, "hujia-failed-phase", 0)
end,
}
hujia:addRelatedSkill(hujiaResponse)
local caocao = General:new(extension, "caocao", "wei", 4) local caocao = General:new(extension, "caocao", "wei", 4)
caocao:addSkill(jianxiong) caocao:addSkill(jianxiong)
caocao:addSkill(hujia)
local guicai = fk.CreateTriggerSkill{ local guicai = fk.CreateTriggerSkill{
name = "guicai", name = "guicai",
@ -321,8 +393,82 @@ local rende = fk.CreateActiveSkill{
end, end,
} }
rende:addRelatedSkill(rendetrig) rende:addRelatedSkill(rendetrig)
local jijiang = fk.CreateViewAsSkill{
name = "jijiang$",
anim_type = "offensive",
pattern = "slash",
card_filter = function(self, to_select, selected)
return false
end,
view_as = function(self, cards)
if #cards ~= 0 then
return nil
end
local c = Fk:cloneCard("slash")
c.skillName = self.name
return c
end,
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)
end,
enabled_at_response = function(self, player)
return not table.every(Fk:currentRoom().alive_players, function(p)
return p == player or p.kingdom ~= "shu"
end)
end,
}
local jijiangResponse = fk.CreateTriggerSkill{
name = "#jijiangResponse",
events = {fk.PreCardUse, fk.PreCardRespond},
mute = true,
priority = 10,
can_trigger = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name, true) and table.contains(data.card.skillNames, "jijiang")
end,
on_cost = function(self, event, target, player, data)
local room = player.room
room:doIndicate(player.id, TargetGroup:getRealTargets(data.tos))
return true
end,
on_use = function(self, event, target, player, data)
local room = player.room
for _, p in ipairs(room:getOtherPlayers(player)) do
if p.kingdom == "shu" then
local cardResponded = room:askForResponse(p, "slash", "slash", "#jijiang-ask:%s", player.id)
if cardResponded then
room:responseCard({
from = p.id,
card = cardResponded,
skipDrop = true,
})
data.card = cardResponded
return false
end
end
end
if event == fk.PreCardUse and player.phase == Player.Play then
room:setPlayerMark(player, "jijiang-failed-phase", 1)
end
return true
end,
refresh_events = {fk.CardUsing},
can_refresh = function(self, event, target, player, data)
return target == player and player:hasSkill(self.name, true) and player:getMark("jijiang-failed-phase") > 0
end,
on_refresh = function(self, event, target, player, data)
player.room:setPlayerMark(player, "jijiang-failed-phase", 0)
end,
}
jijiang:addRelatedSkill(jijiangResponse)
local liubei = General:new(extension, "liubei", "shu", 4) local liubei = General:new(extension, "liubei", "shu", 4)
liubei:addSkill(rende) liubei:addSkill(rende)
liubei:addSkill(jijiang)
local wusheng = fk.CreateViewAsSkill{ local wusheng = fk.CreateViewAsSkill{
name = "wusheng", name = "wusheng",
@ -527,8 +673,30 @@ local zhiheng = fk.CreateActiveSkill{
room:drawCards(from, #effect.cards, self.name) room:drawCards(from, #effect.cards, self.name)
end end
} }
local jiuyuan = fk.CreateTriggerSkill{
name = "jiuyuan$",
anim_type = "support",
frequency = fk.Compulsory,
events = {fk.PreHpRecover},
can_trigger = function(self, event, target, player, data)
return
target == player and
player:hasSkill(self.name) and
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,
}
local sunquan = General:new(extension, "sunquan", "wu", 4) local sunquan = General:new(extension, "sunquan", "wu", 4)
sunquan:addSkill(zhiheng) sunquan:addSkill(zhiheng)
sunquan:addSkill(jiuyuan)
local qixi = fk.CreateViewAsSkill{ local qixi = fk.CreateViewAsSkill{
name = "qixi", name = "qixi",

View File

@ -131,7 +131,8 @@ local peachSkill = fk.CreateActiveSkill{
room:recover({ room:recover({
who = room:getPlayerById(to), who = room:getPlayerById(to),
num = 1, num = 1,
recoverBy = from, card = effect.card,
recoverBy = room:getPlayerById(from),
skillName = self.name skillName = self.name
}) })
end end