Skip to content

Commit 9f304a1

Browse files
authored
Added new card scripts
1 parent d9f4a85 commit 9f304a1

2 files changed

Lines changed: 179 additions & 0 deletions

File tree

‎pre-release/c100200298.lua‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
--カウンターマジック「攻撃の無力化」
2+
--Counter Spell "Negate Attack"
3+
--scripted by Naim
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--During the Battle Phase: Activate 1 of these effects;
7+
--● When an opponent's monster declares an attack while they control more monsters than you do: Negate the attack, then end the Battle Phase
8+
--● When your opponent activates a monster effect: Negate that effect, and if you do, destroy that monster
9+
local e1=Effect.CreateEffect(c)
10+
e1:SetDescription(aux.Stringid(id,0))
11+
e1:SetType(EFFECT_TYPE_ACTIVATE)
12+
e1:SetCode(EVENT_FREE_CHAIN)
13+
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)
14+
return Duel.IsBattlePhase()
15+
end)
16+
e1:SetTarget(s.efftg)
17+
e1:SetOperation(s.effop)
18+
c:RegisterEffect(e1)
19+
--When you draw for your normal draw in your Draw Phase: You can banish this card from your GY; Special Summon 1 monster 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_FIELD+EFFECT_TYPE_TRIGGER_O)
24+
e2:SetCode(EVENT_DRAW)
25+
e2:SetRange(LOCATION_GRAVE)
26+
e2:SetCondition(s.spcon)
27+
e2:SetCost(Cost.SelfBanish)
28+
e2:SetTarget(s.sptg)
29+
e2:SetOperation(s.spop)
30+
c:RegisterEffect(e2)
31+
end
32+
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk)
33+
--● When an opponent's monster declares an attack while they control more monsters than you do: Negate the attack, then end the Battle Phase
34+
local option_1=Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and Duel.GetAttacker():IsControler(1-tp)
35+
and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
36+
--● When your opponent activates a monster effect: Negate that effect, and if you do, destroy that monster
37+
local event_check,_,event_player,event_value,event_reff=Duel.CheckEvent(EVENT_CHAINING,true)
38+
local option_2=event_check and event_player==1-tp and event_reff:IsMonsterEffect() and Chain.IsDisablable(event_value)
39+
if chk==0 then return option_1 or option_2 end
40+
local choice=Duel.SelectEffect(tp,
41+
{option_1,aux.Stringid(id,2)},
42+
{option_2,aux.Stringid(id,3)})
43+
local chain_data=e:GetChainData()
44+
chain_data.choice=choice
45+
if choice==1 then
46+
--● When an opponent's monster declares an attack while they control more monsters than you do: Negate the attack, then end the Battle Phase
47+
e:SetCategory(0)
48+
elseif choice==2 then
49+
--● When your opponent activates a monster effect: Negate that effect, and if you do, destroy that monster
50+
e:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY)
51+
local event_rcard=event_reff:GetHandler()
52+
chain_data.event_value=event_value
53+
chain_data.event_rcard=event_rcard
54+
chain_data.event_reff=event_reff
55+
Duel.SetOperationInfo(0,CATEGORY_DISABLE,event_rcard,1,tp,0)
56+
if event_rcard:IsDestructable() and event_rcard:IsRelateToEffect(event_reff) then
57+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,event_rcard,1,tp,0)
58+
end
59+
end
60+
end
61+
function s.effop(e,tp,eg,ep,ev,re,r,rp)
62+
local chain_data=e:GetChainData()
63+
if chain_data.choice==1 then
64+
--● When an opponent's monster declares an attack while they control more monsters than you do: Negate the attack, then end the Battle Phase
65+
if Duel.NegateAttack() then
66+
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1)
67+
end
68+
elseif chain_data.choice==2 then
69+
--● When your opponent activates a monster effect: Negate that effect, and if you do, destroy that monster
70+
local event_value=chain_data.event_value
71+
local event_rcard=chain_data.event_rcard
72+
local event_reff=chain_data.event_reff
73+
if Duel.NegateEffect(event_value) and event_rcard:IsRelateToEffect(event_reff) then
74+
Duel.Destroy(event_rcard,REASON_EFFECT)
75+
end
76+
end
77+
end
78+
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
79+
return ep==tp and (r&REASON_RULE)>0
80+
end
81+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
82+
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
83+
and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,nil,e,0,tp,false,false) end
84+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
85+
end
86+
function s.spop(e,tp,eg,ep,ev,re,r,rp)
87+
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
88+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
89+
local g=Duel.SelectMatchingCard(tp,Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,1,nil,e,0,tp,false,false)
90+
if #g>0 then
91+
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
92+
end
93+
end

‎pre-release/c101403021.lua‎

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
--災禍の根絶者
2+
--Heretic Eradicator
3+
--scripted by Naim
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--When your opponent would Special Summon exactly 1 monster, while this card is in your hand and your opponent has 4 or more monsters that cannot be Normal Summoned/Set in their face-up field, GY, and/or banishment (Quick Effect): You can negate the Summon, and if you do, destroy that monster, and if you do that, Special Summon this card (while you control no monsters, this effect and its activation cannot be negated)
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
10+
e1:SetType(EFFECT_TYPE_QUICK_O)
11+
e1:SetCode(EVENT_SPSUMMON)
12+
e1:SetRange(LOCATION_HAND)
13+
e1:SetCountLimit(1,{id,0})
14+
e1:SetCondition(s.negspcon)
15+
e1:SetTarget(s.negsptg)
16+
e1:SetOperation(s.negspop)
17+
e1:SetLabel(id)
18+
c:RegisterEffect(e1)
19+
--While you control no monsters, this effect and its activation cannot be negated
20+
aux.GlobalCheck(s,function()
21+
local ge1=Effect.CreateEffect(c)
22+
ge1:SetType(EFFECT_TYPE_FIELD)
23+
ge1:SetCode(EFFECT_CANNOT_INACTIVATE)
24+
ge1:SetValue(function(e,ct)
25+
local trig_eff=Chain.GetTriggeringEffect(ct)
26+
local trig_player=Chain.GetTriggeringPlayer(ct)
27+
return trig_eff:GetLabel()==id and Duel.GetFieldGroupCount(trig_player,LOCATION_MZONE,0)==0
28+
end)
29+
Duel.RegisterEffect(ge1,0)
30+
local ge2=ge1:Clone()
31+
ge2:SetCode(EFFECT_CANNOT_DISEFFECT)
32+
Duel.RegisterEffect(ge2,0)
33+
end)
34+
--You can send this card from the field to the GY; halve the ATK of 1 monster on the field
35+
local e2=Effect.CreateEffect(c)
36+
e2:SetDescription(aux.Stringid(id,1))
37+
e2:SetCategory(CATEGORY_ATKCHANGE)
38+
e2:SetType(EFFECT_TYPE_IGNITION)
39+
e2:SetRange(LOCATION_MZONE)
40+
e2:SetCountLimit(1,{id,1})
41+
e2:SetCost(Cost.SelfToGrave)
42+
e2:SetTarget(s.atktg)
43+
e2:SetOperation(s.atkop)
44+
c:RegisterEffect(e2)
45+
end
46+
function s.negspconfilter(c)
47+
return not c:IsSummonableCard() and c:IsMonster() and c:IsFaceup()
48+
end
49+
function s.negspcon(e,tp,eg,ep,ev,re,r,rp)
50+
return ep==1-tp and Duel.GetCurrentChain()==0 and #eg==1
51+
and Duel.IsExistingMatchingCard(s.negspconfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE|LOCATION_REMOVED,4,nil)
52+
end
53+
function s.negsptg(e,tp,eg,ep,ev,re,r,rp,chk)
54+
local c=e:GetHandler()
55+
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
56+
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
57+
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,1,tp,0)
58+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0)
59+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0)
60+
end
61+
function s.negspop(e,tp,eg,ep,ev,re,r,rp)
62+
local c=e:GetHandler()
63+
Duel.NegateSummon(eg)
64+
if Duel.Destroy(eg,REASON_EFFECT)>0 and c:IsRelateToEffect(e) then
65+
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
66+
end
67+
end
68+
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
69+
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
70+
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,nil,1,tp,LOCATION_MZONE)
71+
end
72+
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
73+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF)
74+
local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil):GetFirst()
75+
if sc then
76+
Duel.HintSelection(sc)
77+
--Halve the ATK of 1 monster on the field
78+
local e1=Effect.CreateEffect(e:GetHandler())
79+
e1:SetType(EFFECT_TYPE_SINGLE)
80+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
81+
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
82+
e1:SetValue(sc:GetAttack()/2)
83+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
84+
sc:RegisterEffect(e1)
85+
end
86+
end

0 commit comments

Comments
 (0)