--The Invocation of TMP --Scripted by: XGlitchy30 local cid,id=GetID() function cid.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetCost(cid.cost) e1:SetOperation(cid.activate) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id+100) e2:SetCondition(cid.thcon) e2:SetCost(cid.thcost) e2:SetTarget(cid.thtg) e2:SetOperation(cid.thop) c:RegisterEffect(e2) end --ACTIVATE function cid.rlfilter(c) return c:IsType(TYPE_MONSTER) and c:IsRace(RACE_WINDBEAST) and c:GetLevel()>0 and c:IsLevelBelow(3) end function cid.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,cid.rlfilter,1,nil) end local g=Duel.SelectReleaseGroup(tp,cid.rlfilter,1,1,nil) Duel.Release(g,REASON_COST) end function cid.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetTarget(cid.tg) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetValue(1) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(aux.Stringid(id,3)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CLIENT_HINT) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetTarget(cid.tg) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetReset(RESET_PHASE+PHASE_END) e2:SetValue(1) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetDescription(aux.Stringid(id,4)) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(cid.tg) e3:SetReset(RESET_PHASE+PHASE_END) e3:SetValue(1) Duel.RegisterEffect(e3,tp) if Duel.GetCurrentPhase()==PHASE_STANDBY and Duel.GetTurnPlayer()==tp then e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+(RESETS_STANDARD-RESET_TOGRAVE-RESET_LEAVE)+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,2,Duel.GetTurnCount()) else e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+(RESETS_STANDARD-RESET_TOGRAVE-RESET_LEAVE)+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,1,0) end end function cid.tg(e,c) return c:IsRace(RACE_WINDBEAST) end --SEARCH function cid.thcon(e,tp,eg,ep,ev,re,r,rp) local tid=e:GetHandler():GetFlagEffectLabel(id) return tid and tid~=Duel.GetTurnCount() and Duel.GetTurnPlayer()==tp end function cid.cfilter(c) return c:IsSetCard(0x5478) and c:IsAbleToRemoveAsCost() end function cid.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(cid.cfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,cid.cfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()) g:AddCard(e:GetHandler()) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_COST) end end function cid.scfilter(c) return c:IsSetCard(0x5478) and c:IsAbleToHand() and not c:IsCode(id,id-4) end function cid.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cid.scfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function cid.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cid.scfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end