--Card-Mistress Magic Valkyria function c249000590.initial_effect(c) --set spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(494922,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,249000590) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCost(c249000590.setcost) e2:SetTarget(c249000590.settg) e2:SetOperation(c249000590.setop) c:RegisterEffect(e2) --synchro while face-up local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_ADD_TYPE) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE) e5:SetRange(LOCATION_MZONE) e5:SetValue(TYPE_SYNCHRO) c:RegisterEffect(e5) end function c249000590.costfilter(c) return c:IsSetCard(0x1D4) and c:IsAbleToRemoveAsCost() end function c249000590.setcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c249000590.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c249000590.costfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c249000590.setfilter(c,tp) return c:IsType(TYPE_SPELL) and c:IsSSetable(true) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) end function c249000590.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c249000590.setfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(c249000590.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,c249000590.setfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function c249000590.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SSet(tp,tc)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetReset(RESET_EVENT+RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) tc:RegisterEffect(e1,true) end end