--Astralost Simulation local ref,id=GetID() Duel.LoadScript("Astralost.lua") function ref.initial_effect(c) --Duplicate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(ref.sstg) e1:SetOperation(ref.ssop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end) c:RegisterEffect(e2) --Recover local e3=Astralost.CreateHealTrigger(c,{id,1}) e3:SetRange(LOCATION_GRAVE) e3:SetCategory(CATEGORY_TOHAND) e3:SetCost(ref.thcost) e3:SetTarget(ref.thtg) e3:SetOperation(ref.thop) c:RegisterEffect(e3) end --Duplicate function ref.ssfilter(c,e,tp) c:AssumeProperty(ASSUME_RACE,RACE_THUNDER) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function ref.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(ref.ssfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function ref.ssop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.GetFirstMatchingCard(ref.ssfilter,tp,LOCATION_DECK,0,nil,e,tp) if tc then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) e1:SetValue(RACE_THUNDER) e1:SetReset(RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD) tc:RegisterEffect(e1) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end end --Recover function ref.thcfilter(c,tp) return Astralost.Is(c) and c:IsAbleToGrave() and not Duel.IsExistingMatchingCard(ref.xfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,c:GetCode()) end function ref.xfilter(c,code) return c:IsFaceup() and c:IsCode(code) end function ref.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(ref.thcfilter,tp,LOCATION_DECK,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,ref.thcfilter,tp,LOCATION_DECK,0,1,1,nil,tp) Duel.SendtoGrave(g,REASON_COST) end function ref.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,tp,LOCATION_GRAVE) end function ref.thop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) end end