diff --git a/constant.lua b/constant.lua index 1f6662ee7d..e88fdb63a3 100644 --- a/constant.lua +++ b/constant.lua @@ -708,7 +708,7 @@ EVENT_PAY_LPCOST = 1201 EVENT_DETACH_MATERIAL = 1202 EVENT_TURN_END = 1210 EVENT_CONFIRM = 1211 -EVENT_TOHAND_CONFIRM = 1212 +EVENT_TO_HAND_CONFIRM = 1212 EVENT_PHASE = 0x1000 EVENT_PHASE_START = 0x2000 EVENT_ADD_COUNTER = 0x10000 diff --git a/official/c13409151.lua b/official/c13409151.lua index 61cfa4f7b1..5057fb65a5 100644 --- a/official/c13409151.lua +++ b/official/c13409151.lua @@ -2,29 +2,30 @@ --Desertapir local s,id=GetID() function s.initial_effect(c) - --flip + --FLIP: Target 1 face-up monster on the field, except "Desertapir"; change it to face-down Defense Position local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION+CATEGORY_SET) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) end -function s.filter(c) - return c:IsFaceup() and c:GetCode()~=id and c:IsCanTurnSet() +s.listed_names={id} +function s.posfilter(c) + return c:IsCanTurnSet() and not c:IsCode(id) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.posfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) + local g=Duel.SelectTarget(tp,s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,POS_FACEDOWN_DEFENSE) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then + if tc and tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end -end +end \ No newline at end of file diff --git a/official/c15001619.lua b/official/c15001619.lua index 61bbe0ec72..ad6889932a 100644 --- a/official/c15001619.lua +++ b/official/c15001619.lua @@ -2,80 +2,82 @@ --Puppet Queen --Scripted by Cybercatman local s,id=GetID() +local CARD_PUPPET_KING=3167573 function s.initial_effect(c) - --Special Summon itself from hand + --When your opponent adds a monster(s) from the Main Deck to their hand, except by drawing it (and except during the Damage Step): You can Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e1:SetCode(EVENT_TOHAND_CONFIRM) + e1:SetCode(EVENT_TO_HAND_CONFIRM) e1:SetRange(LOCATION_HAND) - e1:SetCondition(s.spcon) - e1:SetTarget(s.sptg1) - e1:SetOperation(s.spop1) + e1:SetCondition(s.selfspcon) + e1:SetTarget(s.selfsptg) + e1:SetOperation(s.selfspop) c:RegisterEffect(e1) - --If Normal/Special Summoned, Special Summon 1 Level 7 EARTH Warrior from hand/GY - local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE) - e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e2:SetProperty(EFFECT_FLAG_DELAY) - e2:SetCode(EVENT_SUMMON_SUCCESS) - e2:SetCountLimit(1,id) - e2:SetTarget(s.sptg2) - e2:SetOperation(s.spop2) - c:RegisterEffect(e2) - local e3=e2:Clone() - e3:SetCode(EVENT_SPSUMMON_SUCCESS) - c:RegisterEffect(e3) + --If this card is Normal or Special Summoned: You can Special Summon 1 Level 7 EARTH Warrior monster from your hand or GY, and if you Special Summoned "Puppet King" by this effect, all EARTH Warrior monsters you currently control gain 1000 ATK until the end of the next turn. You can only use this effect of "Puppet Queen" once per turn + local e2a=Effect.CreateEffect(c) + e2a:SetDescription(aux.Stringid(id,1)) + e2a:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE) + e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e2a:SetProperty(EFFECT_FLAG_DELAY) + e2a:SetCode(EVENT_SUMMON_SUCCESS) + e2a:SetCountLimit(1,id) + e2a:SetTarget(s.handgysptg) + e2a:SetOperation(s.handgyspop) + c:RegisterEffect(e2a) + local e2b=e2a:Clone() + e2b:SetCode(EVENT_SPSUMMON_SUCCESS) + c:RegisterEffect(e2b) end -s.listed_names={3167573} -function s.cfilter(c,tp) +s.listed_names={CARD_PUPPET_KING} +function s.selfspconfilter(c,tp) return c:IsControler(1-tp) and c:IsPreviousLocation(LOCATION_DECK) and not c:IsReason(REASON_DRAW) and c:IsMonster() and c:IsPreviousControler(1-tp) end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.cfilter,1,nil,tp) +function s.selfspcon(e,tp,eg,ep,ev,re,r,rp) + return eg:IsExists(s.selfspconfilter,1,nil,tp) end -function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) +function s.selfsptg(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 - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end -function s.spop1(e,tp,eg,ep,ev,re,r,rp) +function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - if not c:IsRelateToEffect(e) then return end - Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) + if c:IsRelateToEffect(e) then + Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) + end end -function s.spfilter(c,e,tp) - return c:IsLevel(7) and c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_EARTH) - and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) +function s.handgyspfilter(c,e,tp) + return c:IsLevel(7) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_WARRIOR) + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) +function s.handgysptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil,e,tp) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_HAND) + and Duel.IsExistingMatchingCard(s.handgyspfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.atkfilter(c) - return c:IsFaceup() and c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_EARTH) + return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_WARRIOR) and c:IsFaceup() end -function s.spop2(e,tp,eg,ep,ev,re,r,rp) +function s.handgyspop(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,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil,e,tp) - if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and g:GetFirst():IsCode(3167573) then + local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.handgyspfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() + if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)>0 and sc:IsCode(CARD_PUPPET_KING) then local c=e:GetHandler() - local tg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) - for tc in tg:Iter() do - --Increase ATK + local atkg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) + for atkc in atkg:Iter() do + --If you Special Summoned "Puppet King" by this effect, all EARTH Warrior monsters you currently control gain 1000 ATK until the end of the next turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetReset(RESETS_STANDARD_PHASE_END,2) e1:SetValue(1000) - tc:RegisterEffect(e1) + e1:SetReset(RESETS_STANDARD_PHASE_END,2) + atkc:RegisterEffect(e1) end end end \ No newline at end of file diff --git a/official/c15079028.lua b/official/c15079028.lua index 823d1e04f8..fdd1316ab9 100644 --- a/official/c15079028.lua +++ b/official/c15079028.lua @@ -3,25 +3,26 @@ --scripted by Rundas local s,id=GetID() function s.initial_effect(c) - --Search + --You can Tribute this Normal Summoned/Set card; add 1 EARTH Fairy monster from your Deck to your hand, except "World Soul - Carbon" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) - e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) - e1:SetCondition(s.scon) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + return e:GetHandler():IsNormalSummoned() + end) e1:SetCost(Cost.SelfTribute) - e1:SetTarget(s.stg) - e1:SetOperation(s.sop) + e1:SetTarget(s.thtg) + e1:SetOperation(s.thop) c:RegisterEffect(e1) - --To Decktop + --If a face-up Fairy monster(s) you control is sent to the GY, while this card is in your GY (except during the Damage Step): You can place this card on top of your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) - e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) @@ -31,35 +32,37 @@ function s.initial_effect(c) c:RegisterEffect(e2) end s.listed_names={id} -function s.sfilter(c) - return c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToHand() and not c:IsCode(id) +function s.thfilter(c) + return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_FAIRY) and not c:IsCode(id) and c:IsAbleToHand() end -function s.scon(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():GetSummonType()&SUMMON_TYPE_SPECIAL==0 +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.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end -function s.stg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.sfilter,tp,LOCATION_DECK,0,1,nil) end - Duel.SetOperationInfo(0,CATEGORY_TOHAND+CATEGORY_SEARCH,nil,1,tp,LOCATION_DECK) -end -function s.sop(e,tp,eg,ep,ev,re,r,rp) - if not Duel.IsExistingMatchingCard(s.sfilter,tp,LOCATION_DECK,0,1,nil) then return end +function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local tc=Duel.SelectMatchingCard(tp,s.sfilter,tp,LOCATION_DECK,0,1,1,nil) - Duel.SendtoHand(tc,tp,REASON_EFFECT) - Duel.ConfirmCards(1-tp,tc) + local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) + if #g>0 then + Duel.SendtoHand(g,tp,REASON_EFFECT) + Duel.ConfirmCards(1-tp,g) + end end -function s.tgfilter(c,tp) - return c:IsRace(RACE_FAIRY) - and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousControler()==tp +function s.tdconfilter(c,tp) + return c:IsPreviousRaceOnField(RACE_FAIRY) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) + and c:IsPreviousControler(tp) and c:IsRace(RACE_FAIRY) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.tgfilter,1,e:GetHandler(),tp) and not eg:IsContains(e:GetHandler()) + return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.tdconfilter,1,nil,tp) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsAbleToDeck() end - Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,tp,LOCATION_GRAVE) + local c=e:GetHandler() + if chk==0 then return c:IsAbleToDeck() end + Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsAbleToDeck() then return end - Duel.SendtoDeck(e:GetHandler(),tp,SEQ_DECKTOP,REASON_EFFECT) + local c=e:GetHandler() + if c:IsRelateToEffect(e) then + Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT) + Duel.ConfirmDecktop(tp,1) + end end \ No newline at end of file diff --git a/official/c16832845.lua b/official/c16832845.lua index 71e285ac7c..7d5db23882 100644 --- a/official/c16832845.lua +++ b/official/c16832845.lua @@ -2,70 +2,56 @@ --Final Geas local s,id=GetID() function s.initial_effect(c) - --Activate + --If a monster(s) with an original Level of 7 or higher has been sent from each player's field to the GY this turn: Banish as many monsters from the GYs as possible, then you can Special Summon the highest-Level Spellcaster monster among those banished monsters (your choice, if tied) local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetHintTiming(0,TIMING_END_PHASE|TIMING_TOGRAVE) - e1:SetCondition(s.condition) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + return Duel.HasFlagEffect(0,id) and Duel.HasFlagEffect(1,id) + end) e1:SetTarget(s.target) e1:SetOperation(s.activate) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E|TIMING_TOGRAVE) c:RegisterEffect(e1) + --Keep track of monsters with an original Level of 7 or higher being sent from the field to the GY aux.GlobalCheck(s,function() - s[0]=false - s[1]=false local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_TO_GRAVE) - ge1:SetOperation(s.checkop) - Duel.RegisterEffect(ge1,0) - aux.AddValuesReset(function() - s[0]=false - s[1]=false + ge1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) + for ec in eg:Iter() do + local prev_ctrl=ec:GetPreviousControler() + if ec:GetOriginalLevel()>=7 and ec:IsPreviousLocation(LOCATION_MZONE) + and not Duel.HasFlagEffect(prev_ctrl,id) then + Duel.RegisterFlagEffect(prev_ctrl,id,RESET_PHASE|PHASE_END,0,1) + end + end end) + Duel.RegisterEffect(ge1,0) end) end -function s.checkop(e,tp,eg,ep,ev,re,r,rp) - local tc=eg:GetFirst() - for tc in aux.Next(eg) do - if tc:GetOriginalLevel()>=7 and tc:IsPreviousLocation(LOCATION_MZONE) then - s[tc:GetPreviousControler()]=true - end - end -end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return s[0] and s[1] -end -function s.filter(c) - return c:IsMonster() and c:IsAbleToRemove() -end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end - local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil) - if g:FilterCount(Card.IsControler,nil,1-tp)==0 then - Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,tp,LOCATION_GRAVE) - elseif g:FilterCount(Card.IsControler,nil,tp)==0 then - Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,1-tp,LOCATION_GRAVE) - else - Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,PLAYER_ALL,LOCATION_GRAVE) - end + if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsMonster,Card.IsAbleToRemove),tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end + Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,PLAYER_ALL,LOCATION_GRAVE) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,PLAYER_EITHER,LOCATION_REMOVED) end function s.spfilter(c,e,tp) - return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and c:IsLocation(LOCATION_REMOVED) and c:HasLevel() + return c:IsRace(RACE_SPELLCASTER) and c:HasLevel() and c:IsLocation(LOCATION_REMOVED) and c:IsFaceup() + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil) - if Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then - local og=Duel.GetOperatedGroup():Filter(s.spfilter,nil,e,tp) - if #og>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then + local g=Duel.GetMatchingGroup(aux.AND(Card.IsMonster,Card.IsAbleToRemove),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil) + if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + and #g:Match(s.spfilter,nil,e,tp)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then + local sg=g:GetMaxGroup(Card.GetLevel) + if #sg>1 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + sg=sg:Select(tp,1,1,nil) + end + if #sg>0 then Duel.BreakEffect() - local sg=og:GetMaxGroup(Card.GetLevel) - if #sg>1 then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - sg=sg:Select(tp,1,1,nil) - end Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end diff --git a/official/c2618725.lua b/official/c2618725.lua index 45081e84c7..1ed2e8e155 100644 --- a/official/c2618725.lua +++ b/official/c2618725.lua @@ -29,7 +29,7 @@ function s.initial_effect(c) end s.listed_series={SET_GMX} function s.gmxdinospfilter(c,e,tp,pos) - return (c:IsSetCard(SET_GMX) or c:IsRace(RACE_DINOSAUR)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return (c:IsSetCard(SET_GMX) or c:IsRace(RACE_DINOSAUR)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,pos) end function s.handsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 diff --git a/official/c30109445.lua b/official/c30109445.lua index 731853b70f..ecddb016bb 100644 --- a/official/c30109445.lua +++ b/official/c30109445.lua @@ -15,7 +15,9 @@ function s.initial_effect(c) e1:SetTarget(aux.TargetBoolFunction(Card.IsTributeSummoned)) e1:SetValue(1) c:RegisterEffect(e1) - --If this card is Tributed: You can activate 1 of these effects (but you can only use each of these effects of "Clown Crew Drish" once per turn); + --If this card is Tributed: You can activate 1 of these effects (but you can only use each effect of "Clown Crew Dristy" once per turn); + --● Return all Link Monsters from the field and the GYs to the Extra Deck + --● Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) @@ -26,21 +28,25 @@ function s.initial_effect(c) c:RegisterEffect(e2) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) - local b1=not Duel.HasFlagEffect(tp,id) + --● Return all Link Monsters from the field and the GYs to the Extra Deck + local option_1=not Duel.HasFlagEffect(tp,id) and Duel.IsExistingMatchingCard(aux.AND(Card.IsLinkMonster,Card.IsFaceup,Card.IsAbleToExtra),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) - local b2=not Duel.HasFlagEffect(tp,id+1) and ((Duel.IsPlayerCanDraw(tp) + --● Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck + local option_2=not Duel.HasFlagEffect(tp,id+1) and ((Duel.IsPlayerCanDraw(tp) and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,nil)) or (Duel.IsPlayerCanDraw(1-tp) and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_HAND,1,nil))) - if chk==0 then return b1 or b2 end - local op=Duel.SelectEffect(tp, - {b1,aux.Stringid(id,1)}, - {b2,aux.Stringid(id,2)}) - e:SetLabel(op) - if op==1 then + if chk==0 then return option_1 or option_2 end + local choice=Duel.SelectEffect(tp, + {option_1,aux.Stringid(id,1)}, + {option_2,aux.Stringid(id,2)}) + e:GetChainData().choice=choice + if choice==1 then + --● Return all Link Monsters from the field and the GYs to the Extra Deck Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_TOEXTRA) Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,PLAYER_ALL,LOCATION_MZONE|LOCATION_GRAVE) - elseif op==2 then + elseif choice==2 then + --● Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_TODECK|CATEGORY_DRAW) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_HAND) @@ -48,27 +54,34 @@ function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() - if op==1 then - --● Return all Link Monsters on the field and in the GYs to the Extra Deck + local choice=e:GetChainData().choice + if choice==1 then + --● Return all Link Monsters from the field and the GYs to the Extra Deck local g=Duel.GetMatchingGroup(aux.AND(Card.IsLinkMonster,Card.IsFaceup,Card.IsAbleToExtra),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,nil) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end - elseif op==2 then - --● Each player shuffles their entire hand into the Deck, then they draw the same number of cards they shuffled - local turn_player=Duel.GetTurnPlayer() - local step=turn_player==0 and 1 or -1 - for p=turn_player,1-turn_player,step do - local g=Duel.GetFieldGroup(p,LOCATION_HAND,0) - if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and Duel.IsPlayerCanDraw(p) then - local draw_count=Duel.GetOperatedGroup():FilterCount(Card.IsPreviousControler,nil,p) - if draw_count>0 then - Duel.ShuffleDeck(p) - Duel.BreakEffect() - Duel.Draw(p,draw_count,REASON_EFFECT) - end + elseif choice==2 then + --● Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck + local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND) + if Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then + local og=Duel.GetOperatedGroup():Match(Card.IsLocation,nil,LOCATION_DECK) + local turn_player=Duel.GetTurnPlayer() + local non_turn_player=1-turn_player + if og:IsExists(Card.IsControler,1,nil,turn_player) then Duel.ShuffleDeck(turn_player) end + if og:IsExists(Card.IsControler,1,nil,non_turn_player) then Duel.ShuffleDeck(non_turn_player) end + local turn_player_drawcount=og:FilterCount(Card.IsPreviousControler,nil,turn_player) + local non_turn_player_drawcount=og:FilterCount(Card.IsPreviousControler,nil,non_turn_player) + local break_chk=true + if turn_player_drawcount>0 then + break_chk=false + Duel.BreakEffect() + Duel.Draw(turn_player,turn_player_drawcount,REASON_EFFECT) + end + if non_turn_player_drawcount>0 then + if break_chk then Duel.BreakEffect() end + Duel.Draw(non_turn_player,non_turn_player_drawcount,REASON_EFFECT) end end end -end +end \ No newline at end of file diff --git a/official/c3167573.lua b/official/c3167573.lua index e21b987116..1bee0537ae 100644 --- a/official/c3167573.lua +++ b/official/c3167573.lua @@ -2,56 +2,61 @@ --Puppet King local s,id=GetID() function s.initial_effect(c) - --Special Summon + --When your opponent adds a Monster Card(s) from the Deck to their hand, except by drawing: You can Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e1:SetCode(EVENT_TOHAND_CONFIRM) + e1:SetCode(EVENT_TO_HAND_CONFIRM) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Destroy + --If you do, during the End Phase of your next turn: destroy this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) + e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) - e1:SetLabelObject(e2) end -function s.cfilter(c,tp) +function s.spconfilter(c,tp) return c:IsControler(1-tp) and c:IsPreviousLocation(LOCATION_DECK) and not c:IsReason(REASON_DRAW) and c:IsMonster() and c:IsPreviousControler(1-tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.cfilter,1,nil,tp) + return eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(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 - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - if not c:IsRelateToEffect(e) then return end - if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then - local des_eff=e:GetLabelObject() - local ct=Duel.IsTurnPlayer(tp) and 2 or 1 - c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END|RESET_SELF_TURN,0,ct) - des_eff:SetLabel(Duel.GetTurnCount()+ct) + if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then + local reset_count=Duel.IsTurnPlayer(tp) and 3 or 2 + c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,reset_count,Duel.GetTurnCount(tp),aux.Stringid(id,2)) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():GetFlagEffect(id)>0 and Duel.GetTurnCount()==e:GetLabel() + local c=e:GetHandler() + return c:HasFlagEffect(id) and Duel.IsTurnPlayer(tp) and Duel.GetTurnCount(tp)==c:GetFlagEffectLabel(id)+1 +end +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return true end + Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) - e:SetLabel(0) - Duel.Destroy(e:GetHandler(),REASON_EFFECT) + local c=e:GetHandler() + if c:IsRelateToEffect(e) then + Duel.Destroy(c,REASON_EFFECT) + end end \ No newline at end of file diff --git a/official/c48806195.lua b/official/c48806195.lua index 3a08ba2b0b..4f55e3a1ae 100644 --- a/official/c48806195.lua +++ b/official/c48806195.lua @@ -3,7 +3,7 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Special Summon self + --You can target 1 "Therion" monster or 1 Reptile monster in your GY; Special Summon this card from your hand, and if you do, equip that monster to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) @@ -11,11 +11,11 @@ function s.initial_effect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,{id,0}) - e1:SetTarget(s.sptg) - e1:SetOperation(s.spop) + e1:SetTarget(s.selfsptg) + e1:SetOperation(s.selfspop) c:RegisterEffect(e1) - aux.AddEREquipLimit(c,nil,s.eqval,Card.EquipByEffectAndLimitRegister,e1) - --Special Summon from the Spell/Trap Zone + aux.AddEREquipLimit(c,nil,function(ec,c,tp) return s.eqfilter(ec,tp) end,Card.EquipByEffectAndLimitRegister,e1) + --You can discard 1 card, then target 1 "Therion" Monster Card in your Spell & Trap Zone; Special Summon it local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -23,74 +23,65 @@ function s.initial_effect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) - e2:SetCost(s.spcost) - e2:SetTarget(s.sptg2) - e2:SetOperation(s.spop2) + e2:SetCost(Cost.Discard()) + e2:SetTarget(s.stzonesptg) + e2:SetOperation(s.stzonespop) c:RegisterEffect(e2) - --Equipped monster gains ATK - local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_EQUIP) - e3:SetCode(EFFECT_UPDATE_ATTACK) - e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsSetCard(SET_THERION) end) - e3:SetValue(700) - c:RegisterEffect(e3) - --Equipped monster gains effect - local e4=Effect.CreateEffect(c) - e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) - e4:SetRange(LOCATION_SZONE) - e4:SetTargetRange(LOCATION_MZONE,0) - e4:SetTarget(function(e,c) return c==e:GetHandler():GetEquipTarget() and c:IsSetCard(SET_THERION) end) - e4:SetLabelObject(e2) - c:RegisterEffect(e4) + --A "Therion" monster equipped with this card gains 700 ATK, also it can activate the 2nd effect listed above as if it were "Therion "Empress" Alasia" + local e3a=Effect.CreateEffect(c) + e3a:SetType(EFFECT_TYPE_EQUIP) + e3a:SetCode(EFFECT_UPDATE_ATTACK) + e3a:SetCondition(function(e) + return e:GetHandler():GetEquipTarget():IsSetCard(SET_THERION) + end) + e3a:SetValue(700) + c:RegisterEffect(e3a) + local e3b=Effect.CreateEffect(c) + e3b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) + e3b:SetRange(LOCATION_SZONE) + e3b:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) + e3b:SetTarget(function(e,c) + return c==e:GetHandler():GetEquipTarget() and c:IsSetCard(SET_THERION) + end) + e3b:SetLabelObject(e2) + c:RegisterEffect(e3b) end s.listed_series={SET_THERION} -function s.eqfilter(c) - return c:IsMonster() and (c:IsSetCard(SET_THERION) or c:IsRace(RACE_REPTILE)) +function s.eqfilter(c,tp) + return (c:IsSetCard(SET_THERION) or c:IsRace(RACE_REPTILE)) and c:IsMonster() and c:CheckUniqueOnField(tp) and not c:IsForbidden() end -function s.eqval(ec,c,tp) - return ec:IsControler(tp) and s.eqfilter(ec) -end -function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) +function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc,tp) end local c=e:GetHandler() - if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc) and not chkc:IsForbidden() end - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 - and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.IsExistingTarget(aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,nil) - end + if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 + and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_GRAVE,0,1,nil,tp) + and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) - local g=Duel.SelectTarget(tp,aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) - Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) - Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) + local g=Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) + Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) end -function s.spop(e,tp,eg,ep,ev,re,r,rp) +function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() - if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 - and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsRelateToEffect(e) - and tc:IsMonster() and not tc:IsForbidden() then + if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 + and tc:IsRelateToEffect(e) then c:EquipByEffectAndLimitRegister(e,tp,tc) end end -function s.spcost(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 - Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) - Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) -end -function s.spfilter(c,e,sp) - return c:IsFaceup() and c:IsOriginalType(TYPE_MONSTER) and c:IsSetCard(SET_THERION) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) +function s.stzonespfilter(c,e,tp) + return c:IsSetCard(SET_THERION) and c:IsMonsterCard() and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end +function s.stzonesptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_STZONE) and s.stzonespfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_SZONE,0,1,nil,e,tp) end + and Duel.IsExistingTarget(s.stzonespfilter,tp,LOCATION_STZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_SZONE,0,1,1,nil,e,tp) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) + local g=Duel.SelectTarget(tp,s.stzonespfilter,tp,LOCATION_STZONE,0,1,1,nil,e,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end -function s.spop2(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end +function s.stzonespop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) diff --git a/official/c52624755.lua b/official/c52624755.lua index 1685c9242b..f299df2cf8 100644 --- a/official/c52624755.lua +++ b/official/c52624755.lua @@ -2,30 +2,30 @@ --Peten the Dark Clown local s,id=GetID() function s.initial_effect(c) - --sp summon + --When this card is sent to the GY: You can banish this card from your GY; Special Summon 1 "Peten the Dark Clown" from your hand or Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetCost(Cost.SelfBanish) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={id} -function s.filter(c,e,sp) +function s.spfilter(c,e,sp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) +function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +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.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end diff --git a/official/c64161630.lua b/official/c64161630.lua index 6cc09fdb20..90de83a6c1 100644 --- a/official/c64161630.lua +++ b/official/c64161630.lua @@ -2,61 +2,60 @@ --Purge Ray local s,id=GetID() function s.initial_effect(c) - --Activate + --Tribute 1 Xyz Monster; during the End Phase, Special Summon from your Extra Deck, 1 "Number" monster with the same Type, but 1 Rank lower, as the Tributed monster had when it was on the field local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) end s.listed_series={SET_NUMBER} -function s.cfilter(c,e,tp) - local rk=c:GetRank() - return rk>1 and c:IsType(TYPE_XYZ) - and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,rk-1,c:GetRace(),e,tp,c) -end -function s.filter(c,rk,rc,e,tp,mc) - return c:IsType(TYPE_XYZ) and c:IsSetCard(SET_NUMBER) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 - and c:GetRank()==rk and c:IsRace(rc) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +function s.costfilter(c,e,tp) + return c:IsXyzMonster() and c:IsRankAbove(2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) - if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,e,tp) end - local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,e,tp) - e:SetLabel(g:GetFirst():GetRank()) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetReset(RESET_PHASE|PHASE_END) - e1:SetLabel(g:GetFirst():GetRace()) - Duel.RegisterEffect(e1,tp) - e:SetLabelObject(e1) - Duel.Release(g,REASON_COST) + if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,e,tp) end + local sc=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,e,tp):GetFirst() + local chain_data=e:GetChainData() + chain_data.cost_type=sc:GetRace() + chain_data.cost_rank=sc:GetRank() + Duel.Release(sc,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then - if e:GetLabel()~=100 then return false end + local cost_chk=e:GetLabel()==100 e:SetLabel(0) - return true + return cost_chk end + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) + local chain_data=e:GetChainData() + local sp_race=chain_data.cost_type + local sp_rank=chain_data.cost_rank-1 + --During the End Phase, Special Summon from your Extra Deck, 1 "Number" monster with the same Type, but 1 Rank lower, as the Tributed monster had when it was on the field local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) - e1:SetOperation(s.spop) + e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) + Duel.Hint(HINT_CARD,0,id) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,sp_race,sp_rank) + if #g>0 then + Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) + end + end) e1:SetReset(RESET_PHASE|PHASE_END) - e1:SetLabel(e:GetLabel()) - e1:SetLabelObject(e:GetLabelObject()) Duel.RegisterEffect(e1,tp) end -function s.spop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_CARD,0,id) - local rk=e:GetLabel() - local rc=e:GetLabelObject():GetLabel() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,rk-1,rc,e,tp) - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) +function s.spfilter(c,e,tp,race,rank) + return c:IsSetCard(SET_NUMBER) and c:IsRace(race) and c:IsRank(rank) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end \ No newline at end of file diff --git a/official/c64697431.lua b/official/c64697431.lua index 2f537818db..436e529645 100644 --- a/official/c64697431.lua +++ b/official/c64697431.lua @@ -1,10 +1,10 @@ --局所的ハリケーン --Hey, Trunade! --- local s,id=GetID() function s.initial_effect(c) - --Activate + --Return all Set Spells and Traps on the field to the hand local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) @@ -12,16 +12,18 @@ function s.initial_effect(c) e1:SetOperation(s.activate) c:RegisterEffect(e1) end -function s.filter(c) +function s.rthfilter(c) return c:IsFacedown() and c:IsSpellTrap() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end - local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,#sg,0,0) + if chk==0 then return Duel.IsExistingMatchingCard(s.rthfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end + Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,PLAYER_ALL,LOCATION_ONFIELD) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) - Duel.SendtoHand(sg,nil,REASON_EFFECT) + local c=e:GetHandler() + local exc=c:IsRelateToEffect(e) and c or nil + local g=Duel.GetMatchingGroup(s.rthfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,exc) + if #g>0 then + Duel.SendtoHand(g,nil,REASON_EFFECT) + end end \ No newline at end of file diff --git a/official/c6853254.lua b/official/c6853254.lua index 0296283946..95dc01a706 100644 --- a/official/c6853254.lua +++ b/official/c6853254.lua @@ -2,53 +2,54 @@ --Return of the Dragon Lords local s,id=GetID() function s.initial_effect(c) - --Activate + --Target 1 Level 7 or 8 Dragon monster in your GY; Special Summon it local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --destroy replace + --If a Dragon monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead local e2=Effect.CreateEffect(c) + e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) - e2:SetTarget(s.reptg) - e2:SetValue(s.repval) - e2:SetOperation(s.repop) + e2:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) + local c=e:GetHandler() + if chk==0 then return c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end + return Duel.SelectEffectYesNo(tp,c,96) + end) + e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) + Duel.Hint(HINT_CARD,0,id) + Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT|REASON_REPLACE) + end) + e2:SetValue(function(e,c) + return s.repfilter(c,e:GetHandlerPlayer()) + end) c:RegisterEffect(e2) end -function s.filter(c,e,tp) - return c:IsRace(RACE_DRAGON) and (c:GetLevel()==7 or c:GetLevel()==8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +function s.spfilter(c,e,tp) + return c:IsLevel(7,8) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end + and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) + local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.repfilter(c,tp) - return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) - and not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT|REASON_BATTLE) -end -function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end - return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) -end -function s.repval(e,c) - return s.repfilter(c,e:GetHandlerPlayer()) -end -function s.repop(e,tp,eg,ep,ev,re,r,rp) - Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) + return c:IsRace(RACE_DRAGON) and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsFaceup() + and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end \ No newline at end of file diff --git a/official/c69840739.lua b/official/c69840739.lua index 13270b39de..377b4bb879 100644 --- a/official/c69840739.lua +++ b/official/c69840739.lua @@ -5,55 +5,72 @@ function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 5 monsters Xyz.AddProcedure(c,nil,5,2) - --Activate 1 of these effects + --Once per turn (Quick Effect): You can activate 1 of these effects; + --● When a monster effect is activated on the field or a Normal Spell/Trap Card is activated: You can detach 1 material from this card; the activated effect becomes "Destroy 1 Spell/Trap your opponent controls" + --● You can detach 1 material from this card; each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) - e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local event_chaining,_,_,event_value,reason_effect,_,reason_player=Duel.CheckEvent(EVENT_CHAINING,true) - --The activated effect becomes "Destroy 1 Spell/Trap Card your opponent controls" - local b1=event_chaining and Duel.IsExistingMatchingCard(Card.IsSpellTrap,reason_player,0,LOCATION_ONFIELD,1,nil) + --● When a monster effect is activated on the field or a Normal Spell/Trap Card is activated: You can detach 1 material from this card; the activated effect becomes "Destroy 1 Spell/Trap your opponent controls" + local option_1=event_chaining and Duel.IsExistingMatchingCard(Card.IsSpellTrap,reason_player,0,LOCATION_ONFIELD,1,nil) and ((reason_effect:IsMonsterEffect() and Duel.GetChainInfo(event_value,CHAININFO_TRIGGERING_LOCATION)==LOCATION_MZONE) or (reason_effect:GetHandler():IsNormalSpellTrap() and reason_effect:IsHasType(EFFECT_TYPE_ACTIVATE))) - --Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck - local b2=(Duel.IsPlayerCanDraw(tp) or Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0) + --● You can detach 1 material from this card; each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck + local option_2=(Duel.IsPlayerCanDraw(tp) or Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0) and (Duel.IsPlayerCanDraw(1-tp) or Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)==0) and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_HAND,LOCATION_HAND,1,nil) - if chk==0 then return b1 or b2 end - local op=not b1 and 2 + if chk==0 then return option_1 or option_2 end + local choice=not option_1 and 2 or Duel.SelectEffect(tp, - {b1,aux.Stringid(id,1)}, - {b2,aux.Stringid(id,2)}) - e:SetLabel(op) - if op==1 then + {option_1,aux.Stringid(id,1)}, + {option_2,aux.Stringid(id,2)}) + local chain_data=e:GetChainData() + chain_data.choice=choice + if choice==1 then + --● When a monster effect is activated on the field or a Normal Spell/Trap Card is activated: You can detach 1 material from this card; the activated effect becomes "Destroy 1 Spell/Trap your opponent controls" e:SetCategory(0) - Duel.SetTargetParam(event_value) - elseif op==2 then + chain_data.event_value=event_value + elseif choice==2 then + --● You can detach 1 material from this card; each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) - if not b1 then Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(id,2)) end + if not option_1 then Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(id,2)) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) - local op=e:GetLabel() - if op==1 then - --The activated effect becomes "Destroy 1 Spell/Trap Card your opponent controls" + local chain_data=e:GetChainData() + local choice=chain_data.choice + if choice==1 then + --● When a monster effect is activated on the field or a Normal Spell/Trap Card is activated: You can detach 1 material from this card; the activated effect becomes "Destroy 1 Spell/Trap your opponent controls" local g=Group.CreateGroup() - local event_value=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) + local event_value=chain_data.event_value Duel.ChangeTargetCard(event_value,g) - Duel.ChangeChainOperation(event_value,s.repop) - elseif op==2 then - --Each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck + Duel.ChangeChainOperation(event_value,function(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + if c:IsNormalSpellTrap() then + c:CancelToGrave(false) + end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) + local g=Duel.SelectMatchingCard(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.Destroy(g,REASON_EFFECT) + end + end) + elseif choice==2 then + --● You can detach 1 material from this card; each player with a hand shuffles their entire hand into the Deck, then draws the same number of cards they shuffled into the Deck local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND) if Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then local og=Duel.GetOperatedGroup():Match(Card.IsLocation,nil,LOCATION_DECK) @@ -61,27 +78,18 @@ function s.effop(e,tp,eg,ep,ev,re,r,rp) local non_turn_player=1-turn_player if og:IsExists(Card.IsControler,1,nil,turn_player) then Duel.ShuffleDeck(turn_player) end if og:IsExists(Card.IsControler,1,nil,non_turn_player) then Duel.ShuffleDeck(non_turn_player) end - local ct1=og:FilterCount(Card.IsPreviousControler,nil,turn_player) - local ct2=og:FilterCount(Card.IsPreviousControler,nil,non_turn_player) - Duel.BreakEffect() - if ct1>0 then - Duel.Draw(turn_player,ct1,REASON_EFFECT) + local turn_player_drawcount=og:FilterCount(Card.IsPreviousControler,nil,turn_player) + local non_turn_player_drawcount=og:FilterCount(Card.IsPreviousControler,nil,non_turn_player) + local break_chk=true + if turn_player_drawcount>0 then + break_chk=false + Duel.BreakEffect() + Duel.Draw(turn_player,turn_player_drawcount,REASON_EFFECT) end - if ct2>0 then - Duel.Draw(non_turn_player,ct2,REASON_EFFECT) + if non_turn_player_drawcount>0 then + if break_chk then Duel.BreakEffect() end + Duel.Draw(non_turn_player,non_turn_player_drawcount,REASON_EFFECT) end end end -end -function s.repop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - if c:IsNormalSpellTrap() then - c:CancelToGrave(false) - end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectMatchingCard(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) - if #g>0 then - Duel.HintSelection(g) - Duel.Destroy(g,REASON_EFFECT) - end -end +end \ No newline at end of file diff --git a/official/c70187958.lua b/official/c70187958.lua index 25fa0af999..d99e805825 100644 --- a/official/c70187958.lua +++ b/official/c70187958.lua @@ -2,30 +2,30 @@ --Dark Desertapir local s,id=GetID() function s.initial_effect(c) - --special summon + --When this card is banished: You can target 1 Level 4 or lower Beast monster in your GY; Special Summon that target local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_REMOVE) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop) c:RegisterEffect(e1) end -function s.filter(c,e,tp) +function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end - if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end +function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end + if chk==0 then return Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) + local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) and tc:IsRace(RACE_BEAST) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end \ No newline at end of file diff --git a/official/c78193831.lua b/official/c78193831.lua index 33787cd47f..2592ae3b48 100644 --- a/official/c78193831.lua +++ b/official/c78193831.lua @@ -2,18 +2,15 @@ --Buster Blader local s,id=GetID() function s.initial_effect(c) - --atkup + --Gains 500 ATK for each Dragon monster your opponent controls or is in their GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) - e1:SetValue(s.val) + e1:SetValue(s.atkval) c:RegisterEffect(e1) end -function s.val(e,c) - return Duel.GetMatchingGroupCount(s.filter,c:GetControler(),0,LOCATION_GRAVE|LOCATION_MZONE,nil)*500 +function s.atkval(e,c) + return 500*Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsRace,IsRace,RACE_DRAGON),c:GetControler(),0,LOCATION_MZONE|LOCATION_GRAVE,nil) end -function s.filter(c) - return c:IsRace(RACE_DRAGON) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) -end \ No newline at end of file diff --git a/official/c81128478.lua b/official/c81128478.lua index 11a8af5d35..c32ee89503 100644 --- a/official/c81128478.lua +++ b/official/c81128478.lua @@ -2,33 +2,34 @@ --Lair Wire local s,id=GetID() function s.initial_effect(c) - --Activate + --Banish 1 Insect monster from your GY, then target 1 monster your opponent controls; destroy it local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) end -function s.cfilter(c) +function s.costfilter(c) return c:IsRace(RACE_INSECT) and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end + if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil) + local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) 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) end - if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end + if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end + if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() diff --git a/official/c81510157.lua b/official/c81510157.lua index 0ec0d8de16..e5e154b25c 100644 --- a/official/c81510157.lua +++ b/official/c81510157.lua @@ -2,8 +2,9 @@ --Soul Taker local s,id=GetID() function s.initial_effect(c) - --Activate + --Target 1 face-up monster your opponent controls; destroy that target, then your opponent gains 1000 LP local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) @@ -12,20 +13,17 @@ function s.initial_effect(c) e1:SetOperation(s.activate) c:RegisterEffect(e1) end -function s.filter(c) - return c:IsFaceup() -end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end 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,0,0) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,1000) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then + if tc:IsRelateToEffect(e) and tc:IsControler(1-tp) and tc:IsFaceup() and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.BreakEffect() Duel.Recover(1-tp,1000,REASON_EFFECT) end diff --git a/official/c93211836.lua b/official/c93211836.lua index feb5248807..b6a37baace 100644 --- a/official/c93211836.lua +++ b/official/c93211836.lua @@ -2,48 +2,40 @@ --Genex Army local s,id=GetID() function s.initial_effect(c) - --summon success + --Check if a "Genex" monster is Tributed for this card's Tribute Summon + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_SINGLE) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e0:SetCode(EFFECT_MATERIAL_CHECK) + e0:SetValue(function(e,c) + e:SetLabel(c:GetMaterial():IsExists(Card.IsSetCard,1,nil,SET_GENEX) and 1 or 0) + end) + c:RegisterEffect(e0) + --When this card is Tribute Summoned by Tributing a "Genex" monster: You can target 1 card your opponent controls; destroy that target local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) - e1:SetCondition(s.condition) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + return e:GetHandler():IsTributeSummoned() and e0:GetLabel()==1 + end) + e1:SetTarget(s.destg) + e1:SetOperation(s.desop) c:RegisterEffect(e1) - --tribute check - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(EFFECT_MATERIAL_CHECK) - e2:SetValue(s.valcheck) - e2:SetLabelObject(e1) - c:RegisterEffect(e2) end s.listed_series={SET_GENEX} -function s.valcheck(e,c) - local g=c:GetMaterial() - if g:IsExists(Card.IsSetCard,1,nil,SET_GENEX) then - e:GetLabelObject():SetLabel(1) - else - e:GetLabelObject():SetLabel(0) - end -end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - return c:IsTributeSummoned() and e:GetLabel()==1 -end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end - if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() end + if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) and tc:IsControler(1-tp) then Duel.Destroy(tc,REASON_EFFECT) end end \ No newline at end of file diff --git a/official/c98169343.lua b/official/c98169343.lua index ec4eb58464..eac13c23d3 100644 --- a/official/c98169343.lua +++ b/official/c98169343.lua @@ -2,7 +2,7 @@ --Trickstar Corobane local s,id=GetID() function s.initial_effect(c) - --Special Summon itself from the hand + --If you control no monsters, or all monsters you control are "Trickstar" monsters: You can Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -13,31 +13,31 @@ function s.initial_effect(c) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Increase the ATK of a "Trickstar" monster that battles an opponent's monster + --During the Damage Step, when your "Trickstar" monster battles an opponent's monster (Quick Effect): You can send this card from your hand to the GY; that monster you control gains ATK equal to its original ATK until the end of this turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_HAND) - e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCountLimit(1,id) e2:SetCondition(s.atkcon) e2:SetCost(Cost.SelfToGrave) + e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) + e2:SetHintTiming(TIMING_DAMAGE_STEP) c:RegisterEffect(e2) end s.listed_series={SET_TRICKSTAR} -function s.cfilter(c) - return c:IsFacedown() or not c:IsSetCard(SET_TRICKSTAR) -end function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) + return not Duel.IsExistingMatchingCard(aux.NOT(aux.FaceupFilter(Card.IsSetCard,SET_TRICKSTAR)),tp,LOCATION_MZONE,0,1,nil) end function s.sptg(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 e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() @@ -46,14 +46,19 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) - local ph=Duel.GetCurrentPhase() - if ph~=PHASE_DAMAGE or Duel.IsDamageCalculated() then return false end - local tc,oc=Duel.GetBattleMonster(tp) - return tc and oc and tc:IsSetCard(SET_TRICKSTAR) and tc:IsFaceup() + if not Duel.IsDamageStep() or Duel.IsDamageCalculated() then return false end + local bc1,bc2=Duel.GetBattleMonster(tp) + return bc1 and bc2 and bc1:IsSetCard(SET_TRICKSTAR) and bc1:IsFaceup() +end +function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) + local bc=Duel.GetBattleMonster(tp) + if chk==0 then return bc:IsRelateToBattle() end + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,bc,1,tp,bc:GetBaseAttack()) end -function s.atkop(e,tp,eg,ep,ev,re,r,rp,chk) - local tc,oc=Duel.GetBattleMonster(tp) - if tc:IsFaceup() and tc:IsControler(tp) then - tc:UpdateAttack(tc:GetBaseAttack(),RESET_PHASE|PHASE_END,e:GetHandler()) +function s.atkop(e,tp,eg,ep,ev,re,r,rp) + local bc=Duel.GetBattleMonster(tp) + if bc:IsRelateToBattle() and bc:IsControler(tp) and bc:IsFaceup() then + --That monster you control gains ATK equal to its original ATK until the end of this turn + bc:UpdateAttack(bc:GetBaseAttack(),RESETS_STANDARD_PHASE_END,e:GetHandler()) end end \ No newline at end of file