Skip to content

Commit e44a572

Browse files
authored
Endymion, the Magistus of Mastery
- Missing CATEGORY_TODECK category and opinfo - Also check for forbidden status and unique on field for the card to equip
1 parent 62dee8c commit e44a572

1 file changed

Lines changed: 30 additions & 33 deletions

File tree

official/c9482987.lua

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
--Scripted by AlphaKretin
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--Equip from Extra Deck
6+
--Equip 1 "Magistus" monster you control with 1 "Magistus" monster from your Extra Deck
77
local e1=Effect.CreateEffect(c)
88
e1:SetDescription(aux.Stringid(id,0))
99
e1:SetCategory(CATEGORY_EQUIP)
@@ -14,66 +14,63 @@ function s.initial_effect(c)
1414
e1:SetTarget(s.eqtg)
1515
e1:SetOperation(s.eqop)
1616
c:RegisterEffect(e1)
17-
--Destroy, draw 1 card and return 1 card to the Deck
17+
--Destroy 1 face-up Spell you control, and if you do, draw 1 card, then place 1 card from your hand on the bottom of the Deck
1818
local e2=Effect.CreateEffect(c)
1919
e2:SetDescription(aux.Stringid(id,1))
20-
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW)
21-
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
20+
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW+CATEGORY_TODECK)
2221
e2:SetType(EFFECT_TYPE_IGNITION)
22+
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
2323
e2:SetRange(LOCATION_MZONE)
2424
e2:SetCountLimit(1,{id,1})
2525
e2:SetTarget(s.destg)
2626
e2:SetOperation(s.desop)
2727
c:RegisterEffect(e2)
2828
end
2929
s.listed_series={SET_MAGISTUS}
30-
function s.eqtgfilter(c,tp)
31-
return c:IsFaceup() and c:IsSetCard(SET_MAGISTUS) and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_EXTRA,0,1,nil,SET_MAGISTUS)
30+
function s.eqfilter(c,tp)
31+
return c:IsSetCard(SET_MAGISTUS) and not c:IsForbidden() and c:CheckUniqueOnField(tp)
3232
end
3333
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
3434
local c=e:GetHandler()
35-
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqtgfilter(chkc,tp) end
35+
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsSetCard(SET_MAGISTUS) and chkc:IsFaceup() end
3636
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
37-
and Duel.IsExistingTarget(s.eqtgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
37+
and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,nil)
38+
and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_EXTRA,0,1,nil,tp) end
3839
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
39-
Duel.SelectTarget(tp,s.eqtgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
40+
Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,1,nil)
4041
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_EXTRA)
4142
end
4243
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
44+
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
4345
local tc=Duel.GetFirstTarget()
44-
if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE)
45-
and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end
46-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
47-
local ec=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_EXTRA,0,1,1,nil,SET_MAGISTUS):GetFirst()
48-
if ec then
49-
Duel.Equip(tp,ec,tc,true)
50-
local e1=Effect.CreateEffect(e:GetHandler())
51-
e1:SetType(EFFECT_TYPE_SINGLE)
52-
e1:SetCode(EFFECT_EQUIP_LIMIT)
53-
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
54-
e1:SetValue(s.eqlimit)
55-
e1:SetLabelObject(tc)
56-
ec:RegisterEffect(e1)
46+
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
47+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
48+
local ec=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_EXTRA,0,1,1,nil,tp):GetFirst()
49+
if ec and Duel.Equip(tp,ec,tc) then
50+
--Equip limit
51+
local e1=Effect.CreateEffect(e:GetHandler())
52+
e1:SetType(EFFECT_TYPE_SINGLE)
53+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
54+
e1:SetCode(EFFECT_EQUIP_LIMIT)
55+
e1:SetValue(function(e,c) return c==tc end)
56+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
57+
ec:RegisterEffect(e1)
58+
end
5759
end
5860
end
59-
function s.eqlimit(e,c)
60-
return c==e:GetLabelObject()
61-
end
62-
function s.desfilter(c)
63-
return c:IsFaceup() and c:IsSpell()
64-
end
6561
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
66-
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_ONFIELD) and s.desfilter(chkc) end
62+
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsSpell() and chkc:IsFaceup() end
6763
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
68-
and Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil) end
64+
and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSpell),tp,LOCATION_ONFIELD,0,1,nil) end
6965
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
70-
local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil)
66+
local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSpell),tp,LOCATION_ONFIELD,0,1,1,nil)
7167
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0)
7268
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
69+
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND)
7370
end
7471
function s.desop(e,tp,eg,ep,ev,re,r,rp)
7572
local tc=Duel.GetFirstTarget()
76-
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and Duel.Draw(tp,1,REASON_EFFECT)~=0 then
73+
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and Duel.Draw(tp,1,REASON_EFFECT)>0 then
7774
Duel.ShuffleHand(tp)
7875
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
7976
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil)
@@ -82,4 +79,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp)
8279
Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
8380
end
8481
end
85-
end
82+
end

0 commit comments

Comments
 (0)