Skip to content

Commit c20de85

Browse files
authored
Fix "Chaos Bringer"
Condition check was causing script issues/slight modernization update
1 parent 589cc46 commit c20de85

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

unofficial/c511000986.lua

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--カオス・クロス
12
--Chaos Bringer
23
Duel.LoadScript("c420.lua")
34
local s,id=GetID()
@@ -12,26 +13,26 @@ function s.initial_effect(c)
1213
e1:SetOperation(s.activate)
1314
c:RegisterEffect(e1)
1415
end
15-
s.listed_names={111011002}
16-
function s.cfilter(c)
17-
return c:IsType(TYPE_XYZ) and c:IsC() and c:GetOverlayCount()>0
16+
s.listed_names={111011002} --"Chaos Field"
17+
s.listed_series={0x568} --"C" archetype
18+
function s.cfilter(c,tp)
19+
return c:IsType(TYPE_XYZ) and c:IsC() and c:GetOverlayCount()>0 and c:IsSummonPlayer(tp)
1820
end
1921
function s.condition(e,tp,eg,ep,ev,re,r,rp)
20-
local g=eg:Filter(s.cfilter,nil)
21-
return #g==1 and ep==1-tp
22+
return #eg==1 and eg:IsExists(s.cfilter,1,nil,1-tp)
2223
end
23-
function s.filter(c)
24+
function s.thfilter(c)
2425
return c:IsCode(111011002) and c:IsAbleToHand()
2526
end
2627
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
27-
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
28+
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
2829
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
2930
end
3031
function s.activate(e,tp,eg,ep,ev,re,r,rp)
31-
local g=eg:Filter(s.cfilter,nil):GetFirst()
32+
local g=eg:Filter(s.cfilter,nil,1-tp):GetFirst()
3233
g:RemoveOverlayCard(tp,g:GetOverlayCount(),g:GetOverlayCount(),REASON_EFFECT)
3334
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
34-
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
35+
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
3536
if #g>0 then
3637
Duel.SendtoHand(g,nil,REASON_EFFECT)
3738
Duel.ConfirmCards(1-tp,g)
@@ -40,8 +41,8 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
4041
e1:SetCode(EFFECT_CANNOT_ATTACK)
4142
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
4243
e1:SetTarget(aux.TargetBoolFunction(Card.IsC))
43-
e1:SetReset(RESET_PHASE+PHASE_END)
44+
e1:SetReset(RESET_PHASE|PHASE_END)
4445
e1:SetValue(1)
4546
Duel.RegisterEffect(e1,tp)
4647
end
47-
end
48+
end

0 commit comments

Comments
 (0)