--【背景音台】Morning Music local m=33701410 local cm=_G["c"..m] function cm.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(cm.target) e1:SetOperation(cm.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(1,0) e2:SetTarget(cm.splimit) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_SUMMON) c:RegisterEffect(e3) local e4=Effect.CreateEffect(e:GetHandler()) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_PHASE+PHASE_STANDBY) e4:SetCountLimit(1) e4:SetRange(LOCATION_SZONE) e4:SetCondition(cm.thcon) e4:SetOperation(cm.thop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_PHASE+PHASE_END) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e6:SetType(EFFECT_TYPE_IGNITION) e6:SetRange(LOCATION_SZONE) e6:SetCost(cm.thcost1) e6:SetTarget(cm.thtg1) e6:SetOperation(cm.thop1) c:RegisterEffect(e6) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local sg=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,0,e:GetHandler()) if sg:GetCount()>0 then Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,sg,sg:GetCount(),0,0) end end function cm.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local sg=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,0,:GetHandler()) Duel.SendtoGrave(sg,REASON_EFFECT) end function cm.splimit(e,c) return not c:IsSetCard(0x15) or not (c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(4)) end function cm.thcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function cm.thfilter(c) return (c:IsSetCard(0x15) or (c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(4))) and c:IsAbleToHand() end function cm.thop(e,tp,eg,ep,ev,re,r,rp) if Duel.SelectYesNo(aux.Stringid(m,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end function cm.thcost1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function cm.thtg1(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,nil) if chk==0 then return g:GetClassCount(Card.GetCode)>=4 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,4,tp,LOCATION_DECK) end function cm.thop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.thfilter),tp,LOCATION_DECK+LOCATION_GRAVE,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local cg=g:SelectSubGroup(tp,aux.dncheck,false,4,4) if cg:GetCount()>0 then Duel.SendtoHand(cg,nil,REASON_EFFECT) cg=Duel.GetOperatedGroup() local tc=cg:GetFirst() while tc do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PUBLIC) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1) end cg:KeepAlive() local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(1,0) e2:SetLabelObject(cg) e2:SetTarget(cm.splimit1) Duel.RegisterEffect(e2,tp) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_SUMMON) Duel.RegisterEffect(e3,tp) end end function cm.filter(c) return c:GetFlagEffect(m)~=0 end function cm.splimit1(e,c) local g=e:GetLabelObject() if not g then e:Reset() return false end local cg=g:Filter(cm.filter,nil) if cg:GetCount()==0 then cg:DeleteGroup() e:Reset() return false end return not cg:IsContains(c) end