--Voice of the Desert local id,cod=23251002,c23251002 function cod.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(cod.cost) e1:SetTarget(cod.target) e1:SetOperation(cod.operation) c:RegisterEffect(e1) end function cod.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() end Duel.Release(e:GetHandler(),REASON_COST) end function cod.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local sel=0 if Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,e:GetHandler()) then sel=sel+1 end if Duel.IsPlayerCanDraw(tp,2) then sel=sel+2 end e:SetLabel(sel) return sel~=0 end local sel=e:GetLabel() if sel==3 then sel=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 elseif sel==1 then Duel.SelectOption(tp,aux.Stringid(id,1)) else Duel.SelectOption(tp,aux.Stringid(id,2)) end e:SetLabel(sel) if sel==1 then local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0) e:SetProperty(EFFECT_FLAG_CARD_TARGET) else Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,2,0,0) e:SetProperty(0) end end function cod.operation(e,tp,eg,ep,ev,re,r,rp) local sel=e:GetLabel() if sel==1 then local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not g or g:GetCount()<2 then return end if Duel.Destroy(g,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) then Duel.BreakEffect() Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end else if Duel.Draw(tp,2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) then Duel.BreakEffect() Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) end end end