--加帕里:变为动物朋友 local m=33711109 local cm=_G["c"..m] function cm.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET) e1:SetTarget(cm.target) e1:SetOperation(cm.operation) c:RegisterEffect(e1) local e1_1=e1:Clone() e1_1:SetRange(LOCATION_GRAVE) e1_1:SetCost(cm.cost) c:RegisterEffect(e1_1) --e2 local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(0x7f) e2:SetCode(EVENT_EQUIP) e2:SetTarget(cm.tg) e2:SetOperation(cm.op) c:RegisterEffect(e2) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(1) c:RegisterEffect(e3) -- local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(m,1)) e4:SetCategory(CATEGORY_EQUIP) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CONTINUOUS_TARGET) e4:SetCountLimit(1) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_FREE_CHAIN) e4:SetCondition(cm.reccon) e4:SetTarget(cm.retarget) e4:SetOperation(cm.remop) c:RegisterEffect(e4) end function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local sg=Duel.GetMatchingGroup(Card.IsFaceup,e:GetHandlerPlayer(),LOCATION_MZONE,0,nil) local vg=Group.CreateGroup() if sg:GetCount()>0 then vg=sg:Filter(Card.IsSetCard,nil,0x442) end if chk==0 then return vg:GetCount()>=2 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true) c:CreateEffectRelation(e) e:SetLabel(2) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function cm.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,e:GetHandler(),tc) end end --e2 function cm.thfil(c) return c:IsSetCard(0x442) and c:IsAbleToGrave() and c:IsType(TYPE_MONSTER) and c:IsLevelBelow(6) end function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.thfil,tp,LOCATION_DECK,0,1,nil) and eg:IsContains(e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function cm.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,cm.thfil,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then if Duel.SendtoGrave(g,REASON_EFFECT)~=0 then local xg=Duel.GetOperatedGroup() local tc=c:GetEquipTarget() if xg:GetCount()>0 then local code=xg:GetFirst():GetOriginalCode() tc:ReplaceEffect(code,0) end --change setcard local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_ADD_SETCODE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetRange(LOCATION_MZONE) e0:SetValue(0x442) tc:RegisterEffect(e0,true) end end end --e4 function cm.reccon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp end function cm.retarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function cm.remop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,e:GetHandler(),tc,false,true) Duel.EquipComplete() end end