From 27dd035318e362ecda29a92e6d24f29d0a5b2fc8 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Sun, 3 May 2026 06:18:59 +0800 Subject: [PATCH 1/7] add and load chain.lua --- chain.lua | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++ utility.lua | 1 + 2 files changed, 221 insertions(+) create mode 100644 chain.lua diff --git a/chain.lua b/chain.lua new file mode 100644 index 0000000000..df1b8d861a --- /dev/null +++ b/chain.lua @@ -0,0 +1,220 @@ +Chain={} + +local function chaininfo_fn(...) + local params={...} + return function(ch) + return Duel.GetChainInfo(ch or 0,table.unpack(params)) + end +end + +Chain.GetTargetCards = chaininfo_fn(CHAININFO_TARGET_CARDS) +Chain.GetTargetPlayer = chaininfo_fn(CHAININFO_TARGET_PLAYER) +Chain.GetTargetParam = chaininfo_fn(CHAININFO_TARGET_PARAM) + +Chain.GetDisableReason = chaininfo_fn(CHAININFO_DISABLE_REASON) +Chain.GetDisablePlayer = chaininfo_fn(CHAININFO_DISABLE_PLAYER) + +Chain.GetID = chaininfo_fn(CHAININFO_CHAIN_ID) + +Chain.GetTriggeringEffect = chaininfo_fn(CHAININFO_TRIGGERING_EFFECT) +Chain.GetTriggeringPlayer = chaininfo_fn(CHAININFO_TRIGGERING_PLAYER) +Chain.GetTriggeringControler = chaininfo_fn(CHAININFO_TRIGGERING_CONTROLER) +Chain.GetTriggeringLocation = chaininfo_fn(CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_LOCATION_SYMBOLIC) +Chain.GetTriggeringSequence = chaininfo_fn(CHAININFO_TRIGGERING_SEQUENCE,CHAININFO_TRIGGERING_SEQUENCE_SYMBOLIC) +Chain.GetTriggeringPosition = chaininfo_fn(CHAININFO_TRIGGERING_POSITION) +Chain.GetTriggeringCode = chaininfo_fn(CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) +Chain.GetTriggeringType = chaininfo_fn(CHAININFO_TRIGGERING_TYPE,CHAININFO_TYPE,CHAININFO_EXTTYPE) +Chain.GetTriggeringLevel = chaininfo_fn(CHAININFO_TRIGGERING_LEVEL) +Chain.GetTriggeringRank = chaininfo_fn(CHAININFO_TRIGGERING_RANK) +Chain.GetTriggeringAttribute = chaininfo_fn(CHAININFO_TRIGGERING_ATTRIBUTE) +Chain.GetTriggeringRace = chaininfo_fn(CHAININFO_TRIGGERING_RACE) +Chain.GetTriggeringATK = chaininfo_fn(CHAININFO_TRIGGERING_ATTACK) +Chain.GetTriggeringDEF = chaininfo_fn(CHAININFO_TRIGGERING_DEFENSE) +Chain.GetTriggeringStatus = chaininfo_fn(CHAININFO_TRIGGERING_STATUS) +Chain.GetTriggeringSummonLocation = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_LOCATION) +Chain.GetTriggeringSummonType = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_TYPE) +Chain.GetTriggeringSetcodes = chaininfo_fn(CHAININFO_TRIGGERING_SETCODES) + +Chain.IsTriggeringCardProperlySummoned = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_PROC_COMPLETE) + +-- boolean check versions for chain info functions + +local function chaininfo_equals(fn) + return function(ch,val) + return fn(ch)==val + end +end + +Chain.IsTriggeringPlayer = chaininfo_equals(Chain.GetTriggeringPlayer) +Chain.IsDisablePlayer = chaininfo_equals(Chain.GetDisablePlayer) +Chain.IsTriggeringControler = chaininfo_equals(Chain.GetTriggeringControler) +Chain.IsTriggeringATK = chaininfo_equals(Chain.GetTriggeringATK) +Chain.IsTriggeringDEF = chaininfo_equals(Chain.GetTriggeringDEF) + +local function chaininfo_includes_bits(fn) + return function(ch,val) + local res=fn(ch) + return res and (res&val)>0 + end +end + + +Chain.IsTriggeringPosition = chaininfo_includes_bits(Chain.GetTriggeringPosition) +Chain.IsTriggeringAttribute = chaininfo_includes_bits(Chain.GetTriggeringAttribute) +Chain.IsTriggeringRace = chaininfo_includes_bits(Chain.GetTriggeringRace) +Chain.IsTriggeringStatus = chaininfo_includes_bits(Chain.GetTriggeringStatus) +Chain.IsTriggeringSummonLocation = chaininfo_includes_bits(Chain.GetTriggeringSummonLocation) +Chain.IsTriggeringSummonType = chaininfo_includes_bits(Chain.GetTriggeringSummonType) + +local function chaininfo_equals_any(fn) + return function(ch,...) + local res=fn(ch) + for _,val in ipairs({...}) do + if res==val then return true end + end + return false + end +end + +Chain.IsTriggeringSequence = chaininfo_equals_any(Chain.GetTriggeringSequence) +Chain.IsTriggeringLevel = chaininfo_equals_any(Chain.GetTriggeringLevel) +Chain.IsTriggeringRank = chaininfo_equals_any(Chain.GetTriggeringRank) + +function Chain.IsTriggeringLocation(ch,loc) + local trig_loc,trig_loc_sym=Chain.GetTriggeringLocation(ch) + return (trig_loc&loc)==loc, + (trig_loc_sym&loc)==loc +end + +function Chain.IsTriggeringCode(ch,...) + local code1,code2=Chain.GetTriggeringCode(ch) + for _,code in ipairs({...}) do + if code==code1 or code==code2 then return true end + end + return false +end + +function Chain.IsTriggeringType(ch,typ) + --hard to name these properly + local typ1,typ2,typ3=Chain.GetTriggeringType(ch) + return (typ1&typ)==typ, + (typ2&typ)==typ, + (typ3&typ)==typ +end + +function Chain.IsTriggeringSetcode(ch,setcodes) + local trig_setcodes=Chain.GetTriggeringSetcodes(ch) + if not trig_setcodes then return false end + if type(setcodes)=="number" then + setcodes={setcodes} + end + for _,setcode in ipairs(setcodes) do + for _,trig_setcode in ipairs(trig_setcodes) do + if (setcode&0xfff)==(trig_setcode&0xfff) and (setcode&trig_setcode)==setcode then return true end + end + end + return false +end + +function Chain.IsTriggeringRaceExcept(ch,race) + return Chain.IsTriggeringRace(ch,RACE_ALL&~race) +end + +function Chain.IsTriggeringAttributeExcept(ch,attr) + return Chain.IsTriggeringAttribute(ch,ATTRIBUTE_ALL&~attr) +end + +-- dynamic chain properties (current properties if the card is still the same copy, otherwise triggering properties) +local function chain_prop(current_fn,triggering_fn) + -- this is counting on the assumption that the additional parameters of the `current_fn` functions + -- won't cause errors with the `triggering_fn` functions, e.g., `Card.GetRace` vs `Chain.GetTriggeringRace` + return function(ch,...) + local eff=Chain.GetTriggeringEffect(ch) + local ec=eff:GetHandler() + if ec:IsRelateToEffect(eff) and ec:IsFaceup() then + return current_fn(ec,...) + end + return triggering_fn(ch,...) + end +end + +Chain.GetControler = chain_prop(Card.GetControler, Chain.GetTriggeringControler) +Chain.GetLocation = chain_prop(Card.GetLocation, Chain.GetTriggeringLocation) +Chain.GetSequence = chain_prop(Card.GetSequence, Chain.GetTriggeringSequence) +Chain.GetPosition = chain_prop(Card.GetPosition, Chain.GetTriggeringPosition) +Chain.GetCode = chain_prop(Card.GetCode, Chain.GetTriggeringCode) +Chain.GetType = chain_prop(Card.GetType, Chain.GetTriggeringType) +Chain.GetLevel = chain_prop(Card.GetLevel, Chain.GetTriggeringLevel) +Chain.GetRank = chain_prop(Card.GetRank, Chain.GetTriggeringRank) +Chain.GetAttribute = chain_prop(Card.GetAttribute, Chain.GetTriggeringAttribute) +Chain.GetRace = chain_prop(Card.GetRace, Chain.GetTriggeringRace) +Chain.GetATK = chain_prop(Card.GetAttack, Chain.GetTriggeringATK) +Chain.GetDEF = chain_prop(Card.GetDefense, Chain.GetTriggeringDEF) +Chain.GetSummonLocation = chain_prop(Card.GetSummonLocation, Chain.GetTriggeringSummonLocation) +Chain.GetSummonType = chain_prop(Card.GetSummonType, Chain.GetTriggeringSummonType) +Chain.GetSetcodes = chain_prop(Card.GetSetCard, Chain.GetTriggeringSetcodes) + +Chain.IsControler = chain_prop(Card.IsControler, Chain.IsTriggeringControler) +Chain.IsLocation = chain_prop(Card.IsLocation, Chain.IsTriggeringLocation) +Chain.IsSequence = chain_prop(Card.IsSequence, Chain.IsTriggeringSequence) +Chain.IsPosition = chain_prop(Card.IsPosition, Chain.IsTriggeringPosition) +Chain.IsCode = chain_prop(Card.IsCode, Chain.IsTriggeringCode) +Chain.IsType = chain_prop(Card.IsType, Chain.IsTriggeringType) +Chain.IsLevel = chain_prop(Card.IsLevel, Chain.IsTriggeringLevel) +Chain.IsRank = chain_prop(Card.IsRank, Chain.IsTriggeringRank) +Chain.IsAttribute = chain_prop(Card.IsAttribute, Chain.IsTriggeringAttribute) +Chain.IsRace = chain_prop(Card.IsRace, Chain.IsTriggeringRace) +Chain.IsATK = chain_prop(Card.IsAttack, Chain.IsTriggeringATK) +Chain.IsDEF = chain_prop(Card.IsDefense, Chain.IsTriggeringDEF) +Chain.IsSummonLocation = chain_prop(Card.IsSummonLocation, Chain.IsTriggeringSummonLocation) +Chain.IsSummonType = chain_prop(Card.IsSummonType, Chain.IsTriggeringSummonType) +Chain.IsSetcode = chain_prop(Card.IsSetCard, Chain.IsTriggeringSetcode) + +function Chain.IsRaceExcept(ch,race) + return Chain.IsRace(ch,RACE_ALL&~race) +end + +function Chain.IsAttributeExcept(ch,attr) + return Chain.IsAttribute(ch,ATTRIBUTE_ALL&~attr) +end + +-- a mechanism for saving any amount of custom information that is strictly associated to a specific chain link +local info_table={} +local info_reset=Effect.GlobalEffect() +info_reset:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) +info_reset:SetCode(EVENT_CHAIN_END) +info_reset:SetOperation(function() info_table={} end) +Duel.RegisterEffect(info_reset,0) + +function Chain.Info(ch) + local cid=Chain.GetID(ch) + info_table[cid]=info_table[cid] or {} + return info_table[cid] +end + +-- aliases for existing chain-related functions (should eventually become the main names) +Chain.ChangeOperation = Duel.ChangeChainOperation +Chain.CanTarget = Duel.CheckChainTarget +Chain.HasUniqueCardNames = Duel.CheckChainUniqueness +Chain.GetTriggeringEvent = Duel.GetChainEvent +Chain.GetCurrentLink = Duel.GetCurrentChain +Chain.IsDisablable = Duel.IsChainDisablable +Chain.IsNegatable = Duel.IsChainNegatable +Chain.IsResolving = Duel.IsChainSolving +Chain.SetLimit = Duel.SetChainLimit +Chain.SetLimitTillEnd = Duel.SetChainLimitTillChainEnd + +-- split Duel.GetChainEvent into individual functions +local function chain_event_fn(n) + return function(ch) + local returns={Duel.GetChainEvent(ch or 0)} + return returns[n] + end +end + +Chain.GetEventGroup = chain_event_fn(1) +Chain.GetEventPlayer = chain_event_fn(2) +Chain.GetEventValue = chain_event_fn(3) +Chain.GetReasonEffect = chain_event_fn(4) +Chain.GetReason = chain_event_fn(5) +Chain.GetReasonPlayer = chain_event_fn(6) diff --git a/utility.lua b/utility.lua index 3901d3f937..f4116f315c 100644 --- a/utility.lua +++ b/utility.lua @@ -2883,6 +2883,7 @@ function Auxiliary.DefaultFieldReturnOp(rg) end Duel.LoadScript("debug_utility.lua") +Duel.LoadScript("chain.lua") Duel.LoadScript("cards_specific_functions.lua") Duel.LoadScript("proc_fusion.lua") Duel.LoadScript("proc_fusion_spell.lua") From a5f79a6bbeefca68a242c94c8cfe96d937c7bbb3 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Sun, 3 May 2026 06:19:15 +0800 Subject: [PATCH 2/7] update cards that use TRIGGERING_SETCODES --- cards_specific_functions.lua | 9 +++------ official/c11464648.lua | 13 ++++--------- official/c11688916.lua | 8 ++------ official/c1340142.lua | 13 ++++--------- official/c15001940.lua | 12 ++---------- official/c17473466.lua | 10 +++------- official/c26223582.lua | 12 ++---------- official/c35371948.lua | 22 +++++----------------- official/c44293356.lua | 9 ++------- official/c46174776.lua | 10 ++-------- official/c52495649.lua | 12 ++---------- official/c53589300.lua | 9 ++------- official/c53618197.lua | 12 ++---------- official/c53782828.lua | 8 +++----- official/c55049722.lua | 8 +++----- official/c56208713.lua | 10 ++++------ official/c56322832.lua | 17 +++++------------ official/c58153103.lua | 13 ++----------- official/c6636319.lua | 15 ++++----------- official/c79755671.lua | 11 ++--------- official/c82699999.lua | 13 +++++-------- official/c88890658.lua | 12 ++---------- official/c89016236.lua | 12 ++---------- pre-release/c101304092.lua | 14 ++------------ pre-release/c101304093.lua | 14 ++------------ pre-release/c101305055.lua | 9 ++------- pre-release/c101305074.lua | 11 ++++------- 27 files changed, 77 insertions(+), 241 deletions(-) diff --git a/cards_specific_functions.lua b/cards_specific_functions.lua index caf43cfa74..3a721965a5 100644 --- a/cards_specific_functions.lua +++ b/cards_specific_functions.lua @@ -290,17 +290,14 @@ function Witchcrafter.CreateCostReplaceEffect(c) e:SetValue(function(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local c=e:GetHandler() - return c:IsSetCard(SET_WITCHCRAFTER) and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) - end - local ctrl,loc,setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if ctrl==1-tp or loc~=LOCATION_MZONE then return false end - for _,setcode in ipairs(setcodes) do - if (SET_WITCHCRAFTER&0xfff)==(setcode&0xfff) and (SET_WITCHCRAFTER&setcode)==SET_WITCHCRAFTER then return true end + return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_WITCHCRAFTER) end + return Chain.IsTriggeringPlayer(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) and Chain.IsTriggeringSetcode(0,SET_WITCHCRAFTER) end) return e end + --Special Summon limit for "Evil HERO" Fusion monsters function Auxiliary.EvilHeroLimit(e,se,sp,st) return se:GetHandler():IsCode(CARD_DARK_FUSION) or (Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),SKILL_DARK_UNITY) and se:GetHandler():IsCode(CARD_SUPER_POLYMERIZATION)) diff --git a/official/c11464648.lua b/official/c11464648.lua index e50c947f46..6309256fad 100644 --- a/official/c11464648.lua +++ b/official/c11464648.lua @@ -52,15 +52,10 @@ function s.immcon(e) return eqpg and eqpg:IsExists(s.equipfilter,1,nil) end function s.immval(e,te) - local tc=te:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (tc:IsRelateToEffect(te) and tc:IsFaceup() and tc:IsLocation(trig_loc)) then - return not tc:IsSetCard(SET_FIENDSMITH) + if Chain.IsResolving() and Chain.GetTriggeringEffect()==te then + return not Chain.IsSetCard(0,SET_FIENDSMITH) end - for _,setcode in ipairs(trig_setcodes) do - if (SET_FIENDSMITH&0xfff)==(setcode&0xfff) and (SET_FIENDSMITH&setcode)==SET_FIENDSMITH then return false end - end - return true + return not te:GetHandler():IsSetCard(SET_FIENDSMITH) end function s.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end @@ -96,4 +91,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c11688916.lua b/official/c11688916.lua index cc864a41e4..8e543e9404 100644 --- a/official/c11688916.lua +++ b/official/c11688916.lua @@ -79,11 +79,7 @@ function s.immcon(e) return a and b and ((a:GetScale()+b:GetScale())%2==1) end function s.immval(e,ct) - local trig_player,trig_setcodes=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_SETCODES) - if trig_player==1-e:GetHandlerPlayer() then return false end - for _,setcode in ipairs(trig_setcodes) do - if (SET_SOLFACHORD&0xfff)==(setcode&0xfff) and (SET_SOLFACHORD&setcode)==SET_SOLFACHORD then return true end - end + return Chain.IsTriggeringPlayer(ct,e:GetHandlerPlayer()) and Chain.IsSetcode(ct,SET_SOLFACHORD) end function s.deckthfilter(c) return c:IsSetCard(SET_SOLFACHORD) and not c:IsCode(id) and c:IsAbleToHand() @@ -117,4 +113,4 @@ function s.gyedthop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end -end \ No newline at end of file +end diff --git a/official/c1340142.lua b/official/c1340142.lua index db685fb258..343ba15c8b 100644 --- a/official/c1340142.lua +++ b/official/c1340142.lua @@ -45,15 +45,10 @@ function s.matcheck(g,lc,sumtype,tp) return g:IsExists(s.matfilter,1,nil,lc,sumtype,tp) end function s.immval(e,te) - local tc=te:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (tc:IsRelateToEffect(te) and tc:IsFaceup() and tc:IsLocation(trig_loc)) then - return not tc:IsSetCard(SET_VAALMONICA) + if Chain.IsResolving() and Chain.GetTriggeringEffect()==te then + return not Chain.IsSetcode(0,SET_VAALMONICA) end - for _,setcode in ipairs(trig_setcodes) do - if (SET_VAALMONICA&0xfff)==(setcode&0xfff) and (SET_VAALMONICA&setcode)==SET_VAALMONICA then return false end - end - return true + return not te:GetHandler():IsSetCard(SET_VAALMONICA) end function s.atkfilter(c) return c:IsLevel(4) and c:IsSetCard(SET_VAALMONICA) and c:IsFaceup() @@ -72,4 +67,4 @@ function s.negsumop(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.RemoveCounter(tp,1,0,COUNTER_RESONANCE,3,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c15001940.lua b/official/c15001940.lua index 4cd7b14e5f..0f7f415c2d 100644 --- a/official/c15001940.lua +++ b/official/c15001940.lua @@ -41,15 +41,7 @@ function s.initial_effect(c) end s.listed_series={SET_RECIPE,SET_NOUVELLES} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToDeck() end @@ -97,4 +89,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c17473466.lua b/official/c17473466.lua index e7cab99297..1daf6b3049 100644 --- a/official/c17473466.lua +++ b/official/c17473466.lua @@ -40,13 +40,9 @@ s.listed_names={id,53589300} --"Nerva the Power Patron of Creation" s.listed_series={SET_POWER_PATRON,SET_ARTMAGE} function s.discon(e,tp,eg,ep,ev,re,r,rp) local ch=Duel.GetCurrentChain()-1 - if not (ch>0 and ep==1-tp and re:IsMonsterEffect() and Duel.IsChainDisablable(ev) and not Duel.HasFlagEffect(tp,id)) then return false end - local ctrl,setcodes,trig_eff=Duel.GetChainInfo(ch,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_SETCODES,CHAININFO_TRIGGERING_EFFECT) - if ctrl~=tp or not trig_eff:IsMonsterEffect() then return false end - for _,set in ipairs(setcodes) do - if (SET_POWER_PATRON&0xfff)==(set&0xfff) and (SET_POWER_PATRON&set)==SET_POWER_PATRON then return true end - if (SET_ARTMAGE&0xfff)==(set&0xfff) and (SET_ARTMAGE&set)==SET_ARTMAGE then return true end - end + return ch>0 and ep==1-tp and not Duel.HasFlagEffect(tp,id) + and Duel.IsChainDisablable(ev) and Chain.IsTriggeringControler(ch,tp) + and Chain.IsTriggeringType(ch,TYPE_MONSTER) and Chain.IsTriggeringSetcode(ch,{SET_POWER_PATRON,SET_ARTMAGE}) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() diff --git a/official/c26223582.lua b/official/c26223582.lua index 89c76c7066..b5df6d20e9 100644 --- a/official/c26223582.lua +++ b/official/c26223582.lua @@ -41,15 +41,7 @@ function s.initial_effect(c) end s.listed_series={SET_NOUVELLES,SET_RECIPE} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>4 end @@ -106,4 +98,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c35371948.lua b/official/c35371948.lua index 56d71364a4..ee2a478012 100644 --- a/official/c35371948.lua +++ b/official/c35371948.lua @@ -148,24 +148,12 @@ function s.rstop2(e,tp,eg,ep,ev,re,r,rp) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) if not (ep==1-tp and Duel.GetLP(1-tp)>0) then return false end - if r&REASON_BATTLE>0 then - return eg:GetFirst():IsSetCard(SET_TRICKSTAR) - else - if not(re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - if re:IsActivated() and (rc:IsFacedown() or not rc:IsRelateToEffect(re)) then - local ch=Duel.GetCurrentChain() - local trig_loc,setcodes=Duel.GetChainInfo(ch,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if trig_loc&LOCATION_MZONE==0 then return false end - for _,set in ipairs(setcodes) do - if (SET_TRICKSTAR&0xfff)==(set&0xfff) and (SET_TRICKSTAR&set)==SET_TRICKSTAR then return true end - end - else - return rc:IsSetCard(SET_TRICKSTAR) - end - end + if r&REASON_BATTLE>0 then return eg:GetFirst():IsSetCard(SET_TRICKSTAR) end + if not (re and re:IsMonsterEffect()) then return false end + if not re:IsActivated() then return re:GetHandler():IsSetCard(SET_TRICKSTAR) end + return Chain.IsTriggeringPlayer(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) and Chain.IsTriggeringSetcode(0,SET_TRICKSTAR) end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Damage(1-tp,200,REASON_EFFECT) -end \ No newline at end of file +end diff --git a/official/c44293356.lua b/official/c44293356.lua index fc9af9bc3c..0eed83fbad 100644 --- a/official/c44293356.lua +++ b/official/c44293356.lua @@ -45,13 +45,8 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterEffect(e1,tp) end function s.inactop(e,tp,eg,ep,ev,re,r,rp) - if ep==1-tp then return end - local trig_typ,trig_setcodes=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) - if trig_typ&(TYPE_RITUAL|TYPE_MONSTER)~=(TYPE_RITUAL|TYPE_MONSTER) then return end - for _,setcode in ipairs(trig_setcodes) do - if (SET_MEGALITH&0xfff)==(setcode&0xfff) and (SET_MEGALITH&setcode)==SET_MEGALITH then - return Duel.SetChainLimit(function(e,rp,tp) return rp==tp end) - end + if ep==tp and Chain.IsTriggeringType(ev,TYPE_RITUAL|TYPE_MONSTER) and Chain.IsTriggeringSetcode(ev,SET_MEGALITH) then + Duel.SetChainLimit(function(e,rp,tp) return rp==tp end) end end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) diff --git a/official/c46174776.lua b/official/c46174776.lua index 38577544b0..c7c6d55d09 100644 --- a/official/c46174776.lua +++ b/official/c46174776.lua @@ -54,13 +54,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) - if not re then return end - local trig_code1,trig_code2,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2,CHAININFO_TRIGGERING_SETCODES) - if trig_code1==id or trig_code2==id then return false end - for _,setcode in ipairs(trig_setcodes) do - if (SET_AZAMINA&0xfff)==(setcode&0xfff) and (SET_AZAMINA&setcode)==SET_AZAMINA then return true end - if (SET_SINFUL_SPOILS&0xfff)==(setcode&0xfff) and (SET_SINFUL_SPOILS&setcode)==SET_SINFUL_SPOILS then return true end - end + return re and Chain.IsTriggeringSetcode(0,{SET_AZAMINA,SET_SINFUL_SPOILS}) and not Chain.IsTriggeringCode(0,id) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end @@ -74,4 +68,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c52495649.lua b/official/c52495649.lua index 39b12114d5..4df08f9007 100644 --- a/official/c52495649.lua +++ b/official/c52495649.lua @@ -44,15 +44,7 @@ function s.initial_effect(c) end s.listed_series={SET_NOUVELLES,SET_RECIPE} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.thfilter(c) return c:IsSetCard({SET_NOUVELLES,SET_RECIPE}) and c:IsAbleToHand() @@ -95,4 +87,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c53589300.lua b/official/c53589300.lua index 40206cc4d8..30ed6efe66 100644 --- a/official/c53589300.lua +++ b/official/c53589300.lua @@ -68,12 +68,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c) g:DeleteGroup() end function s.chcon(e,tp,eg,ep,ev,re,r,rp) - if not (re:IsMonsterEffect() and rp==tp) then return false end - local setcodes=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_SETCODES) - for _,set in ipairs(setcodes) do - if (SET_ARTMAGE&0xfff)==(set&0xfff) and (SET_ARTMAGE&set)==SET_ARTMAGE then return true end - end - return false + return rp==tp and re:IsMonsterEffect() and Chain.IsSetcode(ev,SET_ARTMAGE) end function s.chtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end @@ -88,4 +83,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c53618197.lua b/official/c53618197.lua index 118695411c..f69152374a 100644 --- a/official/c53618197.lua +++ b/official/c53618197.lua @@ -41,15 +41,7 @@ function s.initial_effect(c) end s.listed_series={SET_NOUVELLES,SET_RECIPE} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() end @@ -98,4 +90,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c53782828.lua b/official/c53782828.lua index ac3cd2f0c5..06a3979869 100644 --- a/official/c53782828.lua +++ b/official/c53782828.lua @@ -103,9 +103,7 @@ function s.repval(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_S_FORCE) and extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) end - local ctrl,loc,pos,setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_POSITION,CHAININFO_TRIGGERING_SETCODES) - if ctrl==1-tp or (pos&POS_FACEUP)==0 or loc~=LOCATION_MZONE or not extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) then return false end - for _,setcode in ipairs(setcodes) do - if (SET_S_FORCE&0xfff)==(setcode&0xfff) and (SET_S_FORCE&setcode)==SET_S_FORCE then return true end - end + return Chain.IsTriggeringControler(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) + and Chain.IsTriggeringPosition(0,POS_FACEUP) and Chain.IsTriggeringSetcode(0,SET_S_FORCE) + and extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) end diff --git a/official/c55049722.lua b/official/c55049722.lua index 8e5f23497c..5d3ef867e0 100644 --- a/official/c55049722.lua +++ b/official/c55049722.lua @@ -50,9 +50,7 @@ function s.repval(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_S_FORCE) and extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) end - local ctrl,loc,pos,setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_POSITION,CHAININFO_TRIGGERING_SETCODES) - if ctrl==1-tp or (pos&POS_FACEUP)==0 or loc~=LOCATION_MZONE or not extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) then return false end - for _,setcode in ipairs(setcodes) do - if (SET_S_FORCE&0xfff)==(setcode&0xfff) and (SET_S_FORCE&setcode)==SET_S_FORCE then return true end - end + return Chain.IsTriggeringControler(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) + and Chain.IsTriggeringPosition(0,POS_FACEUP) and Chain.IsTriggeringSetcode(0,SET_S_FORCE) + and extracon(base,e,tp,e,tp,eg,ep,ev,re,r,rp,chk) end diff --git a/official/c56208713.lua b/official/c56208713.lua index a6c4376e13..96dba98962 100644 --- a/official/c56208713.lua +++ b/official/c56208713.lua @@ -41,11 +41,9 @@ s.listed_series={SET_MELODIOUS} s.material_setcode={SET_MELODIOUS} s.listed_names={id} function s.effval(e,ct) - local trig_p,trig_typ,setcodes=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) - if not (trig_p==e:GetHandlerPlayer() and (trig_typ&TYPE_FUSION)>0) then return false end - for _,set in ipairs(setcodes) do - if (SET_MELODIOUS&0xfff)==(set&0xfff) and (SET_MELODIOUS&set)==SET_MELODIOUS then return true end - end + return Chain.IsTriggeringPlayer(ct,e:GetHandlerPlayer()) + and Chain.IsTriggeringType(ct,TYPE_FUSION) + and Chain.IsTriggeringSetcode(ct,SET_MELODIOUS) end function s.deckspfilter(c,e,tp) return c:IsSetCard(SET_MELODIOUS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) @@ -79,4 +77,4 @@ function s.gyspop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end -end \ No newline at end of file +end diff --git a/official/c56322832.lua b/official/c56322832.lua index a737289d07..f8f59ff608 100644 --- a/official/c56322832.lua +++ b/official/c56322832.lua @@ -58,17 +58,10 @@ end s.listed_series={SET_RYU_GE} s.listed_names={id} function s.discon(e,tp,eg,ep,ev,re,r,rp) - if Duel.HasFlagEffect(tp,id) then return false end - local chainlink=Duel.GetCurrentChain(true)-1 - if not (chainlink>0 and ep==1-tp and Duel.IsChainDisablable(ev)) then return false end - local trig_p,trig_typ,setcodes=Duel.GetChainInfo(chainlink,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) - if not (trig_p==tp and (trig_typ&TYPE_SPELL)>0) then return false end - for _,set in ipairs(setcodes) do - if ((SET_RYU_GE&0xfff)==(set&0xfff) and (SET_RYU_GE&set)==SET_RYU_GE) then - return true - end - end - return false + local ch=Duel.GetCurrentChain(true)-1 + return ch>0 and ep==1-tp and not Duel.HasFlagEffect(tp,id) + and Duel.IsChainDisablable(ev) and Chain.IsTriggeringPlayer(ch,tp) + and Chain.IsTriggeringType(ch,TYPE_SPELL) and Chain.IsTriggeringSetcode(ch,SET_RYU_GE) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() @@ -131,4 +124,4 @@ function s.plop(e,tp,eg,ep,ev,re,r,rp) if tc then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end -end \ No newline at end of file +end diff --git a/official/c58153103.lua b/official/c58153103.lua index bc5178361c..cd209e2bac 100644 --- a/official/c58153103.lua +++ b/official/c58153103.lua @@ -70,16 +70,7 @@ s.listed_series={SET_ARMED_DRAGON} s.LVnum=10 s.LVset=SET_ARMED_DRAGON_THUNDER function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_ARMED_DRAGON) - else - for _,setcode in ipairs(trig_setcodes) do - if (SET_ARMED_DRAGON&0xfff)==(setcode&0xfff) and (SET_ARMED_DRAGON&setcode)==SET_ARMED_DRAGON then return true end - end - end + return Chain.IsSetcode(0,SET_ARMED_DRAGON) and re:IsMonsterEffect() end function s.atkcon(atk) return function(e,tp,eg,ep,ev,re,r,rp) @@ -123,4 +114,4 @@ function s.desallop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c6636319.lua b/official/c6636319.lua index 2b57009032..005f48ebb8 100644 --- a/official/c6636319.lua +++ b/official/c6636319.lua @@ -63,18 +63,11 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,1)) end function s.drawcon(e,tp,eg,ep,ev,re,r,rp) - local chainlink=Duel.GetCurrentChain(true)-1 - if not (chainlink>0 and ep==1-tp) then return false end - local trig_p,trig_typ,setcodes=Duel.GetChainInfo(chainlink,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) - if not (trig_p==tp and (trig_typ&TYPE_MONSTER)>0) then return false end - for _,set in ipairs(setcodes) do - if ((SET_KI_SIKIL&0xfff)==(set&0xfff) and (SET_KI_SIKIL&set)==SET_KI_SIKIL) - or ((SET_LIL_LA&0xfff)==(set&0xfff) and (SET_LIL_LA&set)==SET_LIL_LA) then - return true - end - end + return ch>0 and ep==1-tp and Chain.IsTriggeringPlayer(ch,tp) + and Chain.IsTriggeringType(ch,TYPE_MONSTER) + and Chain.IsTriggeringSetcode(ch,{SET_KI_SIKIL,SET_LIL_LA}) end function s.drawop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,1,REASON_EFFECT) -end \ No newline at end of file +end diff --git a/official/c79755671.lua b/official/c79755671.lua index 2b0d778b60..7e024dd7cd 100644 --- a/official/c79755671.lua +++ b/official/c79755671.lua @@ -52,14 +52,7 @@ function s.initial_effect(c) end s.listed_series={SET_DRACOTAIL} function s.descon(e,tp,eg,ep,ev,re,r,rp) - if rp==1-tp then return false end - local trig_p,setcodes=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_SETCODES) - if trig_p==1-tp then return false end - for _,archetype in ipairs(setcodes) do - if ((SET_DRACOTAIL&0xfff)==(archetype&0xfff) and (archetype&SET_DRACOTAIL)==SET_DRACOTAIL) then - return true - end - end + return rp==tp and Chain.IsTriggeringSetcode(0,SET_DRACOTAIL) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end @@ -105,4 +98,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1,true) end -end \ No newline at end of file +end diff --git a/official/c82699999.lua b/official/c82699999.lua index a077e25a15..e4640d85da 100644 --- a/official/c82699999.lua +++ b/official/c82699999.lua @@ -30,13 +30,10 @@ function s.initial_effect(c) end s.listed_series={SET_LIVE_TWIN,SET_KI_SIKIL} function s.discon(e,tp,eg,ep,ev,re,r,rp) - local chainlink=Duel.GetCurrentChain(true)-1 - if not (chainlink>0 and Duel.IsChainDisablable(ev) and ep==1-tp) then return false end - local trig_p,setcodes=Duel.GetChainInfo(chainlink,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_SETCODES) - if not trig_p==tp then return false end - for _,set in ipairs(setcodes) do - if (SET_LIVE_TWIN&0xfff)==(set&0xfff) and (SET_LIVE_TWIN&set)==SET_LIVE_TWIN then return true end - end + local ch=Duel.GetCurrentChain(true)-1 + return ch>0 and ep==1-tp and Duel.IsChainDisablable(ev) + and Chain.IsTriggeringPlayer(ch,tp) + and Chain.IsTriggeringSetcode(ch,SET_LIVE_TWIN) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end @@ -63,4 +60,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c88890658.lua b/official/c88890658.lua index 312780235c..3a92b26ec2 100644 --- a/official/c88890658.lua +++ b/official/c88890658.lua @@ -40,15 +40,7 @@ end s.listed_series={SET_RECIPE,SET_NOUVELLES} s.listed_names={30243636} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,nil) end @@ -111,4 +103,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c89016236.lua b/official/c89016236.lua index c23b4c6fa0..c7d714329f 100644 --- a/official/c89016236.lua +++ b/official/c89016236.lua @@ -41,15 +41,7 @@ function s.initial_effect(c) end s.listed_series={SET_RECIPE,SET_NOUVELLES} function s.regcon(e,tp,eg,ep,ev,re,r,rp) - if not (re and re:IsMonsterEffect()) then return false end - local rc=re:GetHandler() - local trig_loc,trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SETCODES) - if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then - return rc:IsSetCard(SET_NOUVELLES) - end - for _,set in ipairs(trig_setcodes) do - if (SET_NOUVELLES&0xfff)==(set&0xfff) and (SET_NOUVELLES&set)==SET_NOUVELLES then return true end - end + return Chain.IsSetcode(0,SET_NOUVELLES) and re:IsMonsterEffect() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end @@ -95,4 +87,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/pre-release/c101304092.lua b/pre-release/c101304092.lua index 6275e80040..a9619bbf83 100644 --- a/pre-release/c101304092.lua +++ b/pre-release/c101304092.lua @@ -48,17 +48,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) end end function s.effcon(e,tp,eg,ep,ev,re,r,rp) - if ep==1-tp or r&REASON_EFFECT==0 then return false end - local rc=re:GetHandler() - if rc:IsRelateToEffect(re) and rc:IsFaceup() then - return rc:IsSetCard(SET_GMX) - else - local trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_SETCODES) - for _,set in ipairs(trig_setcodes) do - if (SET_GMX&0xfff)==(set&0xfff) and (SET_GMX&set)==SET_GMX then return true end - end - end - return false + return ep==tp and r&REASON_EFFECT>0 and Chain.IsSetcode(0,SET_GMX) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() @@ -93,4 +83,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/pre-release/c101304093.lua b/pre-release/c101304093.lua index 8ae8a44e18..df8f73a087 100644 --- a/pre-release/c101304093.lua +++ b/pre-release/c101304093.lua @@ -99,17 +99,7 @@ function s.lpop(e,tp,eg,ep,ev,re,r,rp) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) - if ep==1-tp or r&REASON_EFFECT==0 then return false end - local rc=re:GetHandler() - if rc:IsRelateToEffect(re) and rc:IsFaceup() then - return rc:IsSetCard(SET_GMX) - else - local trig_setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_SETCODES) - for _,set in ipairs(trig_setcodes) do - if (SET_GMX&0xfff)==(set&0xfff) and (SET_GMX&set)==SET_GMX then return true end - end - end - return false + return ep==tp and r&REASON_EFFECT>0 and Chain.IsSetcode(0,SET_GMX) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) @@ -123,4 +113,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/pre-release/c101305055.lua b/pre-release/c101305055.lua index c7d123d772..a5d181851a 100644 --- a/pre-release/c101305055.lua +++ b/pre-release/c101305055.lua @@ -57,13 +57,8 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) end end function s.inactop(e,tp,eg,ep,ev,re,r,rp) - if ep==1-tp then return end - local trig_typ,trig_setcodes=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) - if trig_typ&TYPE_MONSTER~=TYPE_MONSTER then return end - for _,setcode in ipairs(trig_setcodes) do - if (SET_POWER_PATRON&0xfff)==(setcode&0xfff) and (SET_POWER_PATRON&setcode)==SET_POWER_PATRON then - return Duel.SetChainLimit(function(e,rp,tp) return rp==tp end) - end + if ep==tp and Chain.IsTriggeringType(0,TYPE_MONSTER) and Chain.IsTriggeringSetcode(0,SET_POWER_PATRON) then + Duel.SetChainLimit(function(e,rp,tp) return rp==tp end) end end function s.repval(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) diff --git a/pre-release/c101305074.lua b/pre-release/c101305074.lua index 1845352494..36db92087b 100644 --- a/pre-release/c101305074.lua +++ b/pre-release/c101305074.lua @@ -51,12 +51,9 @@ function s.repval(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_S_FORCE) and Duel.IsExistingMatchingCard(s.repcostfilter,tp,LOCATION_DECK,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) end - local ctrl,loc,pos,setcodes=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_POSITION,CHAININFO_TRIGGERING_SETCODES) - if ctrl==1-tp or (pos&POS_FACEUP)==0 or loc~=LOCATION_MZONE - or not Duel.IsExistingMatchingCard(s.repcostfilter,tp,LOCATION_DECK,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) then return false end - for _,setcode in ipairs(setcodes) do - if (SET_S_FORCE&0xfff)==(setcode&0xfff) and (SET_S_FORCE&setcode)==SET_S_FORCE then return true end - end + return Chain.IsTriggeringControler(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) + and Chain.IsTriggeringPosition(0,POS_FACEUP) and Chain.IsTriggeringSetcode(0,SET_S_FORCE) + and Duel.IsExistingMatchingCard(s.repcostfilter,tp,LOCATION_DECK,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) end function s.repop(base,extracon,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) @@ -86,4 +83,4 @@ function s.banop(e,tp,eg,ep,ev,re,r,rp) if tc:IsImmuneToEffect(e) then return end Duel.MoveSequence(sc,math.log(zone,2)) end -end \ No newline at end of file +end From 6d49529934021e98c957136cd14714e647f51ae6 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Sun, 3 May 2026 22:38:08 +0800 Subject: [PATCH 3/7] Update chain.lua * Added sepatate `Chain.GetTriggeringLocationSymbolic` and `Chain.GetTriggeringSequenceSymbolic`. * Made `Chain.GetTriggeringType` and `Chain.IsTriggeringType` only refer to `CHAININFO_TRIGGERING_TYPE`. Separate functions may be added later for `CHAININFO_TYPE` and `CHAININFO_EXTTYPE` when they're needed. * Integrated symbolic locations into `Chain.IsTriggeringLocation` to be consistent with `Card.IsLocation`. * Symbolic sequences, however, are not integrated into `Chain.IsTriggeringSequence`, and there's no separate function for it (it's currently unused). * Added `Chain.IsTriggeringEffect`. * Minor optimization: Since all chain info functions only pass a single param now, removed variadic args handling from `chaininfo_fn` . * Used Lua's `select` function for `chain_event_fn`. --- chain.lua | 72 ++++++++++++++++++++++++++----------------------------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/chain.lua b/chain.lua index df1b8d861a..6d48c52974 100644 --- a/chain.lua +++ b/chain.lua @@ -1,9 +1,8 @@ Chain={} -local function chaininfo_fn(...) - local params={...} +local function chaininfo_fn(info) return function(ch) - return Duel.GetChainInfo(ch or 0,table.unpack(params)) + return Duel.GetChainInfo(ch or 0,info) end end @@ -16,27 +15,32 @@ Chain.GetDisablePlayer = chaininfo_fn(CHAININFO_DISABLE_PLAYER) Chain.GetID = chaininfo_fn(CHAININFO_CHAIN_ID) -Chain.GetTriggeringEffect = chaininfo_fn(CHAININFO_TRIGGERING_EFFECT) -Chain.GetTriggeringPlayer = chaininfo_fn(CHAININFO_TRIGGERING_PLAYER) -Chain.GetTriggeringControler = chaininfo_fn(CHAININFO_TRIGGERING_CONTROLER) -Chain.GetTriggeringLocation = chaininfo_fn(CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_LOCATION_SYMBOLIC) -Chain.GetTriggeringSequence = chaininfo_fn(CHAININFO_TRIGGERING_SEQUENCE,CHAININFO_TRIGGERING_SEQUENCE_SYMBOLIC) -Chain.GetTriggeringPosition = chaininfo_fn(CHAININFO_TRIGGERING_POSITION) -Chain.GetTriggeringCode = chaininfo_fn(CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) -Chain.GetTriggeringType = chaininfo_fn(CHAININFO_TRIGGERING_TYPE,CHAININFO_TYPE,CHAININFO_EXTTYPE) -Chain.GetTriggeringLevel = chaininfo_fn(CHAININFO_TRIGGERING_LEVEL) -Chain.GetTriggeringRank = chaininfo_fn(CHAININFO_TRIGGERING_RANK) -Chain.GetTriggeringAttribute = chaininfo_fn(CHAININFO_TRIGGERING_ATTRIBUTE) -Chain.GetTriggeringRace = chaininfo_fn(CHAININFO_TRIGGERING_RACE) -Chain.GetTriggeringATK = chaininfo_fn(CHAININFO_TRIGGERING_ATTACK) -Chain.GetTriggeringDEF = chaininfo_fn(CHAININFO_TRIGGERING_DEFENSE) -Chain.GetTriggeringStatus = chaininfo_fn(CHAININFO_TRIGGERING_STATUS) -Chain.GetTriggeringSummonLocation = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_LOCATION) -Chain.GetTriggeringSummonType = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_TYPE) -Chain.GetTriggeringSetcodes = chaininfo_fn(CHAININFO_TRIGGERING_SETCODES) +Chain.GetTriggeringEffect = chaininfo_fn(CHAININFO_TRIGGERING_EFFECT) +Chain.GetTriggeringPlayer = chaininfo_fn(CHAININFO_TRIGGERING_PLAYER) +Chain.GetTriggeringControler = chaininfo_fn(CHAININFO_TRIGGERING_CONTROLER) +Chain.GetTriggeringLocation = chaininfo_fn(CHAININFO_TRIGGERING_LOCATION) +Chain.GetTriggeringLocationSymbolic = chaininfo_fn(CHAININFO_TRIGGERING_LOCATION_SYMBOLIC) +Chain.GetTriggeringSequence = chaininfo_fn(CHAININFO_TRIGGERING_SEQUENCE) +Chain.GetTriggeringLocationSymbolic = chaininfo_fn(CHAININFO_TRIGGERING_SEQUENCE_SYMBOLIC) +Chain.GetTriggeringPosition = chaininfo_fn(CHAININFO_TRIGGERING_POSITION) +Chain.GetTriggeringType = chaininfo_fn(CHAININFO_TRIGGERING_TYPE) +Chain.GetTriggeringLevel = chaininfo_fn(CHAININFO_TRIGGERING_LEVEL) +Chain.GetTriggeringRank = chaininfo_fn(CHAININFO_TRIGGERING_RANK) +Chain.GetTriggeringAttribute = chaininfo_fn(CHAININFO_TRIGGERING_ATTRIBUTE) +Chain.GetTriggeringRace = chaininfo_fn(CHAININFO_TRIGGERING_RACE) +Chain.GetTriggeringATK = chaininfo_fn(CHAININFO_TRIGGERING_ATTACK) +Chain.GetTriggeringDEF = chaininfo_fn(CHAININFO_TRIGGERING_DEFENSE) +Chain.GetTriggeringStatus = chaininfo_fn(CHAININFO_TRIGGERING_STATUS) +Chain.GetTriggeringSummonLocation = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_LOCATION) +Chain.GetTriggeringSummonType = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_TYPE) +Chain.GetTriggeringSetcodes = chaininfo_fn(CHAININFO_TRIGGERING_SETCODES) Chain.IsTriggeringCardProperlySummoned = chaininfo_fn(CHAININFO_TRIGGERING_SUMMON_PROC_COMPLETE) +function Chain.GetTriggeringCode(ch) + return Duel.GetChainInfo(ch or 0,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) +end + -- boolean check versions for chain info functions local function chaininfo_equals(fn) @@ -45,6 +49,7 @@ local function chaininfo_equals(fn) end end +Chain.IsTriggeringEffect = chaininfo_equals(Chain.GetTriggeringEffect) Chain.IsTriggeringPlayer = chaininfo_equals(Chain.GetTriggeringPlayer) Chain.IsDisablePlayer = chaininfo_equals(Chain.GetDisablePlayer) Chain.IsTriggeringControler = chaininfo_equals(Chain.GetTriggeringControler) @@ -58,14 +63,20 @@ local function chaininfo_includes_bits(fn) end end - Chain.IsTriggeringPosition = chaininfo_includes_bits(Chain.GetTriggeringPosition) +Chain.IsTriggeringType = chaininfo_includes_bits(Chain.GetTriggeringType) Chain.IsTriggeringAttribute = chaininfo_includes_bits(Chain.GetTriggeringAttribute) Chain.IsTriggeringRace = chaininfo_includes_bits(Chain.GetTriggeringRace) Chain.IsTriggeringStatus = chaininfo_includes_bits(Chain.GetTriggeringStatus) Chain.IsTriggeringSummonLocation = chaininfo_includes_bits(Chain.GetTriggeringSummonLocation) Chain.IsTriggeringSummonType = chaininfo_includes_bits(Chain.GetTriggeringSummonType) +--integrates symbolic locations to be consistent with Card.IsLocation +Chain.IsTriggeringLocation = aux.OR( + chaininfo_includes_bits(Chain.GetTriggeringLocation), + chaininfo_includes_bits(Chain.GetTriggeringLocationSymbolic) +) + local function chaininfo_equals_any(fn) return function(ch,...) local res=fn(ch) @@ -80,12 +91,6 @@ Chain.IsTriggeringSequence = chaininfo_equals_any(Chain.GetTriggeringSequence) Chain.IsTriggeringLevel = chaininfo_equals_any(Chain.GetTriggeringLevel) Chain.IsTriggeringRank = chaininfo_equals_any(Chain.GetTriggeringRank) -function Chain.IsTriggeringLocation(ch,loc) - local trig_loc,trig_loc_sym=Chain.GetTriggeringLocation(ch) - return (trig_loc&loc)==loc, - (trig_loc_sym&loc)==loc -end - function Chain.IsTriggeringCode(ch,...) local code1,code2=Chain.GetTriggeringCode(ch) for _,code in ipairs({...}) do @@ -94,14 +99,6 @@ function Chain.IsTriggeringCode(ch,...) return false end -function Chain.IsTriggeringType(ch,typ) - --hard to name these properly - local typ1,typ2,typ3=Chain.GetTriggeringType(ch) - return (typ1&typ)==typ, - (typ2&typ)==typ, - (typ3&typ)==typ -end - function Chain.IsTriggeringSetcode(ch,setcodes) local trig_setcodes=Chain.GetTriggeringSetcodes(ch) if not trig_setcodes then return false end @@ -207,8 +204,7 @@ Chain.SetLimitTillEnd = Duel.SetChainLimitTillChainEnd -- split Duel.GetChainEvent into individual functions local function chain_event_fn(n) return function(ch) - local returns={Duel.GetChainEvent(ch or 0)} - return returns[n] + return (select(n,Duel.GetChainEvent(ch or 0))) end end From b9fd80a4f78e21030faadb9520cadd07a3f7edca Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Wed, 6 May 2026 21:54:57 +0800 Subject: [PATCH 4/7] update chain.lua * Renamed `Chain.Info` to `Chain.Data` to avoid confusion with existing "chain info" functions * overwrote `Debug.ReloadFIleBegin` to avoid having the tracking global effect deleted * allowed `Chain.Data` to take an optional `key` parameter, which makes it return different tables associated to the same chain link, avoiding potential conflicts when two effects try to access the same chain link data * by passing `nil` as key, a "shared" table can be accessed * added `Effect.GetChainData` which passes the effect as the `key` to `Chain.Data` --- chain.lua | 65 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/chain.lua b/chain.lua index 6d48c52974..a9b7200065 100644 --- a/chain.lua +++ b/chain.lua @@ -176,41 +176,56 @@ function Chain.IsAttributeExcept(ch,attr) end -- a mechanism for saving any amount of custom information that is strictly associated to a specific chain link -local info_table={} -local info_reset=Effect.GlobalEffect() -info_reset:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) -info_reset:SetCode(EVENT_CHAIN_END) -info_reset:SetOperation(function() info_table={} end) -Duel.RegisterEffect(info_reset,0) - -function Chain.Info(ch) +local data_table={} + +do + -- prevent Debug.ReloadFieldBegin from resetting the global effect + local old=Debug.ReloadFieldBegin + function Debug.ReloadFieldBegin(...) + old(...) + local data_reset=Effect.GlobalEffect() + data_reset:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) + data_reset:SetCode(EVENT_CHAIN_END) + data_reset:SetCountLimit(1) + data_reset:SetOperation(function() data_table={} end) + Duel.RegisterEffect(data_reset,0) + end +end + +local shared_data_key={} -- dummy table to be used as a unique key + +function Chain.Data(ch,key) + local current_link=Chain.GetCurrentLink() + if current_link==0 then + return error("Attempted to access Chain Data table while there is currently no Chain",2) + elseif ch and ch>current_link then + return error("Attempted to access Chain Link higher than current Chain",2) + end + + if not ch or ch==0 then ch=current_link end + local cid=Chain.GetID(ch) - info_table[cid]=info_table[cid] or {} - return info_table[cid] + local chain_link_data=data_table[cid] or {} + data_table[cid]=chain_link_data + + -- if no key is supplied, use a default key for shared data table + key=key or shared_data_key + + chain_link_data[key]=chain_link_data[key] or {} + return chain_link_data[key] +end + +function Effect.GetChainData(e,ch) + return Chain.Data(ch,e) end -- aliases for existing chain-related functions (should eventually become the main names) Chain.ChangeOperation = Duel.ChangeChainOperation Chain.CanTarget = Duel.CheckChainTarget Chain.HasUniqueCardNames = Duel.CheckChainUniqueness -Chain.GetTriggeringEvent = Duel.GetChainEvent Chain.GetCurrentLink = Duel.GetCurrentChain Chain.IsDisablable = Duel.IsChainDisablable Chain.IsNegatable = Duel.IsChainNegatable Chain.IsResolving = Duel.IsChainSolving Chain.SetLimit = Duel.SetChainLimit Chain.SetLimitTillEnd = Duel.SetChainLimitTillChainEnd - --- split Duel.GetChainEvent into individual functions -local function chain_event_fn(n) - return function(ch) - return (select(n,Duel.GetChainEvent(ch or 0))) - end -end - -Chain.GetEventGroup = chain_event_fn(1) -Chain.GetEventPlayer = chain_event_fn(2) -Chain.GetEventValue = chain_event_fn(3) -Chain.GetReasonEffect = chain_event_fn(4) -Chain.GetReason = chain_event_fn(5) -Chain.GetReasonPlayer = chain_event_fn(6) From e57201833754a2f20f15ca0ee548e1bec1b698d1 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Wed, 6 May 2026 21:57:44 +0800 Subject: [PATCH 5/7] update Cost.Choice and Cost.DetachFromSelf * `Cost.Choice` now stores the selected choice as chain data, instead of a label * `Cost.DetachFromSelf` now stores the detached material as chain data --- utility.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/utility.lua b/utility.lua index f4116f315c..cb65b6b27b 100644 --- a/utility.lua +++ b/utility.lua @@ -1583,8 +1583,12 @@ function Cost.DetachFromSelf(min,max,op) local min_count=min_type=="function" and min(e,tp) or min local max_count=max_type=="function" and max(e,tp) or max if chk==0 then return min_count>0 and max_count>=min_count and c:CheckRemoveOverlayCard(tp,min_count,REASON_COST) end - if c:RemoveOverlayCard(tp,min_count,max_count,REASON_COST)>0 and op then - op(e,Duel.GetOperatedGroup()) + if c:RemoveOverlayCard(tp,min_count,max_count,REASON_COST)>0 then + local cd=Chain.Data() + cd.cost_detached_materials=Duel.GetOperatedGroup() + if op then + op(e,cd.cost_detached_materials) + end end end @@ -1729,9 +1733,9 @@ function Cost.Choice(...) if chk==0 then return has_choice end - local op=Duel.SelectEffect(tp,table.unpack(ops)) - choices[op][1](e,tp,eg,ep,ev,re,r,rp,1) - e:SetLabel(op) + local cd=e:GetChainData() + cd.cost_choice=Duel.SelectEffect(tp,table.unpack(ops)) + choices[cd.cost_choice][1](e,tp,eg,ep,ev,re,r,rp,1) end for _,t in pairs(cost_tables) do From 5bbc4158315dea19cc7e5e12832bfb0c37a560f0 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Wed, 6 May 2026 21:58:15 +0800 Subject: [PATCH 6/7] update some cards to use chain data --- official/c14532163.lua | 13 +++++----- official/c17151328.lua | 27 +++++++++----------- official/c17209452.lua | 18 +++++++------- official/c20415050.lua | 15 +++++------ official/c21147203.lua | 11 +++++--- official/c30271097.lua | 36 +++++++++++---------------- official/c30291086.lua | 20 +++++++-------- official/c33008376.lua | 6 ++--- official/c34568783.lua | 15 +++++------ official/c35697544.lua | 32 ++++++++++++------------ official/c40380686.lua | 23 ++++++++--------- official/c40847034.lua | 15 +++++------ official/c41069676.lua | 28 ++++++++------------- official/c44190146.lua | 51 +++++++++++--------------------------- official/c47172959.lua | 17 +++++++------ official/c53008933.lua | 8 +++--- official/c58995660.lua | 20 +++++++-------- official/c70088809.lua | 27 ++++++++++---------- official/c73664385.lua | 16 ++++++------ official/c84271823.lua | 13 ++++------ official/c88021907.lua | 18 +++++++------- official/c92269002.lua | 20 +++++++-------- official/c92936364.lua | 12 ++++----- pre-release/c100455026.lua | 21 ++++++++-------- pre-release/c101305051.lua | 30 +++++++++------------- 25 files changed, 233 insertions(+), 279 deletions(-) diff --git a/official/c14532163.lua b/official/c14532163.lua index dacf4b7b46..81d4c57d34 100644 --- a/official/c14532163.lua +++ b/official/c14532163.lua @@ -23,19 +23,20 @@ function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=#g1>0 local b2=#g2>0 if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,0)}, {b2,aux.Stringid(id,1)}) - e:SetLabel(op) - local g=(op==1 and g1 or g2) + local g=(cd.choice==1 and g1 or g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) - if e:GetLabel()==1 then + local cd=e:GetChainData() + if cd.choice==1 then local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end - else + elseif cd.choice==2 then local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end -end \ No newline at end of file +end diff --git a/official/c17151328.lua b/official/c17151328.lua index bb5fe39759..1fd2cad3da 100644 --- a/official/c17151328.lua +++ b/official/c17151328.lua @@ -35,11 +35,11 @@ function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) local b2=Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_HAND,0,1,nil,ATTRIBUTE_FIRE) if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then Duel.DiscardHand(tp,s.discardcostfilter,1,1,REASON_DISCARD|REASON_COST) end end @@ -48,21 +48,18 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local b1=Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) local b2=Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_HAND,0,1,nil,ATTRIBUTE_FIRE) if chk==0 then return b1 or b2 end - local op=e:GetLabel() - if op==0 then - op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=cd.choice + or Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) - end - e:SetLabel(0) - Duel.SetTargetParam(op) - if op==1 then + if cd.choice==1 then e:SetCategory(CATEGORY_DESTROY) e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e:SetProperty(0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND) @@ -70,14 +67,14 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --Destroy 1 face-up monster your opponent controls local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end - elseif op==2 then + elseif cd.choice==2 then --Destroy 1 FIRE monster in your hand, then you can draw 1 card Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsAttribute,tp,LOCATION_HAND,0,1,1,nil,ATTRIBUTE_FIRE) @@ -104,4 +101,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c17209452.lua b/official/c17209452.lua index bfb2efcfee..79bf7330ea 100644 --- a/official/c17209452.lua +++ b/official/c17209452.lua @@ -58,14 +58,14 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,1,nil) local b2=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then e:SetCategory(CATEGORY_TODECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_GRAVE) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end @@ -74,16 +74,16 @@ function s.thfilter(c) return c:IsSetCard(SET_KEWL_TUNE) and c:IsSpellTrap() and c:IsAbleToHand() end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --● Place 1 card from your opponent's GY on the bottom of the Deck Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT) - end - elseif op==2 then + end + elseif cd.choice==2 then --● Look at your opponent's hand, then you can add 1 "Kewl Tune" Spell/Trap from your Deck to your hand local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g==0 then return end @@ -99,4 +99,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmCards(1-tp,hsg) end end -end \ No newline at end of file +end diff --git a/official/c20415050.lua b/official/c20415050.lua index 1f32bc3f55..030111589f 100644 --- a/official/c20415050.lua +++ b/official/c20415050.lua @@ -31,14 +31,12 @@ s.listed_names={id} function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() - local with_cost=Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,c) - if with_cost and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then + if Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,c) + and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SendtoGrave(g,REASON_COST) - e:SetLabel(1) - else - e:SetLabel(0) + e:GetChainData().paid_cost=true end end function s.thfilter(c) @@ -46,8 +44,6 @@ function s.thfilter(c) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end - Duel.SetTargetParam(e:GetLabel()) - e:SetLabel(0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.setfilter(c) @@ -59,7 +55,8 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) - if Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)==1 and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) + if e:GetChainData().paid_cost + and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) @@ -81,4 +78,4 @@ function s.drwop(e,tp,eg,ep,ev,re,r,rp) Duel.BreakEffect() Duel.DiscardHand(1-tp,nil,1,1,REASON_EFFECT|REASON_DISCARD) end -end \ No newline at end of file +end diff --git a/official/c21147203.lua b/official/c21147203.lua index 9d81cb7646..2edbfb4f3b 100644 --- a/official/c21147203.lua +++ b/official/c21147203.lua @@ -57,7 +57,10 @@ function s.deckspcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.deckspcostfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local sc=Duel.SelectMatchingCard(tp,s.deckspcostfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp):GetFirst() - e:SetLabel(sc:GetOriginalRace(),sc:GetOriginalAttribute(),sc:GetOriginalLevel()) + local cd=e:GetChainData() + cd.race=sc:GetOriginalRace() + cd.attribute=sc:GetOriginalAttribute() + cd.level=sc:GetOriginalLevel() Duel.Remove(sc,POS_FACEUP,REASON_COST) end function s.decksptg(e,tp,eg,ep,ev,re,r,rp,chk) @@ -66,10 +69,10 @@ function s.decksptg(e,tp,eg,ep,ev,re,r,rp,chk) end function s.deckspop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local rac,att,lvl=e:GetLabel() + local cd=e:GetChainData() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.deckspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,rac,att,lvl) + local g=Duel.SelectMatchingCard(tp,s.deckspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,cd.race,cd.attribute,cd.level) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c30271097.lua b/official/c30271097.lua index f465eedc66..0441e4751b 100644 --- a/official/c30271097.lua +++ b/official/c30271097.lua @@ -33,11 +33,11 @@ function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) and Duel.IsExistingTarget(Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,0,tp,false,false) if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.descostfilter,tp,LOCATION_EXTRA,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) @@ -46,10 +46,10 @@ end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then - local op=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then return chkc:IsOnField() and chkc:IsFaceup() and chkc~=c - elseif op==2 then + elseif cd.choice==2 then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsCanBeSpecialSummoned(e,0,tp,false,false) end end @@ -61,23 +61,17 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) and Duel.IsExistingTarget(Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,0,tp,false,false) if chk==0 then return b1 or b2 end - local op=nil - local label=e:GetLabel() - if label~=0 then - op=label - else - op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=cd.choice + or Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) - end - e:SetLabel(0) - Duel.SetTargetParam(op) - if op==1 then + if cd.choice==1 then e:SetCategory(CATEGORY_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,0,tp,false,false) @@ -87,12 +81,12 @@ end function s.effop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end - local op=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --Send 1 monster that mentions "Fallen of Albaz" from your Extra Deck to the GY, then target 1 face-up card on the field; destroy it Duel.Destroy(tc,REASON_EFFECT) - elseif op==2 then + elseif cd.choice==2 then --If you have an "Ecclesia" monster in your field or GY: Target 1 monster in either GY; Special Summon it to your field Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c30291086.lua b/official/c30291086.lua index f19648f8d1..8d91083cb2 100644 --- a/official/c30291086.lua +++ b/official/c30291086.lua @@ -30,31 +30,31 @@ function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return c:HasLevel() and (#rmg>0 or #tgg>0) end e:SetCategory(0) e:SetProperty(0) - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {#rmg>0,aux.Stringid(id,1)}, {#tgg>0,aux.Stringid(id,2)}) - if op==1 then + if cd.choice==1 then local rg=aux.SelectUnselectGroup(rmg,e,tp,1,2,s.attrescon,1,tp,HINTMSG_REMOVE) Duel.Remove(rg,POS_FACEUP,REASON_COST) - local ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_REMOVED) - e:SetLabel(op,ct) - elseif op==2 then + cd.banished_amount=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_REMOVED) + elseif cd.choice==2 then e:SetCategory(CATEGORY_TOGRAVE) e:SetProperty(EFFECT_FLAG_CARD_TARGET) local tg=aux.SelectUnselectGroup(tgg,e,tp,1,2,s.attrescon,1,tp,HINTMSG_TOGRAVE) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,tg,#tg,0,0) - e:SetLabel(2) end end function s.lvop(e,tp,eg,ep,ev,re,r,rp) - local op,ct=e:GetLabel() - if op==2 then + local cd=e:GetChainData() + local ct=cd.banished_amount + if cd.choice==2 then local tg=Duel.GetTargetCards(e) if #tg>0 then ct=Duel.SendtoGrave(tg,REASON_EFFECT|REASON_RETURN) end - elseif op~=1 then return end + elseif cd.choice~=1 then return end if not ct or ct==0 then return end local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup() and c:HasLevel()) then return end @@ -66,4 +66,4 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp) if lvop then c:UpdateLevel(lvop==1 and ct or -ct,RESETS_STANDARD_DISABLE_PHASE_END) end -end \ No newline at end of file +end diff --git a/official/c33008376.lua b/official/c33008376.lua index 740013cc73..dd790aeea2 100644 --- a/official/c33008376.lua +++ b/official/c33008376.lua @@ -35,7 +35,7 @@ function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local sc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp):GetFirst() - e:SetLabel(sc:IsType(TYPE_NORMAL) and 1 or 0) + e:GetChainData().banished_normal=sc:IsType(TYPE_NORMAL) Duel.SendtoGrave(sc,REASON_COST|REASON_DISCARD) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) @@ -45,8 +45,8 @@ end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp,e:GetLabel()==1) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp,e:GetChainData().banished_normal) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c34568783.lua b/official/c34568783.lua index 8d9cc23e2e..9266dc3081 100644 --- a/official/c34568783.lua +++ b/official/c34568783.lua @@ -34,22 +34,23 @@ function s.attrcost(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local sc=Duel.SelectMatchingCard(tp,s.attrcfilter,tp,LOCATION_GRAVE,0,1,1,nil,attr):GetFirst() Duel.Remove(sc,POS_FACEUP,REASON_COST) - local tn_chk=sc:IsType(TYPE_TUNER) and 1 or 0 - e:SetLabel(sc:GetAttribute(),tn_chk) + local cd=e:GetChainData() + cd.attribute=sc:GetAttribute() + cd.banished_tuner=sc:IsType(TYPE_TUNER) end function s.attrop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsFaceup() and c:IsRelateToEffect(e)) then return end - local attr,tn_chk=e:GetLabel() - if c:IsAttribute(attr) then return end + local cd=e:GetChainData() + if c:IsAttribute(cd.attribute) then return end --This card gains that monster's Attribute local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_ATTRIBUTE) - e1:SetValue(attr) + e1:SetValue(cd.attribute) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) - if tn_chk==0 then return end + if not cd.banished_tuner then return end Duel.BreakEffect() --Can be treated as a Tuner this turn local e2=Effect.CreateEffect(c) @@ -100,4 +101,4 @@ end function s.rmtg(e,c) local tp=e:GetHandlerPlayer() return c:GetOwner()==tp and Duel.IsPlayerCanRemove(tp,c) -end \ No newline at end of file +end diff --git a/official/c35697544.lua b/official/c35697544.lua index 93da92f0ac..2339f9eef2 100644 --- a/official/c35697544.lua +++ b/official/c35697544.lua @@ -23,44 +23,44 @@ function s.disconfilter(c,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() - if chkc then return e:GetLabel()==2 and chkc:IsOnField() and chkc~=c end + if chkc then return e:GetChainData().choice==2 and chkc:IsOnField() and chkc~=c end local bc=Duel.GetBattleMonster(tp) local b3_event,_,event_p,event_v,event_reff=Duel.CheckEvent(EVENT_CHAINING,true) - local tg=b3_event and Duel.GetChainInfo(event_v,CHAININFO_TARGET_CARDS) or nil + local tg=b3_event and Chain.GetTargetCards(event_v) or nil --Add 1 card from your Deck to your hand that mentions "Flame Swordsman", except "Fighting Flame Sword" local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) --Destroy 1 card on the field local b2=Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and bc and bc:IsAttribute(ATTRIBUTE_FIRE) and bc:IsRace(RACE_WARRIOR) and bc:IsFaceup() and Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) --Negate an opponent's effect that targets "Flame Swordsman" or a monster(s) that mentions it, that you control - local b3=b3_event and event_p==1-tp and event_reff:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and tg and tg:IsExists(s.disconfilter,1,nil,tp) - and Duel.IsChainDisablable(event_v) + local b3=b3_event and event_p==1-tp and event_reff:IsHasProperty(EFFECT_FLAG_CARD_TARGET) + and tg and tg:IsExists(s.disconfilter,1,nil,tp) and Chain.IsDisablable(event_v) if chk==0 then return b1 or b2 or b3 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}, {b3,aux.Stringid(id,3)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e:SetProperty(0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_DESTROY) e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) - elseif op==3 then + elseif cd.choice==3 then + cd.negate_chain_link=event_v e:SetCategory(CATEGORY_DISABLE) e:SetProperty(0) - e:SetLabel(op,event_v) Duel.SetOperationInfo(0,CATEGORY_DISABLE,event_reff:GetHandler(),1,tp,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local op,event_v=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --Add 1 card from your Deck to your hand that mentions "Flame Swordsman", except "Fighting Flame Sword" Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) @@ -68,14 +68,14 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end - elseif op==2 then + elseif cd.choice==2 then --Destroy 1 card on the field local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end - elseif op==3 then + elseif cd.choice==3 then --Negate an opponent's effect that targets "Flame Swordsman" or a monster(s) that mentions it, that you control - Duel.NegateEffect(event_v) + Duel.NegateEffect(cd.negate_chain_link) end -end \ No newline at end of file +end diff --git a/official/c40380686.lua b/official/c40380686.lua index c25345da69..06749b8cd4 100644 --- a/official/c40380686.lua +++ b/official/c40380686.lua @@ -30,39 +30,38 @@ end function s.chtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=Duel.GetMatchingGroup(s.chfilter,tp,LOCATION_MZONE,0,nil,e) if chk==0 then return #g>0 end + local cd=e:GetChainData() if Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))==0 then - local rc=Duel.AnnounceAnotherRace(g,tp) + cd.race=Duel.AnnounceAnotherRace(g,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - local sg=g:FilterSelect(tp,Card.IsRaceExcept,1,1,nil,rc) + local sg=g:FilterSelect(tp,Card.IsRaceExcept,1,1,nil,cd.race) Duel.SetTargetCard(sg) - e:SetLabel(0,rc) else - local att=Duel.AnnounceAnotherAttribute(g,tp) + cd.attribute=Duel.AnnounceAnotherAttribute(g,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - local sg=g:FilterSelect(tp,Card.IsAttributeExcept,1,1,nil,att) + local sg=g:FilterSelect(tp,Card.IsAttributeExcept,1,1,nil,cd.attribute) Duel.SetTargetCard(sg) - e:SetLabel(1,att) end end function s.chop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc or not tc:IsRelateToEffect(e) or tc:IsFacedown() then return end - local op,decl=e:GetLabel() - if op==0 and tc:IsRaceExcept(decl) then + local cd=e:GetChainData() + if cd.race and tc:IsRaceExcept(cd.race) then --Change monster type local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) - e1:SetValue(decl) + e1:SetValue(cd.race) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) - elseif op==1 and tc:IsAttributeExcept(decl) then + elseif cd.attribute and tc:IsAttributeExcept(cd.attribute) then --Change attribute local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_ATTRIBUTE) - e1:SetValue(decl) + e1:SetValue(cd.attribute) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c40847034.lua b/official/c40847034.lua index 609ea10514..166bcbeac5 100644 --- a/official/c40847034.lua +++ b/official/c40847034.lua @@ -66,31 +66,28 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=eff:GetTarget() if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) - eff:SetLabel(e:GetLabel()) - eff:SetLabelObject(e:GetLabelObject()) Duel.ClearOperationInfo(0) end end - e:SetLabelObject({tc,eff}) + local cd=e:GetChainData() + cd.playlist_target_card=tc + cd.playlist_target_effect=eff e:SetCategory(CATEGORY_TOHAND) Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local tc=e:GetLabelObject()[1] + local cd=e:GetChainData() + local tc=cd.playlist_target_card if tc and tc:IsRelateToEffect(e) then local break_chk=false - local te=e:GetLabelObject()[2] + local te=cd.playlist_target_effect if te then --● Apply that target's effect that activates when it is sent to the GY as Synchro Material local op=te:GetOperation() if tc:IsFaceup() and op then - e:SetLabel(te:GetLabel()) - e:SetLabelObject(te:GetLabelObject()) op(e,tp,eg,ep,ev,re,r,rp) break_chk=true end - e:SetLabel(0) - e:SetLabelObject(nil) end --● Return that target to the hand if break_chk then Duel.BreakEffect() end diff --git a/official/c41069676.lua b/official/c41069676.lua index 12aea52532..ca1cf2a694 100644 --- a/official/c41069676.lua +++ b/official/c41069676.lua @@ -61,17 +61,17 @@ function s.applycost(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() Duel.Remove(rc,POS_FACEUP,REASON_COST) - local available_effs={} + local cd=e:GetChainData() + cd.available_effects={} local effs={rc:GetOwnEffects()} for _,eff in ipairs(effs) do if eff:GetCode()==EVENT_BE_MATERIAL then local tg=eff:GetTarget() if tg==nil or tg(eff,tp,Group.CreateGroup(),PLAYER_NONE,0,e,REASON_EFFECT,PLAYER_NONE,0) then - table.insert(available_effs,eff) + table.insert(cd.available_effects,eff) end end end - e:SetLabelObject(available_effs) end function s.applytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then @@ -80,16 +80,16 @@ function s.applytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end if chk==0 then return true end local eff=nil - local available_effs=e:GetLabelObject() - if #available_effs>1 then + local cd=e:GetChainData() + if #cd.available_effects>1 then local available_effs_desc={} - for _,eff in ipairs(available_effs) do + for _,eff in ipairs(cd.available_effects) do table.insert(available_effs_desc,eff:GetDescription()) end local op=Duel.SelectOption(tp,table.unpack(available_effs_desc)) - eff=available_effs[op+1] + eff=cd.available_effects[op+1] else - eff=available_effs[1] + eff=cd.available_effects[1] end Duel.Hint(HINT_OPSELECTED,1-tp,eff:GetDescription()) e:SetLabel(eff:GetLabel()) @@ -99,21 +99,15 @@ function s.applytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end - eff:SetLabel(e:GetLabel()) - eff:SetLabelObject(e:GetLabelObject()) - e:SetLabelObject(eff) e:SetCategory(0) Duel.ClearOperationInfo(0) + cd.loudness_war_target_effect=eff end function s.applyop(e,tp,eg,ep,ev,re,r,rp) - local eff=e:GetLabelObject() + local eff=e:GetChainData().loudness_war_target_effect if not eff then return end - e:SetLabel(eff:GetLabel()) - e:SetLabelObject(eff:GetLabelObject()) local op=eff:GetOperation() if op then op(e,tp,Group.CreateGroup(),PLAYER_NONE,0,e,REASON_EFFECT,PLAYER_NONE) end - e:SetLabel(0) - e:SetLabelObject(nil) -end \ No newline at end of file +end diff --git a/official/c44190146.lua b/official/c44190146.lua index 65e31fc2b0..20ef274c06 100644 --- a/official/c44190146.lua +++ b/official/c44190146.lua @@ -28,35 +28,6 @@ function s.initial_effect(c) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) - --Global check - aux.GlobalCheck(s,function() - s[0]=nil - s[1]=Group.CreateGroup() - local tmp_g=Group.CreateGroup() - --Keep track of an Xyz Monster activating its effect by detaching a Normal Monster - local ge1=Effect.CreateEffect(c) - ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - ge1:SetCode(EVENT_DETACH_MATERIAL) - ge1:SetLabelObject(tmp_g) - ge1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) - local cid=Duel.GetCurrentChain() - if cid>0 and #tmp_g>0 then - s[0]=Duel.GetChainInfo(cid,CHAININFO_CHAIN_ID) - s[1]=tmp_g-eg:GetFirst():GetOverlayGroup() - tmp_g:Clear() - end - end) - Duel.RegisterEffect(ge1,0) - local ge2=Effect.CreateEffect(c) - ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - ge2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE) - ge2:SetLabelObject(ge1) - ge2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) - tmp_g:Merge(re:GetHandler():GetOverlayGroup()) - return false - end) - Duel.RegisterEffect(ge2,0) - end) end s.listed_names={CARD_PRINCESS_COLOGNE} function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) @@ -102,24 +73,30 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummonComplete() end function s.descon(e,tp,eg,ep,ev,re,r,rp) - return Duel.GetChainInfo(0,CHAININFO_CHAIN_ID)==s[0] and re:GetHandler():IsControler(tp) and re:IsActiveType(TYPE_XYZ) - and s[1] and s[1]:IsExists(Card.IsOriginalType,1,nil,TYPE_NORMAL) + local dg=Chain.Data().cost_detached_materials + return dg and re:GetHandler():IsControler(tp) and re:IsActiveType(TYPE_XYZ) + and dg:IsExists(Card.IsOriginalType,1,nil,TYPE_NORMAL) end -function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local rc=re:GetHandler() if chk==0 then return rc:IsCanBeEffectTarget(e) and Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,rc) end Duel.SetTargetCard(rc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local tc=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,rc):GetFirst() - e:SetLabelObject({tc,rc}) + local cd=e:GetChainData() + cd.xyz_card=rc + cd.opp_card=tc Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,rc:GetRank()*300) end function s.desop(e,tp,eg,ep,ev,re,r,rp) - local opp_c,xyz_c=table.unpack(e:GetLabelObject()) - if opp_c:IsRelateToEffect(e) and opp_c:IsControler(1-tp) and Duel.Destroy(opp_c,REASON_EFFECT)>0 - and xyz_c:IsRelateToEffect(e) and xyz_c:IsFaceup() then - Duel.Damage(1-tp,xyz_c:GetRank()*300,REASON_EFFECT) + local cd=e:GetChainData() + if cd.opp_card:IsRelateToEffect(e) + and cd.opp_card:IsControler(1-tp) + and Duel.Destroy(cd.opp_card,REASON_EFFECT)>0 + and cd.xyz_card:IsRelateToEffect(e) + and cd.xyz_card:IsFaceup() then + Duel.Damage(1-tp,cd.xyz_card:GetRank()*300,REASON_EFFECT) end end diff --git a/official/c47172959.lua b/official/c47172959.lua index 5472a3f9be..c1df4b8e83 100644 --- a/official/c47172959.lua +++ b/official/c47172959.lua @@ -57,7 +57,8 @@ function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dmg) end function s.damop(e,tp,eg,ep,ev,re,r,rp) - local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) + local p=Chain.GetTargetPlayer() + local d=Chain.GetTargetParam() Duel.Damage(p,d,REASON_EFFECT) end function s.damrmcon(e,tp,eg,ep,ev,re,r,rp) @@ -71,6 +72,7 @@ function s.damrmcon(e,tp,eg,ep,ev,re,r,rp) end function s.damrmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end + local cd=e:GetChainData() local bc=e:GetHandler():GetBattleTarget() local dam=0 if bc:IsRelateToBattle() then @@ -78,21 +80,22 @@ function s.damrmtg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0) else dam=bc:GetPreviousAttackOnField() - e:SetLabel(dam) + cd.atk_on_field=dam end - e:SetLabelObject(bc) + cd.battled_monster=bc Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damrmop(e,tp,eg,ep,ev,re,r,rp) - local dam=0 - local bc=e:GetLabelObject() + local cd=e:GetChainData() + local bc=cd.battled_monster local battle_relation=bc:IsRelateToBattle() + local dam=0 if battle_relation and bc:IsFaceup() and bc:IsControler(1-tp) then dam=bc:GetAttack() elseif not battle_relation then - dam=e:GetLabel() + dam=cd.atk_on_field end if Duel.Damage(1-tp,dam,REASON_EFFECT)>0 and battle_relation then Duel.Remove(bc,POS_FACEUP,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c53008933.lua b/official/c53008933.lua index bed8ff1395..50e87cc087 100644 --- a/official/c53008933.lua +++ b/official/c53008933.lua @@ -49,11 +49,13 @@ function s.ctrltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0) - e:SetLabel(Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_SHINING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) and 1 or 0) + local cd=e:GetChainData() + cd.controlled_sarcophagus=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_SHINING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) end function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc:IsRelateToEffect(e) and Duel.GetControl(tc,tp,PHASE_END,1) and e:GetLabel()==0 then + local cd=e:GetChainData() + if tc:IsRelateToEffect(e) and Duel.GetControl(tc,tp,PHASE_END,1) and not cd.controlled_sarcophagus then --Cannot attack while you control it local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) @@ -63,4 +65,4 @@ function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL) tc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c58995660.lua b/official/c58995660.lua index 95e2e3ca68..257cda764b 100644 --- a/official/c58995660.lua +++ b/official/c58995660.lua @@ -27,27 +27,25 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local bc1=Duel.GetBattleMonster(tp) local bc2=bc1:GetBattleTarget() - if bc2 and bc1:GetColumnGroup():IsContains(bc2) then - e:SetLabel(1) - else - e:SetLabel(0) - end - e:SetLabelObject(bc1) + local cd=e:GetChainData() + cd.in_same_column=bc2 and bc1:GetColumnGroup():IsContains(bc2) + cd.own_monster=bc1 bc1:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local bc=e:GetLabelObject() + local cd=e:GetChainData() + local bc=cd.own_monster if not bc:IsRelateToEffect(e) then return end local op=nil - if e:GetLabel()==0 then - op=Duel.TossDice(tp,1) - else + if cd.in_same_column then local is_faceup=bc:IsFaceup() op=Duel.SelectEffect(tp, {true,aux.Stringid(id,1)}, {is_faceup,aux.Stringid(id,2)}, {is_faceup,aux.Stringid(id,3)}) + else + op=Duel.TossDice(tp,1) end local c=e:GetHandler() if op==1 or op==4 then @@ -84,4 +82,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) e3:SetReset(RESETS_STANDARD_PHASE_END) bc:RegisterEffect(e3) end -end \ No newline at end of file +end diff --git a/official/c70088809.lua b/official/c70088809.lua index 575e710188..bb3c861746 100644 --- a/official/c70088809.lua +++ b/official/c70088809.lua @@ -18,7 +18,7 @@ function s.initial_effect(c) c:RegisterEffect(e1) end function s.effcon(e,tp,eg,ep,ev,re,r,rp) - return rp==1-tp and re:IsMonsterEffect() and Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)==LOCATION_MZONE + return rp==1-tp and re:IsMonsterEffect() and Chain.IsTriggeringLocation(ev,LOCATION_MZONE) end function s.revealfilter(c) return c:IsSynchroMonster() and not c:IsPublic() @@ -38,46 +38,47 @@ function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) Duel.ConfirmCards(1-tp,c) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleExtra(tp) - e:SetLabel(#sg+1) - e:SetLabelObject(sg) for sc in sg:Iter() do sc:CreateEffectRelation(e) end + local cd=e:GetChainData() + cd.reveal_count=#sg+1 + cd.revealed_synchros=sg end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end - local reveal_count=e:GetLabel() + local cd=e:GetChainData() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) - if reveal_count>=4 then + if cd.reveal_count>=4 then Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) end - if reveal_count==6 then + if cd.reveal_count==6 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetFieldGroup(tp,0,LOCATION_MZONE),1,tp,0) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() + local cd=e:GetChainData() local break_chk=false - local reveal_count=e:GetLabel() - if reveal_count>=2 and c:IsRelateToEffect(e) then + if cd.reveal_count>=2 and c:IsRelateToEffect(e) then --● 2+: Special Summon this card break_chk=true Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end - if reveal_count>=4 then + if cd.reveal_count>=4 then + cd.revealed_synchros:Match(Card.IsRelateToEffect,nil,e) --● 4+: Send 1 of the revealed Synchro Monsters to the GY - local revealed_synchros=e:GetLabelObject():Match(Card.IsRelateToEffect,nil,e) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) - local g=revealed_synchros:FilterSelect(tp,Card.IsAbleToGrave,1,1,nil) + local g=cd.revealed_synchros:FilterSelect(tp,Card.IsAbleToGrave,1,1,nil) if #g>0 then if break_chk then Duel.BreakEffect() end break_chk=true Duel.SendtoGrave(g,REASON_EFFECT) end end - if reveal_count==6 then + if cd.reveal_count==6 then --● 6: Destroy 1 monster your opponent controls Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) @@ -103,4 +104,4 @@ function s.aclimit(e,re,tp) local rc=re:GetHandler() return re:IsMonsterEffect() and rc:IsOnField() and rc:IsSummonLocation(LOCATION_EXTRA) and not rc:IsSynchroMonster() -end \ No newline at end of file +end diff --git a/official/c73664385.lua b/official/c73664385.lua index f1c6e8fb07..dc196dad4e 100644 --- a/official/c73664385.lua +++ b/official/c73664385.lua @@ -43,30 +43,30 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) if chk==0 then e:SetLabel(0) return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then e:SetCategory(CATEGORY_TOGRAVE) if not cost_skip then Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) if not cost_skip then Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --Send 1 Spellcaster monster or 1 Spell from your Deck to the GY Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end - elseif op==2 then + elseif cd.choice==2 then --Special Summon 1 "Magistus" or "Witchcrafter" monster from your hand or Deck if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) @@ -75,4 +75,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end -end \ No newline at end of file +end diff --git a/official/c84271823.lua b/official/c84271823.lua index 67b3cf0c6a..406de1f888 100644 --- a/official/c84271823.lua +++ b/official/c84271823.lua @@ -48,14 +48,10 @@ function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local lg=e:GetHandler():GetLinkedGroup() local g=eg:Filter(s.cfilter,nil,tp,lg) - local lv - if #g==1 then - lv=g:GetFirst():GetLevel() - end + local cd=e:GetChainData() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) - e:SetLabel(Duel.AnnounceLevel(tp,1,8,lv)) - e:SetLabelObject(g) - Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g,#g,0,e:GetLabel()) + cd.level=Duel.AnnounceLevel(tp,1,8,#g==1 and g:GetFirst():GetLevel() or nil) + Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g,#g,0,cd.level) end function s.opfilter(c,e) return c:IsFaceup() and c:IsRelateToEffect(e) @@ -64,12 +60,13 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local lg=e:GetHandler():GetLinkedGroup() local g=eg:Filter(s.cfilter,nil,tp,lg) + local cd=e:GetChainData() --Their levels become the declared Level for tc in g:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) - e1:SetValue(e:GetLabel()) + e1:SetValue(cd.level) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end diff --git a/official/c88021907.lua b/official/c88021907.lua index e7360ce5e7..8dabb1b943 100644 --- a/official/c88021907.lua +++ b/official/c88021907.lua @@ -23,7 +23,7 @@ function s.initial_effect(c) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsXyzSummoned() end) - e2:SetCost(Cost.DetachFromSelf(1,s.effcostmax,function(e,og) e:SetLabel(#og) end)) + e2:SetCost(Cost.DetachFromSelf(1,s.effcostmax)) e2:SetTarget(s.efftg) e2:SetOperation(s.effop) c:RegisterEffect(e2) @@ -56,21 +56,21 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) {b3,aux.Stringid(id,3)} } local locations=0 - local selection={} - local ct=e:GetLabel() + local ct=#Chain.Data().cost_detached_materials + local cd=e:GetChainData() + cd.selected_effects={} for i=1,ct do local op=Duel.SelectEffect(tp,table.unpack(options)) options[op][1]=false - selection[op]=true + cd.selected_effects[op]=true locations=locations|((op==1 and LOCATION_HAND) or (op==2 and LOCATION_MZONE) or LOCATION_ONFIELD) end - e:SetLabelObject(selection) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,ct,1-tp,locations) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local break_chk=false - local selection=e:GetLabelObject() - if selection[1] then + local cd=e:GetChainData() + if cd.selected_effects[1] then --Send 1 random card from your opponent's hand to the GY local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_HAND,nil) if #g>0 then @@ -79,7 +79,7 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoGrave(sg,REASON_EFFECT) end end - if selection[2] then + if cd.selected_effects[2] then --Send 1 monster your opponent controls to the GY Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,0,LOCATION_MZONE,1,1,nil) @@ -90,7 +90,7 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoGrave(g,REASON_EFFECT) end end - if selection[3] then + if cd.selected_effects[3] then --Send 1 Spell/Trap your opponent controls to the GY Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,aux.AND(Card.IsSpellTrap,Card.IsAbleToGrave),tp,0,LOCATION_ONFIELD,1,1,nil) diff --git a/official/c92269002.lua b/official/c92269002.lua index aebc6bf5a8..3cbceea2ef 100644 --- a/official/c92269002.lua +++ b/official/c92269002.lua @@ -34,15 +34,15 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local _,min_link=lg:GetMinGroup(Card.GetLink) local b2=not Duel.HasFlagEffect(tp,id+1) and min_link and min_link<=#rg if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) - e:SetLabel(op) - if op==1 then + if cd.choice==1 then Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - elseif op==2 then + elseif cd.choice==2 then Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_SPECIAL_SUMMON) local link_map={} @@ -52,13 +52,13 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local rescon=function(sg) return link_map[#sg] end local sg=aux.SelectUnselectGroup(rg,e,tp,min_link,#rg,rescon,1,tp,HINTMSG_REMOVE,rescon) Duel.Remove(sg,POS_FACEUP,REASON_COST) - e:SetLabel(op,#sg) + cd.banished_amount=#sg Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op,link=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --Add 1 "Tri-Brigade" Spell/Trap from your Deck to your hand, except "Tri-Brigade Hammer" Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) @@ -66,10 +66,10 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end - elseif op==2 and link then + elseif cd.choice==2 and cd.banished_amount then --Special Summon 1 "Tri-Brigade" Link Monster from your Extra Deck, with Link Rating equal to the number banished, ignoring its Summoning conditions Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil,link) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil,cd.banished_amount) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end @@ -87,4 +87,4 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) --"Clock Lizard" check aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalRace(RACES_BEAST_BWARRIOR_WINGB) end) end -end \ No newline at end of file +end diff --git a/official/c92936364.lua b/official/c92936364.lua index 48f550cecd..1c454c518f 100644 --- a/official/c92936364.lua +++ b/official/c92936364.lua @@ -33,7 +33,7 @@ function s.initial_effect(c) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.PersistentTargetFilter) - e2:SetValue(function() return e1:GetLabel()*-100 end) + e2:SetValue(function() return e1:GetLabel() end) c:RegisterEffect(e2) --Also their effects are negated local e3=e2:Clone() @@ -69,15 +69,15 @@ function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local sg=aux.SelectUnselectGroup(hg,e,tp,1,#hg,rescon,1,tp,HINTMSG_CONFIRM,rescon) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) - e:SetLabel(sg:FilterCount(Card.IsType,nil,TYPE_TUNER)+1,#sg) + e:SetLabel(#sg*-100) + e:GetChainData().tuners_revealed=sg:FilterCount(Card.IsType,nil,TYPE_TUNER)+1 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsEffectMonster() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsEffectMonster),tp,0,LOCATION_MZONE,1,nil) end - local target_count,reveal_count=e:GetLabel() - e:SetLabel(reveal_count) + local ct=e:GetChainData().tuners_revealed Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) - local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsEffectMonster),tp,0,LOCATION_MZONE,target_count,target_count,nil) + local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsEffectMonster),tp,0,LOCATION_MZONE,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) @@ -97,4 +97,4 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/pre-release/c100455026.lua b/pre-release/c100455026.lua index cdd20cb075..2332f0d0b1 100644 --- a/pre-release/c100455026.lua +++ b/pre-release/c100455026.lua @@ -50,12 +50,12 @@ function s.revealfilter(c) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end - local op=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.cost_choice==1 then --● Add 1 "Witchcrafter" Spell from your Deck to your hand e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - elseif op==2 then + elseif cd.cost_choice==2 then --● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect e:SetCategory(0) local revealed_card=e:GetLabelObject():GetFirst() @@ -63,17 +63,17 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.ClearTargetCard() local tg=te:GetTarget() e:SetProperty(te:GetProperty()) + e:SetLabel(te:GetLabel()) + e:SetLabelObject(te:GetLabelObject()) if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end - te:SetLabelObject(e:GetLabelObject()) - e:SetLabelObject(te) e:SetCategory(0) Duel.ClearOperationInfo(0) + cd.pupils_target_effect=te end - Duel.SetTargetParam(op) end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if op==1 then + local cd=e:GetChainData() + if cd.cost_choice==1 then --● Add 1 "Witchcrafter" Spell from your Deck to your hand Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) @@ -81,11 +81,10 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end - elseif op==2 then + elseif cd.cost_choice==2 then --● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect - local te=e:GetLabelObject() + local te=cd.pupils_target_effect if not te then return end - e:SetLabelObject(te:GetLabelObject()) local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) diff --git a/pre-release/c101305051.lua b/pre-release/c101305051.lua index 0f671b49d4..dd6dc6960d 100644 --- a/pre-release/c101305051.lua +++ b/pre-release/c101305051.lua @@ -45,11 +45,11 @@ function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) --● Return 1 Thunder monster you control to the hand, then target 1 card on the field; destroy it local b2=Duel.IsExistingMatchingCard(s.descostfilter,tp,LOCATION_MZONE,0,1,nil,c) if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) - e:SetLabel(op) - if op==2 then + if cd.choice==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,s.descostfilter,tp,LOCATION_MZONE,0,1,1,nil,c) Duel.HintSelection(g) @@ -66,21 +66,15 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) --● Return 1 Thunder monster you control to the hand, then target 1 card on the field; destroy it local b2=Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) if chk==0 then return b1 or b2 end - local op=nil - local label=e:GetLabel() - if label~=0 then - op=label - else - op=Duel.SelectEffect(tp, + local cd=e:GetChainData() + cd.choice=cd.choice + or Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) - end - e:SetLabel(0) - Duel.SetTargetParam(op) - if op==1 then + if cd.choice==1 then e:SetCategory(0) e:SetProperty(0) - elseif op==2 then + elseif cd.choice==2 then e:SetCategory(CATEGORY_DESTROY) e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) @@ -89,8 +83,8 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if op==1 then + local cd=e:GetChainData() + if cd.choice==1 then --● Place 1 "Blitzclique" Continuous Trap from your Deck face-up on your field if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) @@ -98,7 +92,7 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) if sc then Duel.MoveToField(sc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end - elseif op==2 then + elseif cd.choice==2 then --● Return 1 Thunder monster you control to the hand, then target 1 card on the field; destroy it local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then @@ -120,4 +114,4 @@ function s.selfthop(e,tp,eg,ep,ev,re,r,rp) if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end -end \ No newline at end of file +end From aea8b8e6bc61586d4df312893b0d41a5940945a9 Mon Sep 17 00:00:00 2001 From: Hatter <47074795+that-hatter@users.noreply.github.com> Date: Thu, 7 May 2026 00:23:58 +0800 Subject: [PATCH 7/7] update cards that use Cost.Choice --- official/c40390147.lua | 4 ++-- official/c45935145.lua | 12 ++++++------ official/c78114463.lua | 18 +++++++++--------- official/c84417082.lua | 4 ++-- official/c85692042.lua | 6 +++--- pre-release/c100455026.lua | 5 ++--- unofficial/c511001339.lua | 4 ++-- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/official/c40390147.lua b/official/c40390147.lua index cbce291b13..cae5edfb33 100644 --- a/official/c40390147.lua +++ b/official/c40390147.lua @@ -32,12 +32,12 @@ function s.spcheck(loc) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end - local loc=e:GetLabel()==1 and LOCATION_HAND or LOCATION_DECK + local loc=e:GetChainData().cost_choice==1 and LOCATION_HAND or LOCATION_DECK Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,loc) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local loc=e:GetLabel()==1 and LOCATION_HAND or LOCATION_DECK + local loc=e:GetChainData().cost_choice==1 and LOCATION_HAND or LOCATION_DECK Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,loc,0,1,1,nil,e,tp) if #g>0 then diff --git a/official/c45935145.lua b/official/c45935145.lua index e5cf1065bc..c4278da828 100644 --- a/official/c45935145.lua +++ b/official/c45935145.lua @@ -61,12 +61,12 @@ s.effdetachcost=Cost.Choice( function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return true end - local op=e:GetLabel() + local cd=e:GetChainData() local tc=Duel.GetFirstTarget() - if op==1 then + if cd.cost_choice==1 then e:SetCategory(CATEGORY_TODECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,tc,1,tp,0) - elseif op==2 then + elseif cd.cost_choice==2 then local categ=CATEGORY_SET|CATEGORY_LEAVE_GRAVE if tc:IsMonster() then e:SetCategory(CATEGORY_SPECIAL_SUMMON|categ) @@ -79,11 +79,11 @@ end function s.effop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end - local op=e:GetLabel() - if op==1 then + local cd=e:GetChainData() + if cd.cost_choice==1 then --Return it to the Deck Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) - elseif op==2 then + elseif cd.cost_choice==2 then --If the target is a monster, Special Summon it face-up, or in face-down Defense Position, to your field if tc:IsMonster() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP|POS_FACEDOWN_DEFENSE)>0 diff --git a/official/c78114463.lua b/official/c78114463.lua index 511b752429..5912e975c2 100644 --- a/official/c78114463.lua +++ b/official/c78114463.lua @@ -17,7 +17,7 @@ function s.initial_effect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) - e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Chain.IsNegatable(ev) end) e1:SetCost(Cost.AND(s.revealcost,s.paylpcost)) e1:SetTarget(s.target) e1:SetOperation(s.activate) @@ -35,7 +35,7 @@ function s.revealcost(e,tp,eg,ep,ev,re,r,rp,chk) end end function s.banish_activation_chk(e,tp) - local re=Duel.GetChainInfo(Duel.GetCurrentChain(),CHAININFO_TRIGGERING_EFFECT) + local re=Chain.GetTriggeringEffect() local rc=re:GetHandler() return rc:IsAbleToRemove(tp) or (not rc:IsRelateToEffect(re) and Duel.IsPlayerCanRemove(tp)) end @@ -45,16 +45,16 @@ s.paylpcost=Cost.Choice( ) function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end - local op=e:GetLabel() local rc=re:GetHandler() local relation=rc:IsRelateToEffect(re) + local cd=e:GetChainData() Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) - if op==1 then + if cd.cost_choice==1 then e:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) if rc:IsDestructable() and relation then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) end - elseif op==2 then + elseif cd.cost_choice==2 then e:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE) if relation then Duel.SetOperationInfo(0,CATEGORY_REMOVE,rc,1,tp,0) @@ -67,10 +67,10 @@ function s.banfilter(c,code,opp) return c:IsOriginalCodeRule(code) and c:IsAbleToRemove(opp) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() local rc=re:GetHandler() local code=rc:GetOriginalCodeRule() - if op==1 then + local cd=e:GetChainData() + if cd.cost_choice==1 then --● Pay 1500 LP; negate the activation, and if you do, destroy that card, and if you do that, for the rest of this turn, neither player can activate cards, or the effects of cards, with its same original name if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)>0 then --For the rest of this turn, neither player can activate cards, or the effects of cards, with its same original name @@ -84,7 +84,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end - elseif op==2 then + elseif cd.cost_choice==2 then --● Pay 3000 LP; negate the activation, and if you do, banish that card, then your opponent banishes all cards with its same original name from their hand and Deck if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) and Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)>0 then local opp=1-tp @@ -95,4 +95,4 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) end end end -end \ No newline at end of file +end diff --git a/official/c84417082.lua b/official/c84417082.lua index c96eb81ff5..9ae4ae35c4 100644 --- a/official/c84417082.lua +++ b/official/c84417082.lua @@ -29,7 +29,7 @@ function s.desallcheck(e,tp,eg,ep,ev,re,r,rp,chk) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end - local g=e:GetLabel()==1 + local g=e:GetChainData().cost_choice==1 and Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) or Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) @@ -37,7 +37,7 @@ end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local exc=c:IsRelateToEffect(e) and c or nil - local g=e:GetLabel()==1 + local g=e:GetChainData().cost_choice==1 and Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,exc) or Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 then diff --git a/official/c85692042.lua b/official/c85692042.lua index 13f4a0b4da..d562a5aef0 100644 --- a/official/c85692042.lua +++ b/official/c85692042.lua @@ -75,9 +75,9 @@ function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() - local filter=(op==1 and s.mmfilter) - or (op==2 and s.l4filter) + local cd=e:GetChainData() + local filter=(cd.cost_choice==1 and s.mmfilter) + or (cd.cost_choice==2 and s.l4filter) or s.stfilter Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,filter,tp,LOCATION_DECK,0,1,1,nil) diff --git a/pre-release/c100455026.lua b/pre-release/c100455026.lua index 2332f0d0b1..5e625b2a35 100644 --- a/pre-release/c100455026.lua +++ b/pre-release/c100455026.lua @@ -18,7 +18,7 @@ function s.initial_effect(c) --● Add 1 "Witchcrafter" Spell from your Deck to your hand {aux.TRUE,aux.Stringid(id,2),function(e,tp) return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end}, --● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect - {Cost.Reveal(s.revealfilter,nil,1,1,function(e,tp,og) e:SetLabelObject(og) end),aux.Stringid(id,3),nil} + {Cost.Reveal(s.revealfilter,nil,1,1,function(e,tp,og) e:GetChainData().revealed_card=og:GetFirst() end),aux.Stringid(id,3),nil} ) ) e1:SetTarget(s.efftg) @@ -58,8 +58,7 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) elseif cd.cost_choice==2 then --● Reveal 1 "Witchcrafter" Normal or Quick-Play Spell in your hand; apply that Spell's activation effect e:SetCategory(0) - local revealed_card=e:GetLabelObject():GetFirst() - local te,ceg,cep,cev,cre,cr,crp=revealed_card:CheckActivateEffect(true,true,true) + local te,ceg,cep,cev,cre,cr,crp=cd.revealed_card:CheckActivateEffect(true,true,true) Duel.ClearTargetCard() local tg=te:GetTarget() e:SetProperty(te:GetProperty()) diff --git a/unofficial/c511001339.lua b/unofficial/c511001339.lua index 6df32f8530..a950cf76b0 100644 --- a/unofficial/c511001339.lua +++ b/unofficial/c511001339.lua @@ -32,7 +32,7 @@ function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end - if e:GetLabel()==1 then + if e:GetChainData().cost_choice==1 then Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x1101) end end @@ -45,7 +45,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) e1:SetValue(1) e1:SetReset(RESET_PHASE+PHASE_DAMAGE) c:RegisterEffect(e1) - if e:GetLabel()==1 then + if e:GetChainData().cost_choice==1 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)