--[[ Evil Manifestation Manifestazione Malvagia Card Author: Code Coral Scripted by: Lyris Rescripted by: XGlitchy30 ]] local s,id=GetID() function s.initial_effect(c) --Tokens local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetCategory(CATEGORIES_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:HOPT() e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --shuffle local e2=Effect.CreateEffect(c) e2:Desc(1) e2:SetCategory(CATEGORY_TODECK|CATEGORY_DRAW) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SHOPT() e2:SetCost(aux.bfgcost) e2:SetTarget(s.tg) e2:SetOperation(s.op) c:RegisterEffect(e2) end --E1 function s.cfilter(c,tp) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_REPTILE) and c:IsSetCard(ARCHE_EVIL_DRAGON) and c:IsFaceupEx() and Duel.GetMZoneCount(tp,c)>=2 and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return (e:IsCostChecked() or Duel.GetMZoneCount(tp)>=2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_EVIL_DRAGON,ARCHE_EVIL_DRAGON,TYPES_TOKEN_MONSTER,0,0,2,RACE_REPTILE,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_EVIL_DRAGON,ARCHE_EVIL_DRAGON,TYPES_TOKEN_MONSTER,0,0,2,RACE_REPTILE,ATTRIBUTE_DARK) then for i=1,2 do local token=Duel.CreateToken(tp,TOKEN_EVIL_DRAGON) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET|EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(aux.NOT(aux.TargetBoolFunction(Card.IsRace,RACE_REPTILE))) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end --E2 function s.thfilter(c) return c:IsFaceup() and c:IsRace(RACE_REPTILE) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetCardOperationInfo(g:GetFirst(),CATEGORY_TODECK) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=Duel.GetFirstTarget() if c:IsRelateToChain() and Duel.ShuffleIntoDeck(c)>0 then if Duel.IsPlayerCanDraw(tp,1) then Duel.BreakEffect() end Duel.Draw(tp,1,REASON_EFFECT) end end