Skip to content

Commit 90326ee

Browse files
authored
Various card script fixes
- Explosive Magician: Shouldn't destroy the target if you control it on resolution + shouldn't be treated as a card that places Spell Counters. - Necro Defender: Shouldn't be able to target the same monster twice with this effect + fixed some issues with the "no battle damage" part of the effect regarding control switching. - T.G. Halberd Cannon/Assault Mode: Shouldn't need to still be face-up on the field for the summon negation effect to resolve + its 2nd effect should trigger if it's destroyed on the field, not if it's destroyed in your possession. - Other small fixes and updates. Their Summon negation effect should also check that the player can banish in order to activate the effect: - Infernoid Flood - Primite Scream - Sauravis, the Ancient and Ascended - T.G. Halberd Cannon/Assault Mode - Updated "Duel.Overlay": Now raises the "EVENT_MOVE" event, fixing an issue where the effects of "Guiding Quem, the Virtuous" and "Despian Luluwalilith" wouldn't trigger if a card was attached as Xyz Material directly from the Extra Deck.
1 parent a3df0ee commit 90326ee

11 files changed

Lines changed: 242 additions & 284 deletions

official/c14553285.lua

Lines changed: 43 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,80 +4,63 @@ local s,id=GetID()
44
function s.initial_effect(c)
55
c:EnableReviveLimit()
66
c:EnableCounterPermit(COUNTER_SPELL)
7-
--Cannot special summon
7+
c:AddMustBeSpecialSummoned()
8+
--Place 2 Spell Counters on it
89
local e1=Effect.CreateEffect(c)
9-
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
10-
e1:SetType(EFFECT_TYPE_SINGLE)
11-
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
12-
e1:SetValue(aux.FALSE)
10+
e1:SetDescription(aux.Stringid(id,0))
11+
e1:SetCategory(CATEGORY_COUNTER)
12+
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
13+
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
14+
e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COUNTER,e:GetHandler(),2,tp,COUNTER_SPELL) end)
15+
e1:SetOperation(s.counterop)
1316
c:RegisterEffect(e1)
14-
--counter
17+
--Gains 1000 ATK for each Spell Counter on it
1518
local e2=Effect.CreateEffect(c)
16-
e2:SetDescription(aux.Stringid(id,0))
17-
e2:SetCategory(CATEGORY_COUNTER)
18-
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
19-
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
20-
e2:SetTarget(s.addct)
21-
e2:SetOperation(s.addc)
19+
e2:SetType(EFFECT_TYPE_SINGLE)
20+
e2:SetCode(EFFECT_UPDATE_ATTACK)
21+
e2:SetValue(function(e,c) return c:GetCounter(COUNTER_SPELL)*1000 end)
2222
c:RegisterEffect(e2)
23-
--increase ATK
23+
--Destroy all cards your opponent controls
2424
local e3=Effect.CreateEffect(c)
25-
e3:SetType(EFFECT_TYPE_SINGLE)
26-
e3:SetCode(EFFECT_UPDATE_ATTACK)
27-
e3:SetValue(s.attackup)
25+
e3:SetDescription(aux.Stringid(id,1))
26+
e3:SetCategory(CATEGORY_DESTROY)
27+
e3:SetType(EFFECT_TYPE_IGNITION)
28+
e3:SetRange(LOCATION_MZONE)
29+
e3:SetCost(Cost.RemoveCounterFromSelf(COUNTER_SPELL,2))
30+
e3:SetTarget(s.destg)
31+
e3:SetOperation(s.desop)
2832
c:RegisterEffect(e3)
29-
--destroy
33+
--Special Summon 1 "Arcanite Magician" from your GY
3034
local e4=Effect.CreateEffect(c)
31-
e4:SetDescription(aux.Stringid(id,1))
32-
e4:SetCategory(CATEGORY_DESTROY)
33-
e4:SetType(EFFECT_TYPE_IGNITION)
34-
e4:SetRange(LOCATION_MZONE)
35-
e4:SetCost(s.descost)
36-
e4:SetTarget(s.destg)
37-
e4:SetOperation(s.desop)
35+
e4:SetDescription(aux.Stringid(id,2))
36+
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
37+
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
38+
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
39+
e4:SetCode(EVENT_DESTROYED)
40+
e4:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end)
41+
e4:SetTarget(s.sptg)
42+
e4:SetOperation(s.spop)
3843
c:RegisterEffect(e4)
39-
--Special summon
40-
local e5=Effect.CreateEffect(c)
41-
e5:SetDescription(aux.Stringid(id,2))
42-
e5:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
43-
e5:SetCategory(CATEGORY_SPECIAL_SUMMON)
44-
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
45-
e5:SetCode(EVENT_DESTROYED)
46-
e5:SetCondition(s.spcon)
47-
e5:SetTarget(s.sptg)
48-
e5:SetOperation(s.spop)
49-
c:RegisterEffect(e5)
5044
end
5145
s.counter_place_list={COUNTER_SPELL}
52-
s.listed_names={CARD_ASSAULT_MODE,31924889}
46+
s.listed_names={CARD_ASSAULT_MODE,31924889} --"Arcanite Magician"
5347
s.assault_mode=31924889
54-
function s.addct(e,tp,eg,ep,ev,re,r,rp,chk)
55-
if chk==0 then return true end
56-
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,2,0,COUNTER_SPELL)
57-
end
58-
function s.addc(e,tp,eg,ep,ev,re,r,rp)
59-
if e:GetHandler():IsRelateToEffect(e) then
60-
e:GetHandler():AddCounter(COUNTER_SPELL,2)
48+
function s.counterop(e,tp,eg,ep,ev,re,r,rp)
49+
local c=e:GetHandler()
50+
if c:IsRelateToEffect(e) then
51+
c:AddCounter(COUNTER_SPELL,2)
6152
end
6253
end
63-
function s.attackup(e,c)
64-
return c:GetCounter(COUNTER_SPELL)*1000
65-
end
66-
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
67-
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,COUNTER_SPELL,2,REASON_COST) end
68-
e:GetHandler():RemoveCounter(tp,COUNTER_SPELL,2,REASON_COST)
69-
end
7054
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
71-
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
72-
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
73-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
55+
local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD)
56+
if chk==0 then return #g>0 end
57+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0)
7458
end
7559
function s.desop(e,tp,eg,ep,ev,re,r,rp)
76-
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
77-
Duel.Destroy(g,REASON_EFFECT)
78-
end
79-
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
80-
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
60+
local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD)
61+
if #g>0 then
62+
Duel.Destroy(g,REASON_EFFECT)
63+
end
8164
end
8265
function s.spfilter(c,e,tp)
8366
return c:IsCode(31924889) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
@@ -88,11 +71,11 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
8871
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
8972
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
9073
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
91-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
74+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0)
9275
end
9376
function s.spop(e,tp,eg,ep,ev,re,r,rp)
9477
local tc=Duel.GetFirstTarget()
95-
if tc and tc:IsRelateToEffect(e) then
78+
if tc:IsRelateToEffect(e) then
9679
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
9780
end
9881
end

official/c21113684.lua

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,23 @@ local s,id=GetID()
44
function s.initial_effect(c)
55
c:EnableReviveLimit()
66
c:EnableCounterPermit(COUNTER_SPELL)
7-
--Fusion Materials
7+
--Fusion Materials: 1 Spellcaster Synchro Monster + 1 Spellcaster monster
88
Fusion.AddProcMix(c,true,true,s.matfilter,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER))
9-
--Must first be Fusion Summoned
10-
local e0=Effect.CreateEffect(c)
11-
e0:SetType(EFFECT_TYPE_SINGLE)
12-
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
13-
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
14-
e0:SetRange(LOCATION_EXTRA)
15-
e0:SetValue(aux.fuslimit)
16-
c:RegisterEffect(e0)
17-
--Place 2 Spell Counters on this card
9+
c:AddMustFirstBeFusionSummoned()
10+
--Place 2 Spell Counters on it
1811
local e1=Effect.CreateEffect(c)
1912
e1:SetDescription(aux.Stringid(id,0))
2013
e1:SetCategory(CATEGORY_COUNTER)
2114
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
2215
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
2316
e1:SetCondition(function(e) return e:GetHandler():IsFusionSummoned() end)
24-
e1:SetTarget(s.cntrtg)
25-
e1:SetOperation(s.cntrop)
17+
e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COUNTER,e:GetHandler(),2,tp,COUNTER_SPELL) end)
18+
e1:SetOperation(s.counterop)
2619
c:RegisterEffect(e1)
2720
--Gains 1000 ATK for each Spell Counter on it
2821
local e2=Effect.CreateEffect(c)
2922
e2:SetType(EFFECT_TYPE_SINGLE)
30-
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
3123
e2:SetCode(EFFECT_UPDATE_ATTACK)
32-
e2:SetRange(LOCATION_MZONE)
3324
e2:SetValue(function(e,c) return c:GetCounter(COUNTER_SPELL)*1000 end)
3425
c:RegisterEffect(e2)
3526
--Activate 1 of these effects
@@ -38,7 +29,7 @@ function s.initial_effect(c)
3829
e3:SetType(EFFECT_TYPE_IGNITION)
3930
e3:SetRange(LOCATION_MZONE)
4031
e3:SetCountLimit(1)
41-
e3:SetCost(s.effcost)
32+
e3:SetCost(Cost.RemoveCounterFromField(COUNTER_SPELL,1))
4233
e3:SetTarget(s.efftg)
4334
e3:SetOperation(s.effop)
4435
c:RegisterEffect(e3)
@@ -48,20 +39,12 @@ s.miracle_synchro_fusion=true
4839
function s.matfilter(c,fc,sumtype,tp)
4940
return c:IsType(TYPE_SYNCHRO,fc,sumtype,tp) and c:IsRace(RACE_SPELLCASTER,fc,sumtype,tp)
5041
end
51-
function s.cntrtg(e,tp,eg,ep,ev,re,r,rp,chk)
52-
if chk==0 then return true end
53-
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,2,0,COUNTER_SPELL)
54-
end
55-
function s.cntrop(e,tp,eg,ep,ev,re,r,rp)
42+
function s.counterop(e,tp,eg,ep,ev,re,r,rp)
5643
local c=e:GetHandler()
5744
if c:IsRelateToEffect(e) then
5845
c:AddCounter(COUNTER_SPELL,2)
5946
end
6047
end
61-
function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk)
62-
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,COUNTER_SPELL,1,REASON_COST) end
63-
Duel.RemoveCounter(tp,1,0,COUNTER_SPELL,1,REASON_COST)
64-
end
6548
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
6649
if chkc then return e:GetLabel()==1 and chkc:IsOnField() end
6750
local b1=Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)

official/c27556460.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function s.negsumcon(e,tp,eg,ep,ev,re,r,rp)
4040
and Duel.IsExistingMatchingCard(s.negsumconfilter,tp,LOCATION_MZONE,0,1,nil)
4141
end
4242
function s.negsumtg(e,tp,eg,ep,ev,re,r,rp,chk)
43-
if chk==0 then return true end
43+
if chk==0 then return eg:IsExists(Card.IsAbleToRemove,1,nil) end
4444
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0)
4545
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,#eg,0,0)
4646
end

official/c33413279.lua

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,32 @@
22
--Explosive Magician
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--synchro summon
6-
Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_SPELLCASTER),1,99)
75
c:EnableReviveLimit()
8-
--destroy
6+
--Synchro Summon procedure: 1 Tuner + 1+ non-Tuner Spellcaster monsters
7+
Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_SPELLCASTER),1,99)
8+
--Destroy 1 Spell/Trap your opponent controls
99
local e1=Effect.CreateEffect(c)
1010
e1:SetDescription(aux.Stringid(id,0))
1111
e1:SetCategory(CATEGORY_DESTROY)
1212
e1:SetType(EFFECT_TYPE_IGNITION)
13-
e1:SetRange(LOCATION_MZONE)
1413
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
15-
e1:SetCost(s.descost)
14+
e1:SetRange(LOCATION_MZONE)
15+
e1:SetCost(Cost.RemoveCounterFromField(COUNTER_SPELL,2))
1616
e1:SetTarget(s.destg)
1717
e1:SetOperation(s.desop)
1818
c:RegisterEffect(e1)
1919
end
20-
s.counter_place_list={COUNTER_SPELL}
21-
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
22-
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,COUNTER_SPELL,2,REASON_COST) end
23-
Duel.RemoveCounter(tp,1,0,COUNTER_SPELL,2,REASON_COST)
24-
end
25-
function s.filter(c)
26-
return c:IsSpellTrap()
27-
end
20+
s.counter_list={COUNTER_SPELL}
2821
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
29-
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and s.filter(chkc) end
30-
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_ONFIELD,1,nil) end
22+
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsSpellTrap() end
23+
if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) end
3124
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
32-
local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_ONFIELD,1,1,nil)
33-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
25+
local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil)
26+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0)
3427
end
3528
function s.desop(e,tp,eg,ep,ev,re,r,rp)
3629
local tc=Duel.GetFirstTarget()
37-
if tc:IsRelateToEffect(e) then
30+
if tc:IsRelateToEffect(e) and tc:IsControler(1-tp) then
3831
Duel.Destroy(tc,REASON_EFFECT)
3932
end
4033
end

official/c34446231.lua

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
local s,id=GetID()
55
function s.initial_effect(c)
66
c:EnableReviveLimit()
7-
--Link Summon procedure
7+
--Link Summon procedure: 2+ monsters, including an "Infernoid" monster
88
Link.AddProcedure(c,nil,2,nil,s.matcheck)
99
--Negate an opponent's Special Summon and banish that monster(s)
1010
local e1=Effect.CreateEffect(c)
@@ -28,9 +28,9 @@ function s.initial_effect(c)
2828
e2:SetCode(EVENT_REMOVE)
2929
e2:SetRange(LOCATION_MZONE)
3030
e2:SetCountLimit(1,{id,1})
31-
e2:SetCondition(s.rmvcond)
32-
e2:SetTarget(s.rmvtg)
33-
e2:SetOperation(s.rmvop)
31+
e2:SetCondition(s.rmcon)
32+
e2:SetTarget(s.rmtg)
33+
e2:SetOperation(s.rmop)
3434
c:RegisterEffect(e2)
3535
--Special Summon 1 "Infernoid" monster from your Deck
3636
local e3=Effect.CreateEffect(c)
@@ -55,37 +55,36 @@ function s.negsumcost(e,tp,eg,ep,ev,re,r,rp,chk)
5555
Duel.Release(g,REASON_COST)
5656
end
5757
function s.negsumtg(e,tp,eg,ep,ev,re,r,rp,chk)
58-
if chk==0 then return true end
59-
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0)
60-
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,#eg,0,0)
58+
if chk==0 then return eg:IsExists(Card.IsAbleToRemove,1,nil) end
59+
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,tp,0)
60+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,#eg,tp,0)
6161
end
6262
function s.negsumop(e,tp,eg,ep,ev,re,r,rp)
6363
Duel.NegateSummon(eg)
6464
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
6565
end
66-
function s.cfilter(c,tp)
66+
function s.rmconfilter(c,tp)
6767
return c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp)
6868
end
69-
function s.rmvcond(e,tp,eg,ep,ev,re,r,rp)
70-
return eg:IsExists(s.cfilter,1,nil,tp)
69+
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
70+
return eg:IsExists(s.rmconfilter,1,nil,tp)
7171
end
72-
function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk)
72+
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
7373
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
7474
if chk==0 then return #g>0 end
7575
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,PLAYER_EITHER,LOCATION_ONFIELD)
7676
end
77-
function s.rmvop(e,tp,eg,ep,ev,re,r,rp)
77+
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
7878
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
7979
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
8080
if #g>0 then
81-
Duel.HintSelection(g,true)
81+
Duel.HintSelection(g)
8282
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
8383
end
8484
end
8585
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
8686
local c=e:GetHandler()
87-
return rp==1-tp and c:IsLinkSummoned()
88-
and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
87+
return rp==1-tp and c:IsLinkSummoned() and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE)
8988
end
9089
function s.spfilter(c,e,tp)
9190
return c:IsSetCard(SET_INFERNOID) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,false)

0 commit comments

Comments
 (0)