Skip to content

Commit 61e718f

Browse files
authored
Keeper of Dragon Magic
Use Cost.AND for the shared restriction cost
1 parent 0734b69 commit 61e718f

File tree

1 file changed

+22
-41
lines changed

1 file changed

+22
-41
lines changed

official/c48048590.lua

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ function s.initial_effect(c)
88
e1:SetDescription(aux.Stringid(id,0))
99
e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
1010
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
11+
e1:SetProperty(EFFECT_FLAG_DELAY)
1112
e1:SetCode(EVENT_SUMMON_SUCCESS)
12-
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
1313
e1:SetCountLimit(1,id)
14-
e1:SetCost(s.thcost)
14+
e1:SetCost(Cost.AND(Cost.Discard(),s.cost))
1515
e1:SetTarget(s.thtg)
1616
e1:SetOperation(s.thop)
1717
c:RegisterEffect(e1)
@@ -25,45 +25,28 @@ function s.initial_effect(c)
2525
e3:SetType(EFFECT_TYPE_IGNITION)
2626
e3:SetRange(LOCATION_MZONE)
2727
e3:SetCountLimit(1,{id,1})
28-
e3:SetCost(s.spcost)
28+
e3:SetCost(Cost.AND(s.spcost,s.cost))
2929
e3:SetTarget(s.sptg)
3030
e3:SetOperation(s.spop)
3131
c:RegisterEffect(e3)
32-
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
32+
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,function(c) return not (c:IsSummonLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)) end)
3333
end
3434
s.listed_series={SET_FUSION}
35-
function s.counterfilter(c)
36-
return c:GetSummonLocation()~=LOCATION_EXTRA or c:IsType(TYPE_FUSION)
37-
end
3835
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
3936
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end
40-
--You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters
37+
--You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate either of this card's effects
4138
local e1=Effect.CreateEffect(e:GetHandler())
39+
e1:SetDescription(aux.Stringid(id,2))
4240
e1:SetType(EFFECT_TYPE_FIELD)
43-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
41+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT)
4442
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
4543
e1:SetTargetRange(1,0)
46-
e1:SetTarget(s.splimit)
44+
e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION) end)
4745
e1:SetReset(RESET_PHASE|PHASE_END)
4846
Duel.RegisterEffect(e1,tp)
49-
aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil)
50-
--lizard check
51-
aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter)
52-
end
53-
function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
54-
return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA)
55-
end
56-
function s.lizfilter(e,c)
57-
return not c:IsOriginalType(TYPE_FUSION)
58-
end
59-
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
60-
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil)
61-
and s.cost(e,tp,eg,ep,ev,re,r,rp,0) end
62-
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD)
63-
s.cost(e,tp,eg,ep,ev,re,r,rp,1)
6447
end
6548
function s.thfilter(c)
66-
return c:IsNormalSpell() and c:IsSetCard(SET_FUSION) and c:IsAbleToHand()
49+
return c:IsSetCard(SET_FUSION) and c:IsNormalSpell() and c:IsAbleToHand()
6750
end
6851
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
6952
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
@@ -77,31 +60,29 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
7760
Duel.ConfirmCards(1-tp,g)
7861
end
7962
end
80-
function s.revealfilter(c,e,tp)
81-
return c.material and c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c)
63+
function s.spcostfilter(c,e,tp)
64+
return c:IsType(TYPE_FUSION) and not c:IsPublic() and c.material and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,table.unpack(c.material))
8265
end
83-
function s.spfilter(c,e,tp,fc)
84-
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) and c:IsCode(table.unpack(fc.material))
66+
function s.spfilter(c,e,tp,...)
67+
return c:IsCode(...) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE)
8568
end
8669
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
87-
if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,0)
88-
and Duel.IsExistingMatchingCard(s.revealfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
70+
if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
8971
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
90-
local g=Duel.SelectMatchingCard(tp,s.revealfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
91-
Duel.ConfirmCards(1-tp,g)
92-
e:SetLabelObject(g:GetFirst())
93-
s.cost(e,tp,eg,ep,ev,re,r,rp,1)
72+
local sc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
73+
Duel.ConfirmCards(1-tp,sc)
74+
Duel.ShuffleExtra(tp)
75+
e:SetLabel(table.unpack(sc.material))
9476
end
9577
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
9678
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
9779
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
9880
end
9981
function s.spop(e,tp,eg,ep,ev,re,r,rp)
10082
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
101-
local fc=e:GetLabelObject()
10283
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
103-
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,fc)
104-
if #g>0 then
105-
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
84+
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,e:GetLabel())
85+
if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then
86+
Duel.ConfirmCards(1-tp,g)
10687
end
107-
end
88+
end

0 commit comments

Comments
 (0)