|
| 1 | +--S-Force ソート・ワールド |
| 2 | +--S-Force Sorted World |
| 3 | +--Scripted by Hatter |
| 4 | +local s,id=GetID() |
| 5 | +function s.initial_effect(c) |
| 6 | + --Activate |
| 7 | + local e0=Effect.CreateEffect(c) |
| 8 | + e0:SetType(EFFECT_TYPE_ACTIVATE) |
| 9 | + e0:SetCode(EVENT_FREE_CHAIN) |
| 10 | + e0:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) |
| 11 | + c:RegisterEffect(e0) |
| 12 | + --If you would banish a card(s) from the hand to activate the effect of an "S-Force" monster you control, you can send 1 "S-Force" card from your Deck to the GY instead, except "S-Force Sorted World" |
| 13 | + local e1=Effect.CreateEffect(c) |
| 14 | + e1:SetDescription(aux.Stringid(id,0)) |
| 15 | + e1:SetType(EFFECT_TYPE_FIELD) |
| 16 | + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) |
| 17 | + e1:SetCode(EFFECT_COST_REPLACE) |
| 18 | + e1:SetRange(LOCATION_SZONE) |
| 19 | + e1:SetTargetRange(1,0) |
| 20 | + e1:SetCountLimit(1,{id,0}) |
| 21 | + e1:SetCondition(s.repcon) |
| 22 | + e1:SetValue(s.repval) |
| 23 | + e1:SetOperation(s.repop) |
| 24 | + c:RegisterEffect(e1) |
| 25 | + --If another card(s) is banished: You can target 1 card in your opponent's field or GY; banish it, then you can move 1 "S-Force" monster you control to another of your Main Monster Zones |
| 26 | + local e2=Effect.CreateEffect(c) |
| 27 | + e2:SetDescription(aux.Stringid(id,1)) |
| 28 | + e2:SetCategory(CATEGORY_REMOVE) |
| 29 | + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) |
| 30 | + e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) |
| 31 | + e2:SetCode(EVENT_REMOVE) |
| 32 | + e2:SetRange(LOCATION_SZONE) |
| 33 | + e2:SetCountLimit(1,{id,1}) |
| 34 | + e2:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsLocation,1,nil,LOCATION_REMOVED) end) |
| 35 | + e2:SetTarget(s.bantg) |
| 36 | + e2:SetOperation(s.banop) |
| 37 | + c:RegisterEffect(e2) |
| 38 | +end |
| 39 | +s.listed_names={id} |
| 40 | +s.listed_series={SET_S_FORCE} |
| 41 | +function s.repcostfilter(c,extracon,base,e,tp,eg,ep,ev,re,r,rp) |
| 42 | + return c:IsSetCard(SET_S_FORCE) and not c:IsCode(id) and c:IsAbleToGraveAsCost() |
| 43 | + and (not extracon or extracon(base,e,tp,eg,ep,ev,re,r,rp,c)) |
| 44 | +end |
| 45 | +function s.repcon(e) |
| 46 | + return Duel.IsExistingMatchingCard(s.repcostfilter,e:GetHandlerPlayer(),LOCATION_DECK,0,1,nil) |
| 47 | +end |
| 48 | +function s.repval(base,extracon,e,tp,eg,ep,ev,re,r,rp,chk) |
| 49 | + if chk==0 then |
| 50 | + local c=e:GetHandler() |
| 51 | + return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_S_FORCE) |
| 52 | + and Duel.IsExistingMatchingCard(s.repcostfilter,tp,LOCATION_DECK,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) |
| 53 | + end |
| 54 | + return Chain.IsTriggeringControler(0,tp) and Chain.IsTriggeringLocation(0,LOCATION_MZONE) |
| 55 | + and Chain.IsTriggeringPosition(0,POS_FACEUP) and Chain.IsTriggeringSetcode(0,SET_S_FORCE) |
| 56 | + and Duel.IsExistingMatchingCard(s.repcostfilter,tp,LOCATION_DECK,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) |
| 57 | +end |
| 58 | +function s.repop(base,extracon,e,tp,eg,ep,ev,re,r,rp) |
| 59 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) |
| 60 | + local g=Duel.SelectMatchingCard(tp,s.repcostfilter,tp,LOCATION_DECK,0,1,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) |
| 61 | + Duel.SendtoGrave(g,REASON_COST) |
| 62 | +end |
| 63 | +function s.bantg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) |
| 64 | + if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_ONFIELD|LOCATION_GRAVE) and chkc:IsAbleToRemove() end |
| 65 | + if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,1,nil) end |
| 66 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) |
| 67 | + local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,1,1,nil) |
| 68 | + Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) |
| 69 | +end |
| 70 | +function s.banop(e,tp,eg,ep,ev,re,r,rp) |
| 71 | + local tc=Duel.GetFirstTarget() |
| 72 | + if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_REMOVED) |
| 73 | + and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then |
| 74 | + local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_S_FORCE),tp,LOCATION_MZONE,0,nil) |
| 75 | + if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end |
| 76 | + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) |
| 77 | + local sc=g:Select(tp,1,1,nil):GetFirst() |
| 78 | + if not sc then return end |
| 79 | + Duel.HintSelection(sc) |
| 80 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) |
| 81 | + local zone=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0) |
| 82 | + Duel.BreakEffect() |
| 83 | + if tc:IsImmuneToEffect(e) then return end |
| 84 | + Duel.MoveSequence(sc,math.log(zone,2)) |
| 85 | + end |
| 86 | +end |
0 commit comments