Skip to content

Commit 2b2457a

Browse files
authored
use Cost.Discard
1 parent 50e2b6f commit 2b2457a

File tree

1 file changed

+21
-32
lines changed

1 file changed

+21
-32
lines changed

official/c28406301.lua

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
--Scripted by Hatter
44
local s,id=GetID()
55
function s.initial_effect(c)
6+
--Pendulum Summon procedure
67
Pendulum.AddProcedure(c)
7-
--Increase the ATK of a Fiend monster by 500, then destroy this card.
8+
--Make 1 Fiend monster you control gainx 500 ATK (until the end of this turn) for each "Dark Contract" Spell/Trap with different names currently on your field or in your GY, then destroy this card
89
local e1=Effect.CreateEffect(c)
910
e1:SetDescription(aux.Stringid(id,0))
1011
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY)
@@ -22,7 +23,7 @@ function s.initial_effect(c)
2223
e2:SetType(EFFECT_TYPE_IGNITION)
2324
e2:SetRange(LOCATION_HAND)
2425
e2:SetCountLimit(1,{id,1})
25-
e2:SetCondition(s.spcon)
26+
e2:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_DD),tp,LOCATION_MZONE,0,1,nil) end)
2627
e2:SetTarget(s.sptg)
2728
e2:SetOperation(s.spop)
2829
c:RegisterEffect(e2)
@@ -35,77 +36,68 @@ function s.initial_effect(c)
3536
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
3637
e3:SetCountLimit(1,{id,2})
3738
e3:SetCondition(function(e) return e:GetHandler():IsPendulumSummoned() end)
38-
e3:SetCost(s.drcost)
39+
e3:SetCost(Cost.Discard(Card.IsSetCard({SET_DD,SET_DARK_CONTRACT})))
3940
e3:SetTarget(s.drtg)
4041
e3:SetOperation(s.drop)
4142
c:RegisterEffect(e3)
42-
--Add 1 "D/D" card from your Deck to your hand
43+
--Add 1 "D/D" card from your Deck to your hand, except "D/D Gryphon"
4344
local e4=Effect.CreateEffect(c)
4445
e4:SetDescription(aux.Stringid(id,3))
4546
e4:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
4647
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
47-
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
48+
e4:SetProperty(EFFECT_FLAG_DELAY)
4849
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
4950
e4:SetCountLimit(1,{id,3})
50-
e4:SetCondition(s.thcon)
51+
e4:SetCondition(function(e) return e:GetHandler():IsSummonLocation(LOCATION_GRAVE) end)
5152
e4:SetTarget(s.thtg)
5253
e4:SetOperation(s.thop)
5354
c:RegisterEffect(e4)
5455
end
5556
s.listed_names={id}
5657
s.listed_series={SET_DARK_CONTRACT,SET_DD}
57-
function s.atkfilter(c)
58-
return c:IsFaceup() and c:IsSetCard(SET_DARK_CONTRACT) and c:IsSpellTrap()
58+
function s.atkctfilter(c)
59+
return c:IsSetCard(SET_DARK_CONTRACT) and c:IsSpellTrap() and c:IsFaceup()
5960
end
6061
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
6162
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsRace(RACE_FIEND) end
62-
if chk==0 then return Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,1,nil)
63+
if chk==0 then return Duel.IsExistingMatchingCard(s.atkctfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,1,nil)
6364
and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsRace,RACE_FIEND),tp,LOCATION_MZONE,0,1,nil) end
6465
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF)
6566
Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsRace,RACE_FIEND),tp,LOCATION_MZONE,0,1,1,nil)
66-
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
67+
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,tp,0)
6768
end
6869
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
6970
local c=e:GetHandler()
70-
if not c:IsRelateToEffect(e) then return end
7171
local tc=Duel.GetFirstTarget()
72-
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
73-
local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,nil)
74-
if #g<1 then return end
75-
--Update ATK
72+
if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsImmuneToEffect(e) then
73+
local g=Duel.GetMatchingGroup(s.atkctfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,nil)
74+
if #g==0 then return end
75+
--It gains 500 ATK (until the end of this turn) for each "Dark Contract" Spell/Trap with different names currently on your field or in your GY
7676
local e1=Effect.CreateEffect(c)
7777
e1:SetType(EFFECT_TYPE_SINGLE)
7878
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
7979
e1:SetCode(EFFECT_UPDATE_ATTACK)
8080
e1:SetValue(g:GetClassCount(Card.GetCode)*500)
8181
e1:SetReset(RESETS_STANDARD_PHASE_END)
8282
tc:RegisterEffect(e1)
83-
Duel.BreakEffect()
84-
Duel.Destroy(c,REASON_EFFECT)
83+
if c:IsRelateToEffect(e) then
84+
Duel.BreakEffect()
85+
Duel.Destroy(c,REASON_EFFECT)
86+
end
8587
end
8688
end
87-
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
88-
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_DD),tp,LOCATION_MZONE,0,1,nil)
89-
end
9089
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
9190
local c=e:GetHandler()
9291
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
9392
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end
94-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
93+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0)
9594
end
9695
function s.spop(e,tp,eg,ep,ev,re,r,rp)
9796
local c=e:GetHandler()
9897
if c:IsRelateToEffect(e) then
9998
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
10099
end
101100
end
102-
function s.drcostfilter(c)
103-
return c:IsSetCard({SET_DD,SET_DARK_CONTRACT}) and c:IsDiscardable()
104-
end
105-
function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
106-
if chk==0 then return Duel.IsExistingMatchingCard(s.drcostfilter,tp,LOCATION_HAND,0,1,nil) end
107-
Duel.DiscardHand(tp,s.drcostfilter,1,1,REASON_DISCARD|REASON_COST)
108-
end
109101
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
110102
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
111103
Duel.SetTargetPlayer(tp)
@@ -116,9 +108,6 @@ function s.drop(e,tp,eg,ep,ev,re,r,rp)
116108
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
117109
Duel.Draw(p,d,REASON_EFFECT)
118110
end
119-
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
120-
return e:GetHandler():IsSummonLocation(LOCATION_GRAVE)
121-
end
122111
function s.thfilter(c)
123112
return c:IsSetCard(SET_DD) and not c:IsCode(id) and c:IsAbleToHand()
124113
end
@@ -133,4 +122,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
133122
Duel.SendtoHand(g,nil,REASON_EFFECT)
134123
Duel.ConfirmCards(1-tp,g)
135124
end
136-
end
125+
end

0 commit comments

Comments
 (0)