Skip to content

Commit ded6a8d

Browse files
authored
Update "Cost.SelfChangePosition"
Immediately enable the monster's effects if it's changed from face-down to face-up position. Removes the need for a workaround in the script of "Deus X-Krawler" and some of the "Enneacraft" monsters.
1 parent 05bb5e6 commit ded6a8d

File tree

5 files changed

+7
-85
lines changed

5 files changed

+7
-85
lines changed

official/c28454232.lua

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,12 @@ function s.initial_effect(c)
4949
e4:SetTarget(s.distg)
5050
e4:SetOperation(s.disop)
5151
c:RegisterEffect(e4)
52-
--Your opponent cannot target cards in the field or GY with card effects
52+
--After this card was flipped face-up, while it is in the Monster Zone, your opponent cannot target cards in the field or GY with card effects
5353
local e5a=Effect.CreateEffect(c)
5454
e5a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
5555
e5a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
5656
e5a:SetCode(EVENT_FLIP)
57-
e5a:SetOperation(function(e)
58-
local c=e:GetHandler()
59-
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3))
60-
if Duel.GetCurrentChain()==0 then return end
61-
local fid=c:GetFieldID()
62-
--Workaround to have e5b apply immediately if it's flipped face-up due to its own effect
63-
local e1=Effect.CreateEffect(c)
64-
e1:SetType(EFFECT_TYPE_FIELD)
65-
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE)
66-
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
67-
e1:SetCondition(function() return c:HasFlagEffect(id) and c:IsFaceup() and not c:IsDisabled() and c:IsFieldID(fid) end)
68-
e1:SetTargetRange(LOCATION_ONFIELD|LOCATION_GRAVE,LOCATION_ONFIELD|LOCATION_GRAVE)
69-
e1:SetValue(aux.tgoval)
70-
e1:SetReset(RESET_CHAIN)
71-
Duel.RegisterEffect(e1,e:GetHandlerPlayer())
72-
end)
57+
e5a:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3)) end)
7358
c:RegisterEffect(e5a)
7459
local e5b=Effect.CreateEffect(c)
7560
e5b:SetType(EFFECT_TYPE_FIELD)

official/c62587693.lua

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,7 @@ function s.initial_effect(c)
2121
e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
2222
e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
2323
e2a:SetCode(EVENT_FLIP)
24-
e2a:SetOperation(function(e)
25-
local c=e:GetHandler()
26-
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2))
27-
local chain_link=Duel.GetCurrentChain()
28-
if chain_link==0 then return end
29-
local fid=c:GetFieldID()
30-
local tp=e:GetHandlerPlayer()
31-
--Workaround to have e2b apply immediately if it's flipped face-up due to its own effect
32-
local e1=Effect.CreateEffect(c)
33-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
34-
e1:SetCode(EVENT_CHAIN_SOLVING)
35-
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain()>chain_link and re:IsMonsterEffect() and rp==1-tp and Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)==LOCATION_MZONE and c:HasFlagEffect(id) and c:IsFaceup() and not c:IsDisabled() and c:IsFieldID(fid) end)
36-
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end)
37-
e1:SetReset(RESET_CHAIN)
38-
Duel.RegisterEffect(e1,tp)
39-
local e2=Effect.CreateEffect(c)
40-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
41-
e2:SetCode(EVENT_CHAIN_SOLVED)
42-
e2:SetOperation(function() e1:Reset() e2:Reset() end)
43-
e2:SetReset(RESET_CHAIN)
44-
Duel.RegisterEffect(e2,tp)
45-
end)
24+
e2a:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) end)
4625
c:RegisterEffect(e2a)
4726
local e2b=Effect.CreateEffect(c)
4827
e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)

official/c81237046.lua

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,7 @@ function s.initial_effect(c)
5252
e5a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
5353
e5a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
5454
e5a:SetCode(EVENT_FLIP)
55-
e5a:SetOperation(function(e)
56-
local c=e:GetHandler()
57-
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3))
58-
local chain_link=Duel.GetCurrentChain()
59-
if chain_link==0 then return end
60-
local fid=c:GetFieldID()
61-
local tp=e:GetHandlerPlayer()
62-
--Workaround to have e5b apply immediately if it's flipped face-up due to its own effect
63-
local e1=Effect.CreateEffect(c)
64-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
65-
e1:SetCode(EVENT_TO_GRAVE)
66-
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain()>chain_link and eg:IsExists(s.damconfilter,1,nil,tp) and c:HasFlagEffect(id) and c:IsFaceup() and not c:IsDisabled() and c:IsFieldID(fid) end)
67-
e1:SetOperation(s.damop)
68-
e1:SetReset(RESET_CHAIN)
69-
Duel.RegisterEffect(e1,tp)
70-
local e2=Effect.CreateEffect(c)
71-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
72-
e2:SetCode(EVENT_CHAIN_SOLVED)
73-
e2:SetOperation(function() e1:Reset() e2:Reset() end)
74-
e2:SetReset(RESET_CHAIN)
75-
Duel.RegisterEffect(e2,tp)
76-
end)
55+
e5a:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3)) end))
7756
c:RegisterEffect(e5a)
7857
local e5b=Effect.CreateEffect(c)
7958
e5b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)

official/c82359538.lua

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,30 +54,7 @@ function s.initial_effect(c)
5454
e5a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
5555
e5a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
5656
e5a:SetCode(EVENT_FLIP)
57-
e5a:SetOperation(function(e)
58-
local c=e:GetHandler()
59-
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3))
60-
local chain_link=Duel.GetCurrentChain()
61-
if chain_link==0 then return end
62-
local fid=c:GetFieldID()
63-
local tp=e:GetHandlerPlayer()
64-
--Workaround to have e5b apply immediately if it's flipped face-up due to its own effect
65-
local e1=Effect.CreateEffect(c)
66-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
67-
e1:SetCode(EVENT_TO_HAND)
68-
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain()>chain_link and e:GetHandler():HasFlagEffect(id) and rp==1-tp and r&REASON_EFFECT>0 and eg:IsExists(Card.IsControler,1,nil,1-tp) end)
69-
e1:SetOperation(s.damop)
70-
e1:SetReset(RESET_CHAIN)
71-
Duel.RegisterEffect(e1,tp)
72-
local e2=Effect.CreateEffect(c)
73-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
74-
e2:SetProperty(EFFECT_FLAG_DELAY)
75-
e2:SetCode(EVENT_CHAIN_SOLVED)
76-
e2:SetCondition(function() return c:HasFlagEffect(id) and c:IsFaceup() and not c:IsDisabled() and c:IsFieldID(fid) end)
77-
e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) e1:Reset() e2:Reset() s.chainsolvedop(e,tp,eg,ep,ev,re,r,rp) end)
78-
e2:SetReset(RESET_CHAIN)
79-
Duel.RegisterEffect(e2,tp)
80-
end)
57+
e5a:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3)) end))
8158
c:RegisterEffect(e5a)
8259
local e5b=Effect.CreateEffect(c)
8360
e5b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)

utility.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,7 +1549,9 @@ function Cost.SelfChangePosition(position)
15491549
local function cost_func(e,tp,eg,ep,ev,re,r,rp,chk)
15501550
local c=e:GetHandler()
15511551
if chk==0 then return c:IsCanChangePosition() and not c:IsPosition(position) and (position&POS_FACEDOWN==0 or c:IsCanTurnSet()) end
1552+
local fd_chk=c:IsPosition(POS_FACEDOWN) and position&POS_FACEUP>0
15521553
Duel.ChangePosition(c,position)
1554+
if fd_chk then c:SetStatus(STATUS_EFFECT_ENABLED,true) end
15531555
end
15541556
self_changepos_costs[cost_func]=true
15551557
return cost_func

0 commit comments

Comments
 (0)