--Ephesiam, Amministrale dei Mari --created by ZEN, coded by ZEN & Lyris local cid,id=GetID() function cid.initial_effect(c) local e1=Effect.CreateEffect(c) e1:Desc(1) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetCondition(cid.spcon) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:Desc(2) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id+100) e2:SetTarget(cid.prtg) e2:SetOperation(cid.prop) e2:SetCost(cid.prcost) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:Desc(3) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,id+200) e3:SetCondition(cid.plcon) e3:SetTarget(cid.pltg) e3:SetOperation(cid.plop) c:RegisterEffect(e3) end function cid.cfilter(c) return c:IsFacedown() or not c:IsSetCard(0xd7c) end function cid.cfilter2(c) return c:IsSetCard(0xd7c) and c:IsFaceup() end function cid.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or not Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_MZONE,0,1,nil)) end function cid.prtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) e:SetLabel(Duel.AnnounceType(tp)) end function cid.costfilter(c) return c:IsSetCard(0xd7c) and c:GetSequence()<5 and c:IsAbleToGraveAsCost() end function cid.prcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.costfilter,tp,LOCATION_SZONE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cid.costfilter,tp,LOCATION_SZONE,0,2,2,nil) Duel.SendtoGrave(g,REASON_COST) end function cid.prop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(cid.imtg) if e:GetLabel()==0 then e1:SetDescription(aux.Stringid(id,4)) e1:SetValue(cid.aclimit1) elseif e:GetLabel()==1 then e1:SetDescription(aux.Stringid(id,5)) e1:SetValue(cid.aclimit2) else e1:SetDescription(aux.Stringid(id,6)) e1:SetValue(cid.aclimit3) end e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function cid.aclimit1(e,re,tp) return re:IsActiveType(TYPE_MONSTER) and aux.tgoval(e,re,tp) end function cid.aclimit2(e,re,tp) return re:IsActiveType(TYPE_SPELL) and aux.tgoval(e,re,tp) end function cid.aclimit3(e,re,tp) return re:IsActiveType(TYPE_TRAP) and aux.tgoval(e,re,tp) end function cid.imtg(e,c) return c:IsSetCard(0xd7c) end function cid.plcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_COST) and e:GetHandler():IsPreviousLocation(LOCATION_SZONE) and e:GetHandler():GetPreviousSequence()<5 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0xd7c) end function cid.plfilter(c) return c:IsSetCard(0xd7c) and c:IsFaceup() end function cid.spfilter(c,e,tp) return c:IsSetCard(0xd7c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cid.pltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and cid.plfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,cid.plfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK) end function cid.plop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end local tc=Duel.GetFirstTarget() if not Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) or not tc:IsLocation(LOCATION_SZONE) or not tc:IsFaceup() then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,0)) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) tc:RegisterEffect(e1) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cid.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc2=g:GetFirst() if tc2 then Duel.BreakEffect() Duel.SpecialSummon(tc2,0,tp,tp,false,false,POS_FACEUP) end end end