--妖幻战姬 傀儡师 if not pcall(function() require("expansions/script/c33700760") end) then require("script/c33700760") end local m=33700769 local cm=_G["c"..m] function cm.initial_effect(c) tfrsv.SSLimitEffect(c) tfrsv.ActivateEffect(c,cm.operation) --sp local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1e0) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(cm.spcon) e1:SetTarget(cm.sptg) e1:SetOperation(cm.spop) c:RegisterEffect(e1) end function cm.operation(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,1)) 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:IsAbleToGrave() end function cm.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.tgfilter(chkc) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(cm.tgfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,cm.tgfilter,tp,0,LOCATION_MZONE,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.spcon(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) return tfrsv.columntg2(e,c) end function cm.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local seq=c:GetSequence() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and cm.spfilter(chkc,e,tp) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(cm.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) and seq>0 and seq<4 and (Duel.CheckLocation(tp,LOCATION_MZONE,seq-1) or Duel.CheckLocation(tp,LOCATION_MZONE,seq+1)) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,cm.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function cm.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local seq=c:GetSequence() local zone2=0 if seq==0 then zone2=0x2 elseif seq==4 then zone2=0x8 else zone2=2^(seq-1)+2^(seq+1) end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone2) end end