|
| 1 | +--群れをなす昆虫人間 |
| 2 | +--Swarming Basic Insect |
| 3 | +--scripted by YoshiDuels |
| 4 | +local s,id=GetID() |
| 5 | +function s.initial_effect(c) |
| 6 | + --Add card to hand |
| 7 | + local e1=Effect.CreateEffect(c) |
| 8 | + e1:SetDescription(aux.Stringid(id,0)) |
| 9 | + e1:SetCategory(CATEGORY_TOHAND) |
| 10 | + e1:SetType(EFFECT_TYPE_IGNITION) |
| 11 | + e1:SetRange(LOCATION_MZONE) |
| 12 | + e1:SetCountLimit(1) |
| 13 | + e1:SetCondition(s.condition) |
| 14 | + e1:SetCost(s.cost) |
| 15 | + e1:SetTarget(s.target) |
| 16 | + e1:SetOperation(s.operation) |
| 17 | + c:RegisterEffect(e1) |
| 18 | +end |
| 19 | +function s.thfilter(c,cond_check) |
| 20 | + return c:IsRace(RACE_INSECT) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsDefense(2000) and (cond_check or c:IsAbleToHand()) |
| 21 | +end |
| 22 | +function s.condition(e,tp,eg,ep,ev,re,r,rp) |
| 23 | + return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,true) |
| 24 | +end |
| 25 | +function s.cfilter(c) |
| 26 | + return c:IsMonster() and c:IsAbleToGraveAsCost() |
| 27 | +end |
| 28 | +function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) |
| 29 | + if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,e:GetHandler()) end |
| 30 | +end |
| 31 | +function s.target(e,tp,eg,ep,ev,re,r,rp,chk) |
| 32 | + if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,false) end |
| 33 | + Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) |
| 34 | +end |
| 35 | +function s.operation(e,tp,eg,ep,ev,re,r,rp) |
| 36 | + --Requirement |
| 37 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) |
| 38 | + local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,e:GetHandler()) |
| 39 | + if Duel.SendtoGrave(g,REASON_COST)<1 then return end |
| 40 | + --Effect |
| 41 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) |
| 42 | + local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,false) |
| 43 | + if #g>0 then |
| 44 | + Duel.SendtoHand(g,nil,REASON_EFFECT) |
| 45 | + Duel.ConfirmCards(1-tp,g) |
| 46 | + if g:GetFirst():IsCode(160217037) and Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then |
| 47 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) |
| 48 | + local g=Duel.SelectMatchingCard(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) |
| 49 | + Duel.HintSelection(g) |
| 50 | + Duel.BreakEffect() |
| 51 | + Duel.Destroy(g,REASON_EFFECT) |
| 52 | + end |
| 53 | + end |
| 54 | +end |
0 commit comments