Skip to content

Commit d00b510

Browse files
committed
Add support for the DUEL_EXTRA_DECK_RITUAL flag
Handle rituals being played either from main deck/hand or extra deck
1 parent ef171b5 commit d00b510

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

constant.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,9 +941,10 @@ DUEL_SINGLE_CHAIN_IN_DAMAGE_SUBSTEP = 0x40000000
941941
DUEL_CAN_REPOS_IF_NON_SUMPLAYER = 0x80000000
942942
DUEL_TCG_SEGOC_NONPUBLIC = 0x100000000
943943
DUEL_TCG_SEGOC_FIRSTTRIGGER = 0x200000000
944+
DUEL_EXTRA_DECK_RITUAL = 0x800000000
944945
--Compost flags for duel modes
945946
DUEL_MODE_SPEED = (DUEL_3_COLUMNS_FIELD | DUEL_NO_MAIN_PHASE_2 | DUEL_TRIGGER_ONLY_IN_LOCATION)
946-
DUEL_MODE_RUSH = (DUEL_3_COLUMNS_FIELD | DUEL_NO_MAIN_PHASE_2 | DUEL_NO_STANDBY_PHASE | DUEL_1ST_TURN_DRAW | DUEL_INVERTED_QUICK_PRIORITY | DUEL_DRAW_UNTIL_5 | DUEL_NO_HAND_LIMIT | DUEL_UNLIMITED_SUMMONS | DUEL_TRIGGER_ONLY_IN_LOCATION)
947+
DUEL_MODE_RUSH = (DUEL_3_COLUMNS_FIELD | DUEL_NO_MAIN_PHASE_2 | DUEL_NO_STANDBY_PHASE | DUEL_1ST_TURN_DRAW | DUEL_INVERTED_QUICK_PRIORITY | DUEL_DRAW_UNTIL_5 | DUEL_NO_HAND_LIMIT | DUEL_UNLIMITED_SUMMONS | DUEL_TRIGGER_ONLY_IN_LOCATION | DUEL_EXTRA_DECK_RITUAL)
947948
DUEL_MODE_MR1 = (DUEL_OBSOLETE_IGNITION | DUEL_1ST_TURN_DRAW | DUEL_1_FIELD | DUEL_SPSUMMON_ONCE_OLD_NEGATE | DUEL_RETURN_TO_DECK_TRIGGERS | DUEL_CANNOT_SUMMON_OATH_OLD)
948949
DUEL_MODE_GOAT = (DUEL_MODE_MR1 | DUEL_USE_TRAPS_IN_NEW_CHAIN | DUEL_6_STEP_BATLLE_STEP | DUEL_TRIGGER_WHEN_PRIVATE_KNOWLEDGE | DUEL_EQUIP_NOT_SENT_IF_MISSING_TARGET | DUEL_0_ATK_DESTROYED | DUEL_STORE_ATTACK_REPLAYS | DUEL_SINGLE_CHAIN_IN_DAMAGE_SUBSTEP | DUEL_CAN_REPOS_IF_NON_SUMPLAYER | DUEL_TCG_SEGOC_NONPUBLIC | DUEL_TCG_SEGOC_FIRSTTRIGGER)
949950
DUEL_MODE_MR2 = (DUEL_1ST_TURN_DRAW | DUEL_1_FIELD | DUEL_SPSUMMON_ONCE_OLD_NEGATE | DUEL_RETURN_TO_DECK_TRIGGERS | DUEL_CANNOT_SUMMON_OATH_OLD)

proc_ritual.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ local function ForceExtraRelease(mg)
123123
return g:Includes(mg)
124124
end
125125
end
126+
local function GetDefaultSummonFromLocation()
127+
return Duel.IsDuelType(DUEL_EXTRA_DECK_RITUAL) and LOCATION_EXTRA or LOCATION_HAND
128+
end
126129
Ritual.Target = aux.FunctionWithNamedArgs(
127130
function(filter,_type,lv,extrafil,extraop,matfilter,stage2,location,forcedselection,specificmatfilter,requirementfunc,sumpos,extratg)
128-
location = location or LOCATION_HAND
131+
location = location or GetDefaultSummonFromLocation()
129132
sumpos = sumpos or POS_FACEUP
130133
return function(e,tp,eg,ep,ev,re,r,rp,chk)
131134
if chk==0 then
@@ -196,7 +199,7 @@ function Ritual.Check(sc,lv,forcedselection,_type,requirementfunc)
196199
res=sg:CheckWithSumGreater(requirementfunc or Card.GetRitualLevel,lv,sc)
197200
end
198201
local stop=false
199-
res=res and Duel.GetMZoneCount(tp,sg,tp)>0
202+
res=res and (sc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,sg,sc) or Duel.GetMZoneCount(tp,sg,tp))>0
200203
end
201204
return res,stop
202205
end
@@ -218,7 +221,7 @@ end
218221

219222
Ritual.Operation = aux.FunctionWithNamedArgs(
220223
function(filter,_type,lv,extrafil,extraop,matfilter,stage2,location,forcedselection,customoperation,specificmatfilter,requirementfunc,sumpos)
221-
location = location or LOCATION_HAND
224+
location = location or GetDefaultSummonFromLocation()
222225
sumpos = sumpos or POS_FACEUP
223226
return function(e,tp,eg,ep,ev,re,r,rp)
224227
local mg=Duel.GetRitualMaterial(tp,not requirementfunc)

0 commit comments

Comments
 (0)