--Numero 201: Ossidiana Indorata Spektrale --Scripted by: XGlitchy30 local s,id = GetID() function s.initial_effect(c) aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),2,3) c:EnableReviveLimit() --cannot link material local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e0:SetValue(1) c:RegisterEffect(e0) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCountLimit(1,id) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.thcon) e2:SetCost(s.sharedcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --spin local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TODECK+CATEGORY_TOGRAVE+CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id+100) e3:SetCost(s.tdcost) e3:SetTarget(s.tdtg) e3:SetOperation(s.tdop) c:RegisterEffect(e3) -- if not s.global_check then s.global_check=true local g1=Effect.CreateEffect(c) g1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) g1:SetCode(EVENT_SUMMON_SUCCESS) g1:SetOperation(s.regop) Duel.RegisterEffect(g1,0) local g2=g1:Clone() g2:SetCode(EVENT_SPSUMMON_SUCCESS) Duel.RegisterEffect(g2,0) local g3=g1:Clone() g3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) Duel.RegisterEffect(g3,0) end end s.xyz_number=201 function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetOwner() for p=0,1 do if eg:IsExists(s.counterfilter,1,c,p) then Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1) end end end function s.counterfilter(c,p) return not c:IsAttribute(ATTRIBUTE_DARK) and c:GetSummonPlayer()==p end function s.sharedcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,id)<=0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SUMMON) Duel.RegisterEffect(e2,tp) local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON) Duel.RegisterEffect(e3,tp) local e4=Effect.CreateEffect(e:GetHandler()) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH) e4:SetDescription(aux.Stringid(id,4)) e4:SetReset(RESET_PHASE+PHASE_END) e4:SetTargetRange(1,0) Duel.RegisterEffect(e4,tp) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsAttribute(ATTRIBUTE_DARK) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) end function s.filter(c,tp,ncheck) if not c:IsAbleToHand() then return false end return type(ncheck)~="table" and c:IsSetCard(0x95) and c:IsType(TYPE_SPELL) or (c:IsSetCard(0x27a) and (type(ncheck)~="table" and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,c,tp,{c:GetCode()}) or type(ncheck)=="table" and not c:IsCode(table.unpack(ncheck)))) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tp) if #g>0 then local addcheck=true local tc1=g:GetFirst() if tc1:IsSetCard(0x95) and tc1:IsType(TYPE_SPELL) then if not Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,tc1,tp,{tc1:GetCode()}) or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then addcheck=false end end if addcheck then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g2=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,tc1,tp,{tc1:GetCode()}) if #g2>0 then g:Merge(g2) end end Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.sharedcost(e,tp,eg,ep,ev,re,r,rp,chk) and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) s.sharedcost(e,tp,eg,ep,ev,re,r,rp,chk) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_DECK,1,nil) end local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_DECK) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sg=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,1,nil) if sg:GetCount()>0 then Duel.HintSelection(sg) if Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and sg:GetFirst():IsLocation(LOCATION_DECK+LOCATION_EXTRA) and sg:GetFirst():IsPreviousPosition(POS_FACEUP) then if sg:GetFirst():IsLocation(LOCATION_DECK) and sg:GetFirst():IsControler(tp) then Duel.ShuffleDeck(tp) end local typ=sg:GetFirst():GetPreviousTypeOnField()&(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP) local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_DECK,nil) if #g<=0 then return end local rc=g:RandomSelect(1-tp,1):GetFirst() if rc and Duel.SendtoGrave(rc,REASON_EFFECT)>0 and rc:IsLocation(LOCATION_GRAVE) and rc:IsType(typ) then Duel.Damage(1-tp,3000,REASON_EFFECT) end end end end