--天罗水将 艾尔玛莉亚 function c40009136.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsSynchroType,TYPE_SYNCHRO),aux.NonTuner(Card.IsSynchroType,TYPE_SYNCHRO),1) c:EnableReviveLimit() --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(40009136,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1) e1:SetCondition(c40009136.spcon) e1:SetTarget(c40009136.sptg) e1:SetOperation(c40009136.spop) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(40009136,1)) e2:SetCategory(CATEGORY_DRAW) e2:SetRange(LOCATION_MZONE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetCountLimit(1) e2:SetCondition(c40009136.condition) e2:SetTarget(c40009136.drtg) e2:SetOperation(c40009136.drop) c:RegisterEffect(e2) end function c40009136.spcon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return e:GetHandler():IsSummonType(SUMMON_TYPE_SYNCHRO) and (ph>PHASE_MAIN1 and ph1 and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.IsExistingMatchingCard(c40009136.spfilter1,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_DECK) end function c40009136.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,c40009136.spfilter1,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectMatchingCard(tp,c40009136.spfilter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,g1:GetFirst(),e,tp) g1:Merge(g2) if g1:GetCount()==2 then Duel.SpecialSummon(g1,0,tp,tp,false,false,POS_FACEUP) local fid=e:GetHandler():GetFieldID() g1:RegisterFlagEffect(40009136,RESET_EVENT+RESETS_STANDARD,0,1,fid) g1:RegisterFlagEffect(g1:GetOriginalCode(),RESET_EVENT+RESETS_STANDARD+RESET_DISABLE,0,0) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(g1) e1:SetCondition(c40009136.retcon) e1:SetOperation(c40009136.retop) Duel.RegisterEffect(e1,tp) end end function c40009136.retcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffectLabel(40009136)~=e:GetLabel() then e:Reset() return false else return true end end function c40009136.retop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.SendtoDeck(tc,nil,2,REASON_EFFECT) end function c40009136.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetBattledCount(tp)>4 end function c40009136.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,4) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(4) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,4) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,3) end function c40009136.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)==4 then local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil) if g:GetCount()==0 then return end Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK) local sg=g:Select(p,3,3,nil) Duel.SendtoDeck(sg,nil,0,REASON_EFFECT) Duel.SortDecktop(p,p,3) for i=1,3 do local mg=Duel.GetDecktopGroup(p,1) Duel.MoveSequence(mg:GetFirst(),1) end end end