diff --git a/ChapterB.lua b/ChapterB.lua index 7b6a793..203140b 100644 --- a/ChapterB.lua +++ b/ChapterB.lua @@ -1,7 +1,7 @@ --[[ 代码速查手册(B区) 技能索引: - 八阵、霸刀、霸王、拜印、豹变、豹变、暴敛、暴凌、暴虐、悲歌、北伐、賁育、奔雷、奔袭、崩坏、笔伐、闭月、变天、秉壹、补益、不屈、不屈 + 八阵、霸刀、霸王、拜印、豹变、豹变、暴敛、暴凌、暴虐、悲歌、悲鸣、北伐、賁育、奔雷、奔袭、崩坏、笔伐、闭月、变天、秉壹、补益、不屈、不屈 ]]-- --[[ 技能名:八阵(锁定技) @@ -322,6 +322,13 @@ LuaBeige = sgs.CreateMasochismSkill{ return target ~= nil end } +--[[ + 技能名:悲鸣(锁定技) + 相关武将:山·蔡文姬、SP·蔡文姬 + 描述:你死亡时,杀死你的其他角色弃置其所有手牌。 + 引用:LuaBossBeiming + 状态: +]]-- --[[ 技能名:北伐(锁定技) 相关武将:智·姜维 @@ -427,28 +434,22 @@ LuaBenghuai = sgs.CreatePhaseSkill{ LuaBifaCard = sgs.CreateSkillCard{ name = "LuaBifa", will_throw = false, + handling_method = sgs.Card_MethodNone, filter = function(self, targets, to_select) - if #targets == 0 then - local bifalist = to_select:getPile("bifa") - if bifalist:isEmpty() then - return to_select:objectName() ~= sgs.Self:objectName() - end - end - return false + return #targets == 0 and to_select:getPile("bifa"):isEmpty() and to_select:objectName() ~= sgs.Self:objectName() end, on_use = function(self, room, source, targets) local target = targets[1] - local keystr = string.format("BifaSource%d", self:getEffectiveId()) local tag = sgs.QVariant() tag:setValue(source) - room:setTag(keystr, tag) - target:addToPile("bifa", self:getSubcards(), false) + target:setTag("BifaSource"..tostring(self:getEffectiveId()), tag) + target:addToPile("bifa", self, false) end } LuaBifaVS = sgs.CreateOneCardViewAsSkill{ name = "LuaBifa", response_pattern = "@@LuaBifa" , - filter_pattern = ".!" , + filter_pattern = ".|.|.|hand" , view_as = function(self, cd) local card = LuaBifaCard:clone() card:addSubcard(cd) @@ -460,55 +461,50 @@ LuaBifa = sgs.CreatePhaseChangeSkill{ view_as_skill = LuaBifaVS, on_phasechange = function(self, player) local room = player:getRoom() - if player:isAlive() and player:hasSkill(self:objectName()) then - if player:getPhase() == sgs.Player_Finish then - if not player:isKongcheng() then - room:askForUseCard(player, "@@LuaBifa", "@bifa-remove") - return false - end + if player:isAlive() and player:hasSkill(self:objectName()) and player:getPhase() == sgs.Player_Finish and not player:isKongcheng() then + room:askForUseCard(player, "@@LuaBifa", "@bifa-remove") + return false + elseif player:getPhase() == sgs.Player_RoundStart and player:getPile("bifa"):length() > 0 then + local card_id = player:getPile("bifa"):first() + local chenlin = player:getTag("BifaSource"..tostring(card_id)):toPlayer() + local ids = sgs.IntList() + ids:append(card_id) + local log = sgs.LogMessage() + log.type = "$BifaView" + log.from = player + log.card_str = tostring(card_id) + log.arg = self:objectName() + room:sendLog(log, player) + room:fillAG(ids, player) + local cd = sgs.Sanguosha:getCard(card_id) + local pattern + if cd:isKindOf("BasicCard") then + pattern = "BasicCard" + elseif cd:isKindOf("TrickCard") then + pattern = "TrickCard" + elseif cd:isKindOf("EquipCard") then + pattern = "EquipCard" end - end - if player:getPhase() == sgs.Player_RoundStart then - local bifa_list = player:getPile("bifa") - if bifa_list:length() > 0 then - while not bifa_list:isEmpty() do - local card_id = bifa_list:first() - local keystr = string.format("BifaSource%d", card_id) - local tag = room:getTag(keystr) - local chenlin = tag:toPlayer() - local ids = sgs.IntList() - ids:append(card_id) - room:fillAG(ids, player) - local cd = sgs.Sanguosha:getCard(card_id) - local pattern - if cd:isKindOf("BasicCard") then - pattern = "BasicCard" - elseif cd:isKindOf("TrickCard") then - pattern = "TrickCard" - elseif cd:isKindOf("EquipCard") then - pattern = "EquipCard" - end - local data_for_ai = sgs.QVariant(pattern) - pattern = string.format("%s|.|.|hand", pattern) - local to_give = nil - if not player:isKongcheng() and chenlin and chenlin:isAlive() then - to_give = room:askForCard(player, pattern, "@bifa-give", data_for_ai, sgs.NonTrigger, chenlin) - end - if to_give then - local reasonG = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, player:objectName(), chenlin:objectName(),self:objectName(), "") - room:moveCardTo(to_give, player, chenlin, sgs.Player_PlaceHand, reasonG, false) - local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_EXCHANGE_FROM_PILE, player:objectName(), self:objectName(), "") - room:moveCardTo(cd, nil, player, sgs.Player_PlaceHand, reason, false) - else - local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_REMOVE_FROM_PILE, "", self:objectName(), "") - room:throwCard(cd, reason, nil) - room:loseHp(player) - end - bifa_list:removeOne(card_id) - player:invoke("clearAG") - room:removeTag(keystr) - end + local data_for_ai = sgs.QVariant(pattern) + pattern = pattern.."|.|.|hand" + local to_give = nil + if not player:isKongcheng() and chenlin and chenlin:isAlive() then + to_give = room:askForCard(player, pattern, "@bifa-give", data_for_ai, sgs.Card_MethodNone, chenlin) end + if chenlin and to_give then + room:broadcastSkillInvoke(self:objectName(), 2) + local reasonG = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, player:objectName(), chenlin:objectName(), self:objectName(), "") + room:obtainCard(chenlin, to_give, reasonG, false) + local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_EXCHANGE_FROM_PILE, player:objectName(), self:objectName(), "") + room:obtainCard(player, cd, reason, false) + else + room:broadcastSkillInvoke(self:objectName(), 3) + local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_REMOVE_FROM_PILE, "", self:objectName(), "") + room:throwCard(cd, reason, nil) + room:loseHp(player) + end + room:clearAG(player) + player:removeTag("BifaSource"..tostring(card_id)) end return false end , @@ -527,8 +523,11 @@ LuaBiyue = sgs.CreatePhaseChangeSkill{ name = "LuaBiyue", frequency = sgs.Skill_Frequent, on_phasechange = function(self, player) - if player:getPhase() == sgs.Player_Finish and player:askForSkillInvoke(player, self:objectName()) then - player:drawCards(1) + if player:getPhase() == sgs.Player_Finish then + if player:askForSkillInvoke(self:objectName()) then + player:getRoom():broadcastSkillInvoke(self:objectName()) + player:drawCards(1, self:objectName()) + end end end }