--动物朋友 海生家族之绊 local m=33700754 local cm=_G["c"..m] function cm.initial_effect(c) --maintain local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EVENT_PHASE+PHASE_END) e0:SetRange(LOCATION_SZONE) e0:SetCountLimit(1) e0:SetCondition(cm.mtcon) e0:SetOperation(cm.mtop) c:RegisterEffect(e0) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --add counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_SZONE) e2:SetOperation(aux.chainreg) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetRange(LOCATION_SZONE) e3:SetOperation(cm.acop) c:RegisterEffect(e3) --Light Wing Shield local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(m,2)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_ATTACK_ANNOUNCE) e4:SetCountLimit(1,33710754) e4:SetCost(cm.atkcost) e4:SetOperation(cm.atkop) c:RegisterEffect(e4) --replace local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EFFECT_DESTROY_REPLACE) e5:SetRange(LOCATION_SZONE) e5:SetTarget(cm.reptg) e5:SetValue(cm.repval) e5:SetOperation(cm.repop) c:RegisterEffect(e5) --to hand local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(m,3)) e6:SetProperty(EFFECT_FLAG_CARD_TARGET) e6:SetCategory(CATEGORY_TOHAND) e6:SetType(EFFECT_TYPE_IGNITION) e6:SetRange(LOCATION_SZONE) e6:SetCountLimit(1,m) e6:SetCost(cm.thcost) e6:SetTarget(cm.thtg) e6:SetOperation(cm.thop) c:RegisterEffect(e6) end function cm.mtcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==tp end function cm.mtop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local sel=1 if e:GetHandler():IsCanRemoveCounter(tp,0x1442,2,REASON_COST) then sel=Duel.SelectOption(tp,aux.Stringid(m,0),aux.Stringid(m,1)) else sel=Duel.SelectOption(tp,aux.Stringid(m,1))+1 end if sel==0 then e:GetHandler():RemoveCounter(tp,0x1442,2,REASON_COST) else Duel.SendtoGrave(c,REASON_COST) end end function cm.acop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsSetCard(0x442) and re:GetHandler():IsRace(RACE_AQUA) and c:GetFlagEffect(1)>0 then c:AddCounter(0x1442,1) end end function cm.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1442,2,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x1442,2,REASON_COST) end function cm.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.NegateAttack() end function cm.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(0x442) and c:IsLocation(LOCATION_ONFIELD) and (c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT)) and not c:IsReason(REASON_REPLACE) end function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1442,2,REASON_COST) and eg:IsExists(cm.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function cm.repval(e,c) return cm.repfilter(c,e:GetHandlerPlayer()) end function cm.repop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RemoveCounter(tp,0x1442,2,REASON_EFFECT) end function cm.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x1442,4,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x1442,4,REASON_COST) end function cm.thfilter(c,tid) return c:IsSetCard(0x442) and c:GetTurnID()==tid and c:IsAbleToHand() end function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and cm.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(cm.thfilter,tp,LOCATION_GRAVE,0,1,nil,Duel.GetTurnCount()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,cm.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,Duel.GetTurnCount()) end function cm.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.SendtoHand(tc,tp,REASON_EFFECT) end end