Skip to content

Commit 5efdaec

Browse files
authored
Added new card scripts
1 parent 5cf1984 commit 5efdaec

File tree

2 files changed

+196
-0
lines changed

2 files changed

+196
-0
lines changed

pre-release/c101305043.lua

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
--ぜんなのついなぎひめ
2+
--Zenna-no-Tsuinagihime
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+
--You can also use 1 monster in your hand as material to Link Summon this card
10+
local e0=Effect.CreateEffect(c)
11+
e0:SetType(EFFECT_TYPE_FIELD)
12+
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE)
13+
e0:SetCode(EFFECT_EXTRA_MATERIAL)
14+
e0:SetRange(LOCATION_EXTRA)
15+
e0:SetTargetRange(1,0)
16+
e0:SetOperation(function(c,e,tp,sg,mg,lc,og,chk) return sg:FilterCount(Card.HasFlagEffect,nil,id)<=1 end)
17+
e0:SetValue(s.extraval)
18+
c:RegisterEffect(e0)
19+
--If this card is Link Summoned: You can send 1 monster from your Deck to the GY, or if this card was Link Summoned using only monsters you control, you can send 1 monster from your Extra Deck to the GY instead
20+
local e1a=Effect.CreateEffect(c)
21+
e1a:SetDescription(aux.Stringid(id,0))
22+
e1a:SetCategory(CATEGORY_TOGRAVE)
23+
e1a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
24+
e1a:SetProperty(EFFECT_FLAG_DELAY)
25+
e1a:SetCode(EVENT_SPSUMMON_SUCCESS)
26+
e1a:SetCountLimit(1,{id,0})
27+
e1a:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end)
28+
e1a:SetTarget(s.tgtg)
29+
e1a:SetOperation(s.tgop)
30+
c:RegisterEffect(e1a)
31+
local e1b=Effect.CreateEffect(c)
32+
e1b:SetType(EFFECT_TYPE_SINGLE)
33+
e1b:SetCode(EFFECT_MATERIAL_CHECK)
34+
e1b:SetValue(s.matcheck)
35+
e1b:SetLabelObject(e1a)
36+
c:RegisterEffect(e1b)
37+
--During your next Standby Phase after this card was sent from the field to the GY: You can add 1 monster from your GY to your hand
38+
local e2a=Effect.CreateEffect(c)
39+
e2a:SetDescription(aux.Stringid(id,1))
40+
e2a:SetCategory(CATEGORY_TOHAND)
41+
e2a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
42+
e2a:SetCode(EVENT_PHASE+PHASE_STANDBY)
43+
e2a:SetRange(LOCATION_GRAVE)
44+
e2a:SetCountLimit(1,{id,1})
45+
e2a:SetCondition(function(e,tp) local c=e:GetHandler() return Duel.IsTurnPlayer(tp) and c:HasFlagEffect(id) and (c:GetFlagEffectLabel(id)==1 or c:GetTurnID()~=Duel.GetTurnCount()) end)
46+
e2a:SetTarget(s.thtg)
47+
e2a:SetOperation(s.thop)
48+
c:RegisterEffect(e2a)
49+
local e2b=Effect.CreateEffect(c)
50+
e2b:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
51+
e2b:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
52+
e2b:SetCode(EVENT_TO_GRAVE)
53+
e2b:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end)
54+
e2b:SetOperation(function(e,tp) local ct=(Duel.IsTurnPlayer(tp) and Duel.IsPhase(PHASE_STANDBY)) and 2 or 1 e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,0,ct,ct) end)
55+
c:RegisterEffect(e2b)
56+
end
57+
function s.extraval(chk,summon_type,e,...)
58+
if chk==0 then
59+
local tp,sc=...
60+
if summon_type~=SUMMON_TYPE_LINK or sc~=e:GetHandler() then
61+
return Group.CreateGroup()
62+
else
63+
local g=Duel.GetMatchingGroup(aux.NOT(Card.HasFlagEffect),tp,LOCATION_HAND,0,nil,id)
64+
for mc in g:Iter() do
65+
mc:RegisterFlagEffect(id,0,0,1)
66+
end
67+
return g
68+
end
69+
elseif chk==2 then
70+
local g=Duel.GetMatchingGroup(Card.HasFlagEffect,e:GetHandlerPlayer(),LOCATION_HAND,0,nil,id)
71+
for mc in g:Iter() do
72+
mc:ResetFlagEffect(id)
73+
end
74+
end
75+
end
76+
function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
77+
local locations=e:GetLabel()==0 and LOCATION_DECK or LOCATION_DECK|LOCATION_EXTRA
78+
if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsMonster,Card.IsAbleToGrave),tp,locations,0,1,nil) end
79+
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,locations)
80+
end
81+
function s.tgop(e,tp,eg,ep,ev,re,r,rp)
82+
local locations=e:GetLabel()==0 and LOCATION_DECK or LOCATION_DECK|LOCATION_EXTRA
83+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
84+
local g=Duel.SelectMatchingCard(tp,aux.AND(Card.IsMonster,Card.IsAbleToGrave),tp,locations,0,1,1,nil)
85+
if #g>0 then
86+
Duel.SendtoGrave(g,REASON_EFFECT)
87+
end
88+
end
89+
function s.matcheckfilter(c,tp)
90+
return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp)
91+
end
92+
function s.matcheck(e,c)
93+
local mg=c:GetMaterial()
94+
e:GetLabelObject():SetLabel(mg:FilterCount(s.matcheckfilter,nil,e:GetHandlerPlayer())==#mg and 1 or 0)
95+
end
96+
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
97+
if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_GRAVE,0,1,nil) end
98+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
99+
end
100+
function s.thop(e,tp,eg,ep,ev,re,r,rp)
101+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
102+
local g=Duel.SelectMatchingCard(tp,aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_GRAVE,0,1,1,nil)
103+
if #g>0 then
104+
Duel.HintSelection(g)
105+
Duel.SendtoHand(g,nil,REASON_EFFECT)
106+
end
107+
end

pre-release/c101305060.lua

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
--霊力回復薬
2+
--Spiritual Power Recovery Potion
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Banish any number of Spellcaster monsters and/or Spells from your GY; all monsters you currently control gain 200 ATK for each card banished this way, and if they do, you gain 400 LP for each card banished this way
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_RECOVER)
10+
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
12+
e1:SetCode(EVENT_FREE_CHAIN)
13+
e1:SetCountLimit(1,id)
14+
e1:SetCost(s.atkcost)
15+
e1:SetTarget(s.atktg)
16+
e1:SetOperation(s.atkop)
17+
e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMING_END_PHASE)
18+
c:RegisterEffect(e1)
19+
--During your Main Phase: You can banish this card from your GY; Special Summon any number of Spellcaster monsters with different Attributes from your hand
20+
local e2=Effect.CreateEffect(c)
21+
e2:SetDescription(aux.Stringid(id,1))
22+
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
23+
e2:SetType(EFFECT_TYPE_IGNITION)
24+
e2:SetRange(LOCATION_GRAVE)
25+
e2:SetCountLimit(1,id)
26+
e2:SetCost(Cost.SelfBanish)
27+
e2:SetTarget(s.sptg)
28+
e2:SetOperation(s.spop)
29+
c:RegisterEffect(e2)
30+
end
31+
s.listed_series={SET_POSSESSED}
32+
function s.atkcostfilter(c)
33+
return (c:IsRace(RACE_SPELLCASTER) or c:IsSpell()) and c:IsAbleToRemoveAsCost()
34+
end
35+
function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
36+
if chk==0 then return Duel.IsExistingMatchingCard(s.atkcostfilter,tp,LOCATION_GRAVE,0,1,nil) end
37+
local max_count=Duel.GetMatchingGroupCount(s.atkcostfilter,tp,LOCATION_GRAVE,0,nil)
38+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
39+
local g=Duel.SelectMatchingCard(tp,s.atkcostfilter,tp,LOCATION_GRAVE,0,1,max_count,nil)
40+
Duel.Remove(g,POS_FACEUP,REASON_COST)
41+
e:SetLabel(#g)
42+
end
43+
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
44+
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
45+
local banish_count=e:GetLabel()
46+
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
47+
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,1,tp,200*banish_count)
48+
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,400*banish_count)
49+
end
50+
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
51+
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
52+
if #g==0 then return end
53+
local prev_atk=0
54+
local c=e:GetHandler()
55+
local banish_count=e:GetLabel()
56+
local atk=200*banish_count
57+
local atk_change_chk=false
58+
for atkc in g:Iter() do
59+
prev_atk=atkc:GetAttack()
60+
--All monsters you currently control gain 200 ATK for each card banished this way
61+
atkc:UpdateAttack(atk,RESET_EVENT|RESETS_STANDARD,c)
62+
if not atk_change_chk and atkc:GetAttack()>prev_atk then
63+
atk_change_chk=true
64+
end
65+
end
66+
if not atk_change_chk then return end
67+
Duel.Recover(tp,400*banish_count,REASON_EFFECT)
68+
end
69+
function s.spfilter(c,e,tp)
70+
return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
71+
end
72+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
73+
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
74+
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
75+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
76+
end
77+
function s.spop(e,tp,eg,ep,ev,re,r,rp)
78+
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
79+
if ft<=0 then return end
80+
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp)
81+
if #g==0 then return end
82+
local max_attribute_count=g:GetClassCount(Card.GetAttribute)
83+
ft=math.min(ft,max_attribute_count)
84+
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end
85+
local sg=aux.SelectUnselectGroup(g,e,tp,1,max_attribute_count,aux.dpcheck(Card.GetAttribute),1,tp,HINTMSG_SPSUMMON)
86+
if #sg>0 then
87+
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
88+
end
89+
end

0 commit comments

Comments
 (0)