--created by LeonDuvall, coded by Lyris --Exodice Premier Wrangling local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) c:EnableCounterPermit(0xe71) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetOperation(s.count) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetDescription(1111) e3:SetCategory(CATEGORY_POSITION+CATEGORY_COUNTER) e3:SetTarget(s.chtg) e3:SetOperation(s.chop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1) e4:SetDescription(1152) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_QUICK_O) e5:SetCode(EVENT_FREE_CHAIN) e5:SetRange(LOCATION_SZONE) e5:SetCountLimit(1) e5:SetDescription(1190) e5:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_COUNTER) e5:SetCost(s.thcost) e5:SetTarget(s.thtg) e5:SetOperation(s.thop) c:RegisterEffect(e5) c:SetUniqueOnField(1,0,id) end function s.ctfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0xd18) and c:IsPreviousControler(tp) end function s.count(e,tp,eg,_,_,_,_,rp) if eg:FilterCount(s.ctfilter,nil,tp)==1 then e:GetHandler():AddCounter(0xe71,1) end end function s.filter(c) return c:IsSetCard(0xd18) and c:IsCanTurnSet() end function s.chtg(e,tp,_,_,_,_,_,_,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) Duel.SetOperationInfo(0,CATEGORY_POSITION,Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil),1,nil) end function s.chop(e,tp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsLocation(LOCATION_MZONE) and c:IsFaceup()) or Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)<1 then return end e:GetHandler():AddCounter(0xe76,1) end function s.spcost(e,tp,_,_,_,_,_,_,chk) local c=e:GetHandler() if chk==0 then return c:IsCanRemoveCounter(tp,0xe76,3,REASON_COST) end c:RemoveCounter(tp,0xe76,3,REASON_COST) end function s.sfilter(c,e,tp) return c:IsSetCard(0xd18) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_DEFENSE) end function s.sptg(e,tp,_,_,_,_,_,_,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.sfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND) end function s.spop(e,tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.sfilter),tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp),0,tp,tp,false,false,POS_DEFENSE) end function s.thcost(e,tp,_,_,_,_,_,_,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end function s.afilter(c) return c:IsSetCard(0xd18) and c:IsAbleToHand() end function s.thtg(e,tp,_,_,_,_,_,_,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.afilter,tp,LOCATION_DECK,0,1,nil) and e:GetHandler():IsCanAddCounter(0xe76,1) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.afilter,tp,LOCATION_DECK,0,1,1,nil) if Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) e:GetHandler():AddCounter(0xd18,1) end end