--Number 1202: Khiros, the Great Pharaoh local id,cod=23251022,c23251022 function cod.initial_effect(c) --Xyz Summon c:EnableReviveLimit() aux.AddXyzProcedure(c,nil,5,2,nil,nil,5) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(cod.spcost) e1:SetTarget(cod.sptg) e1:SetOperation(cod.spop) c:RegisterEffect(e1) --Gain ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetValue(cod.val) c:RegisterEffect(e2) end function cod.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function cod.spfil(c,e,tp) return c:IsSetCard(0xd3e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cod.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(cod.spfil,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_REMOVED) end function cod.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,cod.spfil,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil,e,tp) if g:GetCount()>0 then local tc=g:GetFirst() Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(id,RESET_EVENT+0x1fc0000,0,1) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2,true) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetOperation(cod.desop) e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e3:SetCountLimit(1) tc:RegisterEffect(e3) --[[ local e4=Effect.CreateEffect(e:GetHandler()) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCountLimit(1) e4:SetLabelObject(e:GetHandler()) e4:SetOperation(cod.reset) e4:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e4)]]-- Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function cod.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function cod.val(e,c) return Duel.GetMatchingGroupCount(cod.filter,c:GetControler(),LOCATION_MZONE,0,e:GetHandler(),e)*900 end function cod.filter(c,e) return c:GetFlagEffect(id) and c~=e:GetHandler() and not c:IsCode(id) end --[[function cod.rfilter(c,tc) return c==tc end function cod.reset(e,tp,eg,ep,ev,re,r,rp) if eg:IsExists(cod.rfilter,1,nil,e:GetLabelObject()) then e:GetHandler():ResetFlagEffect(id) end end--]]