Skip to content

Commit 40aeb37

Browse files
authored
Orcustrated Core
- Can't use a 2nd Orcustrated Core to apply the effect on a card that already has the effect applied to it - Use a table for checking multiple archetypes
1 parent afdcf39 commit 40aeb37

File tree

1 file changed

+40
-49
lines changed

1 file changed

+40
-49
lines changed

official/c55051920.lua

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,84 +4,75 @@
44
local s,id=GetID()
55
function s.initial_effect(c)
66
--Activate
7+
local e0=Effect.CreateEffect(c)
8+
e0:SetType(EFFECT_TYPE_ACTIVATE)
9+
e0:SetCode(EVENT_FREE_CHAIN)
10+
c:RegisterEffect(e0)
11+
--Neither player can target 1 "Orcust" or "World Legacy" card you control with card effects this turn
712
local e1=Effect.CreateEffect(c)
8-
e1:SetType(EFFECT_TYPE_ACTIVATE)
13+
e1:SetDescription(aux.Stringid(id,0))
14+
e1:SetType(EFFECT_TYPE_QUICK_O)
15+
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
916
e1:SetCode(EVENT_FREE_CHAIN)
10-
e1:SetHintTiming(0,TIMING_END_PHASE)
17+
e1:SetRange(LOCATION_SZONE)
18+
e1:SetCountLimit(1)
19+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMINGS_CHECK_MONSTER)
20+
e1:SetCost(s.effcost)
21+
e1:SetTarget(s.efftg)
22+
e1:SetOperation(s.effop)
1123
c:RegisterEffect(e1)
12-
--Neither player can target 1 "Orcust" or "World Legacy" card you control with card effects this turn
24+
--If other "Orcust" and/or "World Legacy" card(s) you control would be destroyed by battle or card effect, you can send this card to the GY instead
1325
local e2=Effect.CreateEffect(c)
14-
e2:SetDescription(aux.Stringid(id,0))
15-
e2:SetType(EFFECT_TYPE_QUICK_O)
16-
e2:SetCode(EVENT_FREE_CHAIN)
17-
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
26+
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
27+
e2:SetCode(EFFECT_DESTROY_REPLACE)
1828
e2:SetRange(LOCATION_SZONE)
19-
e2:SetCountLimit(1)
20-
e2:SetCost(s.immcost)
21-
e2:SetTarget(s.immtg)
22-
e2:SetOperation(s.immop)
29+
e2:SetTarget(s.reptg)
30+
e2:SetValue(function(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end)
31+
e2:SetOperation(function(e) Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT|REASON_REPLACE) end)
2332
c:RegisterEffect(e2)
24-
--Substitute destruction for an "Orcust" or "World Legacy" card(s)
25-
local e3=Effect.CreateEffect(c)
26-
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
27-
e3:SetCode(EFFECT_DESTROY_REPLACE)
28-
e3:SetRange(LOCATION_SZONE)
29-
e3:SetTarget(s.reptg)
30-
e3:SetValue(s.repval)
31-
e3:SetOperation(s.repop)
32-
c:RegisterEffect(e3)
3333
end
3434
s.listed_series={SET_ORCUST,SET_WORLD_LEGACY}
3535
s.listed_names={id}
36-
function s.cfilter(c,tp)
36+
function s.effcostfilter(c,tp)
3737
return c:IsAbleToRemoveAsCost() and c:IsMonster() and aux.SpElimFilter(c,false,true)
38-
and Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,c)
38+
and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,c)
3939
end
40-
function s.filter(c)
41-
return c:IsFaceup() and c:IsSetCard({SET_ORCUST,SET_WORLD_LEGACY}) and not c:IsCode(id)
40+
function s.tgfilter(c)
41+
return c:IsSetCard({SET_ORCUST,SET_WORLD_LEGACY}) and c:IsFaceup() and not c:IsCode(id) and not c:HasFlagEffect(id)
4242
end
43-
function s.immcost(e,tp,eg,ep,ev,re,r,rp,chk)
44-
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end
43+
function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk)
44+
if chk==0 then return Duel.IsExistingMatchingCard(s.effcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end
4545
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
46-
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp)
46+
local g=Duel.SelectMatchingCard(tp,s.effcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp)
4747
Duel.Remove(g,POS_FACEUP,REASON_COST)
4848
end
49-
function s.immtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
50-
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) and s.filter(chkc) end
51-
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end
49+
function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
50+
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.tgfilter(chkc) end
51+
if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,nil) end
5252
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO)
53-
Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,nil)
53+
Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_ONFIELD,0,1,1,nil)
5454
end
55-
function s.immop(e,tp,eg,ep,ev,re,r,rp)
55+
function s.effop(e,tp,eg,ep,ev,re,r,rp)
5656
local tc=Duel.GetFirstTarget()
5757
if tc:IsRelateToEffect(e) then
58+
tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
5859
--Neither player can target it with card effects this turn
5960
local e1=Effect.CreateEffect(e:GetHandler())
6061
e1:SetDescription(3002)
61-
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
6262
e1:SetType(EFFECT_TYPE_SINGLE)
63+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
6364
e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
64-
e1:SetReset(RESETS_STANDARD_PHASE_END)
6565
e1:SetValue(1)
66+
e1:SetReset(RESETS_STANDARD_PHASE_END)
6667
tc:RegisterEffect(e1)
6768
end
6869
end
6970
function s.repfilter(c,tp)
70-
return c:IsFaceup() and (c:IsSetCard(SET_ORCUST) or c:IsSetCard(SET_WORLD_LEGACY)) and c:IsOnField()
71-
and c:IsControler(tp) and c:IsReason(REASON_EFFECT|REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
71+
return c:IsSetCard({SET_ORCUST,SET_WORLD_LEGACY}) and c:IsOnField() and c:IsControler(tp) and c:IsFaceup()
72+
and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
7273
end
7374
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
74-
if chk==0 then return e:GetHandler():IsAbleToGrave() and not eg:IsContains(e:GetHandler())
75-
and eg:IsExists(s.repfilter,1,e:GetHandler(),tp) end
76-
if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then
77-
return true
78-
else
79-
return false
80-
end
81-
end
82-
function s.repval(e,c)
83-
return s.repfilter(c,e:GetHandlerPlayer())
75+
local c=e:GetHandler()
76+
if chk==0 then return c:IsAbleToGrave() and not eg:IsContains(c) and eg:IsExists(s.repfilter,1,nil,tp) end
77+
return Duel.SelectEffectYesNo(tp,c,96)
8478
end
85-
function s.repop(e,tp,eg,ep,ev,re,r,rp)
86-
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT)
87-
end

0 commit comments

Comments
 (0)