--Percival, Child of the Silent Star function c97569819.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0xd0a1),4,2) c:EnableReviveLimit() --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(10613952,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c97569819.condition) e1:SetTarget(c97569819.target) e1:SetOperation(c97569819.operation) c:RegisterEffect(e1) --immune local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(c97569819.efilter) c:RegisterEffect(e2) --activate from hand local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(97569819) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(1,0) c:RegisterEffect(e3) --search local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE) e4:SetCost(c97569819.thcost) e4:SetTarget(c97569819.thtg) e4:SetOperation(c97569819.thop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetType(EFFECT_TYPE_QUICK_O) e5:SetCode(EVENT_FREE_CHAIN) e5:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE) e5:SetCondition(c97569819.con) c:RegisterEffect(e5) end function c97569819.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) end function c97569819.filter(c,e,tp,ec) return c:IsSetCard(0xd0a2) and c:IsCanBeEffectTarget(e) and c:CheckUniqueOnField(tp) and c:CheckEquipTarget(ec) end function c97569819.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c97569819.filter(chkc,e,tp,e:GetHandler()) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(c97569819.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,e:GetHandler()) end local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) local g=Duel.GetMatchingGroup(c97569819.filter,tp,LOCATION_GRAVE,0,nil,e,tp,e:GetHandler()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g1=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) if ft>1 and g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(97569819,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g2=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g2:GetFirst():GetCode()) g1:Merge(g2) if ft>2 and g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(97569819,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) g2=g:Select(tp,1,1,nil) g1:Merge(g2) end end Duel.SetTargetCard(g1) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g1,g1:GetCount(),0,0) end function c97569819.operation(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if ft0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end