--Arcane-Caster Re-Energize function c249001070.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,249001070+EFFECT_COUNT_CODE_OATH) e1:SetTarget(c249001070.target) c:RegisterEffect(e1) --disable chain local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetTarget(c249001070.target2) e2:SetOperation(c249001070.operation2) c:RegisterEffect(e2) end function c249001070.spfilter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x226) and (c:IsAbleToHand() or (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end function c249001070.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c249001070.spfilter(chkc,e,tp) end if chk==0 then return true end if Duel.IsExistingTarget(c249001070.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(249001070,1)) then e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND) e:SetProperty(EFFECT_FLAG_CARD_TARGET) e:SetOperation(c249001070.activate) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,c249001070.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,0,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,0,0,0) else e:SetCategory(0) e:SetProperty(0) e:SetOperation(nil) end end function c249001070.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) then if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and not tc:IsHasEffect(EFFECT_NECRO_VALLEY) and (not tc:IsAbleToHand() or Duel.SelectOption(tp,1190,1152)==1) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) else Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end end function c249001070.filter(c) return c:IsFaceup() and c:IsSetCard(0x226) end function c249001070.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c249001071.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c249001070.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c249001070.filter,tp,LOCATION_MZONE,0,1,1,nil) end function c249001070.operation2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then --actlimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,1) e2:SetValue(1) e2:SetCondition(c249001070.actcon) e2:SetReset(RESETS_STANDARD+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) end end function c249001070.actcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattleTarget()~=nil end