--灯火之魔女·物语 local m=28327021 local cm=_G["c"..m] xpcall(function() require("expansions/script/c28327000") end,function() require("script/c28327000") end) function cm.initial_effect(c) Yukino.ShikiNoAkari(c) --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,m) e1:SetCondition(cm.rmcon) e1:SetTarget(cm.rmtg) e1:SetOperation(cm.rmop) c:RegisterEffect(e1) --activate limit local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMING_DRAW_PHASE) e2:SetCountLimit(1,m+900) e2:SetRange(LOCATION_MZONE) e2:SetCost(cm.cost) e2:SetOperation(cm.operation) c:RegisterEffect(e2) end function cm.rmcon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() local bc=Duel.GetAttackTarget() if not bc then return false end if tc:IsControler(1-tp) then tc,bc=bc,tc end if tc:IsFaceup() and tc:IsRace(RACE_SPELLCASTER) and c:IsType(TYPE_RITUAL) then e:SetLabelObject(bc) return true else return false end end function cm.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetLabelObject() if chk==0 then return bc:IsAbleToRemove() and Duel.GetFlagEffect(tp,m)==0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0) Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1) end function cm.rmop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetLabelObject() if bc:IsRelateToBattle() and bc:IsControler(1-tp) and Duel.Remove(bc,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then bc:SetTurnCounter(0) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,3) e1:SetLabelObject(bc) e1:SetCountLimit(1) e1:SetCondition(cm.retcon) e1:SetOperation(cm.retop) Duel.RegisterEffect(e1,tp) end end function cm.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp end function cm.retop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() local ct=tc:GetTurnCounter() ct=ct+1 tc:SetTurnCounter(ct) if ct==3 then Duel.ReturnToField(tc) end end function cm.costfilter(c) return c:IsCode(28327000) and c:IsDiscardable() end function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.costfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,cm.costfilter,1,1,REASON_COST+REASON_DISCARD) end function cm.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1_1=Effect.CreateEffect(c) e1_1:SetType(EFFECT_TYPE_FIELD) e1_1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1_1:SetCode(EFFECT_CANNOT_ACTIVATE) e1_1:SetTargetRange(0,1) e1_1:SetValue(1) e1_1:SetCondition(cm.con1_1) e1_1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1_1,tp) end function cm.con1_1(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain()>1 end