Skip to content

Commit eb00bae

Browse files
authored
Added new card script
1 parent e5ae2cc commit eb00bae

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

pre-release/c101301073.lua

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
--
2+
--Spring
3+
--scripted by Naim
4+
local COUNTER_SEASON=0x214
5+
local s,id=GetID()
6+
function s.initial_effect(c)
7+
c:EnableCounterPermit(COUNTER_SEASON)
8+
--Activate
9+
local e0=Effect.CreateEffect(c)
10+
e0:SetType(EFFECT_TYPE_ACTIVATE)
11+
e0:SetCode(EVENT_FREE_CHAIN)
12+
c:RegisterEffect(e0)
13+
--Select any number of your Main Monster Zones to make them unusuable
14+
local e1=Effect.CreateEffect(c)
15+
e1:SetDescription(aux.Stringid(id,0))
16+
e1:SetCategory(CATEGORY_COUNTER)
17+
e1:SetType(EFFECT_TYPE_IGNITION)
18+
e1:SetRange(LOCATION_FZONE)
19+
e1:SetCountLimit(1)
20+
e1:SetTarget(s.countertg)
21+
e1:SetOperation(s.counterop)
22+
c:RegisterEffect(e1)
23+
--Monsters you control gain 400 ATK for each Season Counter on this card
24+
local e2=Effect.CreateEffect(c)
25+
e2:SetType(EFFECT_TYPE_FIELD)
26+
e2:SetCode(EFFECT_UPDATE_ATTACK)
27+
e2:SetRange(LOCATION_FZONE)
28+
e2:SetTargetRange(LOCATION_MZONE,0)
29+
e2:SetValue(function(e,c) return e:GetHandler():GetCounter(COUNTER_SEASON)*400 end)
30+
c:RegisterEffect(e2)
31+
--Place 1 Field Spell from your Deck that you can place a Season Counter on face-up on your field
32+
local e3=Effect.CreateEffect(c)
33+
e3:SetDescription(aux.Stringid(id,1))
34+
e3:SetCategory(CATEGORY_COUNTER)
35+
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
36+
e3:SetCode(EVENT_PHASE+PHASE_END)
37+
e3:SetRange(LOCATION_FZONE)
38+
e3:SetCountLimit(1)
39+
e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end)
40+
e3:SetTarget(s.pltg)
41+
e3:SetOperation(s.plop)
42+
c:RegisterEffect(e3)
43+
end
44+
s.counter_place_list={COUNTER_SEASON}
45+
function s.countertg(e,tp,eg,ep,ev,re,r,rp,chk)
46+
local max_zones=Duel.GetLocationCount(tp,LOCATION_MZONE)
47+
if chk==0 then return max_zones>0 end
48+
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,max_zones,tp,COUNTER_SEASON)
49+
end
50+
function s.counterop(e,tp,eg,ep,ev,re,r,rp)
51+
local max_zones=Duel.GetLocationCount(tp,LOCATION_MZONE)
52+
if max_zones<=0 then return end
53+
local ct=0
54+
local selected_zones=0
55+
repeat
56+
ct=ct+1
57+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLEZONE)
58+
local new_zone=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,selected_zones)
59+
selected_zones=selected_zones|new_zone
60+
until (ct>=max_zones or not Duel.SelectYesNo(tp,aux.Stringid(id,2)))
61+
local c=e:GetHandler()
62+
c:AddCounter(COUNTER_SEASON,ct)
63+
--Those zones cannot be used while this card is on the field
64+
local e1=Effect.CreateEffect(c)
65+
e1:SetType(EFFECT_TYPE_FIELD)
66+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
67+
e1:SetCode(EFFECT_DISABLE_FIELD)
68+
e1:SetRange(LOCATION_FZONE)
69+
e1:SetOperation(function() return selected_zones end)
70+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
71+
c:RegisterEffect(e1)
72+
end
73+
function s.plfilter(c)
74+
return c:IsFieldSpell() and c:IsCanAddCounter(COUNTER_SEASON,1,false,LOCATION_ONFIELD) and not c:IsForbidden()
75+
end
76+
function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk)
77+
if chk==0 then return Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil) end
78+
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,e:GetHandler():GetCounter(COUNTER_SEASON),tp,COUNTER_SEASON)
79+
end
80+
function s.plop(e,tp,eg,ep,ev,re,r,rp)
81+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
82+
local sc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
83+
if not sc then return end
84+
local c=e:GetHandler()
85+
local ct=c:GetCounter(COUNTER_SEASON)
86+
local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
87+
if fc then
88+
Duel.SendtoGrave(fc,REASON_RULE)
89+
Duel.BreakEffect()
90+
end
91+
if Duel.MoveToField(sc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) then
92+
--Cannot activate its effects this turn
93+
local e1=Effect.CreateEffect(c)
94+
e1:SetDescription(3302)
95+
e1:SetType(EFFECT_TYPE_SINGLE)
96+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
97+
e1:SetCode(EFFECT_CANNOT_TRIGGER)
98+
e1:SetReset(RESETS_STANDARD_PHASE_END)
99+
sc:RegisterEffect(e1)
100+
if ct>0 then
101+
sc:AddCounter(COUNTER_SEASON,ct)
102+
end
103+
end
104+
end

0 commit comments

Comments
 (0)