-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathc160009045.lua
43 lines (43 loc) · 1.36 KB
/
c160009045.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
-- フューチャー・マイニング
-- Future Mining
-- Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
-- Add excavated monster to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.thcon)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(aux.FilterMaximumSideFunctionEx(Card.IsFaceup),tp,0,LOCATION_MZONE,2,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1 end
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<2 then return end
Duel.ConfirmDecktop(tp,2)
local g=Duel.GetDecktopGroup(tp,2)
if g:IsExists(aux.AND(Card.IsMonster,Card.IsAbleToHand),1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=g:FilterSelect(tp,aux.AND(Card.IsMonster,Card.IsAbleToHand),1,1,nil)
if #tg>0 then
Duel.DisableShuffleCheck()
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg)
Duel.ShuffleHand(tp)
g:RemoveCard(tg)
end
end
local ct=#g
if ct>0 then
Duel.MoveToDeckBottom(ct,tp)
Duel.SortDeckbottom(tp,tp,ct)
end
end