Skip to content

Commit 2aa46b7

Browse files
authored
Various card script fixes
- Agido the Ancient Sentinel: Sending another 5 cards from the top of either player's Deck to the GY shouldn't happen at the same time as the initial sending of the top 5 cards from each player's Deck to the GY. - Armory Call: Adding the card to your hand and equipping it shouldn't happen at the same time. - Automatic Laser: Shouldn't check that the summoned monster(s) is still face-up and has 1000 or more ATK on resolution. - Backlinker: Should also shuffle face-down monsters into the Deck. Should exclude itself in the activation check when checking if there's a card to shuffle into the Deck for cases where a monster in the EMZ copies this card's effect. - Beast King Unleashed: Shouldn't return if you don't control the monster on resolution. - Code Hack: Shouldn't protect from your own effects. - Disenchanter: Should remove a Spell Counter on resolution, not as cost. - Doom-Z Zero - Drastia/Doom-Z Five - Amalthe/Doom-Z Seven - Elara: Don't allow their Xyz Summoning effects to be used if they're equipped with a Token. - Evilswarm Coppelia: Its effect should activate even if there's no valid target since it's mandatory. - Frightfur Cruel Whale: Added a hint timing for "before damage calculation" during your turn. - Gearfried the Swordmaster: Shouldn't destroy the target if you control it on resolution. - Junk Synchron: The effect negation should disappear immediately if the summoned monster is flipped face-down. - Kashtira Shangri-Ira: Fixed an issue where the wrong zone would be blocked if control of this card had switched by the time the effect resolved. - Mekk-Knight Blue Sky: Fixed an issue where it wasn't counting itself if the opponent controls it when its search effect resolves. - Nightmare Throne: Fixed an issue where in some cases its effect would trigger in the next Chain. - Penguin Torpedo: The effect negation and the "cannot attack" effect should disappear if the monster is flipped face-down or changes control again. - Primordial Soup: Should be able to use its effect even if you have 0 cards in your Deck. Also check that the cards to shuffle are monsters. - Super Soldier Soul: Fixed an issue where the effects would remain applied for longer than they should if control of this card changed. - Tyrant's Tirade: Should prevent monsters that are unaffected by Traps from activating their effects. - Various other small updates and fixes.
1 parent 02516d5 commit 2aa46b7

38 files changed

Lines changed: 604 additions & 679 deletions

official/c17679043.lua

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,78 +3,67 @@
33
--scripted by Naim
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Caan attack directly
6+
--This card can attack directly
77
local e1=Effect.CreateEffect(c)
88
e1:SetType(EFFECT_TYPE_SINGLE)
99
e1:SetCode(EFFECT_DIRECT_ATTACK)
1010
c:RegisterEffect(e1)
11-
--Take control of a target
11+
--Take control of 1 Level 6 or lower monster your opponent controls until the End Phase, but its effects are negated, also it cannot declare an attack, while you control it
1212
local e2=Effect.CreateEffect(c)
1313
e2:SetDescription(aux.Stringid(id,0))
1414
e2:SetCategory(CATEGORY_CONTROL)
1515
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
1616
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
1717
e2:SetCode(EVENT_BATTLE_DAMAGE)
1818
e2:SetCountLimit(1,id)
19-
e2:SetCondition(s.condition)
20-
e2:SetTarget(s.target)
21-
e2:SetOperation(s.operation)
19+
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp end)
20+
e2:SetTarget(s.ctrltg)
21+
e2:SetOperation(s.ctrlop)
2222
c:RegisterEffect(e2)
23-
--destroy itself
23+
--Destroy this card
2424
local e3=Effect.CreateEffect(c)
2525
e3:SetDescription(aux.Stringid(id,1))
2626
e3:SetCategory(CATEGORY_DESTROY)
2727
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
2828
e3:SetCode(EVENT_DAMAGE_STEP_END)
29-
e3:SetCondition(s.descon)
29+
e3:SetCondition(function(e) return e:GetHandler()==Duel.GetAttacker() end)
3030
e3:SetTarget(s.destg)
3131
e3:SetOperation(s.desop)
3232
c:RegisterEffect(e3)
3333
end
34-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
35-
return ep==1-tp
34+
function s.ctrlfilter(c)
35+
return c:IsLevelBelow(6) and c:IsFaceup() and c:IsControlerCanBeChanged()
3636
end
37-
function s.cfilter(c)
38-
return c:IsFaceup() and c:HasLevel() and c:IsLevelBelow(6) and c:IsControlerCanBeChanged()
39-
end
40-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
41-
if chkc then return chkc:IsControler(1-tp) and s.cfilter(chkc) end
42-
if chk==0 then return Duel.IsExistingTarget(s.cfilter,tp,0,LOCATION_MZONE,1,nil) end
37+
function s.ctrltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
38+
if chkc then return chkc:IsControler(1-tp) and s.ctrlfilter(chkc) end
39+
if chk==0 then return Duel.IsExistingTarget(s.ctrlfilter,tp,0,LOCATION_MZONE,1,nil) end
4340
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
44-
local g=Duel.SelectTarget(tp,s.cfilter,tp,0,LOCATION_MZONE,1,1,nil)
45-
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
41+
local g=Duel.SelectTarget(tp,s.ctrlfilter,tp,0,LOCATION_MZONE,1,1,nil)
42+
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0)
4643
end
47-
function s.operation(e,tp,eg,ep,ev,re,r,rp)
44+
function s.ctrlop(e,tp,eg,ep,ev,re,r,rp)
4845
local tc=Duel.GetFirstTarget()
4946
if tc:IsRelateToEffect(e) and Duel.GetControl(tc,tp,PHASE_END,1) then
5047
local c=e:GetHandler()
48+
--Its effects are negated while you control it
49+
tc:NegateEffects(c,RESET_CONTROL)
50+
--It cannot declare an attack while you control it
5151
local e1=Effect.CreateEffect(c)
52+
e1:SetDescription(3206)
5253
e1:SetType(EFFECT_TYPE_SINGLE)
53-
e1:SetCode(EFFECT_DISABLE)
54-
e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END)
54+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
55+
e1:SetCode(EFFECT_CANNOT_ATTACK)
56+
e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL)
5557
tc:RegisterEffect(e1)
56-
local e2=Effect.CreateEffect(c)
57-
e2:SetType(EFFECT_TYPE_SINGLE)
58-
e2:SetCode(EFFECT_DISABLE_EFFECT)
59-
e2:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END)
60-
tc:RegisterEffect(e2)
61-
local e3=Effect.CreateEffect(c)
62-
e3:SetType(EFFECT_TYPE_SINGLE)
63-
e3:SetCode(EFFECT_CANNOT_ATTACK)
64-
e3:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END)
65-
tc:RegisterEffect(e3)
6658
end
6759
end
68-
function s.descon(e,tp,eg,ep,ev,re,r,rp)
69-
return e:GetHandler()==Duel.GetAttacker()
70-
end
7160
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
7261
if chk==0 then return true end
73-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
62+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,tp,0)
7463
end
7564
function s.desop(e,tp,eg,ep,ev,re,r,rp)
7665
local c=e:GetHandler()
77-
if c and c:IsRelateToEffect(e) then
66+
if c:IsRelateToEffect(e) then
7867
Duel.Destroy(c,REASON_EFFECT)
7968
end
8069
end

official/c17749468.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,13 @@ end
6666
function s.selfspcon(e,c)
6767
if not c then return true end
6868
local tp=c:GetControler()
69-
local mg=Duel.GetMatchingGroup(s.selfspcostfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp,e:GetHandler())
69+
local mg=Duel.GetMatchingGroup(s.selfspcostfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp,c)
7070
return #mg>=2 and aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon,0)
7171
end
7272
function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
73-
local mg=Duel.GetMatchingGroup(s.selfspcostfilter,tp,LOCATION_ONFIELD,LOCATION_MZONE,nil,tp,e:GetHandler())
73+
local mg=Duel.GetMatchingGroup(s.selfspcostfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp,c)
7474
local g=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon,1,tp,HINTMSG_RELEASE,nil,nil,true)
7575
if #g>0 then
76-
g:KeepAlive()
7776
e:SetLabelObject(g)
7877
return true
7978
end
@@ -83,7 +82,6 @@ function s.selfspop(e,tp,eg,ep,ev,re,r,rp,c)
8382
local g=e:GetLabelObject()
8483
if not g then return end
8584
Duel.Release(g,REASON_COST|REASON_MATERIAL)
86-
g:DeleteGroup()
8785
end
8886
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
8987
if rp~=1-tp then return end

official/c19000848.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function s.initial_effect(c)
66
--Monsters in your leftmost or rightmost Main Monster Zones cannot be destroyed by card effects
77
local e1=Effect.CreateEffect(c)
88
e1:SetType(EFFECT_TYPE_FIELD)
9-
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
109
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
10+
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
1111
e1:SetRange(LOCATION_MZONE)
1212
e1:SetTargetRange(LOCATION_MZONE,0)
1313
e1:SetTarget(function(e,c) return c:IsSequence(0,4) or (Duel.IsDuelType(DUEL_3_COLUMNS_FIELD) and c:IsSequence(1,3)) end)
@@ -76,4 +76,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
7676
Duel.SendtoHand(g,nil,REASON_EFFECT)
7777
Duel.ConfirmCards(1-tp,g)
7878
end
79-
end
79+
end

official/c20537097.lua

Lines changed: 33 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,62 @@
33
--Scripted by Eerie Code
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Special Summon itself from hand
6+
--If 2 or more cards are in the same column, you can Special Summon this card (from your hand) in that column
77
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
89
e1:SetType(EFFECT_TYPE_FIELD)
9-
e1:SetCode(EFFECT_SPSUMMON_PROC)
1010
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
11+
e1:SetCode(EFFECT_SPSUMMON_PROC)
1112
e1:SetRange(LOCATION_HAND)
1213
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
13-
e1:SetValue(s.hspval)
14+
e1:SetValue(s.spval)
1415
c:RegisterEffect(e1)
15-
--If Normal or Special Summoned, add "Mekk-Knight" monster(s) from Deck
16-
local e2=Effect.CreateEffect(c)
17-
e2:SetDescription(aux.Stringid(id,0))
18-
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
19-
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
20-
e2:SetCode(EVENT_SUMMON_SUCCESS)
21-
e2:SetProperty(EFFECT_FLAG_DELAY)
22-
e2:SetCountLimit(1,{id,1})
23-
e2:SetTarget(s.thtg)
24-
e2:SetOperation(s.thop)
25-
c:RegisterEffect(e2)
26-
local e3=e2:Clone()
27-
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
28-
e3:SetCondition(s.thcon)
29-
c:RegisterEffect(e3)
16+
--Add "Mekk-Knight" monsters with different names, except "Mekk-Knight Blue Sky", from your Deck to your hand, equal to the number of your opponent's cards in this card's column
17+
local e2a=Effect.CreateEffect(c)
18+
e2a:SetDescription(aux.Stringid(id,1))
19+
e2a:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
20+
e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
21+
e2a:SetProperty(EFFECT_FLAG_DELAY)
22+
e2a:SetCode(EVENT_SUMMON_SUCCESS)
23+
e2a:SetCountLimit(1,{id,1})
24+
e2a:SetCondition(function(e) return e:GetHandler():IsSummonLocation(LOCATION_HAND) end)
25+
e2a:SetTarget(s.thtg)
26+
e2a:SetOperation(s.thop)
27+
c:RegisterEffect(e2a)
28+
local e2b=e2a:Clone()
29+
e2b:SetCode(EVENT_SPSUMMON_SUCCESS)
30+
c:RegisterEffect(e2b)
3031
end
31-
s.listed_series={SET_MEKK_KNIGHT}
3232
s.listed_names={id}
33-
function s.cfilter(c)
34-
return c:GetColumnGroupCount()>0
35-
end
36-
function s.hspval(e,c)
37-
local tp=c:GetControler()
33+
s.listed_series={SET_MEKK_KNIGHT}
34+
function s.spval(e,c)
3835
local zone=0
39-
local lg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
40-
for tc in aux.Next(lg) do
36+
local tp=c:GetControler()
37+
local g=Duel.GetMatchingGroup(function(c) return c:GetColumnGroupCount()>0 end,0,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
38+
for tc in g:Iter() do
4139
zone=(zone|tc:GetColumnZone(LOCATION_MZONE,0,0,tp))
4240
end
4341
return 0,zone
4442
end
45-
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
46-
return e:GetHandler():IsPreviousLocation(LOCATION_HAND)
47-
end
4843
function s.thfilter(c)
4944
return c:IsSetCard(SET_MEKK_KNIGHT) and c:IsMonster() and not c:IsCode(id) and c:IsAbleToHand()
5045
end
5146
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
52-
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
5347
local ct=e:GetHandler():GetColumnGroup():FilterCount(Card.IsControler,nil,1-tp)
54-
if chk==0 then return ct>0 and g:GetClassCount(Card.GetCode)>=ct end
48+
if chk==0 then return ct>0 and Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil):GetClassCount(Card.GetCode)>=ct end
5549
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,ct,tp,LOCATION_DECK)
5650
end
5751
function s.thop(e,tp,eg,ep,ev,re,r,rp)
5852
local c=e:GetHandler()
5953
if not c:IsRelateToEffect(e) then return end
6054
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
61-
local ct=e:GetHandler():GetColumnGroup():FilterCount(Card.IsControler,nil,1-tp)
62-
if ct<=0 or g:GetClassCount(Card.GetCode)<ct then return end
63-
local hg=Group.CreateGroup()
64-
for i=1,ct do
65-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
66-
local tc=g:Select(tp,1,1,nil):GetFirst()
67-
hg:AddCard(tc)
68-
g:Remove(Card.IsCode,nil,tc:GetCode())
55+
if #g==0 then return end
56+
local ct=c:GetColumnGroup():FilterCount(Card.IsControler,nil,1-tp)
57+
if c:IsControler(1-tp) then ct=ct+1 end
58+
if ct==0 or g:GetClassCount(Card.GetCode)<ct then return end
59+
local sg=aux.SelectUnselectGroup(g,e,tp,ct,ct,aux.dncheck,1,tp,HINTMSG_ATOHAND)
60+
if #sg>0 then
61+
Duel.SendtoHand(sg,nil,REASON_EFFECT)
62+
Duel.ConfirmCards(1-tp,sg)
6963
end
70-
Duel.SendtoHand(hg,nil,REASON_EFFECT)
71-
Duel.ConfirmCards(1-tp,hg)
7264
end

official/c2377034.lua

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
--Neo Flamvell Hedgehog
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--Banish 1 card in your opponent's GY
5+
--Banish 1 card from your opponent's GY
66
local e1=Effect.CreateEffect(c)
77
e1:SetDescription(aux.Stringid(id,0))
88
e1:SetCategory(CATEGORY_REMOVE)
@@ -12,52 +12,49 @@ function s.initial_effect(c)
1212
e1:SetTarget(s.rmtg)
1313
e1:SetOperation(s.rmop)
1414
c:RegisterEffect(e1)
15-
--Add to your hand 1 FIRE monster with 200 or less DEF from your GY
15+
--Add 1 FIRE monster with 200 or less DEF except "Neo Flamvell Hedgehog" from your GY to your hand
1616
local e2=Effect.CreateEffect(c)
1717
e2:SetDescription(aux.Stringid(id,1))
1818
e2:SetCategory(CATEGORY_TOHAND)
1919
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
2020
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
21-
e2:SetCode(EVENT_LEAVE_FIELD)
22-
e2:SetCondition(s.thcon)
21+
e2:SetCode(EVENT_DESTROYED)
22+
e2:SetCondition(function(e) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_EFFECT) end)
2323
e2:SetTarget(s.thtg)
2424
e2:SetOperation(s.thop)
2525
c:RegisterEffect(e2)
2626
end
2727
s.listed_names={id}
28-
function s.rmfilter(c)
29-
return c:IsAbleToRemove() and aux.SpElimFilter(c)
30-
end
3128
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
32-
if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end
29+
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end
3330
if chk==0 then return true end
3431
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
35-
local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil)
36-
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
32+
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,1,nil)
33+
if #g>0 then
34+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0)
35+
end
3736
end
3837
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
3938
local tc=Duel.GetFirstTarget()
4039
if tc and tc:IsRelateToEffect(e) then
4140
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
4241
end
4342
end
44-
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
45-
return (e:GetHandler():GetReason()&(REASON_DESTROY|REASON_EFFECT))==(REASON_DESTROY|REASON_EFFECT)
46-
end
47-
function s.filter(c)
48-
return c:IsDefenseBelow(200) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToHand() and not c:IsCode(id)
43+
function s.thfilter(c)
44+
return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsDefenseBelow(200) and not c:IsCode(id) and c:IsAbleToHand()
4945
end
5046
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
51-
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end
47+
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end
5248
if chk==0 then return true end
5349
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
54-
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil)
55-
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
50+
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
51+
if #g>0 then
52+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0)
53+
end
5654
end
5755
function s.thop(e,tp,eg,ep,ev,re,r,rp)
5856
local tc=Duel.GetFirstTarget()
59-
if tc and tc:IsRelateToEffect(e) then
57+
if tc and tc:IsRelateToEffect(e) and tc:IsAttribute(ATTRIBUTE_FIRE) then
6058
Duel.SendtoHand(tc,nil,REASON_EFFECT)
61-
Duel.ConfirmCards(1-tp,tc)
6259
end
6360
end

0 commit comments

Comments
 (0)