Skip to content

Commit 5238f5f

Browse files
authored
Various script fixes
- Amazoness Princess: Simplify the zone checking for the cost. - Hieratic Dragon of Gebeb: Shouldn't set the ATK/DEF to 0 with its 2nd effect. - Hieratic Seal From the Ashes: The 2nd effect should target and select the card on activation. The 3rd effect should activate even if there's no valid target since it's mandatory. - Mysterion the Dragon Crown: Should do nothing if the target is face-down on resolution. - Numeron Creation: Don't apply the effect if it's somehow already been applied by the time the card resolves. - Penguin Cleric: Should trigger even if the "Penguin" monster was face-down in the Monster Zone. - Phantom Fortress Enterblathnir: Should be able to chain the effect of "Ghost Belle & Haunted Mansion" if its GY banishing effect is used + removed "Spirit Elimination" handling. - The Agent of Mystery - Earth: Simplify the logic for searching "Master Hyperion". - The Despair Uranus: Simplify the logic for choosing what to Set.
1 parent 4d8339e commit 5238f5f

File tree

11 files changed

+281
-346
lines changed

11 files changed

+281
-346
lines changed

official/c13735899.lua

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
--Scripted by Eerie Code
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Fusion Summon
76
c:EnableReviveLimit()
7+
--Fusion Materials: 1 Spellcaster monster + 1 Dragon monster
88
Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON))
99
--Cannot be used as Fusion Material
1010
local e0=Effect.CreateEffect(c)
@@ -13,37 +13,38 @@ function s.initial_effect(c)
1313
e0:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
1414
e0:SetValue(1)
1515
c:RegisterEffect(e0)
16-
--Decreak ATK by 100 per banished card
16+
--This card loses 100 ATK for each of your banished cards
1717
local e1=Effect.CreateEffect(c)
1818
e1:SetType(EFFECT_TYPE_SINGLE)
19-
e1:SetCode(EFFECT_UPDATE_ATTACK)
2019
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
20+
e1:SetCode(EFFECT_UPDATE_ATTACK)
2121
e1:SetRange(LOCATION_MZONE)
2222
e1:SetValue(function(e,cc) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_REMOVED,0)*-100 end)
2323
c:RegisterEffect(e1)
24-
--Banish monsters
25-
local e2=Effect.CreateEffect(c)
26-
e2:SetDescription(aux.Stringid(id,0))
27-
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
28-
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
29-
e2:SetCode(EVENT_CUSTOM+id)
30-
e2:SetRange(LOCATION_MZONE)
31-
e2:SetCountLimit(1,id)
32-
e2:SetTarget(s.rmtg)
33-
e2:SetOperation(s.rmop)
34-
c:RegisterEffect(e2)
35-
local g=Group.CreateGroup()
36-
g:KeepAlive()
37-
e2:SetLabelObject(g)
38-
--Register summons
24+
--Banish 1 Special Summoned monster, also banish all monsters from the field with its same original Type
3925
local e2a=Effect.CreateEffect(c)
40-
e2a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
41-
e2a:SetCode(EVENT_SPSUMMON_SUCCESS)
42-
e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
26+
e2a:SetDescription(aux.Stringid(id,0))
27+
e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
28+
e2a:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
29+
e2a:SetCode(EVENT_CUSTOM+id)
4330
e2a:SetRange(LOCATION_MZONE)
44-
e2a:SetLabelObject(e2)
45-
e2a:SetOperation(s.regop)
31+
e2a:SetCountLimit(1,id)
32+
e2a:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end)
33+
e2a:SetTarget(s.rmtg)
34+
e2a:SetOperation(s.rmop)
4635
c:RegisterEffect(e2a)
36+
local g=Group.CreateGroup()
37+
g:KeepAlive()
38+
e2a:SetLabelObject(g)
39+
--Register summons
40+
local e2b=Effect.CreateEffect(c)
41+
e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
42+
e2b:SetCode(EVENT_SPSUMMON_SUCCESS)
43+
e2b:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
44+
e2b:SetRange(LOCATION_MZONE)
45+
e2b:SetLabelObject(e2a)
46+
e2b:SetOperation(s.regop)
47+
c:RegisterEffect(e2b)
4748
end
4849
function s.tgfilter(c,rc,e)
4950
return c:IsLocation(LOCATION_MZONE) and (rc==c or (c:IsFaceup() and rc:IsOriginalRace(c:GetOriginalRace())))
@@ -57,7 +58,6 @@ function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
5758
local g=e:GetLabelObject():Filter(s.tgfilter2,nil,e)
5859
if chkc then return g:IsContains(chkc) and s.tgfilter(chkc,nil) end
5960
if chk==0 then return #g>0 end
60-
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1)
6161
local tc=nil
6262
if #g==1 then
6363
tc=g:GetFirst()
@@ -67,21 +67,18 @@ function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
6767
tc=g:Select(tp,1,1,nil)
6868
Duel.SetTargetCard(tc)
6969
end
70-
Duel.SetOperationInfo(0,CATEGORY_REMOVE,tc,1,0,0)
70+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,tc,1,tp,0)
7171
end
7272
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
7373
local tc=Duel.GetFirstTarget()
74-
if tc:IsRelateToEffect(e) then
75-
local g=Group.FromCards(tc)
76-
if tc:IsFaceup() then
77-
g=g+Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsOriginalRace,tc:GetOriginalRace()),tp,LOCATION_MZONE,LOCATION_MZONE,tc)
78-
end
74+
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
75+
local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsOriginalRace,tc:GetOriginalRace()),tp,LOCATION_MZONE,LOCATION_MZONE,tc)+tc
7976
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
8077
end
8178
end
8279
function s.regop(e,tp,eg,ep,ev,re,r,rp)
8380
local c=e:GetHandler()
84-
if Duel.HasFlagEffect(tp,id) or eg:IsContains(c) then return end
81+
if eg:IsContains(c) then return end
8582
local rc=re:GetHandler()
8683
if not (re and re:IsActivated() and re:IsMonsterEffect() and rc) then return end
8784
local tg=eg:Filter(s.tgfilter,nil,rc)

official/c32588805.lua

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,50 @@
1-
--The despair URANUS
1+
--The despair URANUS
22
--The Despair Uranus
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--set
5+
--Your opponent declares either Continuous Spell or Continuous Trap, then you Set 1 card of that type from your Deck
66
local e1=Effect.CreateEffect(c)
77
e1:SetDescription(aux.Stringid(id,0))
88
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
99
e1:SetCode(EVENT_SUMMON_SUCCESS)
10-
e1:SetCondition(s.setcon)
10+
e1:SetCondition(function(e,tp) return e:GetHandler():IsTributeSummoned() and not Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,1,nil) end)
1111
e1:SetTarget(s.settg)
1212
e1:SetOperation(s.setop)
1313
c:RegisterEffect(e1)
14-
--atkup
14+
--This card gains 300 ATK for each face-up Spell/Trap you control
1515
local e2=Effect.CreateEffect(c)
1616
e2:SetType(EFFECT_TYPE_SINGLE)
1717
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
1818
e2:SetCode(EFFECT_UPDATE_ATTACK)
1919
e2:SetRange(LOCATION_MZONE)
20-
e2:SetValue(s.atkval)
20+
e2:SetValue(function(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSpellTrap),e:GetHandlerPlayer(),LOCATION_ONFIELD,0,nil)*300 end)
2121
c:RegisterEffect(e2)
22-
--indes
22+
--Face-up cards in your Spell & Trap Zone cannot be destroyed by card effects
2323
local e3=Effect.CreateEffect(c)
2424
e3:SetType(EFFECT_TYPE_FIELD)
2525
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
2626
e3:SetRange(LOCATION_MZONE)
27-
e3:SetTargetRange(LOCATION_SZONE,0)
28-
e3:SetTarget(s.indtg)
27+
e3:SetTargetRange(LOCATION_STZONE,0)
28+
e3:SetTarget(function(e,c) return c:IsFaceup() end)
2929
e3:SetValue(1)
3030
c:RegisterEffect(e3)
3131
end
32-
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
33-
return e:GetHandler():IsTributeSummoned()
34-
and not Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,1,nil)
35-
end
36-
function s.setfilter1(c)
37-
return c:IsType(TYPE_CONTINUOUS) and c:IsSSetable()
32+
function s.setfilter(c)
33+
return c:IsContinuousSpellTrap() and c:IsSSetable()
3834
end
3935
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
4036
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
41-
and Duel.IsExistingMatchingCard(s.setfilter1,tp,LOCATION_DECK,0,1,nil) end
42-
end
43-
function s.setfilter2(c,typ)
44-
return c:GetType()==typ and c:IsSSetable()
37+
and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end
4538
end
4639
function s.setop(e,tp,eg,ep,ev,re,r,rp)
4740
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
48-
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_OPTION)
49-
local op=Duel.SelectOption(1-tp,71,72)
41+
local op=Duel.SelectOption(1-tp,aux.Stringid(id,1),aux.Stringid(id,2))
42+
local g=Duel.GetMatchingGroup(s.setfilter,tp,LOCATION_DECK,0,nil)
43+
if #g==0 then return end
44+
local filter=op==0 and Card.IsContinuousSpell or Card.IsContinuousTrap
5045
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
51-
local g=nil
52-
if op==0 then g=Duel.SelectMatchingCard(tp,s.setfilter2,tp,LOCATION_DECK,0,1,1,nil,TYPE_SPELL+TYPE_CONTINUOUS)
53-
else g=Duel.SelectMatchingCard(tp,s.setfilter2,tp,LOCATION_DECK,0,1,1,nil,TYPE_TRAP+TYPE_CONTINUOUS) end
54-
if #g>0 then
55-
Duel.SSet(tp,g:GetFirst())
46+
local sg=g:FilterSelect(tp,filter,1,1,nil)
47+
if #sg>0 then
48+
Duel.SSet(tp,sg)
5649
end
57-
end
58-
function s.atkfilter(c)
59-
return c:IsSpellTrap() and c:IsFaceup()
60-
end
61-
function s.atkval(e,c)
62-
return Duel.GetMatchingGroupCount(s.atkfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,nil)*300
63-
end
64-
function s.indtg(e,c)
65-
return c:GetSequence()<5 and c:IsFaceup()
6650
end

official/c42378577.lua

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,35 @@
33
local s,id=GetID()
44
function s.initial_effect(c)
55
--Activate
6+
local e0=Effect.CreateEffect(c)
7+
e0:SetType(EFFECT_TYPE_ACTIVATE)
8+
e0:SetCode(EVENT_FREE_CHAIN)
9+
c:RegisterEffect(e0)
10+
--Special Summon 1 card from your Pendulum Zone
611
local e1=Effect.CreateEffect(c)
7-
e1:SetType(EFFECT_TYPE_ACTIVATE)
12+
e1:SetDescription(aux.Stringid(id,0))
13+
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
14+
e1:SetType(EFFECT_TYPE_QUICK_O)
15+
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
816
e1:SetCode(EVENT_FREE_CHAIN)
9-
e1:SetHintTiming(0,TIMING_END_PHASE)
17+
e1:SetRange(LOCATION_SZONE)
18+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
19+
e1:SetCountLimit(1,id)
20+
e1:SetTarget(s.sptg)
21+
e1:SetOperation(s.spop)
1022
c:RegisterEffect(e1)
11-
--special summon
23+
--Place 1 Pendulum Monster from your Monster Zone in your Pendulum Zone
1224
local e2=Effect.CreateEffect(c)
13-
e2:SetDescription(aux.Stringid(id,0))
14-
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
25+
e2:SetDescription(aux.Stringid(id,1))
1526
e2:SetType(EFFECT_TYPE_QUICK_O)
1627
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
1728
e2:SetCode(EVENT_FREE_CHAIN)
1829
e2:SetRange(LOCATION_SZONE)
19-
e2:SetHintTiming(0,TIMING_END_PHASE)
30+
e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
2031
e2:SetCountLimit(1,id)
21-
e2:SetTarget(s.sptg)
22-
e2:SetOperation(s.spop)
32+
e2:SetTarget(s.pentg)
33+
e2:SetOperation(s.penop)
2334
c:RegisterEffect(e2)
24-
--place in pendulum zone
25-
local e3=Effect.CreateEffect(c)
26-
e3:SetDescription(aux.Stringid(id,1))
27-
e3:SetType(EFFECT_TYPE_QUICK_O)
28-
e3:SetCode(EVENT_FREE_CHAIN)
29-
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
30-
e3:SetRange(LOCATION_SZONE)
31-
e3:SetHintTiming(0,TIMING_END_PHASE)
32-
e3:SetCountLimit(1,id)
33-
e3:SetTarget(s.pentg)
34-
e3:SetOperation(s.penop)
35-
c:RegisterEffect(e3)
3635
end
3736
function s.spfilter(c,e,tp)
3837
return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
@@ -43,28 +42,24 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
4342
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_PZONE,0,1,nil,e,tp) end
4443
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
4544
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_PZONE,0,1,1,nil,e,tp)
46-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
45+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0)
4746
end
4847
function s.spop(e,tp,eg,ep,ev,re,r,rp)
4948
local tc=Duel.GetFirstTarget()
5049
if tc:IsRelateToEffect(e) then
5150
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
5251
end
5352
end
54-
function s.filter(c)
55-
return c:IsFaceup() and c:IsType(TYPE_PENDULUM)
56-
end
5753
function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
58-
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end
54+
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsType(TYPE_PENDULUM) and chkc:IsFaceup() end
5955
if chk==0 then return Duel.CheckPendulumZones(tp)
60-
and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
61-
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2))
62-
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
56+
and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_MZONE,0,1,nil) end
57+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
58+
Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_MZONE,0,1,1,nil)
6359
end
6460
function s.penop(e,tp,eg,ep,ev,re,r,rp)
65-
if not Duel.CheckPendulumZones(tp) then return end
6661
local tc=Duel.GetFirstTarget()
67-
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
62+
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
6863
Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
6964
end
7065
end

official/c46382143.lua

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
--Scripted by Larry126
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Activate
6+
--Special Summon 1 "Number" Dragon Xyz Monster from your Extra Deck, then attach this card on the field to it as material
77
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
89
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
910
e1:SetType(EFFECT_TYPE_ACTIVATE)
1011
e1:SetCode(EVENT_FREE_CHAIN)
@@ -14,28 +15,30 @@ function s.initial_effect(c)
1415
c:RegisterEffect(e1)
1516
end
1617
s.listed_series={SET_GALAXY_EYES,SET_NUMBER}
17-
function s.cfilter(c)
18-
return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetBaseAttack()>=3000
18+
function s.confilter(c)
19+
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:GetBaseAttack()>=3000 and c:IsFaceup()
1920
end
2021
function s.condition(e,tp,eg,ep,ev,re,r,rp)
21-
return Duel.GetMatchingGroupCount(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)>=3
22+
return Duel.IsExistingMatchingCard(s.confilter,tp,LOCATION_MZONE,LOCATION_MZONE,3,nil)
2223
end
2324
function s.spfilter(c,e,tp)
24-
return c:IsRace(RACE_DRAGON) and c:IsSetCard(SET_NUMBER) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
25+
return c:IsSetCard(SET_NUMBER) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
2526
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
2627
end
2728
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
28-
if chk==0 then return Duel.GetFlagEffect(tp,id)==0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
29+
if chk==0 then return not Duel.HasFlagEffect(tp,id)
30+
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
2931
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
3032
end
3133
function s.activate(e,tp,eg,ep,ev,re,r,rp)
34+
if Duel.HasFlagEffect(tp,id) then return end
3235
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1)
3336
local c=e:GetHandler()
3437
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
35-
local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
36-
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and c:IsRelateToEffect(e) then
38+
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
39+
if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)>0 and c:IsRelateToEffect(e) then
3740
Duel.BreakEffect()
3841
c:CancelToGrave()
39-
Duel.Overlay(tc,c)
42+
Duel.Overlay(sc,c)
4043
end
4144
end

0 commit comments

Comments
 (0)