test = sgs.CreateTriggerSkill{ name = "test", events = {sgs.TargetSpecified}, on_trigger = function(self, event, player, data) local room = player:getRoom() local use = data:toCardUse() if use.card and use.card:isKindOf("Slash") then if room:askForSkillInvoke(player, self:objectName()) then local judge = sgs.JudgeStruct() judge.pattern = "." judge.good = true judge.play_animation = false judge.reason = self:objectName() judge.who = player room:judge(judge) local suit = judge.card:getSuit() if suit == sgs.Card_Heart then for _,p in sgs.qlist(use.to) do local mhp = sgs.QVariant() mhp:setValue(1) room:setPlayerProperty(p,"maxhp",mhp) end end if suit == sgs.Card_Diamond then for _,p in sgs.qlist(use.to) do if p:getMark("used") > 0 then return false end local skills = p:getVisibleSkillList() local detachList = {} for _,skill in sgs.qlist(skills) do if not skill:inherits("SPConvertSkill") and not skill:isAttachedLordSkill() then table.insert(detachList,"-"..skill:objectName()) end end room:handleAcquireDetachSkills(p, table.concat(detachList,"|")) room:acquireSkill(p,"jgfanshi") room:setPlayerMark(p,"used",1) end end if suit == sgs.Card_Spade then for _,p in sgs.qlist(use.to) do local equips = p:getEquips() if not equips:isEmpty() then local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0) for _, equip in sgs.qlist(equips) do if player:canDiscard(p, equip:getEffectiveId()) then dummy:addSubcard(equip) end end if dummy:subcardsLength() > 0 then room:throwCard(dummy, p, player) end end end p:throwAllHandCards() p:turnOver() end if suit == sgs.Card_Club then for _,p in sgs.qlist(use.to) do room:acquireSkill(player,"wuhun") room:acquireSkill(player,"wumou") end end for _,p in sgs.qlist(use.to) do p:gainMark("@nightmare",2) end end end end }
test_one = sgs.CreateTriggerSkill{ name = "test_one", events = {sgs.TargetSpecified}, on_trigger = function(self, event, player, data) local room = player:getRoom() local use = data:toCardUse() if use.card and use.card:isKindOf("Slash") then if room:askForSkillInvoke(player, self:objectName()) then local judge = sgs.JudgeStruct() judge.pattern = "." judge.good = true judge.play_animation = false judge.reason = self:objectName() judge.who = player room:judge(judge) local suit = judge.card:getSuit() if suit == sgs.Card_Heart then for _,p in sgs.qlist(use.to) do local mhp = sgs.QVariant() mhp:setValue(1) room:setPlayerProperty(p,"maxhp",mhp) room:acquireSkill(p,"tongji") end end if suit == sgs.Card_Diamond then for _,p in sgs.qlist(use.to) do if p:getMark("used") > 0 then return false end local skills = p:getVisibleSkillList() local detachList = {} for _,skill in sgs.qlist(skills) do if not skill:inherits("SPConvertSkill") and not skill:isAttachedLordSkill() then table.insert(detachList,"-"..skill:objectName()) end end room:handleAcquireDetachSkills(p, table.concat(detachList,"|")) room:acquireSkill(p,"jgfanshi") room:setPlayerMark(p,"used",1) end end if suit == sgs.Card_Spade then for _,p in sgs.qlist(use.to) do local equips = p:getEquips() if not equips:isEmpty() then local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0) for _, equip in sgs.qlist(equips) do if player:canDiscard(p, equip:getEffectiveId()) then dummy:addSubcard(equip) end end if dummy:subcardsLength() > 0 then room:throwCard(dummy, p, player) end end p:throwAllHandCards() p:turnOver() end end if suit == sgs.Card_Club then for _,p in sgs.qlist(use.to) do room:acquireSkill(player,"wuhun") room:acquireSkill(player,"wumou") end end for _,p in sgs.qlist(use.to) do p:gainMark("@nightmare",2) end end end end } test_two = sgs.CreateTriggerSkill{ name = "test_two" , events = {sgs.EventPhaseStart} , frequency = sgs.Skill_NotFrequent , on_trigger = function(self, event, player, data) local room = player:getRoom() local js = room:findPlayerBySkillName(self:objectName()) if player:getPhase() == sgs.Player_Start and player:isAlive() then if room:askForSkillInvoke(js, self:objectName()) then local x = player:getMark("@nightmare") player:speak(x) room:setPlayerProperty(player, "maxhp", sgs.QVariant(player:getMaxHp() + 1)) player:loseAllMarks("@nightmare") local recover = sgs.RecoverStruct() recover.who = player recover.recover = x room:recover(player, recover) end end end , can_trigger = function(self,target) return not target:hasSkill(self:objectName()) end } test_three = sgs.CreateTriggerSkill{ name = "test_three" , events = {sgs.EventPhaseStart} , frequency = sgs.Skill_Compulsory , on_trigger = function(self, event, player, data) local room = player:getRoom() if player:getPhase() == sgs.Player_Start and player:isAlive() then local x = player:getMark("@nightmare") player:loseAllMarks("@nightmare") room:loseHp(player,x) end end }
test_one = sgs.CreateTriggerSkill{ name = "test_one", events = {sgs.TargetSpecified}, on_trigger = function(self, event, player, data) local room = player:getRoom() local use = data:toCardUse() if use.card and use.card:isKindOf("Slash") and not player:hasFlag("test_used") then if room:askForSkillInvoke(player, self:objectName()) then room:setPlayerFlag(player, "test_used") local judge = sgs.JudgeStruct() judge.pattern = "." judge.good = true judge.play_animation = false judge.reason = self:objectName() judge.who = player room:judge(judge) local suit = judge.card:getSuit() if suit == sgs.Card_Heart then for _,p in sgs.qlist(use.to) do local mhp = sgs.QVariant() mhp:setValue(1) room:setPlayerProperty(p,"maxhp",mhp) room:acquireSkill(p,"tongji") end end if suit == sgs.Card_Diamond then for _,p in sgs.qlist(use.to) do if p:getMark("used") > 0 then return false end local skills = p:getVisibleSkillList() local detachList = {} for _,skill in sgs.qlist(skills) do if not skill:inherits("SPConvertSkill") and not skill:isAttachedLordSkill() then table.insert(detachList,"-"..skill:objectName()) end end room:handleAcquireDetachSkills(p, table.concat(detachList,"|")) room:acquireSkill(p,"jgfanshi") room:setPlayerMark(p,"used",1) end end if suit == sgs.Card_Spade then for _,p in sgs.qlist(use.to) do local equips = p:getEquips() if not equips:isEmpty() then local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0) for _, equip in sgs.qlist(equips) do if player:canDiscard(p, equip:getEffectiveId()) then dummy:addSubcard(equip) end end if dummy:subcardsLength() > 0 then room:throwCard(dummy, p, player) end end p:throwAllHandCards() p:turnOver() end end if suit == sgs.Card_Club then for _,p in sgs.qlist(use.to) do room:acquireSkill(player,"wuhun") room:acquireSkill(player,"wumou") end end for _,p in sgs.qlist(use.to) do p:gainMark("@nightmare",2) end end end end } test_two = sgs.CreateTriggerSkill{ name = "test_two" , events = {sgs.EventPhaseStart} , frequency = sgs.Skill_NotFrequent , on_trigger = function(self, event, player, data) local room = player:getRoom() local js = room:findPlayerBySkillName(self:objectName()) if player:getPhase() == sgs.Player_Start and player:isAlive() then if room:askForSkillInvoke(js, self:objectName()) then local x = player:getMark("@nightmare") player:speak(x) room:setPlayerProperty(player, "maxhp", sgs.QVariant(player:getMaxHp() + 1)) player:loseAllMarks("@nightmare") local recover = sgs.RecoverStruct() recover.who = player recover.recover = x room:recover(player, recover) end end end , can_trigger = function(self,target) return not target:hasSkill(self:objectName()) end } test_three = sgs.CreateTriggerSkill{ name = "test_three" , events = {sgs.EventPhaseStart} , frequency = sgs.Skill_Compulsory , on_trigger = function(self, event, player, data) local room = player:getRoom() if player:getPhase() == sgs.Player_Start and player:isAlive() then local x = player:getMark("@nightmare") player:loseAllMarks("@nightmare") room:loseHp(player,x) end end }