--Kyuubi the Uru Knight function c249001214.initial_effect(c) c:EnableReviveLimit() aux.AddFusionProcMix(c,false,true,c249001214.fusfilter1,c249001214.fusfilter2,c249001214.fusfilter3) aux.AddContactFusionProcedure(c,Card.IsAbleToDeckOrExtraAsCost,LOCATION_GRAVE+LOCATION_REMOVED,0,aux.tdcfop(c)) aux.EnablePendulumAttribute(c,false) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(44179224,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,249001214) e1:SetCondition(c249001214.spcon) e1:SetTarget(c249001214.sptg) e1:SetOperation(c249001214.spop) c:RegisterEffect(e1) --to pzone local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(74892653,2)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_DELAY) e2:SetCondition(c249001214.pcon) e2:SetTarget(c249001214.ptg) e2:SetOperation(c249001214.pop) c:RegisterEffect(e2) --negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(249001214,0)) e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCondition(c249001214.discon) e3:SetCost(c249001214.discost) e3:SetTarget(c249001214.distg) e3:SetOperation(c249001214.disop) c:RegisterEffect(e3) --return local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(29343734,0)) e4:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetCondition(c249001214.retcon) e4:SetTarget(c249001214.rettg) e4:SetOperation(c249001214.retop) c:RegisterEffect(e4) --multitype local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SET_AVAILABLE) e5:SetCode(EFFECT_ORIGINAL_LEVEL_RANK_DUALITY) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SET_AVAILABLE) e6:SetCode(EFFECT_XYZ_LEVEL) e6:SetValue(c249001214.rank) c:RegisterEffect(e6) end function c249001214.countfilter(c) return c:IsSetCard(0x232) and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA+LOCATION_ONFIELD+LOCATION_REMOVED)) end function c249001214.fusfilter1(c,sc) local g=Duel.GetMatchingGroup(c249001214.countfilter,sc:GetControler(),LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,0,nil) local ct=g:GetClassCount(Card.GetCode) return ct > 3 and c:IsType(TYPE_FUSION) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL) end function c249001214.fusfilter2(c,sc) local g=Duel.GetMatchingGroup(c249001214.countfilter,sc:GetControler(),LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,0,nil) local ct=g:GetClassCount(Card.GetCode) return ct > 3 and c:IsType(TYPE_SYNCHRO) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL) end function c249001214.fusfilter3(c,sc) local g=Duel.GetMatchingGroup(c249001214.countfilter,sc:GetControler(),LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,0,nil) local ct=g:GetClassCount(Card.GetCode) return ct > 3 and c:IsType(TYPE_XYZ) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial(sc,SUMMON_TYPE_SPECIAL) end function c249001214.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function c249001214.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c249001214.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function c249001214.pcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT)) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_MZONE) end function c249001214.ptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return (Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1) or Duel.IsExistingMatchingCard(c249001214.filter3,tp,LOCATION_ONFIELD,0,1,nil)) end end function c249001214.filter3(c) return c:IsSetCard(0x232) and c:IsFaceup() end function c249001214.pop(e,tp,eg,ep,ev,re,r,rp) if (not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1)) and not Duel.IsExistingMatchingCard(c249001214.filter3,tp,LOCATION_ONFIELD,0,1,nil) then return false end local g=Duel.SelectMatchingCard(tp,c249001214.filter3,tp,LOCATION_ONFIELD,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end function c249001214.discon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function c249001214.discost(e,tp,eg,ep,ev,re,r,rp,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 c249001214.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function c249001214.disop(e,tp,eg,ep,ev,re,r,rp) if not Duel.NegateActivation(ev) then return end if re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function c249001214.retcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_EXTRA) end function c249001214.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_REMOVED,0,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) end function c249001214.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(nil,tp,LOCATION_REMOVED,LOCATION_REMOVED,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) g=Duel.GetOperatedGroup() local atkct=g:GetCount() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(atkct*300) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) local ct=3-Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) if ct>0 and Duel.IsPlayerCanDraw(tp,ct) then Duel.Draw(tp,ct,REASON_EFFECT) end end function c249001214.rank(e,c) return c:GetRank() end