--Mage-Guild Temporal Warrior function c249000865.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcFunFun(c,aux.FilterBoolFunction(Card.IsType,TYPE_MONSTER),aux.FilterBoolFunction(Card.IsFusionSetCard,0x1F9),2,true) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetOperation(c249000865.caop) c:RegisterEffect(e1) --special summon rule local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(249000865,1)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_EXTRA) e2:SetCondition(c249000865.sprcon) e2:SetOperation(c249000865.sprop) c:RegisterEffect(e2) --sp summon condition local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetValue(c249000865.splimit) c:RegisterEffect(e3) --revive local e4=Effect.CreateEffect(c) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCode(EVENT_FREE_CHAIN) e4:SetTarget(c249000865.target) e4:SetOperation(c249000865.operation) c:RegisterEffect(e4) end function c249000865.caop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if Duel.GetAttacker()==c and bc and c:IsRelateToBattle() and c:IsChainAttackable() then Duel.ChainAttack() end end function c249000865.cfilter(c) return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToDeckOrExtraAsCost() end function c249000865.fcheck(c,sg) return c:IsType(TYPE_MONSTER) and sg:IsExists(c249000865.fcheck2,2,c) end function c249000865.fcheck2(c) return c:IsFusionSetCard(0x1F9) and c:IsType(TYPE_MONSTER) end function c249000865.fselect(c,tp,mg,sg) sg:AddCard(c) local res=false if sg:GetCount()<3 then res=mg:IsExists(c249000865.fselect,1,sg,tp,mg,sg) elseif Duel.GetLocationCountFromEx(tp,tp,sg)>0 then res=sg:IsExists(c249000865.fcheck,1,nil,sg) end sg:RemoveCard(c) return res end function c249000865.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() local mg=Duel.GetMatchingGroup(c249000865.cfilter,tp,LOCATION_ONFIELD,0,nil) local sg=Group.CreateGroup() return mg:IsExists(c249000865.fselect,1,nil,tp,mg,sg) end function c249000865.sprop(e,tp,eg,ep,ev,re,r,rp,c) local mg=Duel.GetMatchingGroup(c249000865.cfilter,tp,LOCATION_ONFIELD,0,nil) local sg=Group.CreateGroup() while sg:GetCount()<3 do Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=mg:FilterSelect(tp,c249000865.fselect,1,1,sg,tp,mg,sg) sg:Merge(g) end local cg=sg:Filter(Card.IsFacedown,nil) if cg:GetCount()>0 then Duel.ConfirmCards(1-tp,cg) end Duel.SendtoDeck(sg,nil,2,REASON_COST) end function c249000865.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function c249000865.filter(c,e,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) end function c249000865.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and c249000865.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c249000865.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c249000865.filter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c249000865.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end