diff --git a/script/c511000698.lua b/script/c511000698.lua index e188cc59..22916258 100644 --- a/script/c511000698.lua +++ b/script/c511000698.lua @@ -1,93 +1,40 @@ ---Dimension Xyz -function c511000698.initial_effect(c) - function aux.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) - local code=c:GetOriginalCode() - local mt=_G["c" .. code] - if f then - mt.xyz_filter=function(mc) return mc and f(mc) end - else - mt.xyz_filter=function(mc) return true end - end - mt.minxyzct=ct - if not maxct then - mt.maxxyzct=ct - else - if maxct==5 and code~=14306092 and code~=63504681 and code~=23776077 then - mt.maxxyzct=99 - else - mt.maxxyzct=maxct - end - end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetRange(LOCATION_EXTRA) - if not maxct then maxct=ct end - if alterf then - e1:SetCondition(Auxiliary.XyzCondition2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetTarget(Auxiliary.XyzTarget2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetOperation(Auxiliary.XyzOperation2(f,lv,ct,maxct,alterf,desc,op)) - else - e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct)) - e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct)) - e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct)) - end - e1:SetValue(SUMMON_TYPE_XYZ) - c:RegisterEffect(e1) - end - - --Activate - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetCode(EVENT_FREE_CHAIN) - e1:SetCondition(c511000698.condition) - e1:SetTarget(c511000698.target) - e1:SetOperation(c511000698.operation) - c:RegisterEffect(e1) -end -function c511000698.condition(e,tp,eg,ep,ev,re,r,rp) - return Duel.GetLP(tp)<=1000 -end -function c511000698.filter(c,e,tp) - return Duel.IsExistingMatchingCard(c511000698.filter2,tp,0x1E,0,2,c,c:GetLevel(),c:GetCode()) - and Duel.IsExistingMatchingCard(c511000698.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetLevel()) -end -function c511000698.filter2(c,lv,code) - return c:GetLevel()==lv and c:IsCode(code) -end -function c511000698.xyzfilter(c,e,tp,lv) - return c:GetRank()==lv and (c.minxyzct==3 or c.maxxyzct>=3) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) -end -function c511000698.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chk==0 then return Duel.IsExistingMatchingCard(c511000698.filter,tp,0x1E,0,1,nil,e,tp) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) -end -function c511000698.operation(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local g1=Duel.SelectMatchingCard(tp,c511000698.filter,tp,0x1E,0,1,1,nil,e,tp) - local gx=g1:GetFirst() - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local g2=Duel.SelectMatchingCard(tp,c511000698.filter2,tp,0x1E,0,2,2,gx,gx:GetLevel(),gx:GetCode()) - g1:Merge(g2) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local x=Duel.SelectMatchingCard(tp,c511000698.xyzfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,gx:GetLevel()) - local xyz=x:GetFirst() - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetRange(LOCATION_EXTRA) - e1:SetOperation(c511000698.xyzop) - e1:SetReset(RESET_CHAIN) - e1:SetValue(SUMMON_TYPE_XYZ) - e1:SetLabelObject(g1) - xyz:RegisterEffect(e1) - Duel.XyzSummon(tp,xyz,nil) -end -function c511000698.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og) - local mat=e:GetLabelObject() - c:SetMaterial(mat) - Duel.Overlay(c,mat) -end +--Dimension Xyz +function c511000698.initial_effect(c) + --Activate + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetCondition(c511000698.condition) + e1:SetTarget(c511000698.target) + e1:SetOperation(c511000698.operation) + c:RegisterEffect(e1) +end +function c511000698.condition(e,tp,eg,ep,ev,re,r,rp) + return Duel.GetLP(tp)<=1000 +end +function c511000698.filter(c,tp,xyz) + local g=Duel.GetMatchingGroup(c511000698.filter2,tp,0x1e,0,nil,c:GetLevel(),c:GetCode(),xyz) + return xyz:IsXyzSummonable(g,3,3) and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or c:IsLocation(LOCATION_MZONE)) +end +function c511000698.filter2(c,lv,code,xyz) + return c:IsXyzLevel(xyz,lv) and c:IsCode(code) +end +function c511000698.xyzfilter(c,tp) + return Duel.IsExistingMatchingCard(c511000698.filter,tp,0x1e,0,1,nil,tp,c) +end +function c511000698.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chk==0 then return Duel.IsExistingMatchingCard(c511000698.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,tp) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) +end +function c511000698.operation(e,tp,eg,ep,ev,re,r,rp) + local xyzg=Duel.GetMatchingGroup(c511000698.xyzfilter,tp,LOCATION_EXTRA,0,nil,tp) + if xyzg:GetCount()>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local xyz=xyzg:Select(tp,1,1,nil):GetFirst() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) + local mc=Duel.SelectMatchingCard(tp,c511000698.filter,tp,0x1e,0,1,1,nil,tp,xyz):GetFirst() + local g=Duel.GetMatchingGroup(c511000698.filter2,tp,0x1e,0,nil,mc:GetLevel(),mc:GetCode(),xyz) + Duel.XyzSummon(tp,xyz,g,3,3) + end +end diff --git a/script/c511001445.lua b/script/c511001445.lua index 985e3038..9c5c5cf2 100644 --- a/script/c511001445.lua +++ b/script/c511001445.lua @@ -1,89 +1,35 @@ ---Halfway to Forever -function c511001445.initial_effect(c) - function aux.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) - local code=c:GetOriginalCode() - local mt=_G["c" .. code] - if f then - mt.xyz_filter=function(mc) return mc and f(mc) end - else - mt.xyz_filter=function(mc) return true end - end - mt.minxyzct=ct - if not maxct then - mt.maxxyzct=ct - else - if maxct==5 and code~=14306092 and code~=63504681 and code~=23776077 then - mt.maxxyzct=99 - else - mt.maxxyzct=maxct - end - end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetRange(LOCATION_EXTRA) - if not maxct then maxct=ct end - if alterf then - e1:SetCondition(Auxiliary.XyzCondition2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetTarget(Auxiliary.XyzTarget2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetOperation(Auxiliary.XyzOperation2(f,lv,ct,maxct,alterf,desc,op)) - else - e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct)) - e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct)) - e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct)) - end - e1:SetValue(SUMMON_TYPE_XYZ) - c:RegisterEffect(e1) - end - - --Activate - local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) - e1:SetTarget(c511001445.target) - e1:SetOperation(c511001445.activate) - c:RegisterEffect(e1) -end -function c511001445.filter(c,tid) - return c:GetTurnID()==tid and c:IsReason(REASON_BATTLE) -end -function c511001445.xyzfilter(c,mg) - return c:IsXyzSummonable(mg) and (c.minxyzct==2 or c.maxxyzct>=2) -end -function c511001445.mfilter1(c,exg) - return exg:IsExists(c511001445.mfilter2,1,nil,c) -end -function c511001445.mfilter2(c,mc) - return c.xyz_filter(mc) -end -function c511001445.target(e,tp,eg,ep,ev,re,r,rp,chk) - local tid=Duel.GetTurnCount() - local mg=Duel.GetMatchingGroup(c511001445.filter,tp,LOCATION_GRAVE,0,nil,tid) - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and mg:GetCount()>1 - and Duel.IsExistingMatchingCard(c511001445.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) -end -function c511001445.activate(e,tp,eg,ep,ev,re,r,rp) - local tid=Duel.GetTurnCount() - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local mg=Duel.GetMatchingGroup(c511001445.filter,tp,LOCATION_GRAVE,0,nil,tid) - local exg=Duel.GetMatchingGroup(c511001445.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg1=mg:FilterSelect(tp,c511001445.mfilter1,1,1,nil,exg) - local tc1=sg1:GetFirst() - local exg2=exg:Filter(c511001445.mfilter2,nil,tc1) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local sg2=mg:FilterSelect(tp,c511001445.mfilter1,1,1,tc1,exg2) - sg1:Merge(sg2) - local xyzg=Duel.GetMatchingGroup(c511001445.xyzfilter,tp,LOCATION_EXTRA,0,nil,sg1) - if xyzg:GetCount()>0 then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - xyz:SetMaterial(sg1) - Duel.Overlay(xyz,sg1) - Duel.SpecialSummon(xyz,SUMMON_TYPE_XYZ,tp,tp,true,false,POS_FACEUP) - xyz:CompleteProcedure() - end -end +--Halfway to Forever +function c511001445.initial_effect(c) + --Activate + local e1=Effect.CreateEffect(c) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetTarget(c511001445.target) + e1:SetOperation(c511001445.activate) + c:RegisterEffect(e1) +end +function c511001445.filter(c,tid) + return c:GetTurnID()==tid and c:IsReason(REASON_BATTLE) +end +function c511001445.xyzfilter(c,mg) + return c:IsXyzSummonable(mg,2,2) --and (c.minxyzct==2 or c.maxxyzct>=2) +end +function c511001445.target(e,tp,eg,ep,ev,re,r,rp,chk) + local tid=Duel.GetTurnCount() + local mg=Duel.GetMatchingGroup(c511001445.filter,tp,LOCATION_GRAVE,0,nil,tid) + if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and mg:GetCount()>1 + and Duel.IsExistingMatchingCard(c511001445.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) +end +function c511001445.activate(e,tp,eg,ep,ev,re,r,rp) + local tid=Duel.GetTurnCount() + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + local mg=Duel.GetMatchingGroup(c511001445.filter,tp,LOCATION_GRAVE,0,nil,tid) + local xyzg=Duel.GetMatchingGroup(c511001445.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + if xyzg:GetCount()>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local xyz=xyzg:Select(tp,1,1,nil):GetFirst() + Duel.XyzSummon(tp,xyz,mg,2,2) + end +end diff --git a/script/c511001447.lua b/script/c511001447.lua index 786c8f88..f8430306 100644 --- a/script/c511001447.lua +++ b/script/c511001447.lua @@ -1,94 +1,53 @@ ---Session Draw -function c511001447.initial_effect(c) - function aux.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) - local code=c:GetOriginalCode() - local mt=_G["c" .. code] - if f then - mt.xyz_filter=function(mc) return mc and f(mc) end - else - mt.xyz_filter=function(mc) return true end - end - mt.minxyzct=ct - if not maxct then - mt.maxxyzct=ct - else - if maxct==5 and code~=14306092 and code~=63504681 and code~=23776077 then - mt.maxxyzct=99 - else - mt.maxxyzct=maxct - end - end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetRange(LOCATION_EXTRA) - if not maxct then maxct=ct end - if alterf then - e1:SetCondition(Auxiliary.XyzCondition2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetTarget(Auxiliary.XyzTarget2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetOperation(Auxiliary.XyzOperation2(f,lv,ct,maxct,alterf,desc,op)) - else - e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct)) - e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct)) - e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct)) - end - e1:SetValue(SUMMON_TYPE_XYZ) - c:RegisterEffect(e1) - end - - --Activate - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) - e1:SetOperation(c511001447.activate) - c:RegisterEffect(e1) -end -function c511001447.activate(e,tp,eg,ep,ev,re,r,rp) - local ph=Duel.GetCurrentPhase() - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - e1:SetProperty(EFFECT_FLAG_DELAY) - e1:SetCode(EVENT_DRAW) - e1:SetCountLimit(1) - if Duel.GetTurnPlayer()==tp and ph==PHASE_DRAW then - e1:SetLabel(Duel.GetTurnCount()) - e1:SetCondition(c511001447.con) - e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,2) - else - e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,1) - end - e1:SetOperation(c511001447.op) - Duel.RegisterEffect(e1,tp) -end -function c511001447.con(e,tp,eg,ep,ev,re,r,rp) - return Duel.GetTurnCount()~=e:GetLabel() -end -function c511001447.xyzfilter(c,mg) - return c:IsXyzSummonable(mg) and (c.minxyzct==2 or c.maxxyzct>=2) -end -function c511001447.op(e,tp,eg,ep,ev,re,r,rp) - if ep~=tp or Duel.GetCurrentPhase()~=PHASE_DRAW or Duel.GetTurnPlayer()~=tp - or bit.band(r,REASON_RULE)==0 then return end - Duel.Hint(HINT_CARD,0,511001447) - local tc1=eg:GetFirst() - local tc2=Duel.GetDecktopGroup(tp,1):GetFirst() - Duel.Draw(tp,1,REASON_EFFECT) - if tc1 and tc2 then - local g=Group.FromCards(tc1,tc2) - Duel.ConfirmCards(1-tp,g) - if tc1:IsType(TYPE_MONSTER) and tc2:IsType(TYPE_MONSTER) and tc1:GetLevel()==tc2:GetLevel() then - local xyzg=Duel.GetMatchingGroup(c511001447.xyzfilter,tp,LOCATION_EXTRA,0,nil,g) - if xyzg:GetCount()>0 then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - xyz:SetMaterial(g) - Duel.Overlay(xyz,g) - Duel.SpecialSummon(xyz,SUMMON_TYPE_XYZ,tp,tp,true,false,POS_FACEUP) - xyz:CompleteProcedure() - end - end - Duel.ShuffleHand(tp) - end - Duel.ShuffleHand(tp) -end +--Session Draw +function c511001447.initial_effect(c) + --Activate + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetOperation(c511001447.activate) + c:RegisterEffect(e1) +end +function c511001447.activate(e,tp,eg,ep,ev,re,r,rp) + local ph=Duel.GetCurrentPhase() + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) + e1:SetProperty(EFFECT_FLAG_DELAY) + e1:SetCode(EVENT_DRAW) + e1:SetCountLimit(1) + if Duel.GetTurnPlayer()==tp and ph==PHASE_DRAW then + e1:SetLabel(Duel.GetTurnCount()) + e1:SetCondition(c511001447.con) + e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,2) + else + e1:SetReset(RESET_PHASE+PHASE_DRAW+RESET_SELF_TURN,1) + end + e1:SetOperation(c511001447.op) + Duel.RegisterEffect(e1,tp) +end +function c511001447.con(e,tp,eg,ep,ev,re,r,rp) + return Duel.GetTurnCount()~=e:GetLabel() +end +function c511001447.xyzfilter(c,mg) + return c:IsXyzSummonable(mg,2,2) +end +function c511001447.op(e,tp,eg,ep,ev,re,r,rp) + if ep~=tp or Duel.GetCurrentPhase()~=PHASE_DRAW or Duel.GetTurnPlayer()~=tp + or bit.band(r,REASON_RULE)==0 then return end + Duel.Hint(HINT_CARD,0,511001447) + local tc1=eg:GetFirst() + local tc2=Duel.GetDecktopGroup(tp,1):GetFirst() + Duel.Draw(tp,1,REASON_EFFECT) + if tc1 and tc2 then + local g=Group.FromCards(tc1,tc2) + Duel.ConfirmCards(1-tp,g) + if tc1:IsType(TYPE_MONSTER) and tc2:IsType(TYPE_MONSTER) and tc1:GetLevel()==tc2:GetLevel() then + local xyzg=Duel.GetMatchingGroup(c511001447.xyzfilter,tp,LOCATION_EXTRA,0,nil,g) + if xyzg:GetCount()>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local xyz=xyzg:Select(tp,1,1,nil):GetFirst() + Duel.XyzSummon(tp,xyz,g) + end + end + end + Duel.ShuffleHand(tp) +end diff --git a/script/c511001874.lua b/script/c511001874.lua index efad5b6b..cd44cfdc 100644 --- a/script/c511001874.lua +++ b/script/c511001874.lua @@ -1,73 +1,33 @@ ---Rescue Xyz -function c511001874.initial_effect(c) - function aux.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) - local code=c:GetOriginalCode() - local mt=_G["c" .. code] - if f then - mt.xyz_filter=function(mc) return mc and f(mc) end - else - mt.xyz_filter=function(mc) return true end - end - mt.minxyzct=ct - if not maxct then - mt.maxxyzct=ct - else - if maxct==5 and code~=14306092 and code~=63504681 and code~=23776077 then - mt.maxxyzct=99 - else - mt.maxxyzct=maxct - end - end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetRange(LOCATION_EXTRA) - if not maxct then maxct=ct end - if alterf then - e1:SetCondition(Auxiliary.XyzCondition2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetTarget(Auxiliary.XyzTarget2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetOperation(Auxiliary.XyzOperation2(f,lv,ct,maxct,alterf,desc,op)) - else - e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct)) - e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct)) - e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct)) - end - e1:SetValue(SUMMON_TYPE_XYZ) - c:RegisterEffect(e1) - end - - --synchro effect - local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) - e1:SetTarget(c511001874.target) - e1:SetOperation(c511001874.activate) - c:RegisterEffect(e1) -end -function c511001874.filter(c) - return c:IsFaceup() and c:GetOwner()~=c:GetControler() -end -function c511001874.xyzfilter(c,mg) - return c:IsXyzSummonable(mg) and c.minxyzct<=mg:GetCount() -end -function c511001874.target(e,tp,eg,ep,ev,re,r,rp,chk) - local mg=Duel.GetMatchingGroup(c511001874.filter,tp,0,LOCATION_MZONE,nil) - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(c511001874.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) -end -function c511001874.activate(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local mg=Duel.GetMatchingGroup(c511001874.filter,tp,0,LOCATION_MZONE,nil) - local g=Duel.GetMatchingGroup(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,nil,mg) - if g:GetCount()>0 then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local xyz=g:Select(tp,1,1,nil):GetFirst() - if mg:GetCount()>xyz.minxyzct then - mg=mg:Select(tp,xyz.minxyzct,xyz.maxxyzct,nil) - end - Duel.XyzSummon(tp,xyz,mg) - end -end +--Rescue Xyz +function c511001874.initial_effect(c) + --synchro effect + local e1=Effect.CreateEffect(c) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetTarget(c511001874.target) + e1:SetOperation(c511001874.activate) + c:RegisterEffect(e1) +end +function c511001874.filter(c) + return c:IsFaceup() and c:GetOwner()~=c:GetControler() +end +function c511001874.xyzfilter(c,mg) + return c:IsXyzSummonable(mg,1,mg:GetCount()) +end +function c511001874.target(e,tp,eg,ep,ev,re,r,rp,chk) + local mg=Duel.GetMatchingGroup(c511001874.filter,tp,0,LOCATION_MZONE,nil) + if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + and Duel.IsExistingMatchingCard(c511001874.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) +end +function c511001874.activate(e,tp,eg,ep,ev,re,r,rp) + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + local mg=Duel.GetMatchingGroup(c511001874.filter,tp,0,LOCATION_MZONE,nil) + local g=Duel.GetMatchingGroup(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,nil,mg,1,mg:GetCount()) + if g:GetCount()>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local xyz=g:Select(tp,1,1,nil):GetFirst() + Duel.XyzSummon(tp,xyz,mg,1,mg:GetCount()) + end +end diff --git a/script/c511002769.lua b/script/c511002769.lua index d0e8b94a..875ab782 100644 --- a/script/c511002769.lua +++ b/script/c511002769.lua @@ -1,97 +1,53 @@ ---Modify Deep Blue -function c511002769.initial_effect(c) - function aux.AddXyzProcedure(c,f,lv,ct,alterf,desc,maxct,op) - local code=c:GetOriginalCode() - local mt=_G["c" .. code] - if f then - mt.xyz_filter=function(mc) return mc and f(mc) end - else - mt.xyz_filter=function(mc) return true end - end - mt.minxyzct=ct - if not maxct then - mt.maxxyzct=ct - else - if maxct==5 and code~=14306092 and code~=63504681 and code~=23776077 then - mt.maxxyzct=99 - else - mt.maxxyzct=maxct - end - end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_SPSUMMON_PROC) - e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) - e1:SetRange(LOCATION_EXTRA) - if not maxct then maxct=ct end - if alterf then - e1:SetCondition(Auxiliary.XyzCondition2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetTarget(Auxiliary.XyzTarget2(f,lv,ct,maxct,alterf,desc,op)) - e1:SetOperation(Auxiliary.XyzOperation2(f,lv,ct,maxct,alterf,desc,op)) - else - e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct)) - e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct)) - e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct)) - end - e1:SetValue(SUMMON_TYPE_XYZ) - c:RegisterEffect(e1) - end - - --Activate - local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) - e1:SetLabel(0) - e1:SetCost(c511002769.cost) - e1:SetTarget(c511002769.target) - e1:SetOperation(c511002769.activate) - c:RegisterEffect(e1) -end -function c511002769.filter(c,rk) - return c:GetLevel()==rk -end -function c511002769.xyzfilter(c,mg) - local ct=c.minxyzct - return c:IsXyzSummonable(mg) and ct<=mg:GetCount() and mg:IsExists(c511002769.mfilter,ct,nil,c) -end -function c511002769.mfilter(c,xyz) - return xyz.xyz_filter(c) and c:IsCanBeXyzMaterial(xyz) -end -function c511002769.cfilter(c,e,tp) - local rk=c:GetRank() - local mg=Duel.GetMatchingGroup(c511002769.filter,tp,LOCATION_DECK,0,nil,rk) - return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToRemoveAsCost() - and mg:GetCount()>1 and Duel.IsExistingMatchingCard(c511002769.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) -end -function c511002769.cost(e,tp,eg,ep,ev,re,r,rp,chk) - e:SetLabel(1) - if chk==0 then return true end -end -function c511002769.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - if e:GetLabel()~=1 then return false end - e:SetLabel(0) - return Duel.IsExistingMatchingCard(c511002769.cfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local rg=Duel.SelectMatchingCard(tp,c511002769.cfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) - Duel.Remove(rg,POS_FACEUP,REASON_COST) - local rk=rg:GetFirst():GetRank() - Duel.SetTargetParam(rk) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) -end -function c511002769.activate(e,tp,eg,ep,ev,re,r,rp) - local rk=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local mg=Duel.GetMatchingGroup(c511002769.filter,tp,LOCATION_DECK,0,nil,rk) - local xyzg=Duel.GetMatchingGroup(c511002769.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) - if xyzg:GetCount()>0 then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local xyz=xyzg:Select(tp,1,1,nil):GetFirst() - local ct=xyz.minxyzct - local ct2=xyz.maxxyzct - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local g=mg:FilterSelect(tp,c511002769.mfilter,ct,ct2,nil,xyz) - Duel.XyzSummon(tp,xyz,g) - end -end +--Modify Deep Blue +function c511002769.initial_effect(c) + --Activate + local e1=Effect.CreateEffect(c) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetLabel(0) + e1:SetCost(c511002769.cost) + e1:SetTarget(c511002769.target) + e1:SetOperation(c511002769.activate) + c:RegisterEffect(e1) +end +function c511002769.filter(c,rk) + return c:GetLevel()==rk +end +function c511002769.xyzfilter(c,mg) + return c:IsXyzSummonable(mg,1,mg:GetCount()) +end +function c511002769.cfilter(c,e,tp) + local rk=c:GetRank() + local mg=Duel.GetMatchingGroup(c511002769.filter,tp,LOCATION_DECK,0,nil,rk) + return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToRemoveAsCost() + and mg:GetCount()>1 and Duel.IsExistingMatchingCard(c511002769.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) +end +function c511002769.cost(e,tp,eg,ep,ev,re,r,rp,chk) + e:SetLabel(1) + return true +end +function c511002769.target(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then + if e:GetLabel()~=1 then return false end + e:SetLabel(0) + return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 + and Duel.IsExistingMatchingCard(c511002769.cfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) + end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local rg=Duel.SelectMatchingCard(tp,c511002769.cfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) + Duel.Remove(rg,POS_FACEUP,REASON_COST) + Duel.SetTargetParam(rg:GetFirst():GetRank()) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) +end +function c511002769.activate(e,tp,eg,ep,ev,re,r,rp) + local rk=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + local mg=Duel.GetMatchingGroup(c511002769.filter,tp,LOCATION_DECK,0,nil,rk) + local xyzg=Duel.GetMatchingGroup(c511002769.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) + if xyzg:GetCount()>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local xyz=xyzg:Select(tp,1,1,nil):GetFirst() + Duel.XyzSummon(tp,xyz,mg,1,mg:GetCount()) + end +end