Commit df693213 authored by Tachibana's avatar Tachibana

tnndx

parent 6be85944
......@@ -480,7 +480,10 @@ function rsef.RegisterReset(reg_eff, reset_list, is_return)
end
--Effect: Register Effect Final
function rsef.RegisterEffect(reg_list, reg_eff)
if rsef.effet_no_register then return reg_eff, -1 end
if rsef.effet_no_register then
rsef.effet_no_register = false
return reg_eff, -1
end
local reg_owner, reg_handler, reg_ignore = rsef.GetRegisterCard(reg_list)
if type(reg_handler) == "number" and (reg_handler == 0 or reg_handler == 1) then
Duel.RegisterEffect(reg_eff, reg_handler)
......@@ -649,11 +652,11 @@ function rsef.Attribute(reg_list, eff_type, att_list, val_list, tg, tg_range_lis
att_list3 = { }
-- for card code buff
if type(att_str) == "number" then
att_list3 = { m }
att_list3 = { att_str }
else
att_list3 = rsef.value_code_list[att_str]
end
if #att_list3 == 0 then
if not att_list3 or #att_list3 == 0 then
Debug.Message("rsef.Attribute for ".. reg_owner:GetOriginalCodeRule() .. " must have a correct att_list (2nd parama).")
return
end
......@@ -727,7 +730,7 @@ end
--Field Val Effect: Base set
function rsef.FV(reg_list, code, val, tg, tg_range_list, range, con, reset_list, flag, desc_list, lim_list)
local flag2 = rsef.GetRegisterProperty(reg_list, flag)
if desc_list then flag2 = flag2 | EFFECT_FLAG_CLIENT_HINT end
if desc_list then flag2 = flag2 | EFFECT_FLAG_CLIENT_HINT end
return rsef.Register(reg_list, EFFECT_TYPE_FIELD, code, desc_list, lim_list, nil, flag2, range, con, nil, tg, nil, val, tg_range_list, nil, reset_list)
end
--Field Val Effect: attribute base set (new)
......@@ -1142,70 +1145,80 @@ function rsef.FC_PhaseLeave(reg_list, leave_val, times, whos, phase, leaveway, r
-- 1 your opponent's phase (1 - tp)
local reg_owner, reg_handler = rsef.GetRegisterCard(reg_list)
local cphase = Duel.GetCurrentPhase()
local turnctlist = { Duel.GetTurnCount(), Duel.GetTurnCount(reg_handler), Duel.GetTurnCount(1 - reg_handler) }
local atct = Duel.GetTurnCount()
local turnp = Duel.GetTurnPlayer()
phase = phase or PHASE_END
leaveway = leaveway or "des"
if times and times == 0 and whos == 0 and turnp == tp then
times = cphase <= phase and 2 or 1
end
if times and times == 0 and whos == 1 and turnp ~= tp then
times = cphase <= phase and 2 or 1
end
local sg = rsgf.Mix2(leave_val)
local fid = reg_owner:GetFieldID()
for tc in aux.Next(sg) do
local rst = times and rsrst.std + RESET_PHASE + phase or rsrst.std
tc:RegisterFlagEffect(rscode.Phase_Leave_Flag, rst, 0, 0, fid)
tc:RegisterFlagEffect(rscode.Phase_Leave_Flag, rsrst.std, 0, 0, fid)
end
local e1 = rsef.FC(reg_list, EVENT_PHASE + phase, rshint.epleave, 1, "ii", nil, rsef.FC_PhaseLeave_Con(cphase, turnctlist, turnp, fid, times, whos), rsef.FC_PhaseLeave_Op(leaveway, fid), reset_list)
sg:KeepAlive()
e1:SetLabelObject(sg)
local e1 = rsef.FC(reg_list, EVENT_PHASE + phase, rshint.epleave, 1, "ii", nil, rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times), rsef.FC_PhaseLeave_Op(leaveway, fid))
rsop.opinfo[e1] = {sg, 0, 0}
return e1
end
function rsef.FC_PhaseLeave_Filter(c, fid)
return c:GetFlagEffectLabel(rscode.Phase_Leave_Flag) == fid
end
function rsef.FC_PhaseLeave_Con(cphase, turnctlist, turnp, fid, times, whos)
return function(e, tp, eg, ep, ev, re, r, rp)
local ecphase = Duel.GetCurrentPhase()
local eturnp = Duel.GetTurnPlayer()
local eturnct, eturncttp, eturnctop = Duel.GetTurnCount(), Duel.GetTurnCount(tp), Duel.GetTurnCount()
local turnct, turncttp, turnctop = turnctlist[1], turnctlist[2], turnctlist[3]
local g = e:GetLabelObject()
local rg = g:Filter(rsef.FC_PhaseLeave_Filter, nil, fid)
local reset = false
local solve = false
if #rg <= 0 then reset = true end
if times and times > 0 and not whos then
if eturnct > turnct + (times - 1) then reset = true end
if eturnct == turnct + (times - 1) then solve = true end
end
if times and times > 0 and whos == 0 and eturnp == tp then
if eturncttp > turncttp + (times - 1) then reset = true end
if eturncttp == turncttp + (times - 1) then solve = true end
end
if times and times > 0 and whos == 0 and eturnp ~= tp then
if eturnctop > turnctop + (times - 1) then reset = true end
if eturnctop == turnctop + (times - 1) then solve = true end
end
if not times then
solve = true
function rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times)
return function(e, tp, ...)
local sg, tct, ph_chk = table.unpack(rsop.opinfo[e])
local cur_t = Duel.GetTurnCount()
if ph_chk ~= cur_t then
if not whos or (whos == 0 and Duel.GetTurnPlayer() == tp) or (whos == 1 and Duel.GetTurnPlayer() ~= tp) then
-- case1 , next phase
if times and times == 0 and Duel.GetTurnCount() > atct then
ph_chk = cur_t
tct = tct + 1
elseif not times or times > 0 then
-- case2 , normal
ph_chk = cur_t
tct = tct + 1
end
end
end
rsop.opinfo[e] = {sg, tct, ph_chk}
sg, tct, ph_chk = table.unpack(rsop.opinfo[e])
local reset, solve = false, false
local rg = sg:Filter(rsef.FC_PhaseLeave_Filter, nil, fid)
if #rg <= 0 then
reset = true
end
--case1, every phase
if not times then
solve = true
end
-- case2, next phase
if times == 0 then
if tct == 1 then
solve = true
elseif tct > 1 then
reset = true
end
end
-- case3, 1+ phase
if times>0 and times == tct then
solve = true
elseif times>0 and tct > times then
reset = true
end
if reset then
g:DeleteGroup()
sg:DeleteGroup()
e:Reset()
return false
return
end
return solve
end
end
function rsef.FC_PhaseLeave_Op(solve_str, fid)
return function(e, tp, eg, ep, ev, re, r, rp)
local sg, tct, ph_chk = table.unpack(rsop.opinfo[e])
e:Reset()
local c = e:GetOwner()
Duel.Hint(HINT_CARD, 0, c:GetOriginalCode())
local g = e:GetLabelObject()
local rg = g:Filter(rsef.FC_PhaseLeave_Filter, nil, fid)
local rg = sg:Filter(rsef.FC_PhaseLeave_Filter, nil, fid)
if type(solve_str) == "function" then solve_str(rg, e, tp, eg, ep, ev, re, r, rp)
else
rshint.nohint = true
......@@ -1247,7 +1260,7 @@ function rsop.FC_Global(reg_player,event)
end
--Field Continues: Easy Player
function rsef.FC_Easy(reg_list, code, flag, range, con, op, reset_list)
return rsef.FC(reg_list, code, nil, nil, nil, nil, con, op, reset_list)
return rsef.FC(reg_list, code, nil, nil, flag, range, con, op, reset_list)
end
----------------"Part_Effect_SingleContinuous"----------------
......@@ -1487,44 +1500,92 @@ function rsop.token_reg(tk_code)
end
end
end
function rstg.token(tk_code, tk_att_fun, ct, sum_pos, ignore_ft)
if not rstg.tk_list[tk_code] then
local ge1 = rsef.FC_Global(0, EVENT_ADJUST, tk_code, nil, rsop.token_reg(tk_code))
function rstg.token(tk_code_or_fun, ct, sum_pos, tg_p, ignore_ft)
if type(tk_code_or_fun) == "number" and not rstg.tk_list[tk_code_or_fun] then
local ge1 = rsef.FC_Global(0, EVENT_ADJUST, tk_code_or_fun, nil, rsop.token_reg(tk_code_or_fun))
end
return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
local res, spct = rssf.CheckTokenSummonable(e, tp, tk_code, tk_att_fun, ct, sum_pos, ignore_ft, eg, ep, ev, re, r, rp, 0)
tg_p = tg_p or 0
local sp = tg_p == 0 and tp or 1 - tp
local res = rssf.CheckTokenSummonable(e, tp, tk_code_or_fun, sum_pos, sp, nil, eg, ep, ev, re, r, rp, 0)
local ft = Duel.GetLocationCount(sp, LOCATION_MZONE, tp)
if rscon.bsdcheck(tp) and type(ct) == "number" and ct > 1 then res = false end
if type(ct) == "number" and ft < ct then res = false end
if chkc then return true end
if chk == 0 then return res end
Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, spct, 0, 0)
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, spct, 0, 0)
end
end
function rssf.CheckTokenSummonable(e, tp, tk_code, tk_att_fun, ct, sum_pos, ignore_ft, ...)
tk_att_fun = tk_att_fun or aux.TRUE
local tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = tk_att_fun(e, tp, ...)
local tk = rstg.tk_list[tk_code][tp]
local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
function rssf.CheckTokenSummonable(e, tp, tk_code_or_fun, sum_pos, tg_p, sum_zone, ...)
local tk
local tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type
if type(tk_code_or_fun) == "number" then
tk = rstg.tk_list[tk_code_or_fun][tp]
elseif type(tk_code_or_fun) == "function" then
tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = tk_att_fun(e, tp, ...)
else
tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = table.unpack(tk_code_or_fun)
end
ct = ct or 1
sp = sp or tp
sp = sp or tg_p or tp
sum_pos = sum_pos2 or sum_pos or POS_FACEUP
sum_type = sum_type or 0
if tk_set and
if not tk and
not Duel.IsPlayerCanSpecialSummonMonster(tp, tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos, sp, sum_type) then
return false
end
if not tk_set and not tk:IsCanBeSpecialSummoned(e, sum_type or 0, tp, false, false, sum_pos, sp) then
if tk and not tk:IsCanBeSpecialSummoned(e, sum_type or 0, tp, false, false, sum_pos, sp, sum_zone) then
return false
end
if rscon.bsdcheck(tp) and type(ct) == "number" and ct > 1 then return false end
if type(ct) == "number" and ft < ct then return false end
if not ignore_ft and ft <= 0 then return false end
if rsof.Check_Boolean(ct, true) then
ct = math.min(ct, ft)
return true
end
function rssf.SpecialSummonToken(e, tp, tk_code_or_fun, minct, maxct, sum_pos, tg_p, sum_zone, ...)
local res_ct = 0
local res = rssf.CheckTokenSummonable(e, tp, tk_code_or_fun, minct, sum_pos, tg_p, sum_zone, ...)
if not res then return res_ct end
local ft = Duel.GetLocationCount(sp, LOCATION_MZONE, tp)
if ft <= 0 then return false end
local sum_min, sum_max = minct, math.min(maxct, ft)
if rscon.bsdcheck(tp) and type(minct) == "number" and minct > 1 then return res_ct end
if type(minct) == "number" and ft < minct then return res_ct end
if rsof.Check_Boolean(minct) then
sum_min= ft
end
if rscon.bsdcheck(tp) then
ct = 1
sum_min, sum_max = 1, 1
end
if sum_min > sum_max then return res_ct end
local sp_ct = sum_min
if sum_max > sum_min then
local list = { }
for idx = sum_min, sum_max do
table.insert(list, idx)
end
sp_ct = Duel.AnnounceNumber(tp, table.unpack(list))
end
local tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type
if type(tk_code_or_fun) == "number" then
tk_code = tk_code_or_fun
elseif type(tk_code_or_fun) == "function" then
tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = tk_code_or_fun(e, tp, ...)
else
tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = table.unpack(tk_code_or_fun)
end
return true, ct
sp = sp or tg_p or tp
sum_pos = sum_pos2 or sum_pos or POS_FACEUP
sum_type = sum_type or 0
for idx = 1, sp_ct do
tk = Duel.CreateToken(tp, tk_code)
if type(tk_code_or_fun) ~= "number" then
local e1, e2, e3, e4, e5, e6 = rscf.QuickBuff({e:GetHandler(), tk, true}, "type", tk_type, "batk", tk_atk, "bdef", tk_def, "lv", tk_lv, "race", tk_race, "att", tk_att,"rst",rsrst.std_ntf)
end
if rssf.SpecialSummonStep(tk, sum_type, tp, sp, false, false, sum_pos, sum_zone) then
res_ct = res_ct + 1
end
end
Duel.SpecialSummonComplete()
return res_ct
end
--Effect Target: Negative Effect / Activate
function rstg.disneg(dn_type, dn_str, ex_tg)
......@@ -2558,7 +2619,7 @@ end
--Function:outer case function for SelectSolve
function rsop.SelectOC(chk_hint, is_break, sel_hint, success_loc)
if type(chk_hint) == "string" then
chk_hint = rshint["w"..chk_hint]
chk_hint = rscate.cate_selhint_list[chk_hint][4]
end
rsop.SelectOC_checkhint = chk_hint
rsop.SelectOC_isbreak = is_break
......@@ -2572,7 +2633,7 @@ function rsop.SelectSolve(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, m
local card_filter, group_filter = table.unpack(filter)
card_filter = card_filter or aux.TRUE
local g = Duel.GetMatchingGroup(card_filter, tp, loc_self, loc_oppo, except_group, ...)
return rsgf.SelectSolve(g, hintpar, sp, { aux.TRUE, group_filter }, minct, maxct, except_group, solve_fun, ...)
return rsgf.SelectSolve(g, sel_hint, sp, { aux.TRUE, group_filter }, minct, maxct, except_group, solve_fun, ...)
end
function rsop.GetFollowingSolvepar(solve_parama, parlen)
solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama }
......@@ -2655,6 +2716,7 @@ end
--Function:Select card and SSet
function rsop.SelectSSet(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
rshint.nohint_sel = true
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4)
return rsop.SelectSolve(HINTMSG_SET, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, rsop.SelectSSet_Operation(sp, solve_parama), ...)
end
function rsop.SelectSSet_Operation(sp, solve_parama)
......@@ -3052,11 +3114,34 @@ function rsop.OperationConfirm(g, chk, reason)
local g = g:Filter(Card.IsControler, nil, p)
if #g > 0 then
Duel.ConfirmCards(1 - p, g)
Duel.ShuffleHand(p)
end
end
return #g
end
function rsop.OperationReturnToField(pos)
return function(g, chk, reason)
if chk == 0 then return true end
local rg,rg2,ft = Group.CreateGroup(), Group.CreateGroup(), 0
for p = 0, 1 do
rg = g:Filter(aux.FilterEqualFunction(Card.GetPreviousControler, p), nil)
if #rg > 0 then
ft = Duel.GetLocationCount(p, LOCATION_MZONE)
rg2 = rg:Clone()
if #rg2 > ft then
rg2 = rg:Select(p, ft, ft, nil)
end
rg:Sub(rg2)
for tc in aux.Next(rg2) do
Duel.ReturnToField(tc, pos or tc:GetPreviousPosition())
end
for tc in aux.Next(rg) do
Duel.ReturnToField(tc, pos or tc:GetPreviousPosition())
end
end
end
end
end
----------------"Part_ZoneSequence_Function"------------------
--Get pend zone
function rszsf.GetUseAblePZoneCount(tp, g_or_c)
......@@ -3407,6 +3492,7 @@ end
Group.SelectMoveToField_Activate = rsgf.SelectMoveToField_Activate
--Function:Select card and SSet
function rsgf.SelectSSet(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4)
rshint.nohint_sel = true
return rsgf.SelectSolve(g, HINTMSG_SET, sp, filter, minct, maxct, except_obj, rsop.SelectSSet_Operation(sp, solve_parama), ...)
end
......@@ -4637,7 +4723,7 @@ function rshint.SelectOption(p, ...)
if type(sel_hint) == "table" then
ops[off] = aux.Stringid(sel_hint[1], sel_hint[2])
elseif type(sel_hint) == "string" then
ops[off] = rshint[sel_hint]
ops[off] = rscate.cate_selhint_list[sel_hint][3]
else
ops[off] = sel_hint
end
......
......@@ -160,24 +160,26 @@ function rsof.Get_Cate_Hint_Op_List()
, ["sum"] = { CATEGORY_SUMMON, HINTMSG_SUMMON, aux.Stringid(65247798,0), aux.Stringid(41139112,0) }
, ["sp"] = { CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, aux.Stringid(74892653,2), aux.Stringid(17535764,1) }
, ["tk"] = { CATEGORY_TOKEN, 0 }
, ["tk"] = { CATEGORY_TOKEN, 0, aux.Stringid(9929398,0), aux.Stringid(2625939,0) }
, ["pos"] = { CATEGORY_POSITION, HINTMSG_POSCHANGE, aux.Stringid(3648368,0), aux.Stringid(m,2) }
, ["upa"] = { CATEGORY_POSITION, HINTMSG_POSCHANGE, aux.Stringid(359563,0), aux.Stringid(m,2), rsop.OperationPos(POS_FACEUP_ATTACK), Card.IsCanChangePosition }
, ["upd"] = { CATEGORY_POSITION, HINTMSG_POSCHANGE, aux.Stringid(52158283,1), aux.Stringid(m,2), rsop.OperationPos(POS_FACEUP_DEFENSE), Card.IsCanChangePosition }
, ["dpd"] = { CATEGORY_POSITION, HINTMSG_SET, aux.Stringid(359563,0), aux.Stringid(m,2), rsop.OperationPos(POS_FACEDOWN_DEFENSE), Card.IsCanTurnSet }
, ["dpd"] = { CATEGORY_POSITION, HINTMSG_SET, aux.Stringid(359563,0), aux.Stringid(m,2), rsop.OperationPos(POS_FACEDOWN_DEFENSE), Card.IsCanTurnSet }
, ["pos"] = { CATEGORY_POSITION, HINTMSG_POSCHANGE, aux.Stringid(3648368,0) }
, ["upa"] = { CATEGORY_POSITION, HINTMSG_SET, aux.Stringid(359563,0), nil, rsop.OperationPos(POS_FACEUP_ATTACK), Card.IsCanChangePosition }
, ["upd"] = { CATEGORY_POSITION, HINTMSG_POSCHANGE, aux.Stringid(52158283,1), nil, rsop.OperationPos(POS_FACEUP_DEFENSE), Card.IsCanChangePosition }
, ["dpd"] = { CATEGORY_POSITION, HINTMSG_SET, aux.Stringid(359563,0), nil, rsop.OperationPos(POS_FACEDOWN_DEFENSE), Card.IsCanTurnSet }
, ["ctrl"] = { CATEGORY_CONTROL, HINTMSG_CONTROL, aux.Stringid(4941482,0) }
, ["sctrl"] = { CATEGORY_CONTROL, HINTMSG_CONTROL, aux.Stringid(36331074,0) }
, ["dis"] = { CATEGORY_DISABLE, HINTMSG_DISABLE, aux.Stringid(39185163,1), aux.Stringid(25166510,2) }
, ["diss"] = { CATEGORY_DISABLE_SUMMON, 0, aux.Stringid(m+1,1) }
, ["diss"] = { CATEGORY_DISABLE_SUMMON, 0, aux.Stringid(m,1) }
, ["neg"] = { CATEGORY_NEGATE, 0, aux.Stringid(19502505,1) }
, ["eq"] = { CATEGORY_EQUIP, HINTMSG_EQUIP, aux.Stringid(68184115,0), aux.Stringid(35100834,0) }
, ["atk"] = { CATEGORY_ATKCHANGE, aux.Stringid(m,2), aux.Stringid(7194917,0) }
, ["def"] = { CATEGORY_DEFCHANGE, aux.Stringid(m,2), aux.Stringid(7194917,0) }
, ["atk"] = { CATEGORY_ATKCHANGE, HINTMSG_FACEUP, aux.Stringid(7194917,0) }
, ["def"] = { CATEGORY_DEFCHANGE, HINTMSG_FACEUP, aux.Stringid(7194917,0) }
, ["ct"] = { CATEGORY_COUNTER, HINTMSG_COUNTER, aux.Stringid(3070049,0) }
, ["pct"] = { CATEGORY_COUNTER, HINTMSG_COUNTER, aux.Stringid(3070049,0) }
......@@ -198,9 +200,9 @@ function rsof.Get_Cate_Hint_Op_List()
, ["cf"] = { 0, HINTMSG_CONFIRM, nil, nil, rsop.OperationConfirm }
, ["tf"] = { 0, HINTMSG_TOFIELD, aux.Stringid(m,7) }
, ["rf"] = { 0, aux.Stringid(80335817,0) }
, ["rf"] = { 0, aux.Stringid(80335817,0), nil, nil, rsop.OperationReturnToField() }
, ["act"] = { 0, aux.Stringid(m,1), aux.Stringid(m,0) }
, ["act"] = { 0, HINTMSG_RESOLVEEFFECT, aux.Stringid(m,0) }
, ["set"] = { 0, HINTMSG_SET, aux.Stringid(2521011,0), aux.Stringid(30741503,1) }
, ["sset"] = { 0, HINTMSG_SET, aux.Stringid(2521011,0), aux.Stringid(30741503,1), rsop.OperationSSet}
......@@ -458,7 +460,7 @@ function rsof.Escape_Old_Functions()
if type(dn_filter) == "number" then
dn_filter = dn_list[dn_filter]
end
return rscon.disneg("neg", dn_filter, pl_fun and 0 or 1)(...)
return rscon.disneg("neg", dn_filter, pl_fun and 1 or 0)(...)
end
end
rscon.discon = function(dn_filter, pl_fun)
......@@ -467,7 +469,7 @@ function rsof.Escape_Old_Functions()
if type(dn_filter) == "number" then
dn_filter = dn_list[dn_filter]
end
return rscon.disneg("dis", dn_filter, pl_fun and 0 or 1)(...)
return rscon.disneg("dis", dn_filter, pl_fun and 1 or 0)(...)
end
end
rsef.QO_NEGATE = function(reg_list, dn_type, lim_list, dn_str, range, con, cost, desc_list, cate, flag, reset_list)
......
......@@ -29,10 +29,10 @@ function cm.efop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_DESTROYED)
--e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1)
e1:SetTarget(cm.thtg)
e1:SetOperation(cm.thop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1,true)
rc:RegisterFlagEffect(0,reset_flag,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(m,5))
if not rc:IsType(TYPE_EFFECT) then
......@@ -45,35 +45,58 @@ function cm.efop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.repfilter(c,tp)
return c:IsLocation(LOCATION_ONFIELD)
and c:IsReason(REASON_BATTLE+REASON_EFFECT) and not c:IsReason(REASON_REPLACE)
local a1=c:IsPreviousLocation(LOCATION_ONFIELD)
local a2=c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)
local a3=not c:IsReason(REASON_REPLACE)
local a4=Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,c)
return a1 and a2 and a3 and a4
end
function cm.repfilter1(c,tp)
local a1=c:IsPreviousLocation(LOCATION_ONFIELD)
local a2=c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE)
local a3=not c:IsReason(REASON_REPLACE)
local g=Group.CreateGroup()
if a1 and a2 and a3 then
g=Duel.GetMatchingGroup(cm.thfilter1,tp,LOCATION_DECK,0,nil,c)
end
return g:GetCount()>0
end
function cm.thfilter(c,ec)
return c:IsType(bit.band(ec:GetType(),0x7)) and c:IsAbleToHand() and c:IsSetCard(0xccc)
return ( (c:IsType(TYPE_MONSTER) and ec:IsType(TYPE_MONSTER)) or (c:IsType(TYPE_SPELL) and ec:IsType(TYPE_SPELL)) or (c:IsType(TYPE_TRAP) and ec:IsType(TYPE_TRAP)) ) and c:IsAbleToHand() and c:IsSetCard(0xccc)
end
function cm.thfilter1(c,ec)
if ( (c:IsType(TYPE_MONSTER) and ec:IsType(TYPE_MONSTER)) or (c:IsType(TYPE_SPELL) and ec:IsType(TYPE_SPELL)) or (c:IsType(TYPE_TRAP) and ec:IsType(TYPE_TRAP)) ) and c:IsAbleToHand() and c:IsSetCard(0xccc) then
c:RegisterFlagEffect(m,0,0,0)
return true
else
return false
end
end
function cm.thfilter2(c)
return c:GetFlagEffect(m)>0
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_GRAVE,0,1,nil,eg:GetFirst()) and eg:IsExists(cm.repfilter,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
if chk==0 then return eg:IsExists(cm.repfilter,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local mon=0
local spe=0
local tra=0
for tc in aux.Next(eg) do
if tc:IsType(TYPE_MONSTER) then mon=1 end
if tc:IsType(TYPE_SPELL) then spe=1 end
if tc:IsType(TYPE_TRAP) then tra=1 end
end
local ct=mon+spe+tra
local tg=eg:Filter(cm.repfilter1,nil,tp)
local g=Duel.GetMatchingGroup(cm.thfilter2,tp,LOCATION_DECK,0,nil)
for tc in aux.Next(g) do
tc:ResetFlagEffect(m)
end
local sg=Group.CreateGroup()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg1=g:FilterSelect(tp,Card.IsType,1,1,nil,TYPE_MONSTER)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.GetMatchingGroup(cm.thfilter,tp,LOCATION_DECK,0,nil,e,tp)
local sg=g:SelectSubGroup(tp,cm.thfilter0,false,1,ct)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
local sg2=g:FilterSelect(tp,Card.IsType,1,1,nil,TYPE_SPELL)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg3=g:FilterSelect(tp,Card.IsType,1,1,nil,TYPE_TRAP)
sg:Merge(sg1)
sg:Merge(sg2)
sg:Merge(sg3)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function cm.thfilter0(g)
return g:GetClassCount(Card.GetType)==#g
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment