--Moonvale Archlord function c10505095.initial_effect(c) c:EnableReviveLimit() --todeck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(10505095,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCountLimit(1,10505095) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c10505095.condition) e1:SetTarget(c10505095.target) e1:SetOperation(c10505095.operation) c:RegisterEffect(e1) --cannot be target local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x1a4)) e4:SetValue(aux.tgoval) c:RegisterEffect(e4) --special summon local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(10505095,1)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_GRAVE) e5:SetCountLimit(1,10506095) e5:SetCost(c10505095.spcost) e5:SetTarget(c10505095.sptg) e5:SetOperation(c10505095.spop) c:RegisterEffect(e5) end function c10505095.condition(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL end function c10505095.filter1(c) return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and (c:IsSetCard(0x1a4) or c:IsSetCard(0x1a5)) and c:IsAbleToDeck() end function c10505095.filter2(c) return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsAbleToDeck() end function c10505095.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c10505095.filter1,tp,LOCATION_GRAVE+LOCATION_ONFIELD,0,2,nil) and Duel.IsExistingTarget(c10505095.filter2,tp,0,LOCATION_GRAVE+LOCATION_ONFIELD,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,c10505095.filter1,tp,LOCATION_GRAVE+LOCATION_ONFIELD,0,2,2,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g2=Duel.SelectTarget(tp,c10505095.filter2,tp,0,LOCATION_GRAVE+LOCATION_ONFIELD,2,2,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,4,0,0) end function c10505095.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoDeck(g,nil,2,REASON_EFFECT) end function c10505095.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c10505095.spfilter(c,e,tp) return c:IsSetCard(0x1a4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c10505095.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c10505095.spfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,e:GetHandler(),e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND) end function c10505095.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,aux.NecroValleyFilter(c10505095.spfilter),tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end