--Cracked Amethyst local ref=_G['c'..171000124] function ref.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CUSTOM+171000124) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,171000124+EFFECT_COUNT_CODE_OATH) e1:SetCondition(ref.condition) e1:SetTarget(ref.target) e1:SetOperation(ref.operation) c:RegisterEffect(e1) if not ref.global_check then ref.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROYED) ge1:SetCondition(ref.regcon) ge1:SetOperation(ref.regop) Duel.RegisterEffect(ge1,0) end end ------ function ref.cfilter(c,tp) return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_ONFIELD) end function ref.regcon(e,tp,eg,ep,ev,re,r,rp) local v=0 if eg:IsExists(ref.cfilter,1,nil,0) then v=v+1 end if eg:IsExists(ref.cfilter,1,nil,1) then v=v+2 end if v==0 then return false end e:SetLabel(({0,1,PLAYER_ALL})[v]) return true end function ref.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RaiseEvent(eg,EVENT_CUSTOM+171000124,re,r,rp,ep,e:GetLabel()) end ------ function ref.condition(e,tp,eg,ep,ev,re,r,rp) return ev==tp or ev==PLAYER_ALL end function ref.ssfilter(c,e,tp) return c:IsSetCard(0xfef) and c:IsType(TYPE_MONSTER) and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function ref.distg(e,c) return c:IsSetCard(0xfef) and c:IsType(TYPE_MONSTER) and bit.band(c:GetType(),TYPE_EFFECT)>0 and not c:IsDisabled() end function ref.distg2(e,c) return c:IsSetCard(0xfef) and c:IsType(TYPE_MONSTER) end function ref.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(ref.ssfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function ref.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCountFromEx(tp)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,ref.ssfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(ref.distg) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetTarget(ref.distg2) e2:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) Duel.RegisterEffect(e2,tp) local e3=e1:Clone() e3:SetTarget(ref.distg2) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetValue(1) Duel.RegisterEffect(e3,tp) local e4=e1:Clone() e4:SetTarget(ref.distg2) e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e4:SetValue(1) Duel.RegisterEffect(e4,tp) end