--苍波新兵 贝拉吉欧斯 function c40009118.initial_effect(c) --battle indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetCondition(c40009118.indcon) c:RegisterEffect(e1) --dam local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetValue(1) c:RegisterEffect(e2) --pos local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(40009118,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetCondition(c40009118.poscon) e3:SetTarget(c40009118.sptg) e3:SetOperation(c40009118.spop) c:RegisterEffect(e3) --draw local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(40009118,1)) e4:SetCategory(CATEGORY_SEARCH) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BE_MATERIAL) e4:SetCountLimit(1,40009118) e4:SetCondition(c40009118.drcon) e4:SetTarget(c40009118.target) e4:SetOperation(c40009118.activate) c:RegisterEffect(e4) end function c40009118.indcon(e) return e:GetHandler():IsAttackPos() end function c40009118.poscon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRelateToBattle() and c:IsAttackPos() end function c40009118.filter(c,e,tp) return c:IsSetCard(0x6f1d) and not c:IsCode(40009118) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c40009118.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c40009118.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function c40009118.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c40009118.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT+RESETS_STANDARD+RESET_DISABLE,0,0) end end function c40009118.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO and c:GetReasonCard():IsSetCard(0x6f1d) end function c40009118.filter1(c,tp) return c:IsCode(40009084) and (c:IsAbleToHand() or c:GetActivateEffect():IsActivatable(tp,true,true)) end function c40009118.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c40009118.filter1,tp,LOCATION_DECK,0,1,nil,tp) end if not Duel.CheckPhaseActivity() then e:SetLabel(1) else e:SetLabel(0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c40009118.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD) if e:GetLabel()==1 then Duel.RegisterFlagEffect(tp,15248873,RESET_CHAIN,0,1) end local g=Duel.SelectMatchingCard(tp,c40009118.filter1,tp,LOCATION_DECK,0,1,1,nil,tp) Duel.ResetFlagEffect(tp,15248873) local tc=g:GetFirst() if tc then local te=tc:GetActivateEffect() local b1=tc:IsAbleToHand() if e:GetLabel()==1 then Duel.RegisterFlagEffect(tp,15248873,RESET_CHAIN,0,1) end local b2=te:IsActivatable(tp,true,true) Duel.ResetFlagEffect(tp,15248873) if b1 and (not b2 or Duel.SelectOption(tp,1190,1150)==0) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) else local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0) if fc then Duel.SendtoGrave(fc,REASON_RULE) Duel.BreakEffect() end Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) te:UseCountLimit(tp,1,true) local tep=tc:GetControler() local cost=te:GetCost() if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end Duel.RaiseEvent(tc,4179255,te,0,tp,tp,Duel.GetCurrentChain()) end end end