-- Galaxy Trumpeter function c405245.initial_effect(c) --synchro material local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(405245,0)) e0:SetCategory(CATEGORY_TOHAND) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e0:SetCode(EVENT_BE_MATERIAL) e0:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e0:SetCondition(c405245.condition) e0:SetTarget(c405245.target) e0:SetOperation(c405245.operation) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(c405245.condition2) e1:SetOperation(c405245.efop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(405245,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,405245) e2:SetTarget(c405245.sptg) e2:SetOperation(c405245.spop) c:RegisterEffect(e2) --draw local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(405245,2)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_HAND) e3:SetRange(LOCATION_HAND) e3:SetCountLimit(1,405245) e3:SetCondition(c405245.drcon) e3:SetTarget(c405245.drtg) e3:SetOperation(c405245.drop) c:RegisterEffect(e3) end function c405245.condition(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO end function c405245.condition2(e,tp,eg,ep,ev,re,r,rp) return r==REASON_XYZ end function c405245.filter(c) return c:IsFaceup() and (c:IsSetCard(0x55) or c:IsSetCard(0x7b)) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c405245.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and c405245.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c405245.filter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c405245.filter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c405245.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function c405245.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(405245,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(c405245.target) e1:SetOperation(c405245.operation) e1:SetReset(RESET_EVENT+0x1fe0000) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) rc:RegisterEffect(e2,true) end end function c405245.spfilter(c,e,tp) return (c:IsSetCard(0x55) or c:IsSetCard(0x7b)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c405245.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c405245.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function c405245.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c405245.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end end function c405245.drcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(r,REASON_EFFECT)~=0 and e:GetHandler():GetPreviousControler()==tp end function c405245.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c405245.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end