--created by Walrus, coded by Lyris local cid,id=GetID() function cid.initial_effect(c) c:EnableReviveLimit() aux.CannotBeEDMaterial(c,nil,LOCATION_ONFIELD) c:SetUniqueOnField(1,0,aux.FilterBoolFunction(Card.IsSetCard,0x4c97)) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetCondition(cid.tgcon) e1:SetValue(cid.efilter) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE+LOCATION_GRAVE) e2:SetTarget(cid.disable) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,id) e3:SetCategory(CATEGORY_RECOVER+CATEGORY_ATKCHANGE) e3:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD+LOCATION_GRAVE) end) e3:SetCost(cid.cost) e3:SetTarget(cid.tg) e3:SetOperation(cid.op) c:RegisterEffect(e3) --atkdown local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(0,LOCATION_MZONE) e4:SetValue(cid.atkval) c:RegisterEffect(e4) end function cid.tgfilter(c) return c:IsFaceup() and c:IsSetCard(0x3c97) end function cid.tgcon(e) return Duel.IsExistingMatchingCard(cid.tgfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function cid.efilter(e,re) return e:GetOwnerPlayer()~=re:GetOwnerPlayer() end function cid.disable(e,c) return (c:IsType(TYPE_EFFECT) or bit.band(c:GetOriginalType(),TYPE_EFFECT)==TYPE_EFFECT) and c:GetType()&0x81==0x81 end function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToDeckAsCost() end Duel.SendtoDeck(c,nil,2,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(0,1) e1:SetValue(function(ef,ref,val) return val/2 end) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function cid.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() and aux.nzatk(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectTarget(tp,aux.AND(Card.IsFaceup,aux.nzatk),tp,0,LOCATION_MZONE,1,1,nil):GetFirst() Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,tc and tc:GetAttack() or 0) end function cid.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then if Duel.Recover(tp,tc:GetAttack(),REASON_EFFECT)<1 then return end Duel.BreakEffect() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(0) tc:RegisterEffect(e1) end end function cid.atkfilter(c) return c:IsFaceup() and c:IsSetCard(0xc97) and c:IsType(TYPE_MONSTER) end function cid.atkval(e,c) return Duel.GetMatchingGroupCount(cid.atkfilter,e:GetHandler():GetControler(),LOCATION_REMOVED,0,nil)*-100 end