--Naval Gears - Admiral Hipper local cid,id=GetID() function cid.initial_effect(c) --link summon aux.AddLinkProcedure(c,cid.lfilter,2,99) c:EnableReviveLimit() --If grave by not battle or effects; shuffle card to deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(83239739,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetTarget(cid.target) e2:SetOperation(cid.operation) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(5126490,0)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetTarget(cid.damtg) e3:SetOperation(cid.damop) c:RegisterEffect(e3) end function cid.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetAttackTarget()~=nil end local bc=e:GetHandler():GetBattleTarget() end function cid.damop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() local c=e:GetHandler() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fc0000) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) c:RegisterEffect(e1) --if bc:IsRelateToBattle() and bc:IsRelateToEffect(e) then local option if Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then option=0 end if Duel.GetLocationCount(1-tp,LOCATION_SZONE)>0 then option=1 end if Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetLocationCount(1-tp,LOCATION_SZONE)>0 then option=Duel.SelectOption(tp,aux.Stringid(4777,5),aux.Stringid(4777,6)) end if option==0 then Duel.MoveToField(bc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_SETCODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(0x700) e1:SetReset(RESET_EVENT+RESETS_STANDARD) bc:RegisterEffect(e1) bc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetLabel(Duel.GetTurnCount()) e2:SetLabelObject(bc) e2:SetCondition(cid.descon) e2:SetOperation(cid.desop) e2:SetReset(RESET_PHASE+PHASE_END,2) Duel.RegisterEffect(e2,tp) end if option==1 then Duel.MoveToField(bc,1-tp,1-tp,LOCATION_SZONE,POS_FACEUP,true) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_SETCODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(0x700) e1:SetReset(RESET_EVENT+RESETS_STANDARD) bc:RegisterEffect(e1) bc:RegisterEffect(e1) bc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,2) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetLabel(Duel.GetTurnCount()) e2:SetLabelObject(bc) e2:SetCondition(cid.descon) e2:SetOperation(cid.desop) e2:SetReset(RESET_PHASE+PHASE_END,2) Duel.RegisterEffect(e2,tp) end --end end function cid.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() return Duel.GetTurnCount()~=e:GetLabel() and tc:GetFlagEffect(id)~=0 end function cid.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.Hint(HINT_CARD,0,id) Duel.Destroy(tc,REASON_EFFECT) end function cid.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsLocation(LOCATION_SZONE) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) end function cid.sumfilter(c,e,tp) return c:IsSetCard(0x700) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) end function cid.operation(e,tp,eg,ep,ev,re,r,rp) c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end if Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fc0000) e1:SetValue(TYPE_TRAP+TYPE_CONTINUOUS) c:RegisterEffect(e1) local ct=Duel.GetLocationCount(tp,LOCATION_MZONE) if ct<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,59822133) then ct=1 end if ct>2 then ct=2 end local g=Duel.SelectMatchingCard(tp,cid.sumfilter,tp,LOCATION_SZONE,0,1,ct,nil,e,tp) local gc=g:GetCount() if gc==0 then return end if gc<=ct then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end end function cid.lfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x700) and not c:IsType(TYPE_TOKEN) end