Skip to content

Commit 2ad67cd

Browse files
authored
"Assault Mode Activate" script update + updated some functions
- Assault Mode Activate: Added more hint timings and general modernisation. - Duel.GetReleaseGroup & Duel.Release: Added partial handling for Tributing cards in the Extra Deck.
1 parent f0b46e7 commit 2ad67cd

File tree

2 files changed

+66
-14
lines changed

2 files changed

+66
-14
lines changed

official/c80280737.lua

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,45 @@ local s,id=GetID()
44
function s.initial_effect(c)
55
--Activate
66
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
78
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
89
e1:SetType(EFFECT_TYPE_ACTIVATE)
910
e1:SetCode(EVENT_FREE_CHAIN)
10-
e1:SetHintTiming(0,TIMING_END_PHASE)
1111
e1:SetCost(s.cost)
1212
e1:SetTarget(s.target)
1313
e1:SetOperation(s.activate)
14+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
1415
c:RegisterEffect(e1)
1516
end
1617
s.listed_series={SET_ASSAULT_MODE}
1718
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
1819
e:SetLabel(1)
1920
return true
2021
end
21-
function s.filter1(c,e,tp,ft)
22-
return c:IsType(TYPE_SYNCHRO) and (ft>0 or (c:GetSequence()<5 and c:IsControler(tp)))
23-
and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_DECK,0,1,nil,c:GetCode(),e,tp)
22+
function s.costfilter(c,e,tp)
23+
return c:IsSynchroMonster() and Duel.GetMZoneCount(tp,c)>0
24+
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetCode())
2425
end
25-
function s.filter2(c,tcode,e,tp)
26-
return c:IsSetCard(SET_ASSAULT_MODE) and c.assault_mode and c.assault_mode==tcode and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
26+
function s.spfilter(c,e,tp,code)
27+
return c:IsSetCard(SET_ASSAULT_MODE) and c.assault_mode and c.assault_mode==code and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
2728
end
2829
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
29-
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
3030
if chk==0 then
3131
if e:GetLabel()~=1 then return false end
3232
e:SetLabel(0)
33-
return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.filter1,1,false,nil,nil,e,tp,ft)
33+
return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,e,tp)
3434
end
35-
local rg=Duel.SelectReleaseGroupCost(tp,s.filter1,1,1,false,nil,nil,e,tp,ft)
36-
Duel.SetTargetParam(rg:GetFirst():GetCode())
37-
Duel.Release(rg,REASON_COST)
35+
local sc=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,e,tp):GetFirst()
36+
Duel.SetTargetParam(sc:GetCode())
37+
Duel.Release(sc,REASON_COST)
3838
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
3939
end
4040
function s.activate(e,tp,eg,ep,ev,re,r,rp)
4141
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
4242
local code=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
4343
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
44-
local tc=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_DECK,0,1,1,nil,code,e,tp):GetFirst()
45-
if tc and Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP_ATTACK)>0 then
46-
tc:CompleteProcedure()
44+
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,code):GetFirst()
45+
if sc and Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP_ATTACK)>0 then
46+
sc:CompleteProcedure()
4747
end
4848
end

proc_workaround.lua

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
--Utilities to be added to the core
22

3+
--[[
4+
allow EFFECT_EXTRA_RELEASE_NONSUM effects to work on cards in the Extra Deck
5+
used by "Duel Evolution - Assault Zone"
6+
possibly to be expanded on to also include other locations such as the Deck
7+
8+
will add more comments later
9+
--]]
10+
Duel.GetReleaseGroup=(function()
11+
local oldfunc=Duel.GetReleaseGroup
12+
return function(player,use_hand,use_oppo,reason)
13+
use_hand=use_hand or false
14+
use_oppo=use_oppo or false
15+
reason=reason or REASON_COST
16+
local g=oldfunc(player,use_hand,use_oppo,reason)
17+
local exg=Duel.GetMatchingGroup(function(c) return c:IsHasEffect(EFFECT_EXTRA_RELEASE_NONSUM) and c:IsReleasable(reason) end,player,LOCATION_EXTRA,0,nil)
18+
if #exg>0 then
19+
local re=Duel.GetReasonEffect()
20+
for exc in exg:Iter() do
21+
local effs={exc:IsHasEffect(EFFECT_EXTRA_RELEASE_NONSUM)}
22+
for _,eff in ipairs(effs) do
23+
local value=eff:GetValue()
24+
if value==1 or value(eff,re,reason,player) then
25+
g:AddCard(exc)
26+
end
27+
end
28+
end
29+
end
30+
return g
31+
end
32+
end)()
33+
Duel.Release=(function()
34+
local oldfunc=Duel.Release
35+
return function(targets,reason,rp)
36+
rp=rp or Duel.GetReasonPlayer()
37+
local exg=Group.CreateGroup()
38+
local others=Group.CreateGroup()
39+
if type(targets)=="Group" then
40+
exg,others=targets:Split(Card.IsLocation,nil,LOCATION_EXTRA)
41+
elseif type(targets)=="Card" then
42+
if targets:IsLocation(LOCATION_EXTRA) then
43+
exg:AddCard(targets)
44+
else
45+
others:AddCard(targets)
46+
end
47+
end
48+
oldfunc(others,reason,rp)
49+
if #exg>0 then
50+
Duel.SendtoGrave(exg,REASON_RELEASE|reason,nil,rp)
51+
end
52+
end
53+
end)()
54+
355
--[[
456
If a non-activated effect allows a monster to be Special Summoned with a different property (e.g. "as a Level X monster") then that different property should be considered when any "cannot summon" type of effects are checked
557
("Cockadoodledoo" vs "Evilswarm Ophion" workaround)

0 commit comments

Comments
 (0)