mirror of
https://github.com/Qsgs-Fans/FreeKill.git
synced 2024-11-16 11:42:45 +08:00
Fixbug (#144)
视为技添加frequency(为了显示限定技) 修复主动技canUse (by @Ho-spair ) Exppattern增加子类别 增加体力上限相关的log 增加求桃prompt 修复许褚、夏侯惇(by @xxyheaven )和赵云 移除观星一张牌直接放在牌堆顶 添加获得牌的log(和摸牌区分开) 封装重铸(和以技能重铸)函数 --------- Signed-off-by: Mechanel <nyutanislavsky@qq.com>
This commit is contained in:
parent
b552f2ed3e
commit
8d87fbbf09
|
@ -414,13 +414,21 @@ local function sendMoveCardLog(move)
|
|||
arg2 = #move.ids,
|
||||
card = move.ids,
|
||||
}
|
||||
elseif move.fromArea == Card.DrawPile and move.toArea == Card.PlayerHand then
|
||||
elseif move.moveReason == fk.ReasonDraw then
|
||||
ClientInstance:appendLog{
|
||||
type = "$DrawCards",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif (move.fromArea == Card.DrawPile or move.fromArea == Card.DiscardPile)
|
||||
and move.moveReason == fk.ReasonPrey then
|
||||
ClientInstance:appendLog{
|
||||
type = "$PreyCardsFromPile",
|
||||
from = move.to,
|
||||
card = move.ids,
|
||||
arg = #move.ids,
|
||||
}
|
||||
elseif (move.fromArea == Card.Processing or move.fromArea == Card.PlayerJudge)
|
||||
and move.toArea == Card.PlayerHand then
|
||||
ClientInstance:appendLog{
|
||||
|
|
|
@ -155,6 +155,8 @@ FreeKill使用的是libgit2的C API,与此同时使用Git完成拓展包的下
|
|||
["#AskForResponseCard"] = "请打出卡牌 %1",
|
||||
["#AskForNullification"] = "是否为目标为 %dest 的 %arg 使用无懈可击?",
|
||||
["#AskForNullificationWithoutTo"] = "是否对 %src 使用的 %arg 使用无懈可击?",
|
||||
["#AskForPeaches"] = "%src 生命危急,需要 %arg 个桃",
|
||||
["#AskForPeachesSelf"] = "你生命危急,需要 %arg 个桃或酒",
|
||||
|
||||
["#AskForDiscard"] = "请弃置 %arg 张牌,最少 %arg2 张",
|
||||
["#AskForCard"] = "请选择 %arg 张牌,最少 %arg2 张",
|
||||
|
@ -206,10 +208,12 @@ Fk:loadTranslationTable{
|
|||
["thunder_damage"] = "雷属性",
|
||||
["ice_damage"] = "冰属性",
|
||||
|
||||
["phase_start"] = "准备阶段",
|
||||
["phase_judge"] = "判定阶段",
|
||||
["phase_draw"] = "摸牌阶段",
|
||||
["phase_play"] = "出牌阶段",
|
||||
["phase_discard"] = "弃牌阶段",
|
||||
["phase_finish"] = "结束阶段",
|
||||
|
||||
["chained"] = "横置",
|
||||
["not-chained"] = "重置",
|
||||
|
@ -223,8 +227,8 @@ Fk:loadTranslationTable{
|
|||
["$GameEnd"] = "== 游戏结束 ==",
|
||||
|
||||
-- get/lose skill
|
||||
["#AcquireSkill"] = "%from 获得了技能“%arg”",
|
||||
["#LoseSkill"] = "%from 失去了技能“%arg”",
|
||||
["#AcquireSkill"] = "%from 获得了技能 “%arg”",
|
||||
["#LoseSkill"] = "%from 失去了技能 “%arg”",
|
||||
|
||||
-- moveCards (they are sent by notifyMoveCards)
|
||||
["$PutCard"] = "%from 的 %arg 张牌被置于牌堆顶",
|
||||
|
@ -233,6 +237,7 @@ Fk:loadTranslationTable{
|
|||
["$AddToPile"] = "%card 被作为 %arg 移出游戏",
|
||||
["$GetCardsFromPile"] = "%from 从 %arg 中获得了 %arg2 张牌 %card",
|
||||
["$DrawCards"] = "%from 摸了 %arg 张牌 %card",
|
||||
["$PreyCardsFromPile"] = "%from 获得了 %arg 张牌 %card",
|
||||
["$GotCardBack"] = "%from 收回了 %arg 张牌 %card",
|
||||
["$RecycleCard"] = "%from 从弃牌堆回收了 %arg 张牌 %card",
|
||||
["$MoveCards"] = "%to 从 %from 处获得了 %arg 张牌 %card",
|
||||
|
@ -288,6 +293,8 @@ Fk:loadTranslationTable{
|
|||
["#LoseHP"] = "%from 失去了 %arg 点体力",
|
||||
["#HealHP"] = "%from 回复了 %arg 点体力",
|
||||
["#ShowHPAndMaxHP"] = "%from 现在的体力值为 %arg,体力上限为 %arg2",
|
||||
["#LoseMaxHP"] = "%from 减了 %arg 点体力上限",
|
||||
["#HealMaxHP"] = "%from 加了 %arg 点体力上限",
|
||||
|
||||
-- dying and death
|
||||
["#EnterDying"] = "%from 进入了濒死阶段",
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
---@field public interaction any
|
||||
local ViewAsSkill = UsableSkill:subclass("ViewAsSkill")
|
||||
|
||||
function ViewAsSkill:initialize(name)
|
||||
UsableSkill.initialize(self, name, Skill.NotFrequent)
|
||||
function ViewAsSkill:initialize(name, frequency)
|
||||
UsableSkill.initialize(self, name, frequency)
|
||||
self.pattern = ""
|
||||
end
|
||||
|
||||
|
|
|
@ -162,8 +162,8 @@ function fk.CreateActiveSkill(spec)
|
|||
readUsableSpecToSkill(skill, spec)
|
||||
|
||||
if spec.can_use then
|
||||
skill.canUse = function(curSkill, player)
|
||||
return spec.can_use(curSkill, player) and curSkill:isEffectable(player)
|
||||
skill.canUse = function(curSkill, player, card)
|
||||
return spec.can_use(curSkill, player, card) and curSkill:isEffectable(player)
|
||||
end
|
||||
end
|
||||
if spec.card_filter then skill.cardFilter = spec.card_filter end
|
||||
|
@ -205,7 +205,7 @@ function fk.CreateViewAsSkill(spec)
|
|||
assert(type(spec.name) == "string")
|
||||
assert(type(spec.view_as) == "function")
|
||||
|
||||
local skill = ViewAsSkill:new(spec.name)
|
||||
local skill = ViewAsSkill:new(spec.name, spec.frequency or Skill.NotFrequent)
|
||||
readUsableSpecToSkill(skill, spec)
|
||||
|
||||
skill.viewAs = spec.view_as
|
||||
|
|
|
@ -228,6 +228,19 @@ GameEvent.functions[GameEvent.ChangeMaxHp] = function(self)
|
|||
end
|
||||
end
|
||||
|
||||
self:sendLog{
|
||||
type = num > 0 and "#HealMaxHP" or "#LoseMaxHP",
|
||||
from = player.id,
|
||||
arg = num > 0 and num or - num,
|
||||
}
|
||||
|
||||
self:sendLog{
|
||||
type = "#ShowHPAndMaxHP",
|
||||
from = player.id,
|
||||
arg = player.hp,
|
||||
arg2 = player.maxHp,
|
||||
}
|
||||
|
||||
self.logic:trigger(fk.MaxHpChanged, player, { num = num })
|
||||
return true
|
||||
end
|
||||
|
|
|
@ -1235,10 +1235,6 @@ function Room:askForGuanxing(player, cards, top_limit, bottom_limit)
|
|||
if #top_limit > 0 and #bottom_limit > 0 then
|
||||
assert(#cards >= top_limit[1] + bottom_limit[1] and #cards <= top_limit[2] + bottom_limit[2], "限定区间设置错误:可用空间不能容纳所有牌。")
|
||||
end
|
||||
if #cards == 1 then
|
||||
table.insert(self.draw_pile, 1, cards[1])
|
||||
return
|
||||
end
|
||||
local command = "AskForGuanxing"
|
||||
self:notifyMoveFocus(player, command)
|
||||
local data = {
|
||||
|
@ -2290,7 +2286,7 @@ function Room:retrial(card, player, judge, skillName, exchange)
|
|||
end
|
||||
end
|
||||
|
||||
--- 弃置一名玩家的牌。
|
||||
--- 弃置一名角色的牌。
|
||||
---@param card_ids integer[] @ 被弃掉的牌
|
||||
---@param skillName string @ 技能名
|
||||
---@param who ServerPlayer @ 被弃牌的人
|
||||
|
@ -2311,6 +2307,32 @@ function Room:throwCard(card_ids, skillName, who, thrower)
|
|||
})
|
||||
end
|
||||
|
||||
--- 重铸一名角色的牌。
|
||||
---@param card_ids integer[] @ 被重铸的牌
|
||||
---@param who ServerPlayer @ 重铸的角色
|
||||
---@param skillName string @ 技能名,默认为“重铸”
|
||||
function Room:recastCard(card_ids, who, skillName)
|
||||
if type(card_ids) == "number" then
|
||||
card_ids = {card_ids}
|
||||
end
|
||||
skillName = skillName or "recast"
|
||||
self:moveCards({
|
||||
ids = card_ids,
|
||||
from = who.id,
|
||||
toArea = Card.DiscardPile,
|
||||
skillName = skillName,
|
||||
moveReason = fk.ReasonPutIntoDiscardPile,
|
||||
proposer = who.id
|
||||
})
|
||||
self:sendLog{
|
||||
type = skillName == "recast" and "#Recast" or "#RecastBySkill",
|
||||
from = who.id,
|
||||
card = card_ids,
|
||||
arg = skillName,
|
||||
}
|
||||
self:drawCards(who, #card_ids, skillName)
|
||||
end
|
||||
|
||||
--- 根据拼点信息开始拼点。
|
||||
---@param pindianData PindianStruct
|
||||
function Room:pindian(pindianData)
|
||||
|
|
|
@ -197,20 +197,7 @@ local recast = fk.CreateActiveSkill{
|
|||
name = "recast",
|
||||
target_num = 0,
|
||||
on_use = function(self, room, effect)
|
||||
local from = room:getPlayerById(effect.from)
|
||||
room:moveCards({
|
||||
ids = effect.cards,
|
||||
from = effect.from,
|
||||
toArea = Card.DiscardPile,
|
||||
skillName = "recast",
|
||||
moveReason = fk.ReasonPutIntoDiscardPile,
|
||||
})
|
||||
room:sendLog{
|
||||
type = "#Recast",
|
||||
from = effect.from,
|
||||
card = effect.cards,
|
||||
}
|
||||
room:drawCards(from, #effect.cards, self.name)
|
||||
room:recastCard(effect.cards, room:getPlayerById(effect.from))
|
||||
end
|
||||
}
|
||||
Fk:addSkill(recast)
|
||||
|
|
|
@ -69,11 +69,13 @@ GameRule = fk.CreateTriggerSkill{
|
|||
local dyingPlayer = room:getPlayerById(data.who)
|
||||
while dyingPlayer.hp < 1 do
|
||||
local pattern = "peach"
|
||||
local prompt = "#AskForPeaches:" .. dyingPlayer.id .. "::" .. tostring(1 - dyingPlayer.hp)
|
||||
if player == dyingPlayer then
|
||||
pattern = pattern .. ",analeptic"
|
||||
prompt = "#AskForPeachesSelf:::" .. tostring(1 - dyingPlayer.hp)
|
||||
end
|
||||
|
||||
local peach_use = room:askForUseCard(player, "peach", pattern)
|
||||
local peach_use = room:askForUseCard(player, "peach", pattern, prompt)
|
||||
if not peach_use then break end
|
||||
peach_use.tos = { {dyingPlayer.id} }
|
||||
if peach_use.card.trueName == "analeptic" then
|
||||
|
|
|
@ -148,22 +148,21 @@ local ganglie = fk.CreateTriggerSkill{
|
|||
anim_type = "masochism",
|
||||
events = {fk.Damaged},
|
||||
can_trigger = function(self, event, target, player, data)
|
||||
local room = target.room
|
||||
return data.from ~= nil and
|
||||
target == player and
|
||||
return target == player and
|
||||
target:hasSkill(self.name) and
|
||||
not target.dead
|
||||
end,
|
||||
on_use = function(self, event, target, player, data)
|
||||
local room = player.room
|
||||
local from = data.from
|
||||
if from then room:doIndicate(player.id, {from.id}) end
|
||||
local judge = {
|
||||
who = player,
|
||||
reason = self.name,
|
||||
pattern = ".|.|spade,club,diamond",
|
||||
pattern = ".|.|^heart",
|
||||
}
|
||||
room:judge(judge)
|
||||
if judge.card.suit ~= Card.Heart then
|
||||
if judge.card.suit ~= Card.Heart and from then
|
||||
local discards = room:askForDiscard(from, 2, 2, false, self.name, true)
|
||||
if #discards == 0 then
|
||||
room:damage{
|
||||
|
@ -236,8 +235,7 @@ local luoyi = fk.CreateTriggerSkill{
|
|||
|
||||
refresh_events = {fk.DamageCaused},
|
||||
can_refresh = function(self, event, target, player, data)
|
||||
if not (target == player and player:hasSkill(self.name) and
|
||||
player:usedSkillTimes(self.name) > 0) then
|
||||
if target ~= player or player:usedSkillTimes(self.name) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -577,8 +575,16 @@ local longdan = fk.CreateViewAsSkill{
|
|||
pattern = "slash,jink",
|
||||
card_filter = function(self, to_select, selected)
|
||||
if #selected == 1 then return false end
|
||||
local c = Fk:getCardById(to_select)
|
||||
return c.trueName == "slash" or c.name == "jink"
|
||||
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
|
||||
return (Fk.currentResponsePattern == nil and c.skill:canUse(Self)) or (Fk.currentResponsePattern and Exppattern:Parse(Fk.currentResponsePattern):match(c))
|
||||
end,
|
||||
view_as = function(self, cards)
|
||||
if #cards ~= 1 then
|
||||
|
|
Loading…
Reference in New Issue
Block a user