Skip to content

Commit 4c4d21c

Browse files
authored
Some script fixes
- Darklord Zerato + Fiendish Engine Ω: Should destroy itself even if it's face-down on resolution + missing destruction category on the last effect. - Detonating Kuriboh: Should be sent to the GY if you control the targeted monster on resolution. - Escape from the Dark Dimension + Soul Resurrection: The monster shouldn't be destroyed if this card's effects are negated when it leaves the field. - Lord British Space Fighter: Shouldn't destroy the target if it's face-up on resolution + should trigger even if it destroys a Trap Monster. - Swordsoul Grandmaster - Chixiao: Shouldn't be able to target an Effect Monster that is currently a Normal Monster. - Tenyi Spirit - Shthana: Should be able to target a monster that was a non-Effect Monster on the field even if it's an Effect Monster in the GY.
1 parent 9798d6f commit 4c4d21c

File tree

8 files changed

+176
-177
lines changed

8 files changed

+176
-177
lines changed

official/c24557335.lua

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,70 @@
33
--Scripted by Hatter
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Special Summon itself from the hand
6+
--Special Summon this card from your hand
77
local e1=Effect.CreateEffect(c)
88
e1:SetDescription(aux.Stringid(id,0))
99
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
1010
e1:SetType(EFFECT_TYPE_IGNITION)
1111
e1:SetRange(LOCATION_HAND)
1212
e1:SetCountLimit(1,id)
13-
e1:SetCondition(s.spcon)
13+
e1:SetCondition(function(e,tp) return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,nil) end)
1414
e1:SetTarget(s.sptg)
1515
e1:SetOperation(s.spop)
1616
c:RegisterEffect(e1)
1717
--Special Summon a non-Effect monster that was destroyed, then destroy 1 monster the opponent controls
1818
local e2=Effect.CreateEffect(c)
19-
e1:SetDescription(aux.Stringid(id,1))
19+
e2:SetDescription(aux.Stringid(id,1))
2020
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY)
2121
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
22-
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
23-
e2:SetRange(LOCATION_HAND+LOCATION_GRAVE)
22+
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET,EFFECT_FLAG2_CHECK_SIMULTANEOUS)
23+
e2:SetRange(LOCATION_HAND|LOCATION_GRAVE)
2424
e2:SetCode(EVENT_DESTROYED)
2525
e2:SetCountLimit(1,{id,1})
26-
e2:SetCost(aux.bfgcost)
26+
e2:SetCost(aux.SelfBanishCost)
2727
e2:SetTarget(s.destg)
2828
e2:SetOperation(s.desop)
2929
c:RegisterEffect(e2)
3030
end
31-
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
32-
return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,nil)
33-
end
3431
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
32+
local c=e:GetHandler()
3533
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
36-
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
37-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
34+
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
35+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0)
3836
end
3937
function s.spop(e,tp,eg,ep,ev,re,r,rp)
4038
local c=e:GetHandler()
4139
if c:IsRelateToEffect(e) then
4240
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
4341
end
4442
end
45-
function s.cfilter(c,e,tp)
46-
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
47-
and c:IsPreviousControler(tp) and c:IsPreviousPosition(POS_FACEUP) and not c:IsType(TYPE_TOKEN)
48-
and c:IsNonEffectMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
49-
and c:IsCanBeEffectTarget(e) and not c:IsLocation(LOCATION_EXTRA)
43+
function s.spfilter(c,e,tp)
44+
return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE)
45+
and c:IsPreviousControler(tp) and c:IsPreviousPosition(POS_FACEUP)
46+
and not c:IsPreviousTypeOnField(TYPE_EFFECT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
47+
and c:IsCanBeEffectTarget(e)
5048
end
5149
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
52-
if chkc then return s.cfilter(chkc,e,tp) end
50+
if chkc then return s.spfilter(chkc,e,tp) end
5351
local c=e:GetHandler()
54-
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
55-
and eg:IsExists(s.cfilter,1,nil,e,tp) and ((not eg:IsContains(c)) or c:IsLocation(LOCATION_HAND)) end
52+
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and eg:IsExists(s.spfilter,1,nil,e,tp)
53+
and ((not eg:IsContains(c)) or c:IsLocation(LOCATION_HAND)) end
5654
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
57-
local g=eg:FilterSelect(tp,s.cfilter,1,1,nil,e,tp)
58-
Duel.SetTargetCard(g:GetFirst())
59-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,g:GetFirst():GetLocation())
55+
local g=eg:FilterSelect(tp,s.spfilter,1,1,nil,e,tp)
56+
Duel.SetTargetCard(g)
57+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0)
58+
Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,1-tp,LOCATION_MZONE)
6059
end
6160
function s.desop(e,tp,eg,ep,ev,re,r,rp)
6261
local tc=Duel.GetFirstTarget()
63-
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0
62+
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0
6463
and Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_MZONE,1,nil)
6564
and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
6665
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
67-
local des=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_MZONE,1,1,nil)
68-
if #des>0 then
69-
Duel.Destroy(des,REASON_EFFECT)
66+
local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_MZONE,1,1,nil)
67+
if #g>0 then
68+
Duel.HintSelection(g)
69+
Duel.Destroy(g,REASON_EFFECT)
7070
end
7171
end
7272
end

official/c31550470.lua

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,65 @@ local s,id=GetID()
44
function s.initial_effect(c)
55
--Activate
66
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
78
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
89
e1:SetType(EFFECT_TYPE_ACTIVATE)
9-
e1:SetCode(EVENT_FREE_CHAIN)
10-
e1:SetHintTiming(0,TIMING_END_PHASE)
1110
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
11+
e1:SetCode(EVENT_FREE_CHAIN)
12+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
1213
e1:SetTarget(s.target)
1314
e1:SetOperation(s.operation)
1415
c:RegisterEffect(e1)
15-
--Destroy
16+
--When this card leaves the field, destroy that monster
1617
local e2=Effect.CreateEffect(c)
17-
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
18-
e2:SetCode(EVENT_LEAVE_FIELD)
19-
e2:SetOperation(s.desop)
18+
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
19+
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
20+
e2:SetCode(EVENT_LEAVE_FIELD_P)
21+
e2:SetOperation(function(e) e:SetLabel(e:GetHandler():IsDisabled() and 1 or 0) end)
2022
c:RegisterEffect(e2)
21-
--Destroy2
2223
local e3=Effect.CreateEffect(c)
23-
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
24-
e3:SetRange(LOCATION_SZONE)
24+
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
2525
e3:SetCode(EVENT_LEAVE_FIELD)
26-
e3:SetCondition(s.descon2)
27-
e3:SetOperation(s.desop2)
26+
e3:SetOperation(s.mondesop)
27+
e3:SetLabelObject(e2)
2828
c:RegisterEffect(e3)
29+
--When that monster is destroyed, destroy this card
30+
local e4=Effect.CreateEffect(c)
31+
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
32+
e4:SetCode(EVENT_LEAVE_FIELD)
33+
e4:SetRange(LOCATION_SZONE)
34+
e4:SetCondition(s.selfdescon)
35+
e4:SetOperation(function(e) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end)
36+
c:RegisterEffect(e4)
2937
end
30-
function s.filter(c,e,tp)
38+
function s.spfilter(c,e,tp)
3139
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
3240
end
3341
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
34-
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end
42+
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end
3543
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
36-
and Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
44+
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
3745
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
38-
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp)
39-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
46+
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp)
47+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0)
4048
end
4149
function s.operation(e,tp,eg,ep,ev,re,r,rp)
4250
local c=e:GetHandler()
4351
local tc=Duel.GetFirstTarget()
44-
if c:IsRelateToEffect(e) and tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
52+
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e)
53+
and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
4554
c:SetCardTarget(tc)
46-
e:SetLabelObject(tc)
47-
c:CreateRelation(tc,RESET_EVENT+RESETS_STANDARD)
48-
tc:CreateRelation(c,RESET_EVENT+RESETS_STANDARD)
4955
Duel.SpecialSummonComplete()
5056
end
5157
end
52-
function s.desop(e,tp,eg,ep,ev,re,r,rp)
58+
function s.mondesop(e,tp,eg,ep,ev,re,r,rp)
59+
if e:GetLabelObject():GetLabel()~=0 then return end
5360
local tc=e:GetHandler():GetFirstCardTarget()
5461
if tc and tc:IsLocation(LOCATION_MZONE) then
5562
Duel.Destroy(tc,REASON_EFFECT,LOCATION_REMOVED)
5663
end
5764
end
58-
function s.descon2(e,tp,eg,ep,ev,re,r,rp)
65+
function s.selfdescon(e,tp,eg,ep,ev,re,r,rp)
5966
local tc=e:GetHandler():GetFirstCardTarget()
6067
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY)
61-
end
62-
function s.desop2(e,tp,eg,ep,ev,re,r,rp)
63-
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
64-
end
68+
end

official/c35514096.lua

Lines changed: 40 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,67 @@
11
--ロードブリティッシュ
22
--Lord British Space Fighter
33
local s,id=GetID()
4+
local TOKEN_MULTI=id+1
45
function s.initial_effect(c)
6+
--Activate 1 of these effects
57
local e1=Effect.CreateEffect(c)
68
e1:SetDescription(aux.Stringid(id,0))
79
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
810
e1:SetCode(EVENT_BATTLE_DESTROYING)
9-
e1:SetCondition(s.condition)
10-
e1:SetTarget(s.target)
11-
e1:SetOperation(s.operation)
11+
e1:SetCondition(function() return e:GetHandler():IsRelateToBattle() end)
12+
e1:SetTarget(s.efftg)
13+
e1:SetOperation(s.effop)
1214
c:RegisterEffect(e1)
1315
end
14-
s.listed_names={35514097}
15-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
16-
local c=e:GetHandler()
17-
return c:IsRelateToBattle() and c:GetBattleTarget():IsMonster()
18-
end
19-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
16+
s.listed_names={TOKEN_MULTI}
17+
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
2018
if chkc then return chkc:IsOnField() and chkc:IsFacedown() end
2119
if chk==0 then return true end
22-
local c=e:GetHandler()
23-
local t1=c:CanChainAttack()
24-
local t2=Duel.IsExistingTarget(Card.IsFacedown,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
25-
local t3=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
26-
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,1200,1200,4,RACE_MACHINE,ATTRIBUTE_LIGHT)
27-
local op=0
28-
if t1 or t2 or t3 then
29-
local m={}
30-
local n={}
31-
local ct=1
32-
if t1 then m[ct]=aux.Stringid(id,1) n[ct]=1 ct=ct+1 end
33-
if t2 then m[ct]=aux.Stringid(id,2) n[ct]=2 ct=ct+1 end
34-
if t3 then m[ct]=aux.Stringid(id,3) n[ct]=3 ct=ct+1 end
35-
local sp=Duel.SelectOption(tp,table.unpack(m))
36-
op=n[sp+1]
37-
end
20+
local b1=e:GetHandler():CanChainAttack()
21+
local b2=Duel.IsExistingTarget(Card.IsFacedown,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
22+
local b3=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
23+
and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_MULTI,0,TYPES_TOKEN,1200,1200,4,RACE_MACHINE,ATTRIBUTE_LIGHT)
24+
local op=Duel.SelectEffect(tp,
25+
{b1,aux.Stringid(id,1)},
26+
{b2,aux.Stringid(id,2)},
27+
{b3,aux.Stringid(id,3)})
3828
e:SetLabel(op)
39-
if op==2 then
29+
if op==1 then
30+
e:SetCategory(0)
31+
e:SetProperty(0)
32+
elseif op==2 then
33+
e:SetCategory(CATEGORY_DESTROY)
34+
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
4035
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
4136
local g=Duel.SelectTarget(tp,Card.IsFacedown,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
42-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
43-
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
44-
e:SetCategory(CATEGORY_DESTROY)
37+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0)
4538
elseif op==3 then
46-
e:SetProperty(0)
4739
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
48-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0)
49-
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
50-
else
5140
e:SetProperty(0)
52-
e:SetCategory(0)
41+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0)
42+
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0)
5343
end
5444
end
55-
function s.operation(e,tp,eg,ep,ev,re,r,rp)
56-
local c=e:GetHandler()
57-
if e:GetLabel()==2 then
45+
function s.effop(e,tp,eg,ep,ev,re,r,rp)
46+
local op=e:GetLabel()
47+
if op==1 then
48+
--This card can make a second attack in a row
49+
local c=e:GetHandler()
50+
if c:IsRelateToBattle() then
51+
Duel.ChainAttack()
52+
end
53+
elseif op==2 then
54+
--Destroy 1 Set card on the field
5855
local tc=Duel.GetFirstTarget()
59-
if tc and tc:IsRelateToEffect(e) then
56+
if tc:IsRelateToEffect(e) and tc:IsFacedown() then
6057
Duel.Destroy(tc,REASON_EFFECT)
6158
end
62-
elseif e:GetLabel()==3 then
59+
elseif op==3 then
60+
--Special Summon 1 "Multi Token"
6361
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
64-
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,1200,1200,4,RACE_MACHINE,ATTRIBUTE_LIGHT) then
65-
local token=Duel.CreateToken(tp,id+1)
62+
and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_MULTI,0,TYPES_TOKEN,1200,1200,4,RACE_MACHINE,ATTRIBUTE_LIGHT) then
63+
local token=Duel.CreateToken(tp,TOKEN_MULTI)
6664
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
6765
end
68-
elseif e:GetLabel()==1 then
69-
if c:IsRelateToBattle() then
70-
Duel.ChainAttack()
71-
end
7266
end
73-
end
67+
end

official/c40921744.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ function s.initial_effect(c)
1818
--Destroy this card during the End Phase
1919
local e4=Effect.CreateEffect(c)
2020
e4:SetDescription(aux.Stringid(id,2))
21+
e4:SetCategory(CATEGORY_DESTROY)
2122
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
2223
e4:SetCode(EVENT_PHASE+PHASE_END)
2324
e4:SetRange(LOCATION_MZONE)
@@ -54,7 +55,7 @@ function s.selfdestg(e,tp,eg,ep,ev,re,r,rp,chk)
5455
end
5556
function s.selfdesop(e,tp,eg,ep,ev,re,r,rp)
5657
local c=e:GetHandler()
57-
if c:IsRelateToEffect(e) and c:IsFaceup() then
58+
if c:IsRelateToEffect(e) then
5859
Duel.Destroy(c,REASON_EFFECT)
5960
end
6061
end

official/c46789706.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp)
6161
local c=e:GetHandler()
6262
if not (c:IsRelateToEffect(e) and c:IsControler(tp)) then return end
6363
local tc=Duel.GetFirstTarget()
64-
if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then
64+
if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(1-tp) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then
6565
Duel.SendtoGrave(c,REASON_RULE,PLAYER_NONE,PLAYER_NONE)
6666
elseif Duel.Equip(tp,c,tc) then
6767
--Equip limit
@@ -78,4 +78,4 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp)
7878
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
7979
c:RegisterEffect(e2)
8080
end
81-
end
81+
end

0 commit comments

Comments
 (0)