--[[ //CodeRed //CodiceRosso Card Author: Burndown Scripted by: XGlitchy30 ]] local s,id=GetID() function s.initial_effect(c) --[[When exactly 1 "Viravolve" monster you control is destroyed by battle and sent to the GY: Shuffle that destroyed monster into the Deck/Extra Deck; draw 1 card, and if it is a Level 1 monster, you can Special Summon it.]] aux.RegisterMergedDelayedEventGlitchy(c,id,EVENT_BATTLE_DESTROYED,s.cfilter,id) local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORY_DRAW|CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_CUSTOM+id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --[[If this card in its owner's possession is sent to the GY by an opponent's card: Destroy 1 card on the field and inflict 100 damage to its controller.]] local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_DESTROY|CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE|EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end --E1 function s.cfilter(tc,_,_,eg) if #eg~=1 then return false end return tc:IsLocation(LOCATION_GRAVE) and tc:IsPreviousControler(tp) and tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_FACEUP) and tc:IsPreviousSetCard(ARCHE_VIRAVOLVE) and tc:IsMonster() and tc:IsSetCard(ARCHE_VIRAVOLVE) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local tc=eg:GetFirst() if chk==0 then return tc and tc:IsAbleToDeckOrExtraAsCost() end Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.Draw(tp,1,REASON_EFFECT)==0 then return end local tc=Duel.GetOperatedGroup():GetFirst() if tc:IsMonster() and tc:IsLevel(1) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SelectYesNo(tp,STRING_ASK_SPSUMMON) then Duel.ConfirmCards(1-tp,tc) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end --E2 function s.descon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,1,PLAYER_EITHER,100) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) local p=g:GetFirst():GetControler() if Duel.Destroy(g,REASON_EFFECT)>0 then Duel.Damage(p,100,REASON_EFFECT) end end end