--Dustflaw Barter function c89217838.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,89217838) e1:SetCost(c89217838.cost) e1:SetTarget(c89217838.target) e1:SetOperation(c89217838.activate) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,89217838) e2:SetCondition(c89217838.drcon) e2:SetCost(aux.bfgcost) e2:SetTarget(c89217838.drtg) e2:SetOperation(c89217838.drop) c:RegisterEffect(e2) end function c89217838.filter(c) return c:IsSetCard(0xff15) and c:GetType()==TYPE_SPELL+TYPE_RITUAL and c:IsDiscardable() end function c89217838.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c89217838.filter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,c89217838.filter,1,1,REASON_COST+REASON_DISCARD,nil) end function c89217838.thfilter(c) return c:IsSetCard(0xff15) and bit.band(c:GetType(),0x81)==0x81 and c:IsAbleToHand() end function c89217838.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(c89217838.thfilter,tp,LOCATION_DECK,0,nil) return g:GetClassCount(Card.GetCode)>=2 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function c89217838.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c89217838.thfilter,tp,LOCATION_DECK,0,nil) if g:GetClassCount(Card.GetCode)>=2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g2=g:Select(tp,1,1,nil) g1:Merge(g2) Duel.SendtoHand(g1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g1) end end function c89217838.drfilter(c) return c:IsFaceup() and c:IsSetCard(0xff15) end function c89217838.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c89217838.drfilter,tp,LOCATION_SZONE,0,2,nil) end function c89217838.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c89217838.drop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c89217838.drfilter,tp,LOCATION_SZONE,0,nil) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=g:Select(1-tp,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT) if sg:GetFirst():IsLocation(LOCATION_GRAVE) then Duel.Draw(tp,2,REASON_EFFECT) end end end