--Chita, Chimera of Magnificent Vine function c500316982.initial_effect(c) aux.AddXyzProcedure(c,aux.FilterBoolFunction(c500316982.xyzfilter),6,2) c:EnableReviveLimit() --FLIP Assets ;) local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(500316982,0)) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM) e0:SetType(EFFECT_TYPE_FIELD) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_EXTRA) e0:SetTargetRange(POS_FACEDOWN_DEFENSE,0) e0:SetCondition(c500316982.xyzcon) e0:SetOperation(c500316982.xyzop) e0:SetValue(SUMMON_TYPE_XYZ) c:RegisterEffect(e0) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(500316982,4)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetTarget(c500316982.target) e1:SetOperation(c500316982.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(500316982,1)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCost(c500316982.cost2) e2:SetTarget(c500316982.target2) e2:SetOperation(c500316982.operation2) c:RegisterEffect(e2) end function c500316982.xyzfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x285a) or c:IsRace(RACE_WINDBEAST) end function c500316982.mfilter(c,xyzc) return c:IsFaceup() and not c:IsType(TYPE_XYZ) and c:GetLevel()==6 and c:IsCanBeXyzMaterial(xyzc) and c:IsSetCard(0x285a) or c:IsRace(RACE_WINDBEAST) end function c500316982.xyzfilter1(c,g) return g:IsExists(c500316982.xyzfilter2,1,c,c:GetLevel()) end function c500316982.xyzfilter2(c,rk) return c:GetLevel()==rk end function c500316982.xyzcon(e,c,og,min,max) if c==nil then return true end local tp=c:GetControler() local mg=nil if og then mg=og:Filter(c500316982.mfilter,nil,c) else mg=Duel.GetMatchingGroup(c500316982.mfilter,tp,LOCATION_MZONE,0,nil,c) end return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and (not min or min<=2 and max>=2) and mg:IsExists(c500316982.xyzfilter1,1,nil,mg) end function c500316982.xyzop(e,tp,eg,ep,ev,re,r,rp,c,og,min,max) local g=nil local sg=Group.CreateGroup() if og and not min then g=og local tc=og:GetFirst() while tc do sg:Merge(tc:GetOverlayGroup()) tc=og:GetNext() end else local mg=nil if og then mg=og:Filter(c500316982.mfilter,nil,c) else mg=Duel.GetMatchingGroup(c500316982.mfilter,tp,LOCATION_MZONE,0,nil,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) g=mg:FilterSelect(tp,c500316982.xyzfilter1,1,1,nil,mg) local tc1=g:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g2=mg:FilterSelect(tp,c500316982.xyzfilter2,1,1,tc1,tc1:GetLevel()) local tc2=g2:GetFirst() g:Merge(g2) sg:Merge(tc1:GetOverlayGroup()) sg:Merge(tc2:GetOverlayGroup()) end Duel.SendtoGrave(sg,REASON_RULE) c:SetMaterial(g) Duel.Overlay(c,g) end function c500316982.filter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x285a) and c:IsAbleToDeck() end function c500316982.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and c500316982.filter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingTarget(c500316982.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,c500316982.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c500316982.operation(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=5 then return end Duel.SendtoDeck(tg,nil,0,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA) if ct==5 then Duel.BreakEffect() Duel.Draw(tp,2,REASON_EFFECT) end end function c500316982.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OATH) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(c500316982.ftarget) e1:SetLabel(e:GetHandler():GetFieldID()) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function c500316982.target2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetTargetCard(g) end function c500316982.operation2(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e) local c=e:GetHandler() local tc=sg:GetFirst() while tc do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_SWAP_BASE_AD) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) tc=sg:GetNext() end end function c500316982.ftarget(e,c) return e:GetLabel()~=c:GetFieldID() end