--妖幻战姬 炼金术师 if not pcall(function() require("expansions/script/c33700760") end) then require("script/c33700760") end local m=33700768 local cm=_G["c"..m] function cm.initial_effect(c) tfrsv.SSLimitEffect(c) tfrsv.ActivateEffect(c,cm.operation) --set local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1e0) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(cm.setcon) e1:SetTarget(cm.settg) e1:SetOperation(cm.setop) c:RegisterEffect(e1) end function cm.operation(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetCondition(tfrsv.ccon) e1:SetTarget(cm.tgtg) e1:SetOperation(cm.tgop) c:RegisterEffect(e1) end function cm.tgfilter(c) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGrave() end function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and cm.tgfilter(chkc) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(cm.tgfilter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,cm.tgfilter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,1000) end function cm.tgop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 then Duel.Recover(1-tp,1000,REASON_EFFECT) end end function cm.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(cm.rfilter,tp,LOCATION_MZONE,0,1,nil,e) end function cm.rfilter(c,e) local tp=e:GetHandlerPlayer() return tfrsv.columntg2(e,c) end function cm.setfilter(c,tp) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable(true) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) end function cm.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and cm.setfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(cm.setfilter,tp,0,LOCATION_GRAVE,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,cm.setfilter,tp,0,LOCATION_GRAVE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function cm.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and (tc:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then Duel.SSet(tp,tc) Duel.ConfirmCards(1-tp,tc) 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