|
| 1 | +--JP name |
| 2 | +--R.B. Operation Test |
| 3 | +--Scripted by The Razgriz |
| 4 | +local s,id=GetID() |
| 5 | +function s.initial_effect(c) |
| 6 | + --When this card is activated: You can target 1 Level 3 or higher "R.B." monster in your GY; Special Summon it |
| 7 | + local e1=Effect.CreateEffect(c) |
| 8 | + e1:SetDescription(aux.Stringid(id,0)) |
| 9 | + e1:SetType(EFFECT_TYPE_ACTIVATE) |
| 10 | + e1:SetCode(EVENT_FREE_CHAIN) |
| 11 | + e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) |
| 12 | + e1:SetTarget(s.target) |
| 13 | + e1:SetOperation(s.activate) |
| 14 | + c:RegisterEffect(e1) |
| 15 | + --Gain LP equal to the combined original ATK of the targeted "R.B." monsters, and if you do, return them to the hand/Extra Deck, then you can Special Summon 1 "R.B." monster from your hand |
| 16 | + local e2=Effect.CreateEffect(c) |
| 17 | + e2:SetDescription(aux.Stringid(id,1)) |
| 18 | + e2:SetCategory(CATEGORY_RECOVER+CATEGORY_TOHAND+CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON) |
| 19 | + e2:SetType(EFFECT_TYPE_IGNITION) |
| 20 | + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) |
| 21 | + e2:SetRange(LOCATION_SZONE) |
| 22 | + e2:SetCountLimit(1,{id,1}) |
| 23 | + e2:SetTarget(s.recthsptg) |
| 24 | + e2:SetOperation(s.recthspop) |
| 25 | + c:RegisterEffect(e2) |
| 26 | +end |
| 27 | +s.listed_series={SET_RB} |
| 28 | +function s.spfromgyfilter(c,e,tp) |
| 29 | + return c:IsLevelAbove(3) and c:IsSetCard(SET_RB) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) |
| 30 | +end |
| 31 | +function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) |
| 32 | + if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfromgyfilter(chkc,e,tp) end |
| 33 | + if chk==0 then return true end |
| 34 | + if Duel.IsExistingTarget(s.spfromgyfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then |
| 35 | + e:SetCategory(CATEGORY_SPECIAL_SUMMON) |
| 36 | + e:SetProperty(EFFECT_FLAG_CARD_TARGET) |
| 37 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) |
| 38 | + local g=Duel.SelectTarget(tp,s.spfromgyfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) |
| 39 | + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) |
| 40 | + else |
| 41 | + e:SetCategory(0) |
| 42 | + e:SetProperty(0) |
| 43 | + end |
| 44 | +end |
| 45 | +function s.activate(e,tp,eg,ep,ev,re,r,rp) |
| 46 | + local tc=Duel.GetFirstTarget() |
| 47 | + if tc and tc:IsRelateToEffect(e) then |
| 48 | + Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) |
| 49 | + end |
| 50 | +end |
| 51 | +function s.recthfilter(c) |
| 52 | + return c:IsSetCard(SET_RB) and c:IsFaceup() and (c:IsAbleToHand() or c:IsAbleToExtra()) |
| 53 | +end |
| 54 | +function s.recthsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) |
| 55 | + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.recthfilter(chkc) end |
| 56 | + if chk==0 then return Duel.IsExistingTarget(s.recthfilter,tp,LOCATION_MZONE,0,1,nil) end |
| 57 | + local ct=Duel.GetTargetCount(s.recthfilter,tp,LOCATION_MZONE,0,nil) |
| 58 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) |
| 59 | + local g=Duel.SelectTarget(tp,s.recthfilter,tp,LOCATION_MZONE,0,1,ct,nil) |
| 60 | + Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,g:GetSum(Card.GetBaseAttack)) |
| 61 | + Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,tp,0) |
| 62 | + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) |
| 63 | +end |
| 64 | +function s.spfromhandfilter(c,e,tp) |
| 65 | + return c:IsSetCard(SET_RB) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) |
| 66 | +end |
| 67 | +function s.recthspop(e,tp,eg,ep,ev,re,r,rp) |
| 68 | + local tg=Duel.GetTargetCards(e):Match(Card.IsFaceup,nil) |
| 69 | + if #tg==0 then return end |
| 70 | + local sum=tg:GetSum(Card.GetBaseAttack) |
| 71 | + if Duel.Recover(tp,sum,REASON_EFFECT)>0 and Duel.SendtoHand(tg,nil,REASON_EFFECT)>0 and Duel.GetMZoneCount(tp)>0 |
| 72 | + and tg:FilterCount(Card.IsLocation,nil,LOCATION_HAND|LOCATION_EXTRA)>0 |
| 73 | + and Duel.IsExistingMatchingCard(s.spfromhandfilter,tp,LOCATION_HAND,0,1,nil,e,tp) then |
| 74 | + Duel.ShuffleHand(tp) |
| 75 | + if not Duel.SelectYesNo(tp,aux.Stringid(id,3)) then return end |
| 76 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) |
| 77 | + local sg=Duel.SelectMatchingCard(tp,s.spfromhandfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) |
| 78 | + if #sg>0 then |
| 79 | + Duel.BreakEffect() |
| 80 | + Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) |
| 81 | + end |
| 82 | + end |
| 83 | +end |
0 commit comments