Skip to content

Commit b177dc1

Browse files
committed
added Tamatamagachance
1 parent a5d8d2c commit b177dc1

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

rush/c160402053.lua

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
--タマタマガチャンス
2+
--Tamatamagachance
3+
--scripted by YoshiDuels
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Send the top 3 cards of your Deck to the GY
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_DECKDES|CATEGORY_SPECIAL_SUMMON)
10+
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetCode(EVENT_FREE_CHAIN)
12+
e1:SetCost(s.cost)
13+
e1:SetTarget(s.target)
14+
e1:SetOperation(s.activate)
15+
c:RegisterEffect(e1)
16+
end
17+
s.listed_names={CARD_TAMABOT}
18+
function s.cfilter(c)
19+
return c:IsMonster() and c:IsRace(RACE_MACHINE) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost()
20+
end
21+
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
22+
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,nil) end
23+
end
24+
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
25+
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3) end
26+
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3)
27+
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
28+
end
29+
function s.tgfilter(c)
30+
return c:IsLocation(LOCATION_GRAVE) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsMonster()
31+
end
32+
function s.chkfilter(c)
33+
return c:IsLevel(7) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH)
34+
end
35+
function s.spfilter(c,e,tp)
36+
return (s.chkfilter(c) or c:IsCode(CARD_TAMABOT)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP)
37+
end
38+
function s.activate(e,tp,eg,ep,ev,re,r,rp)
39+
--Requirement
40+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
41+
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,1,nil)
42+
if Duel.SendtoGrave(g,REASON_COST)==0 then return end
43+
--Effect
44+
Duel.DiscardDeck(tp,3,REASON_EFFECT)
45+
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
46+
if ft<1 then return end
47+
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end
48+
local og=Duel.GetOperatedGroup()
49+
local ct=og:FilterCount(s.tgfilter,nil)
50+
if ct>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
51+
local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
52+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
53+
local g=aux.SelectUnselectGroup(sg,1,tp,1,math.min(ft,3,#sg),s.rescon,1,tp)
54+
if #g>0 then
55+
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
56+
end
57+
end
58+
end
59+
function s.rescon(sg,e,tp,mg)
60+
if sg:FilterCount(s.chkfilter,nil)>0 then return #sg==1 end
61+
return sg:FilterCount(s.chkfilter,nil)==0
62+
end

0 commit comments

Comments
 (0)