--Roisia, Knights of the Fallen function c1553035.initial_effect(c) aux.EnablePendulumAttribute(c) --splimit local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetRange(LOCATION_PZONE) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e0:SetTargetRange(1,0) e0:SetTarget(c1553035.splimit) c:RegisterEffect(e0) --effect gain local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCountLimit(1,1553035) e1:SetCondition(c1553035.efcon) e1:SetOperation(c1553035.efop) c:RegisterEffect(e1) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(1553035,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_PZONE) e3:SetCountLimit(1,1553035+1) e3:SetTarget(c1553035.tg) e3:SetOperation(c1553035.op) c:RegisterEffect(e3) end function c1553035.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsSetCard(0xFA0) and bit.band(sumtype,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c1553035.efcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_LINK+REASON_SYNCHRO+REASON_XYZ)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function c1553035.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(1553035,1)) e1:SetCategory(CATEGORY_NEGATE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_NO_TURN_RESET) e1:SetCondition(c1553035.negcon) e1:SetTarget(c1553035.negtg) e1:SetOperation(c1553035.negop) e1:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT+RESETS_STANDARD) rc:RegisterEffect(e2,true) end rc:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(1553035,2)) end function c1553035.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if rp==tp or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or not g:IsContains(c) then return false end return e:GetHandler():GetFlagEffect(1553035)==0 and (Duel.IsChainNegatable(ev) or Duel.IsChainDisablable(ev)) end function c1553035.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if not e:GetHandler():GetFlagEffect(1553035)==0 then return false end if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function c1553035.negop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) e:GetHandler():RegisterFlagEffect(1553035,RESET_EVENT+RESETS_STANDARD,0,1) end function c1553035.filter(c) return c:IsFaceup() and (c:IsSetCard(0xFA0) or c:IsSetCard(0x190)) end function c1553035.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c1553035.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_SZONE,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,c1553035.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0) end function c1553035.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if g:GetCount()>0 then Duel.Destroy(g,REASON_EFFECT) end end