--Smiling Ennigmaterial --Script by XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --boost atk local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE+LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCost(cid.atkcost) e1:SetTarget(cid.atktg) e1:SetOperation(cid.atkop) c:RegisterEffect(e1) --destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(cid.reptg) e2:SetValue(cid.repval) e2:SetOperation(cid.repop) c:RegisterEffect(e2) --remove replace local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_GRAVE) e3:SetCode(EFFECT_SEND_REPLACE) e3:SetTarget(cid.reptg2) e3:SetValue(cid.repval2) e3:SetOperation(cid.repop) c:RegisterEffect(e3) end --filters function cid.atkfilter(c) return c:IsFaceup() and c:IsSetCard(0xead) and c:IsType(TYPE_MONSTER) end function cid.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0xead) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function cid.repfilter2(c,tp) return c:IsControler(tp) and c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:GetDestination()==LOCATION_REMOVED and c:IsType(TYPE_MONSTER) and c:IsSetCard(0xead) end --boost atk function cid.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() end if Duel.Release(e:GetHandler(),REASON_COST)~=0 then if e:GetHandler():GetPreviousLocation()==LOCATION_MZONE then e:SetLabel(e:GetHandler():GetPreviousAttackOnField()) else e:SetLabel(e:GetHandler():GetTextAttack()) end end end function cid.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and cid.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(cid.atkfilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,cid.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function cid.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabel()) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end --destroy replace function cid.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(cid.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function cid.repval(e,c) return cid.repfilter(c,e:GetHandlerPlayer()) end function cid.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) end --send replace function cid.reptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemove() and bit.band(r,REASON_EFFECT)~=0 and eg:IsExists(cid.repfilter2,1,nil,tp) end return Duel.SelectYesNo(tp,aux.Stringid(id,1)) end function cid.repval2(e,c) return cid.repfilter2(c,e:GetHandlerPlayer()) end