Bugfix (#313)
1. 修复传入数组的extraPile无法收回 2. 被弃置牌的log添加操作者 3. beforeMaxHpChanged的num可以被修改 4. 额外回合增加skillName 5. 修复亮将技能和禁止亮将 6. 水一些注释和格式 --------- Signed-off-by: Mechanel <nyutanislavsky@qq.com>
This commit is contained in:
parent
58e76c1b9c
commit
f72aaa23cf
|
@ -19,6 +19,7 @@ RowLayout {
|
||||||
property alias skillButtons: skillPanel.skill_buttons
|
property alias skillButtons: skillPanel.skill_buttons
|
||||||
|
|
||||||
property var expanded_piles: ({}) // name -> int[]
|
property var expanded_piles: ({}) // name -> int[]
|
||||||
|
property var extra_cards: []
|
||||||
|
|
||||||
property var disabledSkillNames: []
|
property var disabledSkillNames: []
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ RowLayout {
|
||||||
footnote = "$Equip";
|
footnote = "$Equip";
|
||||||
} else if (pile === "_extra") {
|
} else if (pile === "_extra") {
|
||||||
ids = extra_ids;
|
ids = extra_ids;
|
||||||
|
extra_cards = ids;
|
||||||
footnote = extra_footnote;
|
footnote = extra_footnote;
|
||||||
} else {
|
} else {
|
||||||
ids = lcall("GetPile", self.playerid, pile);
|
ids = lcall("GetPile", self.playerid, pile);
|
||||||
|
@ -122,7 +124,13 @@ RowLayout {
|
||||||
})
|
})
|
||||||
handcardAreaItem.updateCardPosition();
|
handcardAreaItem.updateCardPosition();
|
||||||
} else {
|
} else {
|
||||||
const ids = lcall("GetPile", self.playerid, pile);
|
let ids = [];
|
||||||
|
if (pile === "_extra") {
|
||||||
|
ids = extra_cards;
|
||||||
|
extra_cards = [];
|
||||||
|
} else {
|
||||||
|
ids = lcall("GetPile", self.playerid, pile);
|
||||||
|
}
|
||||||
ids.forEach(id => {
|
ids.forEach(id => {
|
||||||
const card = handcardAreaItem.remove([id])[0];
|
const card = handcardAreaItem.remove([id])[0];
|
||||||
card.origX = parentPos.x;
|
card.origX = parentPos.x;
|
||||||
|
|
|
@ -469,6 +469,7 @@ local function separateMoves(moves)
|
||||||
moveReason = move.moveReason,
|
moveReason = move.moveReason,
|
||||||
specialName = move.specialName,
|
specialName = move.specialName,
|
||||||
fromSpecialName = info.fromSpecialName,
|
fromSpecialName = info.fromSpecialName,
|
||||||
|
proposer = move.proposer,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -480,9 +481,9 @@ local function mergeMoves(moves)
|
||||||
local ret = {}
|
local ret = {}
|
||||||
local temp = {}
|
local temp = {}
|
||||||
for _, move in ipairs(moves) do
|
for _, move in ipairs(moves) do
|
||||||
local info = string.format("%q,%q,%q,%q,%s,%s",
|
local info = string.format("%q,%q,%q,%q,%s,%s,%q",
|
||||||
move.from, move.to, move.fromArea, move.toArea,
|
move.from, move.to, move.fromArea, move.toArea,
|
||||||
move.specialName, move.fromSpecialName)
|
move.specialName, move.fromSpecialName, move.proposer)
|
||||||
if temp[info] == nil then
|
if temp[info] == nil then
|
||||||
temp[info] = {
|
temp[info] = {
|
||||||
ids = {},
|
ids = {},
|
||||||
|
@ -493,6 +494,7 @@ local function mergeMoves(moves)
|
||||||
moveReason = move.moveReason,
|
moveReason = move.moveReason,
|
||||||
specialName = move.specialName,
|
specialName = move.specialName,
|
||||||
fromSpecialName = move.fromSpecialName,
|
fromSpecialName = move.fromSpecialName,
|
||||||
|
proposer = move.proposer,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
table.insert(temp[info].ids, move.ids[1])
|
table.insert(temp[info].ids, move.ids[1])
|
||||||
|
@ -504,7 +506,7 @@ local function mergeMoves(moves)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function sendMoveCardLog(move)
|
local function sendMoveCardLog(move)
|
||||||
local client = ClientInstance
|
local client = ClientInstance ---@class Client
|
||||||
if #move.ids == 0 then return end
|
if #move.ids == 0 then return end
|
||||||
local hidden = table.contains(move.ids, -1)
|
local hidden = table.contains(move.ids, -1)
|
||||||
local msgtype
|
local msgtype
|
||||||
|
@ -607,12 +609,22 @@ local function sendMoveCardLog(move)
|
||||||
})
|
})
|
||||||
elseif move.toArea == Card.DiscardPile then
|
elseif move.toArea == Card.DiscardPile then
|
||||||
if move.moveReason == fk.ReasonDiscard then
|
if move.moveReason == fk.ReasonDiscard then
|
||||||
|
if move.proposer and move.proposer ~= move.from then
|
||||||
|
client:appendLog{
|
||||||
|
type = "$DiscardOther",
|
||||||
|
from = move.from,
|
||||||
|
to = {move.proposer},
|
||||||
|
card = move.ids,
|
||||||
|
arg = #move.ids,
|
||||||
|
}
|
||||||
|
else
|
||||||
client:appendLog{
|
client:appendLog{
|
||||||
type = "$DiscardCards",
|
type = "$DiscardCards",
|
||||||
from = move.from,
|
from = move.from,
|
||||||
card = move.ids,
|
card = move.ids,
|
||||||
arg = #move.ids,
|
arg = #move.ids,
|
||||||
}
|
}
|
||||||
|
end
|
||||||
elseif move.moveReason == fk.ReasonPutIntoDiscardPile then
|
elseif move.moveReason == fk.ReasonPutIntoDiscardPile then
|
||||||
client:appendLog{
|
client:appendLog{
|
||||||
type = "$PutToDiscard",
|
type = "$PutToDiscard",
|
||||||
|
|
|
@ -344,6 +344,7 @@ Fk:loadTranslationTable({
|
||||||
["$LightningMove"] = "%card transfered from %from to %to",
|
["$LightningMove"] = "%card transfered from %from to %to",
|
||||||
["$PasteCard"] = "%from used %card to %to",
|
["$PasteCard"] = "%from used %card to %to",
|
||||||
["$DiscardCards"] = "%from discarded %arg card(s) %card",
|
["$DiscardCards"] = "%from discarded %arg card(s) %card",
|
||||||
|
["$DiscardOther"] = "%to discarded %arg card(s) %card from %from",
|
||||||
["$InstallEquip"] = "%from equipped %card",
|
["$InstallEquip"] = "%from equipped %card",
|
||||||
["$UninstallEquip"] = "%from uninstalled %card",
|
["$UninstallEquip"] = "%from uninstalled %card",
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ Fk:loadTranslationTable{
|
||||||
["fire_damage"] = "火属性",
|
["fire_damage"] = "火属性",
|
||||||
["thunder_damage"] = "雷属性",
|
["thunder_damage"] = "雷属性",
|
||||||
["ice_damage"] = "冰属性",
|
["ice_damage"] = "冰属性",
|
||||||
["hp_lost"] = "体力流失",
|
["hp_lost"] = "失去体力",
|
||||||
["lose_hp"] = "失去体力",
|
["lose_hp"] = "失去体力",
|
||||||
|
|
||||||
["phase_start"] = "准备阶段",
|
["phase_start"] = "准备阶段",
|
||||||
|
@ -412,6 +412,7 @@ Fk:loadTranslationTable{
|
||||||
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆",
|
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆",
|
||||||
["$PutKnownCard"] = "%from 的牌 %card 被置于牌堆",
|
["$PutKnownCard"] = "%from 的牌 %card 被置于牌堆",
|
||||||
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",
|
["$DiscardCards"] = "%from 弃置了 %arg 张牌 %card",
|
||||||
|
["$DiscardOther"] = "%to 弃置了 %from 的 %arg 张牌 %card",
|
||||||
["$PutToDiscard"] = "%arg 张牌 %card 被置入弃牌堆",
|
["$PutToDiscard"] = "%arg 张牌 %card 被置入弃牌堆",
|
||||||
|
|
||||||
["#ShowCard"] = "%from 展示了牌 %card",
|
["#ShowCard"] = "%from 展示了牌 %card",
|
||||||
|
|
|
@ -94,7 +94,8 @@ function General:addRelatedSkill(skill)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- 获取武将所有技能。
|
--- 获取武将所有技能。
|
||||||
---@param include_lord bool
|
---@param include_lord? boolean
|
||||||
|
---@return string[]
|
||||||
function General:getSkillNameList(include_lord)
|
function General:getSkillNameList(include_lord)
|
||||||
local ret = {}
|
local ret = {}
|
||||||
local other_skills = table.map(self.other_skills, Util.Name2SkillMapper)
|
local other_skills = table.map(self.other_skills, Util.Name2SkillMapper)
|
||||||
|
|
|
@ -45,8 +45,8 @@ end
|
||||||
---@param to_select integer @ id of the target
|
---@param to_select integer @ id of the target
|
||||||
---@param selected integer[] @ ids of selected targets
|
---@param selected integer[] @ ids of selected targets
|
||||||
---@param selected_cards integer[] @ ids of selected cards
|
---@param selected_cards integer[] @ ids of selected cards
|
||||||
---@param extra_data any @ extra_data
|
|
||||||
---@param card Card @ helper
|
---@param card Card @ helper
|
||||||
|
---@param extra_data? any @ extra_data
|
||||||
function ActiveSkill:targetFilter(to_select, selected, selected_cards, card, extra_data)
|
function ActiveSkill:targetFilter(to_select, selected, selected_cards, card, extra_data)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
|
@ -74,14 +74,14 @@ GameEvent.functions[GameEvent.ChangeHp] = function(self)
|
||||||
room:sendLog{
|
room:sendLog{
|
||||||
type = "#LoseHP",
|
type = "#LoseHP",
|
||||||
from = player.id,
|
from = player.id,
|
||||||
arg = 0 - num,
|
arg = 0 - data.num,
|
||||||
}
|
}
|
||||||
room:sendLogEvent("LoseHP", {})
|
room:sendLogEvent("LoseHP", {})
|
||||||
elseif reason == "recover" then
|
elseif reason == "recover" then
|
||||||
room:sendLog{
|
room:sendLog{
|
||||||
type = "#HealHP",
|
type = "#HealHP",
|
||||||
from = player.id,
|
from = player.id,
|
||||||
arg = num,
|
arg = data.num,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -290,12 +290,19 @@ end
|
||||||
GameEvent.functions[GameEvent.ChangeMaxHp] = function(self)
|
GameEvent.functions[GameEvent.ChangeMaxHp] = function(self)
|
||||||
local player, num = table.unpack(self.data)
|
local player, num = table.unpack(self.data)
|
||||||
local room = self.room
|
local room = self.room
|
||||||
if room.logic:trigger(fk.BeforeMaxHpChanged, player, { num = num }) or num == 0 then
|
|
||||||
|
---@type MaxHpChangedData
|
||||||
|
local data = {
|
||||||
|
num = num,
|
||||||
|
}
|
||||||
|
|
||||||
|
if room.logic:trigger(fk.BeforeMaxHpChanged, player, data) or data.num == 0 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
player.maxHp = math.max(player.maxHp + num, 0)
|
num = data.num
|
||||||
room:broadcastProperty(player, "maxHp")
|
|
||||||
|
room:setPlayerProperty(player, "maxHp", math.max(player.maxHp + num, 0))
|
||||||
room:sendLogEvent("ChangeMaxHp", {
|
room:sendLogEvent("ChangeMaxHp", {
|
||||||
player = player.id,
|
player = player.id,
|
||||||
num = num,
|
num = num,
|
||||||
|
|
|
@ -1195,7 +1195,7 @@ function Room:askForDiscard(player, minNum, maxNum, includeEquip, skillName, can
|
||||||
toDiscard = ret.cards
|
toDiscard = ret.cards
|
||||||
else
|
else
|
||||||
if cancelable then return {} end
|
if cancelable then return {} end
|
||||||
toDiscard = table.random(canDiscards, minNum)
|
toDiscard = table.random(canDiscards, minNum) ---@type integer[]
|
||||||
end
|
end
|
||||||
|
|
||||||
if not skipDiscard then
|
if not skipDiscard then
|
||||||
|
@ -1272,7 +1272,7 @@ function Room:askForCard(player, minNum, maxNum, includeEquip, skillName, cancel
|
||||||
pattern = pattern,
|
pattern = pattern,
|
||||||
expand_pile = expand_pile,
|
expand_pile = expand_pile,
|
||||||
}
|
}
|
||||||
local prompt = prompt or ("#AskForCard:::" .. maxNum .. ":" .. minNum)
|
prompt = prompt or ("#AskForCard:::" .. maxNum .. ":" .. minNum)
|
||||||
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, data, no_indicate)
|
local _, ret = self:askForUseActiveSkill(player, "choose_cards_skill", prompt, cancelable, data, no_indicate)
|
||||||
if ret then
|
if ret then
|
||||||
chosenCards = ret.cards
|
chosenCards = ret.cards
|
||||||
|
@ -2633,7 +2633,7 @@ function Room:doCardUseEffect(cardUseEvent)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type CardEffectEvent
|
---@class CardEffectEvent
|
||||||
local cardEffectEvent = {
|
local cardEffectEvent = {
|
||||||
from = cardUseEvent.from,
|
from = cardUseEvent.from,
|
||||||
tos = cardUseEvent.tos,
|
tos = cardUseEvent.tos,
|
||||||
|
@ -2916,7 +2916,8 @@ end
|
||||||
---@param cid integer|Card @ 要拿到的卡牌
|
---@param cid integer|Card @ 要拿到的卡牌
|
||||||
---@param unhide? boolean @ 是否明着拿
|
---@param unhide? boolean @ 是否明着拿
|
||||||
---@param reason? CardMoveReason @ 卡牌移动的原因
|
---@param reason? CardMoveReason @ 卡牌移动的原因
|
||||||
function Room:obtainCard(player, cid, unhide, reason)
|
---@param proposer? integer @ 移动操作者的id
|
||||||
|
function Room:obtainCard(player, cid, unhide, reason, proposer)
|
||||||
if type(cid) ~= "number" then
|
if type(cid) ~= "number" then
|
||||||
assert(cid and cid:isInstanceOf(Card))
|
assert(cid and cid:isInstanceOf(Card))
|
||||||
cid = cid:isVirtual() and cid.subcards or {cid.id}
|
cid = cid:isVirtual() and cid.subcards or {cid.id}
|
||||||
|
@ -2935,7 +2936,7 @@ function Room:obtainCard(player, cid, unhide, reason)
|
||||||
to = player,
|
to = player,
|
||||||
toArea = Card.PlayerHand,
|
toArea = Card.PlayerHand,
|
||||||
moveReason = reason or fk.ReasonJustMove,
|
moveReason = reason or fk.ReasonJustMove,
|
||||||
proposer = player,
|
proposer = proposer or player,
|
||||||
moveVisible = unhide or false,
|
moveVisible = unhide or false,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -2987,7 +2988,6 @@ function Room:moveCardTo(card, to_place, target, reason, skill_name, special_nam
|
||||||
reason = reason or fk.ReasonJustMove
|
reason = reason or fk.ReasonJustMove
|
||||||
skill_name = skill_name or ""
|
skill_name = skill_name or ""
|
||||||
special_name = special_name or ""
|
special_name = special_name or ""
|
||||||
proposer = proposer or nil
|
|
||||||
local ids = Card:getIdList(card)
|
local ids = Card:getIdList(card)
|
||||||
|
|
||||||
local to
|
local to
|
||||||
|
@ -3587,6 +3587,10 @@ function Room:printCard(name, suit, number)
|
||||||
return cd
|
return cd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 刷新使命技状态
|
||||||
|
---@param player ServerPlayer
|
||||||
|
---@param skillName Suit
|
||||||
|
---@param failed? boolean
|
||||||
function Room:updateQuestSkillState(player, skillName, failed)
|
function Room:updateQuestSkillState(player, skillName, failed)
|
||||||
assert(Fk.skills[skillName].frequency == Skill.Quest)
|
assert(Fk.skills[skillName].frequency == Skill.Quest)
|
||||||
|
|
||||||
|
@ -3600,6 +3604,9 @@ function Room:updateQuestSkillState(player, skillName, failed)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 废除区域
|
||||||
|
---@param player ServerPlayer
|
||||||
|
---@param playerSlots string | string[]
|
||||||
function Room:abortPlayerArea(player, playerSlots)
|
function Room:abortPlayerArea(player, playerSlots)
|
||||||
assert(type(playerSlots) == "string" or type(playerSlots) == "table")
|
assert(type(playerSlots) == "string" or type(playerSlots) == "table")
|
||||||
|
|
||||||
|
@ -3652,6 +3659,9 @@ function Room:abortPlayerArea(player, playerSlots)
|
||||||
self.logic:trigger(fk.AreaAborted, player, { slots = slotsSealed })
|
self.logic:trigger(fk.AreaAborted, player, { slots = slotsSealed })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 恢复区域
|
||||||
|
---@param player ServerPlayer
|
||||||
|
---@param playerSlots string | string[]
|
||||||
function Room:resumePlayerArea(player, playerSlots)
|
function Room:resumePlayerArea(player, playerSlots)
|
||||||
assert(type(playerSlots) == "string" or type(playerSlots) == "table")
|
assert(type(playerSlots) == "string" or type(playerSlots) == "table")
|
||||||
|
|
||||||
|
@ -3675,6 +3685,9 @@ function Room:resumePlayerArea(player, playerSlots)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 设置休整
|
||||||
|
---@param player ServerPlayer
|
||||||
|
---@param roundNum integer
|
||||||
function Room:setPlayerRest(player, roundNum)
|
function Room:setPlayerRest(player, roundNum)
|
||||||
player.rest = roundNum
|
player.rest = roundNum
|
||||||
self:broadcastProperty(player, "rest")
|
self:broadcastProperty(player, "rest")
|
||||||
|
|
|
@ -630,15 +630,18 @@ function ServerPlayer:endPlayPhase()
|
||||||
-- TODO: send log
|
-- TODO: send log
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- 获得一个额外回合
|
||||||
---@param delay? boolean
|
---@param delay? boolean
|
||||||
function ServerPlayer:gainAnExtraTurn(delay)
|
---@param skillName? string
|
||||||
|
function ServerPlayer:gainAnExtraTurn(delay, skillName)
|
||||||
local room = self.room
|
local room = self.room
|
||||||
delay = (delay == nil) and true or delay
|
delay = (delay == nil) and true or delay
|
||||||
|
skillName = (skillName == nil) and room.logic:getCurrentSkillName() or skillName
|
||||||
if delay then
|
if delay then
|
||||||
local logic = room.logic
|
local logic = room.logic
|
||||||
local turn = logic:getCurrentEvent():findParent(GameEvent.Turn, true)
|
local turn = logic:getCurrentEvent():findParent(GameEvent.Turn, true)
|
||||||
if turn then
|
if turn then
|
||||||
turn:prependExitFunc(function() self:gainAnExtraTurn(false) end)
|
turn:prependExitFunc(function() self:gainAnExtraTurn(false, skillName) end)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -653,7 +656,6 @@ function ServerPlayer:gainAnExtraTurn(delay)
|
||||||
|
|
||||||
self.tag["_extra_turn_count"] = self.tag["_extra_turn_count"] or {}
|
self.tag["_extra_turn_count"] = self.tag["_extra_turn_count"] or {}
|
||||||
local ex_tag = self.tag["_extra_turn_count"]
|
local ex_tag = self.tag["_extra_turn_count"]
|
||||||
local skillName = room.logic:getCurrentSkillName()
|
|
||||||
table.insert(ex_tag, skillName)
|
table.insert(ex_tag, skillName)
|
||||||
|
|
||||||
GameEvent(GameEvent.Turn, self):exec()
|
GameEvent(GameEvent.Turn, self):exec()
|
||||||
|
@ -833,7 +835,7 @@ end
|
||||||
|
|
||||||
-- Hegemony func
|
-- Hegemony func
|
||||||
|
|
||||||
---@param skill Skill
|
---@param skill Skill | string
|
||||||
function ServerPlayer:addFakeSkill(skill)
|
function ServerPlayer:addFakeSkill(skill)
|
||||||
assert(type(skill) == "string" or skill:isInstanceOf(Skill))
|
assert(type(skill) == "string" or skill:isInstanceOf(Skill))
|
||||||
if type(skill) == "string" then
|
if type(skill) == "string" then
|
||||||
|
@ -854,7 +856,7 @@ function ServerPlayer:addFakeSkill(skill)
|
||||||
self:doNotify("AddSkill", json.encode{ self.id, skill.name, true })
|
self:doNotify("AddSkill", json.encode{ self.id, skill.name, true })
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param skill Skill
|
---@param skill Skill | string
|
||||||
function ServerPlayer:loseFakeSkill(skill)
|
function ServerPlayer:loseFakeSkill(skill)
|
||||||
assert(type(skill) == "string" or skill:isInstanceOf(Skill))
|
assert(type(skill) == "string" or skill:isInstanceOf(Skill))
|
||||||
if type(skill) == "string" then
|
if type(skill) == "string" then
|
||||||
|
@ -873,6 +875,7 @@ function ServerPlayer:loseFakeSkill(skill)
|
||||||
self:doNotify("LoseSkill", json.encode{ self.id, skill.name, true })
|
self:doNotify("LoseSkill", json.encode{ self.id, skill.name, true })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---@param skill Skill | string
|
||||||
function ServerPlayer:isFakeSkill(skill)
|
function ServerPlayer:isFakeSkill(skill)
|
||||||
if type(skill) == "string" then skill = Fk.skills[skill] end
|
if type(skill) == "string" then skill = Fk.skills[skill] end
|
||||||
assert(skill:isInstanceOf(Skill))
|
assert(skill:isInstanceOf(Skill))
|
||||||
|
@ -1049,18 +1052,8 @@ function ServerPlayer:hideGeneral(isDeputy)
|
||||||
end
|
end
|
||||||
|
|
||||||
local general = Fk.generals[generalName]
|
local general = Fk.generals[generalName]
|
||||||
local skills = general.skills
|
|
||||||
local place = isDeputy and "m" or "d"
|
local place = isDeputy and "m" or "d"
|
||||||
for _, s in ipairs(skills) do
|
for _, sname in ipairs(general:getSkillNameList()) do
|
||||||
room:handleAddLoseSkills(self, "-" .. s.name, nil, false, true)
|
|
||||||
if s.relate_to_place ~= place then
|
|
||||||
if s.frequency == Skill.Compulsory then
|
|
||||||
self:addFakeSkill("reveal_skill")
|
|
||||||
end
|
|
||||||
self:addFakeSkill(s)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
for _, sname in ipairs(general.other_skills) do
|
|
||||||
room:handleAddLoseSkills(self, "-" .. sname, nil, false, true)
|
room:handleAddLoseSkills(self, "-" .. sname, nil, false, true)
|
||||||
local s = Fk.skills[sname]
|
local s = Fk.skills[sname]
|
||||||
if s.relate_to_place ~= place then
|
if s.relate_to_place ~= place then
|
||||||
|
|
|
@ -50,6 +50,10 @@
|
||||||
---@field public num integer @ 失去体力的数值
|
---@field public num integer @ 失去体力的数值
|
||||||
---@field public skillName string @ 导致这次失去的技能名
|
---@field public skillName string @ 导致这次失去的技能名
|
||||||
|
|
||||||
|
--- 描述跟体力上限变化有关的数据
|
||||||
|
---@class MaxHpChangedData
|
||||||
|
---@field public num integer @ 体力上限变化量,可能是正数或者负数
|
||||||
|
|
||||||
---@alias DamageType integer
|
---@alias DamageType integer
|
||||||
|
|
||||||
fk.NormalDamage = 1
|
fk.NormalDamage = 1
|
||||||
|
|
|
@ -197,20 +197,16 @@ local revealProhibited = fk.CreateInvaliditySkill {
|
||||||
end
|
end
|
||||||
|
|
||||||
if #generals == 0 then return false end
|
if #generals == 0 then return false end
|
||||||
if type(from._fake_skills) == "table" and not table.contains(from._fake_skills, skill) then return false end
|
|
||||||
local sname = skill.name
|
local sname = skill.name
|
||||||
for _, g in ipairs(generals) do
|
for _, g in ipairs(generals) do
|
||||||
if g == "m" then
|
if (g == "m" and from.general == "anjiang") or (g == "d" and from.deputyGeneral == "anjiang") then
|
||||||
if from.general ~= "anjiang" then return false end
|
|
||||||
else
|
|
||||||
if from.deputyGeneral ~= "anjiang" then return false end
|
|
||||||
end
|
|
||||||
local generalName = g == "m" and from:getMark("__heg_general") or from:getMark("__heg_deputy")
|
local generalName = g == "m" and from:getMark("__heg_general") or from:getMark("__heg_deputy")
|
||||||
local general = Fk.generals[generalName]
|
local general = Fk.generals[generalName]
|
||||||
if table.contains(general:getSkillNameList(true), sname) then
|
if table.contains(general:getSkillNameList(true), sname) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -254,6 +250,30 @@ local revealSkill = fk.CreateActiveSkill{
|
||||||
elseif choice == "revealMain" then player:revealGeneral(false)
|
elseif choice == "revealMain" then player:revealGeneral(false)
|
||||||
elseif choice == "revealDeputy" then player:revealGeneral(true) end
|
elseif choice == "revealDeputy" then player:revealGeneral(true) end
|
||||||
end,
|
end,
|
||||||
|
can_use = function(self, player)
|
||||||
|
local choiceList = {}
|
||||||
|
if (player.general == "anjiang" and not player:prohibitReveal()) then
|
||||||
|
local general = Fk.generals[player:getMark("__heg_general")]
|
||||||
|
for _, sname in ipairs(general:getSkillNameList(true)) do
|
||||||
|
local s = Fk.skills[sname]
|
||||||
|
if s.frequency == Skill.Compulsory and s.relate_to_place ~= "m" then
|
||||||
|
table.insert(choiceList, "revealMain")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (player.deputyGeneral == "anjiang" and not player:prohibitReveal(true)) then
|
||||||
|
local general = Fk.generals[player:getMark("__heg_deputy")]
|
||||||
|
for _, sname in ipairs(general:getSkillNameList(true)) do
|
||||||
|
local s = Fk.skills[sname]
|
||||||
|
if s.frequency == Skill.Compulsory and s.relate_to_place ~= "d" then
|
||||||
|
table.insert(choiceList, "revealDeputy")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return #choiceList > 0
|
||||||
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
AuxSkills = {
|
AuxSkills = {
|
||||||
|
|
|
@ -1048,7 +1048,7 @@ local spearSkill = fk.CreateViewAsSkill{
|
||||||
pattern = "slash",
|
pattern = "slash",
|
||||||
card_filter = function(self, to_select, selected)
|
card_filter = function(self, to_select, selected)
|
||||||
if #selected == 2 then return false end
|
if #selected == 2 then return false end
|
||||||
return Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
|
return table.contains(Self:getHandlyIds(true), to_select)
|
||||||
end,
|
end,
|
||||||
view_as = function(self, cards)
|
view_as = function(self, cards)
|
||||||
if #cards ~= 2 then
|
if #cards ~= 2 then
|
||||||
|
|
|
@ -208,19 +208,10 @@ local test_vs = fk.CreateViewAsSkill{
|
||||||
}
|
}
|
||||||
local test_trig = fk.CreateTriggerSkill{
|
local test_trig = fk.CreateTriggerSkill{
|
||||||
name = "test_trig",
|
name = "test_trig",
|
||||||
events = {fk.EventPhaseEnd},
|
events = {fk.BeforeHpChanged},
|
||||||
can_trigger = function(self, event, target, player, data)
|
on_cost = Util.TrueFunc,
|
||||||
return target == player and player:hasSkill(self.name) and player.phase == Player.Discard
|
|
||||||
end,
|
|
||||||
on_cost = function(self, event, target, player, data)
|
|
||||||
local cards = player.room:askForDiscard(player, 1, 1, false, self.name, true, nil, "#test_trig-ask", true)
|
|
||||||
if #cards > 0 then
|
|
||||||
self.cost_data = cards
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_use = function(self, event, target, player, data)
|
on_use = function(self, event, target, player, data)
|
||||||
player.room:throwCard(self.cost_data, self.name, player, player)
|
data.num = data.num - 1
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
local damage_maker = fk.CreateActiveSkill{
|
local damage_maker = fk.CreateActiveSkill{
|
||||||
|
@ -245,7 +236,7 @@ local damage_maker = fk.CreateActiveSkill{
|
||||||
} end,
|
} end,
|
||||||
on_use = function(self, room, effect)
|
on_use = function(self, room, effect)
|
||||||
local from = room:getPlayerById(effect.from)
|
local from = room:getPlayerById(effect.from)
|
||||||
local victim = #effect.tos > 0 and room:getPlayerById(effect.tos[1])
|
local victim = room:getPlayerById(effect.tos[1])
|
||||||
local target = #effect.tos > 1 and room:getPlayerById(effect.tos[2])
|
local target = #effect.tos > 1 and room:getPlayerById(effect.tos[2])
|
||||||
local choice = self.interaction.data
|
local choice = self.interaction.data
|
||||||
local number
|
local number
|
||||||
|
@ -254,7 +245,7 @@ local damage_maker = fk.CreateActiveSkill{
|
||||||
for i = 1, 99 do
|
for i = 1, 99 do
|
||||||
table.insert(choices, tostring(i))
|
table.insert(choices, tostring(i))
|
||||||
end
|
end
|
||||||
number = tonumber(room:askForChoice(from, choices, self.name, nil))
|
number = tonumber(room:askForChoice(from, choices, self.name, nil)) ---@type integer
|
||||||
end
|
end
|
||||||
if target then from = target end
|
if target then from = target end
|
||||||
if choice == "heal_hp" then
|
if choice == "heal_hp" then
|
||||||
|
@ -316,9 +307,6 @@ local change_hero = fk.CreateActiveSkill{
|
||||||
local choice = self.interaction.data
|
local choice = self.interaction.data
|
||||||
local generals = room:getNGenerals(8)
|
local generals = room:getNGenerals(8)
|
||||||
local general = room:askForGeneral(from, generals, 1)
|
local general = room:askForGeneral(from, generals, 1)
|
||||||
if general == nil then
|
|
||||||
general = table.random(generals)
|
|
||||||
end
|
|
||||||
table.removeOne(generals, general)
|
table.removeOne(generals, general)
|
||||||
room:changeHero(target, general, false, choice == "deputyGeneral", true)
|
room:changeHero(target, general, false, choice == "deputyGeneral", true)
|
||||||
room:returnToGeneralPile(generals)
|
room:returnToGeneralPile(generals)
|
||||||
|
@ -330,7 +318,7 @@ local test_zhenggong = fk.CreateTriggerSkill{
|
||||||
frequency = Skill.Compulsory,
|
frequency = Skill.Compulsory,
|
||||||
anim_type = "negative",
|
anim_type = "negative",
|
||||||
can_trigger = function(self, event, target, player, data)
|
can_trigger = function(self, event, target, player, data)
|
||||||
return player:hasSkill(self.name) and player.room:getTag("RoundCount") == 1
|
return player:hasSkill(self) and player.room:getTag("RoundCount") == 1
|
||||||
end,
|
end,
|
||||||
on_use = function(self, event, target, player, data)
|
on_use = function(self, event, target, player, data)
|
||||||
player:gainAnExtraTurn()
|
player:gainAnExtraTurn()
|
||||||
|
@ -390,7 +378,6 @@ Fk:loadTranslationTable{
|
||||||
["$cheat"] = "喝啊!",
|
["$cheat"] = "喝啊!",
|
||||||
-- ["@@test_cheat-phase"] = "苦肉",
|
-- ["@@test_cheat-phase"] = "苦肉",
|
||||||
-- ["@@test_cheat-inhand"] = "连营",
|
-- ["@@test_cheat-inhand"] = "连营",
|
||||||
--["#test_trig-ask"] = "你可弃置一张手牌",
|
|
||||||
["control"] = "控制",
|
["control"] = "控制",
|
||||||
[":control"] = "出牌阶段,你可以控制/解除控制若干名其他角色。",
|
[":control"] = "出牌阶段,你可以控制/解除控制若干名其他角色。",
|
||||||
["$control"] = "战将临阵,斩关刈城!",
|
["$control"] = "战将临阵,斩关刈城!",
|
||||||
|
@ -416,8 +403,8 @@ Fk:loadTranslationTable{
|
||||||
["~mouxusheng"] = "来世,愿再为我江东之臣……",
|
["~mouxusheng"] = "来世,愿再为我江东之臣……",
|
||||||
|
|
||||||
["heal_hp"] = "回复体力",
|
["heal_hp"] = "回复体力",
|
||||||
["lose_max_hp"] = "减少体力上限",
|
["lose_max_hp"] = "减体力上限",
|
||||||
["heal_max_hp"] = "增加体力上限",
|
["heal_max_hp"] = "加体力上限",
|
||||||
["revive"] = "复活",
|
["revive"] = "复活",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue