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/c10802915.lua b/official/c10802915.lua index 14528430e9..4825122ebe 100644 --- a/official/c10802915.lua +++ b/official/c10802915.lua @@ -2,47 +2,41 @@ --Tour Guide From the Underworld local s,id=GetID() function s.initial_effect(c) - --spsummon - local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetCategory(CATEGORY_SPECIAL_SUMMON) - e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e2:SetCode(EVENT_SUMMON_SUCCESS) - e2:SetTarget(s.sptg) - e2:SetOperation(s.spop) - c:RegisterEffect(e2) + --When this card is Normal Summoned: You can Special Summon 1 Level 3 Fiend monster from your hand or Deck, but negate its effects, also it cannot be used as Synchro Material + local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DISABLE) + e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetCode(EVENT_SUMMON_SUCCESS) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop) + c:RegisterEffect(e1) end -function s.filter(c,e,tp) - return c:GetLevel()==3 and c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +function s.spfilter(c,e,tp) + return c:IsLevel(3) and c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end 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.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_HAND|LOCATION_DECK,0,1,1,nil,e,tp) - local tc=g:GetFirst() - if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then - local e1=Effect.CreateEffect(e:GetHandler()) + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() + if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then + local c=e:GetHandler() + --But negate its effects + sc:NegateEffects(c) + --Also it cannot be used as Synchro Material + local e1=Effect.CreateEffect(c) + e1:SetDescription(3310) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_DISABLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CLIENT_HINT) + e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) + e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e1,true) - local e2=Effect.CreateEffect(e:GetHandler()) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(EFFECT_DISABLE_EFFECT) - e2:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e2,true) - local e3=Effect.CreateEffect(e:GetHandler()) - e3:SetType(EFFECT_TYPE_SINGLE) - e3:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) - e3:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e3:SetValue(1) - e3:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e3,true) + sc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end \ No newline at end of file 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/c1426714.lua b/official/c1426714.lua index 260562eac0..b1e99231c2 100644 --- a/official/c1426714.lua +++ b/official/c1426714.lua @@ -1,63 +1,62 @@ ---No.48 シャドー・リッチ +--No.48 シャドー・リッチ --Number 48: Shadow Lich local s,id=GetID() +local TOKEN_PHANTOM=id+1 function s.initial_effect(c) - --xyz summon - Xyz.AddProcedure(c,nil,3,2) c:EnableReviveLimit() - --token + --Xyz Summon procedure: 2 Level 3 monsters + Xyz.AddProcedure(c,nil,3,2) + --Once per opponent's turn (Quick Effect): You can detach 1 material from this card; Special Summon 1 "Phantom Token" (Fiend-Type/DARK/Level 1/ATK 500/DEF 500) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) - e1:SetHintTiming(0,TIMING_BATTLE_START|TIMING_END_PHASE) - e1:SetCondition(s.spcon) + e1:SetCountLimit(1) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + return Duel.IsTurnPlayer(1-tp) + end) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) - --cannot be battle target + --While you control a "Phantom Token", your opponent's monsters cannot target this card for attacks local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) + e2:SetType(EFFECT_TYPE_FIELD) + e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) - e2:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) - e2:SetCondition(s.atkcon) - e2:SetValue(aux.imval2) + e2:SetTargetRange(0,LOCATION_MZONE) + e2:SetCondition(function(e) + return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,TOKEN_PHANTOM),e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) + end) + e2:SetValue(function(e,c) + return c==e:GetHandler() + end) c:RegisterEffect(e2) - --atk + --Gains 500 ATK for each "Phantom Token" you control local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_MZONE) - e3:SetValue(s.atkval) + e3:SetValue(function(e,c) + return 500*Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsCode,TOKEN_PHANTOM),e:GetHandlerPlayer(),LOCATION_ONFIELD,0,nil) + end) c:RegisterEffect(e3) end -s.listed_names={1426715} s.xyz_number=48 -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsTurnPlayer(1-tp) -end +s.listed_names={TOKEN_PHANTOM} 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.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,500,500,1,RACE_FIEND,ATTRIBUTE_DARK) end - Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) + and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_PHANTOM) end + Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,500,500,1,RACE_FIEND,ATTRIBUTE_DARK) then - local token=Duel.CreateToken(tp,id+1) + if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_PHANTOM) then + local token=Duel.CreateToken(tp,TOKEN_PHANTOM) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) end -end -function s.atkcon(e) - return Duel.IsExistingMatchingCard(Card.IsCode,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil,id+1) -end -function s.atkval(e,c) - return Duel.GetMatchingGroupCount(Card.IsCode,c:GetControler(),LOCATION_ONFIELD,0,nil,id+1)*500 -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/c3111207.lua b/official/c3111207.lua index 0c40412e4c..3f69a7b789 100644 --- a/official/c3111207.lua +++ b/official/c3111207.lua @@ -1,82 +1,60 @@ --彩宝龍 --Lappis Dragon --Logical Nonsense ---Substitute ID local s,id=GetID() function s.initial_effect(c) - --Special summon itself from hand, if added from deck + --If this card is added from the Deck to your hand: You can reveal this card; Special Summon it 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_DELAY) e1:SetCode(EVENT_TO_HAND) - e1:SetRange(LOCATION_HAND) - e1:SetCost(s.spcost) e1:SetCountLimit(1,id) - e1:SetCondition(s.spcon1) - e1:SetTarget(s.sptg1) - e1:SetOperation(s.spop1) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + return e:GetHandler():IsPreviousLocation(LOCATION_DECK) + end) + e1:SetCost(Cost.SelfReveal) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop(false)) c:RegisterEffect(e1) - --Special summon itself from hand, if added from GY + --If this card is added from your GY to your hand by a card effect: You can reveal this card; Special Summon this card, but banish it when it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_SPECIAL_SUMMON) + e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_HAND) - e2:SetRange(LOCATION_HAND) - e2:SetCost(s.spcost) e2:SetCountLimit(1,id) - e2:SetCondition(s.spcon2) - e2:SetTarget(s.sptg2) - e2:SetOperation(s.spop2) + e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_GRAVE) and c:IsReason(REASON_EFFECT) + end) + e2:SetCost(Cost.SelfReveal) + e2:SetTarget(s.sptg) + e2:SetOperation(s.spop(true)) c:RegisterEffect(e2) end - --Reveal itself as cost -function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return not e:GetHandler():IsPublic() end -end - --If it was previously in deck -function s.spcon1(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():IsPreviousLocation(LOCATION_DECK) -end - --Activation legality -function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsRelateToEffect(e) and 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) -end - --Special summoning itself -function s.spop1(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) -end - --If it was previously in GY -function s.spcon2(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - return (r&REASON_EFFECT)~=0 and c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp) -end - --Activation legality -function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) +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 - --Special summoning itself -function s.spop2(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then - --Banish it if it leaves the field - local e1=Effect.CreateEffect(c) - e1:SetDescription(3300) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) - e1:SetReset(RESET_EVENT|RESETS_REDIRECT) - e1:SetValue(LOCATION_REMOVED) - c:RegisterEffect(e1,true) +function s.spop(banish_when_it_leaves) + return function(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 + and banish_when_it_leaves then + --Banish it when it leaves the field + local e1=Effect.CreateEffect(c) + e1:SetDescription(3300) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) + e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) + e1:SetValue(LOCATION_REMOVED) + e1:SetReset(RESET_EVENT|RESETS_REDIRECT) + c:RegisterEffect(e1,true) + end end end \ No newline at end of file diff --git a/official/c31525442.lua b/official/c31525442.lua index c8e0ce2e9e..19e139c792 100644 --- a/official/c31525442.lua +++ b/official/c31525442.lua @@ -1,83 +1,111 @@ --予見者ゾルガ --Zolga the Prophet --Scripted by The Razgriz ---Substitute ID local s,id=GetID() function s.initial_effect(c) - --Special Summon/Look at top 5 cards + --If you control an EARTH Fairy monster, except "Zolga the Prophet": You can Special Summon this card from your hand, then look at up to 5 cards from the top of each player's Deck local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_IGNITION) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) - e1:SetCountLimit(1,id) + e1:SetCountLimit(1,{id,0}) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Activate - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) - e2:SetCode(EVENT_ATTACK_ANNOUNCE) - e2:SetRange(LOCATION_GRAVE) - e2:SetCountLimit(1,{id,1}) - e2:SetCost(Cost.SelfBanish) - e2:SetCondition(s.con) - e2:SetTarget(s.tg) - e2:SetOperation(s.op) - c:RegisterEffect(e2) + --When a monster that was Normal Summoned by Tributing this card declares an attack: You can banish this card from your GY; destroy that monster, and if you do, inflict 2000 damage to your opponent + local e2a=Effect.CreateEffect(c) + e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e2a:SetCode(EVENT_BE_MATERIAL) + e2a:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + local rc=c:GetReasonCard() + return r==REASON_SUMMON and c:IsLocation(LOCATION_GRAVE) and rc:IsTributeSummoned() and rc:IsFaceup() + end) + e2a:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + local fid=c:GetFieldID() + local rc=c:GetReasonCard() + rc:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~(RESET_TEMP_REMOVE|RESET_LEAVE)),EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(id,2)) + --Reset the flag effect + hint on the Tribute Summoned monster if this card moves from the GY + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e0:SetCode(EVENT_MOVE) + e0:SetOperation(function() + if rc:HasFlagEffect(id) and rc:GetFlagEffectLabel(id)==fid then + rc:ResetFlagEffect(id) + end + e0:Reset() + end) + c:RegisterEffect(e0) + end) + c:RegisterEffect(e2a) + local e2b=Effect.CreateEffect(c) + e2b:SetDescription(aux.Stringid(id,1)) + e2b:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) + e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2b:SetCode(EVENT_ATTACK_ANNOUNCE) + e2b:SetRange(LOCATION_GRAVE) + e2b:SetCountLimit(1,{id,1}) + e2b:SetCondition(s.descon) + e2b:SetCost(Cost.SelfBanish) + e2b:SetTarget(s.destg) + e2b:SetOperation(s.desop) + c:RegisterEffect(e2b) end -function s.filter(c) - return c:IsFaceup() and c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_EARTH) and not c:IsCode(id) +s.listed_names={id} +function s.spconfilter(c) + return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_FAIRY) and c:IsFaceup() and not c:IsCode(id) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) + return Duel.IsExistingMatchingCard(s.spconfilter,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) - and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 or Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>0 end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + and (Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 + or Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>0) 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() - if not c:IsRelateToEffect(e) then return end - if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then - Duel.BreakEffect() - s.look(tp,tp) - s.look(tp,1-tp) - end -end -function s.look(tp,p) - local gc=math.min(5,Duel.GetFieldGroupCount(p,LOCATION_DECK,0)) - if gc>0 then - local ac=gc==1 and gc or Duel.AnnounceNumberRange(tp,1,gc) - Duel.ConfirmCards(tp,Duel.GetDecktopGroup(p,ac)) + if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then + local your_deck_count=math.min(5,Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)) + local oppo_deck_count=math.min(5,Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)) + local look_count=0 + local break_chk=true + if your_deck_count>0 then + break_chk=false + Duel.BreakEffect() + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) + look_count=your_deck_count==1 and your_deck_count or Duel.AnnounceNumberRange(tp,1,your_deck_count) + Duel.ConfirmCards(tp,Duel.GetDecktopGroup(tp,look_count)) + end + if oppo_deck_count>0 then + if break_chk then Duel.BreakEffect() end + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,4)) + look_count=oppo_deck_count==1 and oppo_deck_count or Duel.AnnounceNumberRange(tp,1,oppo_deck_count) + Duel.ConfirmCards(tp,Duel.GetDecktopGroup(1-tp,look_count)) + end end end -function s.con(e,tp,eg,ev,ep,re,r,rp) - local c=e:GetHandler() - local tc=c:GetReasonCard() - local at=Duel.GetAttacker() - return (e:GetHandler():IsReason(REASON_RELEASE) and not e:GetHandler():IsReason(REASON_EFFECT)) and tc and tc:IsMonster() and at==tc +function s.descon(e,tp,eg,ev,ep,re,r,rp) + local bc=Duel.GetAttacker() + return bc:HasFlagEffect(id) and bc:GetFlagEffectLabel(id)==e:GetHandler():GetFieldID() end -function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return true end - local at=Duel.GetAttacker() - local tc=e:GetHandler():GetReasonCard() - if (e:GetHandler():IsReason(REASON_RELEASE) and not e:GetHandler():IsReason(REASON_EFFECT)) and tc:IsReason(REASON_SUMMON) and tc:IsMonster() and at==tc then - Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0) - Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,2000) - end +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) + local bc=Duel.GetAttacker() + if chk==0 then return bc:IsRelateToBattle() end + Duel.SetOperationInfo(0,CATEGORY_DESTROY,bc,1,tp,0) + Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,2000) end -function s.op(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - local tc=e:GetHandler():GetReasonCard() - local at=Duel.GetAttacker() - if not tc:IsReason(REASON_SUMMON) or (not c:IsReason(REASON_RELEASE) or c:IsReason(REASON_EFFECT)) and not at==tc then return end - if at==tc then - if Duel.Destroy(tc,REASON_EFFECT)~=0 then - Duel.Damage(1-tp,2000,REASON_EFFECT) - end +function s.desop(e,tp,eg,ep,ev,re,r,rp) + local bc=Duel.GetAttacker() + if bc:IsRelateToBattle() and Duel.Destroy(bc,REASON_EFFECT)>0 then + Duel.Damage(1-tp,2000,REASON_EFFECT) 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/c33093439.lua b/official/c33093439.lua index f7cf2a9486..67fab7797d 100644 --- a/official/c33093439.lua +++ b/official/c33093439.lua @@ -3,74 +3,62 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - --cannot special summon + --Must be Special Summoned (from your hand) by banishing all LIGHT Machine monsters from your field and GY + c:AddMustBeSpecialSummoned() + local e0=Effect.CreateEffect(c) + e0:SetDescription(aux.Stringid(id,0)) + e0:SetType(EFFECT_TYPE_FIELD) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) + e0:SetCode(EFFECT_SPSUMMON_PROC) + e0:SetRange(LOCATION_HAND) + e0:SetCondition(s.spcon) + e0:SetOperation(s.spop) + c:RegisterEffect(e0) + --If this card is Special Summoned: Send all other face-up monsters on the field to the GY local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) - e1:SetCode(EFFECT_SPSUMMON_CONDITION) - e1:SetValue(aux.FALSE) + e1:SetDescription(aux.Stringid(id,1)) + e1:SetCategory(CATEGORY_TOGRAVE) + e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) + e1:SetCode(EVENT_SPSUMMON_SUCCESS) + e1:SetTarget(s.tgtg) + e1:SetOperation(s.tgop) c:RegisterEffect(e1) - --special summon - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(EFFECT_SPSUMMON_PROC) - e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e2:SetRange(LOCATION_HAND) - e2:SetCondition(s.spcon) - e2:SetOperation(s.spop) - c:RegisterEffect(e2) - --destroy - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,0)) - e3:SetCategory(CATEGORY_TOGRAVE) - e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) - e3:SetCode(EVENT_SPSUMMON_SUCCESS) - e3:SetRange(LOCATION_MZONE) - e3:SetTarget(s.target) - e3:SetOperation(s.operation) - c:RegisterEffect(e3) end -function s.cfilter(c) - return c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemoveAsCost() - and (not c:IsLocation(LOCATION_MZONE) or c:IsFaceup()) -end -function s.mzfilter(c) - return c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 +function s.spcostfilter(c) + return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsFaceup() and c:IsAbleToRemoveAsCost() end function s.spcon(e,c) if c==nil then return true end - local tp=c:GetControler() - local mg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) - local gg=not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE,0,nil) - or Group.CreateGroup() - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - return (#mg>0 and (ft>0 or (mg:IsExists(s.mzfilter,1,nil) and ft>-1))) - or (#gg>0 and ft>0) + local tp=e:GetHandlerPlayer() + local locations=Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and LOCATION_MZONE or LOCATION_MZONE|LOCATION_GRAVE + local g=Duel.GetMatchingGroup(s.spcostfilter,tp,locations,0,nil) + return #g>0 and Duel.GetMZoneCount(tp,g)>0 end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) - local g - if Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then - g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) - else - g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) - end - Duel.Remove(g,POS_FACEUP,REASON_COST) - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_SET_ATTACK) - e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) - e1:SetValue(#g*500) - c:RegisterEffect(e1) - local e2=e1:Clone() - e2:SetCode(EFFECT_SET_DEFENSE) - c:RegisterEffect(e2) + local locations=Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and LOCATION_MZONE or LOCATION_MZONE|LOCATION_GRAVE + local g=Duel.GetMatchingGroup(s.spcostfilter,tp,locations,0,nil) + local banished_count=Duel.Remove(g,POS_FACEUP,REASON_COST) + --This card's ATK/DEF become the number of monsters banished for its Special Summon x 500 + local e1a=Effect.CreateEffect(c) + e1a:SetType(EFFECT_TYPE_SINGLE) + e1a:SetCode(EFFECT_SET_ATTACK) + e1a:SetValue(banished_count*500) + e1a:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) + c:RegisterEffect(e1a) + local e1b=e1a:Clone() + e1b:SetCode(EFFECT_SET_DEFENSE) + c:RegisterEffect(e1b) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) +function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) - Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0) + Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,tp,0) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) - Duel.SendtoGrave(g,REASON_EFFECT) +function s.tgop(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + local exc=c:IsRelateToEffect(e) and c or nil + local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,exc) + if #g>0 then + Duel.SendtoGrave(g,REASON_EFFECT) + end end \ No newline at end of file diff --git a/official/c33184167.lua b/official/c33184167.lua index 6621d42de9..c323517f22 100644 --- a/official/c33184167.lua +++ b/official/c33184167.lua @@ -2,43 +2,30 @@ --Tribe-Infecting Virus local s,id=GetID() function s.initial_effect(c) - --destroy + --Discard 1 card, then declare 1 Monster Type; destroy all monsters on the field with the declared Type local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) - e1:SetCost(s.cost) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetCost(Cost.Discard()) + e1:SetTarget(s.destg) + e1:SetOperation(s.desop) c:RegisterEffect(e1) end -function s.cost(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.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) -end -function s.filter(c) - return c:IsFaceup() -end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) - local tc=g:GetFirst() - local race=0 - for tc in aux.Next(g) do - race=(race|tc:GetRace()) - end - Duel.Hint(HINT_SELECTMSG,tp,0) - local arc=Duel.AnnounceRace(tp,1,race) - e:SetLabel(arc) - local dg=g:Filter(Card.IsRace,nil,arc) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) + local monster_types=g:GetBitwiseOr(Card.GetRace) + if chk==0 then return monster_types>0 end + local declared_type=Duel.AnnounceRace(tp,1,monster_types) + g:Match(Card.IsRace,nil,declared_type) + e:GetChainData().declared_type=declared_type + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end -function s.filter2(c,rc) - return c:IsFaceup() and c:IsRace(rc) -end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local arc=e:GetLabel() - local g=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,arc) - Duel.Destroy(g,REASON_EFFECT) +function s.desop(e,tp,eg,ep,ev,re,r,rp) + local declared_type=e:GetChainData().declared_type + local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,declared_type),tp,LOCATION_MZONE,LOCATION_MZONE,nil) + if #g>0 then + Duel.Destroy(g,REASON_EFFECT) + end end \ No newline at end of file diff --git a/official/c38033121.lua b/official/c38033121.lua index fa3ae24d10..0d794f017b 100644 --- a/official/c38033121.lua +++ b/official/c38033121.lua @@ -2,16 +2,16 @@ --Dark Magician Girl local s,id=GetID() function s.initial_effect(c) - --atkup + --Gains 300 ATK for every "Dark Magician" or "Magician of Black Chaos" in the GYs 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 -s.listed_names={CARD_DARK_MAGICIAN} -function s.val(e,c) - return Duel.GetMatchingGroupCount(Card.IsCode,c:GetControler(),LOCATION_GRAVE,LOCATION_GRAVE,nil,30208479,CARD_DARK_MAGICIAN)*300 +s.listed_names={CARD_DARK_MAGICIAN,30208479} --"Magician of Black Chaos" +function s.atkval(e,c) + return 300*Duel.GetMatchingGroupCount(Card.IsCode,0,LOCATION_GRAVE,LOCATION_GRAVE,nil,CARD_DARK_MAGICIAN,30208479) end \ No newline at end of file diff --git a/official/c423585.lua b/official/c423585.lua index 10de6cca80..c63f774648 100644 --- a/official/c423585.lua +++ b/official/c423585.lua @@ -2,77 +2,72 @@ --Summoner Monk local s,id=GetID() function s.initial_effect(c) - --to defense - local e1=Effect.CreateEffect(c) - e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_POSITION) - e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) - e1:SetCode(EVENT_SUMMON_SUCCESS) - e1:SetTarget(s.potg) - e1:SetOperation(s.poop) - c:RegisterEffect(e1) - local e2=e1:Clone() - e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) - c:RegisterEffect(e2) - --special summon + --While this card is face-up on the field, it cannot be Tributed + local e1a=Effect.CreateEffect(c) + e1a:SetType(EFFECT_TYPE_SINGLE) + e1a:SetProperty(EFFECT_FLAG_SINGLE_RANGE) + e1a:SetCode(EFFECT_UNRELEASABLE_SUM) + e1a:SetRange(LOCATION_MZONE) + e1a:SetValue(1) + c:RegisterEffect(e1a) + local e1b=e1a:Clone() + e1b:SetCode(EFFECT_UNRELEASABLE_NONSUM) + c:RegisterEffect(e1b) + --If this card is Normal or Flip Summoned: Change this card to Defense Position + local e2a=Effect.CreateEffect(c) + e2a:SetDescription(aux.Stringid(id,0)) + e2a:SetCategory(CATEGORY_POSITION) + e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) + e2a:SetCode(EVENT_SUMMON_SUCCESS) + e2a:SetTarget(s.postg) + e2a:SetOperation(s.posop) + c:RegisterEffect(e2a) + local e2b=e2a:Clone() + e2b:SetCode(EVENT_FLIP_SUMMON_SUCCESS) + c:RegisterEffect(e2b) + --Once per turn: You can discard 1 Spell; Special Summon 1 Level 4 monster from your Deck, but that monster cannot attack this turn local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) - e3:SetCountLimit(1) e3:SetRange(LOCATION_MZONE) - e3:SetCost(s.spcost) + e3:SetCountLimit(1) + e3:SetCost(Cost.Discard(Card.IsSpell)) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) - --cannot release - local e4=Effect.CreateEffect(c) - e4:SetType(EFFECT_TYPE_SINGLE) - e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e4:SetRange(LOCATION_MZONE) - e4:SetCode(EFFECT_UNRELEASABLE_SUM) - e4:SetValue(1) - c:RegisterEffect(e4) - local e5=e4:Clone() - e5:SetCode(EFFECT_UNRELEASABLE_NONSUM) - c:RegisterEffect(e5) end -function s.potg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chk==0 then return e:GetHandler():IsAttackPos() end - Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) +function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chk==0 then return true end + Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,tp,POS_FACEUP_DEFENSE) end -function s.poop(e,tp,eg,ep,ev,re,r,rp) +function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - if c:IsFaceup() and c:IsAttackPos() and c:IsRelateToEffect(e) then + if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end -function s.costfilter(c) - return c:IsSpell() and c:IsDiscardable() -end -function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end - Duel.DiscardHand(tp,s.costfilter,1,1,REASON_COST|REASON_DISCARD) -end -function s.filter(c,e,tp) - return c:GetLevel()==4 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +function s.spfilter(c,e,tp) + return c:IsLevel(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end 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_DECK,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) 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.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) - local tc=g:GetFirst() - if tc then - Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() + if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then + --But that monster cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) - tc:RegisterEffect(e1) + sc:RegisterEffect(e1) end + Duel.SpecialSummonComplete() 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/c75253697.lua b/official/c75253697.lua index 1d36c9c0a3..851f3b0d4c 100644 --- a/official/c75253697.lua +++ b/official/c75253697.lua @@ -2,10 +2,10 @@ --Number 72: Shogi Rook local s,id=GetID() function s.initial_effect(c) - --Xyz summon - Xyz.AddProcedure(c,nil,6,2) c:EnableReviveLimit() - --Destroy + --Xyz Summon procedure: 2 Level 6 monsters + Xyz.AddProcedure(c,nil,6,2) + --Once per turn: You can detach 2 materials from this card, then target 1 face-up monster your opponent controls and 1 Set Spell/Trap your opponent controls; destroy them, also any battle damage your opponent takes is halved for the rest of this turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) @@ -19,31 +19,33 @@ function s.initial_effect(c) c:RegisterEffect(e1) end s.xyz_number=72 -function s.dfilter(c,pos) - return c:IsPosition(pos) +function s.desfilter(c) + return (c:IsFaceup() and c:IsMonster()) or (c:IsFacedown() and c:IsSpellTrap()) +end +function s.rescon(sg,e,tp,mg) + return sg:IsExists(Card.IsFaceup,1,nil) and sg:IsExists(Card.IsFacedown,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end - if chk==0 then return Duel.IsExistingTarget(s.dfilter,tp,0,LOCATION_MZONE,1,nil,POS_FACEUP) - and Duel.IsExistingTarget(s.dfilter,tp,0,LOCATION_SZONE,1,nil,POS_FACEDOWN) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g1=Duel.SelectTarget(tp,s.dfilter,tp,0,LOCATION_MZONE,1,1,nil,POS_FACEUP) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g2=Duel.SelectTarget(tp,s.dfilter,tp,0,LOCATION_SZONE,1,1,nil,POS_FACEDOWN) - g1:Merge(g2) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0) + local g=Duel.GetTargetGroup(s.desfilter,tp,0,LOCATION_ONFIELD,nil) + if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end + local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_DESTROY) + Duel.SetTargetCard(tg) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,2,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) - if tg and #tg>0 then + if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end + --Also any battle damage your opponent takes is halved for the rest of this turn local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) - e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(0,1) e1:SetValue(HALF_DAMAGE) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) -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/c80441106.lua b/official/c80441106.lua index c4e7d998e0..7a08493fd2 100644 --- a/official/c80441106.lua +++ b/official/c80441106.lua @@ -2,38 +2,32 @@ --Keldo local s,id=GetID() function s.initial_effect(c) - --todeck + --If this card is destroyed by battle and sent to the GY: Target 2 cards in your opponent's GY; shuffle them into the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYED) - 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():IsLocation(LOCATION_GRAVE) + end) + e1:SetTarget(s.tdtg) + e1:SetOperation(s.tdop) c:RegisterEffect(e1) end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) -end -function s.filter(c,e) - return c:IsAbleToDeck() and c:IsCanBeEffectTarget(e) -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(1-tp) and s.filter(chkc,e) end +function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return false end if chk==0 then return true end - local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_GRAVE,nil,e) - if #g>=2 then + if Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,2,nil) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) - local sg=g:Select(tp,2,2,nil) - Duel.SetTargetCard(sg) - Duel.SetOperationInfo(0,CATEGORY_TODECK,sg,2,0,0) + local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,2,2,nil) + Duel.SetOperationInfo(0,CATEGORY_TODECK,g,2,tp,0) end end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) - if not g then return end - local sg=g:Filter(Card.IsRelateToEffect,nil,e) - Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) +function s.tdop(e,tp,eg,ep,ev,re,r,rp) + local tg=Duel.GetTargetCards(e) + if tg and #tg>0 then + Duel.SendtoDeck(tg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) + end 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/c94014327.lua b/official/c94014327.lua index 3cbcd1b2c4..49eadb498b 100644 --- a/official/c94014327.lua +++ b/official/c94014327.lua @@ -55,25 +55,24 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #tg==2 and Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) tg=tg:FilterSelect(tp,Card.IsCanBeSpecialSummoned,1,1,nil,e,0,tp,false,false) - else - for tc in tg:Iter() do - if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then - tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) - --You cannot Special Summon, except Fiend monsters, while you control either of those face-up monsters - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) - e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) - e1:SetRange(LOCATION_MZONE) - e1:SetAbsoluteRange(tp,1,0) - e1:SetCondition(function(e) return e:GetHandler():IsControler(e:GetOwnerPlayer()) end) - e1:SetTarget(function(e,c) return c:IsRaceExcept(RACE_FIEND) end) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e1) - end + end + for tc in tg:Iter() do + if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then + tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) + --You cannot Special Summon, except Fiend monsters, while you control either of those face-up monsters + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_FIELD) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) + e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) + e1:SetRange(LOCATION_MZONE) + e1:SetAbsoluteRange(tp,1,0) + e1:SetCondition(function(e) return e:GetHandler():IsControler(e:GetOwnerPlayer()) end) + e1:SetTarget(function(e,c) return c:IsRaceExcept(RACE_FIEND) end) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + tc:RegisterEffect(e1) end - Duel.SpecialSummonComplete() end + Duel.SpecialSummonComplete() end function s.repfilter(c,e) return c:IsFaceup() and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED|STATUS_BATTLE_DESTROYED) 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