Skip to content

Commit e587c4d

Browse files
authored
Added new card script
1 parent 100351a commit e587c4d

File tree

1 file changed

+153
-0
lines changed

1 file changed

+153
-0
lines changed

pre-release/c100451026.lua

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
--W:Pファンシーボール
2+
--W:P Fancy Ball
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
c:EnableReviveLimit()
7+
--Link Summon procedure: 2+ Effect Monsters
8+
Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2)
9+
--When your opponent activates a monster effect on the field or GY (Quick Effect): You can banish this card that was Special Summoned this turn until the End Phase; negate that effect, and if you do, banish it
10+
local e1=Effect.CreateEffect(c)
11+
e1:SetDescription(aux.Stringid(id,0))
12+
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_REMOVE)
13+
e1:SetType(EFFECT_TYPE_QUICK_O)
14+
e1:SetCode(EVENT_CHAINING)
15+
e1:SetRange(LOCATION_MZONE)
16+
e1:SetCountLimit(1,{id,0})
17+
e1:SetCondition(s.discon)
18+
e1:SetCost(s.discost)
19+
e1:SetTarget(s.distg)
20+
e1:SetOperation(s.disop)
21+
c:RegisterEffect(e1)
22+
--During your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Link Summon 1 Link Monster, and if this card you control would be used as material for that Link Summon, you can also use 1 Link-2 or lower monster your opponent controls
23+
local e2=Effect.CreateEffect(c)
24+
e2:SetDescription(aux.Stringid(id,1))
25+
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
26+
e2:SetType(EFFECT_TYPE_QUICK_O)
27+
e2:SetCode(EVENT_FREE_CHAIN)
28+
e2:SetRange(LOCATION_MZONE)
29+
e2:SetCountLimit(1,{id,1})
30+
e2:SetCondition(function(e,tp) return Duel.IsMainPhase(1-tp) end)
31+
e2:SetTarget(s.linktg)
32+
e2:SetOperation(s.linkop)
33+
e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER)
34+
c:RegisterEffect(e2)
35+
end
36+
function s.discon(e,tp,eg,ep,ev,re,r,rp,chk)
37+
if not e:GetHandler():IsStatus(STATUS_SPSUMMON_TURN) then return false end
38+
local trig_loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
39+
return ep==1-tp and re:IsMonsterEffect() and trig_loc&(LOCATION_MZONE|LOCATION_GRAVE)>0 and Duel.IsChainDisablable(ev)
40+
end
41+
function s.discost(e,tp,eg,ep,ev,re,r,rp,chk)
42+
local c=e:GetHandler()
43+
if chk==0 then return c:IsAbleToRemoveAsCost() end
44+
--Banish this card until the End Phase
45+
aux.RemoveUntil(c,nil,REASON_COST,PHASE_END,id,e,tp,aux.DefaultFieldReturnOp)
46+
end
47+
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
48+
local rc=re:GetHandler()
49+
local relation=rc:IsRelateToEffect(re)
50+
if chk==0 then return rc:IsAbleToRemove(tp)
51+
or (not relation and Duel.IsPlayerCanRemove(tp)) end
52+
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,tp,0)
53+
if relation then
54+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,rc,1,tp,0)
55+
else
56+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,rc:GetPreviousLocation())
57+
end
58+
end
59+
function s.disop(e,tp,eg,ep,ev,re,r,rp)
60+
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
61+
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
62+
end
63+
end
64+
function s.linktg(e,tp,eg,ep,ev,re,r,rp,chk)
65+
if chk==0 then
66+
local c=e:GetHandler()
67+
--If this card you control would be used as material for that Link Summon, you can also use 1 Link-2 or lower monster your opponent controls
68+
local e1=Effect.CreateEffect(c)
69+
e1:SetType(EFFECT_TYPE_FIELD)
70+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
71+
e1:SetCode(EFFECT_EXTRA_MATERIAL)
72+
e1:SetRange(LOCATION_MZONE)
73+
e1:SetTargetRange(1,0)
74+
e1:SetOperation(s.extracon)
75+
e1:SetValue(s.extraval)
76+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
77+
c:RegisterEffect(e1)
78+
local res=Duel.IsExistingMatchingCard(Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,1,nil)
79+
e1:Reset()
80+
return res
81+
end
82+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
83+
Duel.SetChainLimit(function(re,rp,tp) return not (re:IsMonsterEffect() and re:GetHandler():IsLinkMonster()) end)
84+
end
85+
function s.linkop(e,tp,eg,ep,ev,re,r,rp)
86+
local c=e:GetHandler()
87+
local e1=nil
88+
if c:IsRelateToEffect(e) then
89+
--If this card you control would be used as material for that Link Summon, you can also use 1 Link-2 or lower monster your opponent controls
90+
e1=Effect.CreateEffect(c)
91+
e1:SetType(EFFECT_TYPE_FIELD)
92+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
93+
e1:SetCode(EFFECT_EXTRA_MATERIAL)
94+
e1:SetRange(LOCATION_MZONE)
95+
e1:SetTargetRange(1,0)
96+
e1:SetOperation(s.extracon)
97+
e1:SetValue(s.extraval)
98+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
99+
c:RegisterEffect(e1)
100+
end
101+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
102+
local sc=Duel.SelectMatchingCard(tp,Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,1,1,nil):GetFirst()
103+
if sc then
104+
Duel.LinkSummon(tp,sc)
105+
if e1 then
106+
local eff_code=Duel.GetCurrentChain()==1 and EVENT_SPSUMMON or EVENT_SPSUMMON_SUCCESS
107+
--Reset e1
108+
local e2=Effect.CreateEffect(c)
109+
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
110+
e2:SetCode(eff_code)
111+
e2:SetOperation(function(e) e1:Reset() e:Reset() end)
112+
Duel.RegisterEffect(e2,tp)
113+
end
114+
elseif e1 then
115+
e1:Reset()
116+
end
117+
end
118+
function s.extracon(c,e,tp,sg,mg,lc,og,chk)
119+
if not sg:IsContains(e:GetHandler()) then return false end
120+
local g=Duel.GetMatchingGroup(Card.IsLinkBelow,tp,0,LOCATION_MZONE,nil,2)
121+
if #g==0 then return true end
122+
local max_count=1
123+
local must_include=Group.CreateGroup()
124+
local effs={Duel.GetPlayerEffect(tp,EFFECT_EXTRA_MATERIAL)}
125+
for _,eff in ipairs(effs) do
126+
if not eff:GetOwner():IsCode(id) then
127+
if #(eff:GetValue()(0,SUMMON_TYPE_LINK,eff,tp,lc))>0 then
128+
local handler=eff:GetHandler()
129+
must_include:Merge(handler)
130+
if #(sg&must_include)>0 or lc==handler then
131+
max_count=max_count+1
132+
end
133+
end
134+
end
135+
end
136+
return #(sg&g)>0 and #(sg&g)<=max_count
137+
end
138+
function s.extraval(chk,summon_type,e,...)
139+
local c=e:GetHandler()
140+
if chk==0 then
141+
local tp,sc=...
142+
if summon_type~=SUMMON_TYPE_LINK then
143+
return Group.CreateGroup()
144+
else
145+
return Duel.GetMatchingGroup(Card.IsLinkBelow,tp,0,LOCATION_MZONE,nil,2)
146+
end
147+
elseif chk==1 then
148+
local sg,sc,tp=...
149+
if summon_type&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK and #sg>0 then
150+
Duel.Hint(HINT_CARD,tp,id)
151+
end
152+
end
153+
end

0 commit comments

Comments
 (0)