--Hardened Knight of Ivory - Rebirth --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.AddOrigPandemoniumType(c) aux.AddFusionProcFunRep(c,aux.FilterBoolFunction(Card.IsType,TYPE_PANDEMONIUM),2,true) --activate local p1=Effect.CreateEffect(c) p1:GLString(0) p1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOGRAVE) p1:SetType(EFFECT_TYPE_IGNITION) p1:SetProperty(EFFECT_FLAG_CARD_TARGET) p1:SetRange(LOCATION_SZONE) p1:SetCountLimit(1,id) p1:SetCondition(aux.PandActCheck) p1:SetTarget(cid.dptg) p1:SetOperation(cid.dpop) c:RegisterEffect(p1) aux.EnablePandemoniumAttribute(c,p1,true,TYPE_EFFECT+TYPE_FUSION) --spsummon condition local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(aux.fuslimit) c:RegisterEffect(e0) --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetValue(aux.indoval) c:RegisterEffect(e2) --target local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCountLimit(1,id+100) e3:SetCondition(cid.spcon) e3:SetTarget(cid.sptg) e3:SetOperation(cid.spop) c:RegisterEffect(e3) --pand local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(id,3)) e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e8:SetCode(EVENT_DESTROYED) e8:SetProperty(EFFECT_FLAG_DELAY) e8:SetCondition(cid.pencon) e8:SetTarget(cid.pentg) e8:SetOperation(cid.penop) c:RegisterEffect(e8) end --ACTIVATE function cid.filter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsType(TYPE_PANDEMONIUM) end function cid.tgfilter(c) return ((c:IsType(TYPE_MONSTER) and c:IsType(TYPE_PANDEMONIUM)) or c:IsType(TYPE_TRAP)) and c:IsAbleToGrave() end function cid.dptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsType(TYPE_PANDEMONIUM) end if chk==0 then return Duel.IsExistingTarget(cid.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(cid.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,cid.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cid.dpop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not e:GetHandler():IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end if Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sc=Duel.SelectMatchingCard(tp,cid.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #sc>0 then Duel.SendtoGrave(sc,REASON_EFFECT) end end end --TARGET function cid.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION) end function cid.thfilter(c) return c:IsFaceup() and c:IsType(TYPE_PANDEMONIUM) and c:IsAbleToHand() end function cid.spfilter(c,e,tp) return c:IsType(TYPE_PANDEMONIUM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.thfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function cid.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOHAND) local g=Duel.SelectMatchingCard(tp,cid.thfilter,tp,LOCATION_EXTRA,0,1,1,nil) local tc=g:GetFirst() if tc and Duel.SendtoHand(tc,nil,REASON_EFFECT)~=0 then Duel.ConfirmCards(1-tp,g) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cid.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end end --ACTIVATE PANDE function cid.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsReason(REASON_EFFECT) end function cid.actfilter(c,tp) return c:GetType()&TYPE_PANDEMONIUM==TYPE_PANDEMONIUM and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and (c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_EXTRA) and c:IsFaceup())) and not c:IsForbidden() and not Duel.IsExistingMatchingCard(cid.excfilter,tp,LOCATION_SZONE,0,1,c) end function cid.excfilter(c) return c:GetType()&TYPE_PANDEMONIUM==TYPE_PANDEMONIUM and c:IsFaceup() end function cid.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.actfilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,nil,tp) end end function cid.penop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,cid.actfilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,1,1,nil,tp) local tc=g:GetFirst() if tc then Duel.HintSelection(g) Card.SetCardData(tc,CARDDATA_TYPE,TYPE_TRAP+TYPE_CONTINUOUS) Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) if not tc:IsLocation(LOCATION_SZONE) then local edcheck=0 if tc:IsLocation(LOCATION_EXTRA) then edcheck=TYPE_PENDULUM end Card.SetCardData(tc,CARDDATA_TYPE,TYPE_MONSTER+TYPE_EFFECT+edcheck+aux.GetOriginalPandemoniumType(tc)) else tc:RegisterFlagEffect(726,RESET_EVENT+0x1fe0000,EFFECT_FLAG_CANNOT_DISABLE,1) tc:RegisterFlagEffect(725,RESET_PHASE+PHASE_END,EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE,1) end end end