--Enforcer of White Truth --scripted by Rawstone local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_LIGHT),aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),true) --gain bonuses local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.op) c:RegisterEffect(e1) --banish local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_HAND) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+500) e2:SetCondition(s.ddcon) e2:SetTarget(s.ddtg) e2:SetOperation(s.ddop) c:RegisterEffect(e2) end function s.filter1(c) return c:IsType(TYPE_SPELL) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsFaceup() and chkc:IsControler(tp) and s.filter1(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter1,tp,LOCATION_ONFIELD,0,1,1,nil) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetReset(RESET_PHASE+PHASE_BATTLE) e3:SetRange(LOCATION_ONFIELD) e3:SetCondition(s.tgcon) e3:SetOperation(s.desop2) tc:RegisterEffect(e3) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return re:GetHandler()==e:GetHandler() and (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) and not re:IsHasType(EFFECT_TYPE_ACTIVATE) end function s.desop2(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,nil) local g2=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,nil) if g1:GetCount()==0 or g2:GetCount()==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local tc=g1:Select(tp,1,1,nil):GetFirst() Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local tc1=g2:Select(tp,1,1,nil):GetFirst() Duel.Remove(tc1,POS_FACEUP,REASON_EFFECT) e:Reset() end function s.ddcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()~=PHASE_DRAW end function s.ddfilter(c,tp) return c:IsControler(1-tp) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemove() end function s.ddtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=eg:Filter(s.ddfilter,nil,tp) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) and #g>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.ddop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) if #g1>0 then if Duel.Remove(g1,POS_FACEUP,REASON_EFFECT) then if not e:GetHandler():IsRelateToEffect(e) then return end local g=eg:Filter(s.ddfilter,nil,tp) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end end end