Skip to content

Commit eb444e8

Browse files
committed
"Darklord Uprising" fix
Fixed a bug where the player would not be able to activate it sometimes when their monster zones were all occupied
1 parent bc9ac17 commit eb444e8

File tree

1 file changed

+42
-48
lines changed

1 file changed

+42
-48
lines changed

official/c54527349.lua

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,65 +3,60 @@
33
--Scripted by edo9300
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
local e1=Fusion.CreateSummonEff({handler=c,fusfilter=aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),extrafil=s.extrafil,stage2=s.stage2})
7-
local tg=e1:GetTarget()
8-
local op=e1:GetOperation()
9-
e1:SetTarget(s.target(tg))
10-
e1:SetOperation(s.operation(op))
11-
e1:SetCost(s.cost(tg))
6+
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
8+
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_RECOVER)
9+
e1:SetType(EFFECT_TYPE_ACTIVATE)
10+
e1:SetCode(EVENT_FREE_CHAIN)
1211
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
12+
e1:SetCost(s.spcost)
13+
e1:SetTarget(s.sptg)
14+
e1:SetOperation(s.spop)
1315
c:RegisterEffect(e1)
1416
end
1517
s.listed_series={SET_DARKLORD}
16-
function s.target(target)
17-
return function(e,tp,eg,ep,ev,re,r,rp,chk)
18-
if chk==0 then
19-
if e:GetLabel()==0 then
20-
return target(e,tp,eg,ep,ev,re,r,rp,0)
21-
end
22-
e:SetLabel(0)
23-
return true
24-
end
25-
e:SetLabel(0)
26-
return target(e,tp,eg,ep,ev,re,r,rp,chk)
27-
end
28-
end
29-
function s.operation(operation)
30-
return function(e,...)
31-
e:SetLabel(1)
32-
local res=operation(e,...)
33-
e:SetLabel(0)
34-
return res
18+
function s.fextra(exc)
19+
return function(e,tp,mg)
20+
return nil,s.costcardcheck(exc)
3521
end
3622
end
37-
function s.check(e)
23+
function s.costcardcheck(exc)
3824
return function(tp,sg,fc)
39-
return e:GetLabel()==1 or (not e:GetLabelObject() or not sg:IsContains(e:GetLabelObject()))
25+
return not (exc and sg:IsContains(exc))
4026
end
4127
end
42-
function s.extrafil(e,tp,mg1)
43-
return nil,s.check(e)
28+
function s.costfilter(c,e,tp,eg,ep,ev,re,r,rp)
29+
if not (c:IsSetCard(SET_DARKLORD) and c:IsMonster() and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost()) then return false end
30+
local params={fusfilter=aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),extrafil=s.fextra(c)}
31+
return Fusion.SummonEffTG(params)(e,tp,eg,ep,ev,re,r,rp,0)
4432
end
45-
function s.costfilter(c,target,e,tp,eg,ep,ev,re,r,rp,chk)
46-
e:SetLabelObject(c)
47-
local res=c:IsSetCard(SET_DARKLORD) and c:IsMonster() and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
48-
and c:IsAbleToGraveAsCost() and target(e,tp,eg,ep,ev,re,r,rp,0)
49-
e:SetLabelObject(nil)
50-
return res
33+
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
34+
e:SetLabel(100)
35+
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,e,tp,eg,ep,ev,re,r,rp) end
36+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
37+
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp)
38+
Duel.SendtoGrave(g,REASON_COST)
39+
e:SetLabelObject(g:GetFirst())
5140
end
52-
function s.cost(target)
53-
return function(e,tp,eg,ep,ev,re,r,rp,chk)
54-
if chk==0 then
55-
e:SetLabel(0)
56-
local res=Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,target,e,tp,eg,ep,ev,re,r,rp,chk)
57-
if res then e:SetLabel(1) end
58-
return res
59-
end
60-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
61-
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil,target,e,tp,eg,ep,ev,re,r,rp,chk)
62-
Duel.SendtoGrave(g,REASON_COST)
63-
e:SetLabelObject(g:GetFirst())
41+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
42+
if chk==0 then
43+
local params={fusfilter=aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK)}
44+
return e:GetLabel()==100 or Fusion.SummonEffTG(params)(e,tp,eg,ep,ev,re,r,rp,0)
45+
end
46+
local cost_card=e:GetLabelObject()
47+
if cost_card then
48+
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,1,tp,cost_card:GetBaseAttack())
49+
end
50+
end
51+
function s.spop(e,tp,eg,ep,ev,re,r,rp,chk)
52+
local cost_card=e:GetLabelObject()
53+
local params={}
54+
if cost_card then
55+
params={fusfilter=aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),extrafil=s.fextra(cost_card),stage2=s.stage2}
56+
else
57+
params={fusfilter=aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK)}
6458
end
59+
Fusion.SummonEffOP(params)(e,tp,eg,ep,ev,re,r,rp,1)
6560
end
6661
function s.stage2(e,tc,tp,sg,chk)
6762
if chk==1 and e:IsHasType(EFFECT_TYPE_ACTIVATE) and e:GetLabelObject() then
@@ -70,7 +65,6 @@ function s.stage2(e,tc,tp,sg,chk)
7065
Duel.BreakEffect()
7166
Duel.Recover(tp,lp,REASON_EFFECT)
7267
end
73-
e:SetLabel(0)
7468
e:SetLabelObject(nil)
7569
end
7670
end

0 commit comments

Comments
 (0)