Commit dae07ccc authored by Tachibana's avatar Tachibana

emergency

parent 0e4f9e18
No preview for this file type
...@@ -8,11 +8,11 @@ rsv.Library_Switch = true ...@@ -8,11 +8,11 @@ rsv.Library_Switch = true
-----------------------"Part_Effect_Base"----------------------- -----------------------"Part_Effect_Base"-----------------------
--Creat Event --Creat Event
function rsef.CreatEvent(event_code, event1, con1, ...) function rsef.CreatEvent(event_code, event1, con1, ...)
rsef.CreatEvent_Switch = rsef.CreatEvent_Switch or {} rsef.CreatEvent_Switch = rsef.CreatEvent_Switch or { }
if rsef.CreatEvent_Switch[event_code] then return end if rsef.CreatEvent_Switch[event_code] then return end
rsef.CreatEvent_Switch[event_code] = true rsef.CreatEvent_Switch[event_code] = true
local creat_list = { event1, con1, ... } local creat_list = { event1, con1, ... }
local eff_list = {} local eff_list = { }
for idx, val in pairs(creat_list) do for idx, val in pairs(creat_list) do
if type(val) == "number" then if type(val) == "number" then
local e1 = rsef.FC({ true, 0 }, val) local e1 = rsef.FC({ true, 0 }, val)
...@@ -632,7 +632,7 @@ function rsef.SV_ExtraMaterial(reg_list, mat_list, val_list, con, reset_list, fl ...@@ -632,7 +632,7 @@ function rsef.SV_ExtraMaterial(reg_list, mat_list, val_list, con, reset_list, fl
range = range or LOCATION_HAND range = range or LOCATION_HAND
val_list = val_list or { aux.TRUE } val_list = val_list or { aux.TRUE }
local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list) local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list)
local eff_list = {} local eff_list = { }
for idx, eff_code in ipairs(code_list) do for idx, eff_code in ipairs(code_list) do
local e1 = rsef.SV(reg_list, eff_code, val_list2[idx], range, con, reset_list, flag, desc_list, lim_list) local e1 = rsef.SV(reg_list, eff_code, val_list2[idx], range, con, reset_list, flag, desc_list, lim_list)
table.insert(eff_list, e1) table.insert(eff_list, e1)
...@@ -751,7 +751,7 @@ function rsef.FV_ExtraMaterial(reg_list, mat_list, val_list, tg, tg_range_list, ...@@ -751,7 +751,7 @@ function rsef.FV_ExtraMaterial(reg_list, mat_list, val_list, tg, tg_range_list,
tg_range_list = tg_range_list or { LOCATION_HAND, 0 } tg_range_list = tg_range_list or { LOCATION_HAND, 0 }
local flag2 = rsef.GetRegisterProperty(reg_list, flag) | EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE local flag2 = rsef.GetRegisterProperty(reg_list, flag) | EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE
local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list) local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list)
local eff_list = {} local eff_list = { }
for idx, eff_code in ipairs(code_list) do for idx, eff_code in ipairs(code_list) do
local e1 = rsef.FV(reg_list, eff_code, val_list2[idx], tg, tg_range_list, range, con, reset_list, flag2, desc_list, lim_list) local e1 = rsef.FV(reg_list, eff_code, val_list2[idx], tg, tg_range_list, range, con, reset_list, flag2, desc_list, lim_list)
table.insert(eff_list, e1) table.insert(eff_list, e1)
...@@ -766,7 +766,7 @@ function rsef.FV_ExtraMaterial_Self(reg_list, mat_list, val_list, tg, tg_range_l ...@@ -766,7 +766,7 @@ function rsef.FV_ExtraMaterial_Self(reg_list, mat_list, val_list, tg, tg_range_l
tg_range_list = tg_range_list or { LOCATION_HAND, 0 } tg_range_list = tg_range_list or { LOCATION_HAND, 0 }
local flag2 = rsef.GetRegisterProperty(reg_list, flag) | EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_UNCOPYABLE local flag2 = rsef.GetRegisterProperty(reg_list, flag) | EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE + EFFECT_FLAG_UNCOPYABLE
local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list) local code_list, val_list2 = rsof.Table_Suit(mat_list, code_list_1, code_list_2, val_list)
local eff_list = {} local eff_list = { }
for idx, eff_code in ipairs(code_list) do for idx, eff_code in ipairs(code_list) do
local e1 = rsef.FV(reg_list, eff_code, val_list2[idx], tg, tg_range_list, LOCATION_EXTRA, con, reset_list, flag2, desc_list, lim_list) local e1 = rsef.FV(reg_list, eff_code, val_list2[idx], tg, tg_range_list, LOCATION_EXTRA, con, reset_list, flag2, desc_list, lim_list)
table.insert(eff_list, e1) table.insert(eff_list, e1)
...@@ -1001,8 +1001,8 @@ function rsef.FC_AttachEffect_Con(e0, attach_con) ...@@ -1001,8 +1001,8 @@ function rsef.FC_AttachEffect_Con(e0, attach_con)
end end
function rsef.FC_AttachEffect_Op(e0, force) function rsef.FC_AttachEffect_Op(e0, force)
return function(e, tp, eg, ep, ev, re, r, rp) return function(e, tp, eg, ep, ev, re, r, rp)
rsef.attacheffect[ev] = rsef.attacheffect[ev] or {} rsef.attacheffect[ev] = rsef.attacheffect[ev] or { }
rsef.attacheffectf[ev] = rsef.attacheffectf[ev] or {} rsef.attacheffectf[ev] = rsef.attacheffectf[ev] or { }
if force then table.insert(rsef.attacheffectf[ev], e) if force then table.insert(rsef.attacheffectf[ev], e)
else else
table.insert(rsef.attacheffect[ev], e) table.insert(rsef.attacheffect[ev], e)
...@@ -1011,11 +1011,11 @@ function rsef.FC_AttachEffect_Op(e0, force) ...@@ -1011,11 +1011,11 @@ function rsef.FC_AttachEffect_Op(e0, force)
end end
function rsef.FC_AttachEffect_GetGroup(sel_list) function rsef.FC_AttachEffect_GetGroup(sel_list)
local attach_group = Group.CreateGroup() local attach_group = Group.CreateGroup()
local attach_eff_list = {} local attach_eff_list = { }
for _, ae in pairs(sel_list) do for _, ae in pairs(sel_list) do
local tc = ae:GetOwner() local tc = ae:GetOwner()
attach_group:AddCard(tc) attach_group:AddCard(tc)
attach_eff_list[tc] = attach_eff_list[tc] or {} attach_eff_list[tc] = attach_eff_list[tc] or { }
table.insert(attach_eff_list[tc], ae) table.insert(attach_eff_list[tc], ae)
end end
return attach_group, attach_eff_list return attach_group, attach_eff_list
...@@ -1049,14 +1049,14 @@ function rsef.FC_AttachEffect_Reset(re1, baseop) ...@@ -1049,14 +1049,14 @@ function rsef.FC_AttachEffect_Reset(re1, baseop)
end end
end end
function rsef.FC_AttachEffect_Solve(solve_eff_list, attach_time, e, tp, eg, ep, ev, re, r, rp) function rsef.FC_AttachEffect_Solve(solve_eff_list, attach_time, e, tp, eg, ep, ev, re, r, rp)
local act_use_list = {} local act_use_list = { }
local ev2 = Duel.GetCurrentChain() local ev2 = Duel.GetCurrentChain()
local attach_code = rscode.Extra_Effect_Activate local attach_code = rscode.Extra_Effect_Activate
if attach_time == 0x2 then attach_code = rscode.Extra_Effect_BSolve end if attach_time == 0x2 then attach_code = rscode.Extra_Effect_BSolve end
if attach_time == 0x4 then attach_code = rscode.Extra_Effect_ASolve end if attach_time == 0x4 then attach_code = rscode.Extra_Effect_ASolve end
Duel.RaiseEvent(e:GetHandler(), attach_code, e, 0, tp, tp, ev2) Duel.RaiseEvent(e:GetHandler(), attach_code, e, 0, tp, tp, ev2)
local force_list = rsef.attacheffectf[ev2] or {} local force_list = rsef.attacheffectf[ev2] or { }
local sel_tab_list = rsef.attacheffect[ev2] or {} local sel_tab_list = rsef.attacheffect[ev2] or { }
for _, ae in pairs(force_list) do for _, ae in pairs(force_list) do
local tc = ae:GetOwner() local tc = ae:GetOwner()
if tc:IsOnField() then if tc:IsOnField() then
...@@ -1085,7 +1085,7 @@ function rsef.FC_AttachEffect_Solve(solve_eff_list, attach_time, e, tp, eg, ep, ...@@ -1085,7 +1085,7 @@ function rsef.FC_AttachEffect_Solve(solve_eff_list, attach_time, e, tp, eg, ep,
else else
Duel.Hint(HINT_CARD, 0, tc:GetOriginalCodeRule()) Duel.Hint(HINT_CARD, 0, tc:GetOriginalCodeRule())
end end
local hint_list = {} local hint_list = { }
for _, ae in pairs(attach_eff_list[tc]) do for _, ae in pairs(attach_eff_list[tc]) do
local hint = ae:GetDescription() local hint = ae:GetDescription()
table.insert(hint_list, hint) table.insert(hint_list, hint)
...@@ -1115,7 +1115,7 @@ function rsef.FC_AttachEffect_ChangeOp2(baseop) ...@@ -1115,7 +1115,7 @@ function rsef.FC_AttachEffect_ChangeOp2(baseop)
if (c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS) or c:IsLocation(LOCATION_PZONE)) and not c:IsRelateToEffect(e) then if (c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS) or c:IsLocation(LOCATION_PZONE)) and not c:IsRelateToEffect(e) then
return return
end end
rsef.solveeffect[ev2] = {} rsef.solveeffect[ev2] = { }
--baseop record --baseop record
table.insert(rsef.solveeffect[ev2], baseop) table.insert(rsef.solveeffect[ev2], baseop)
--activate select --activate select
...@@ -1136,7 +1136,7 @@ function rsef.FC_AttachEffect_ChangeOp2(baseop) ...@@ -1136,7 +1136,7 @@ function rsef.FC_AttachEffect_ChangeOp2(baseop)
end end
--Effect Function:XXX card / group will leave field in XXX Phase , often use in special summon --Effect Function:XXX card / group will leave field in XXX Phase , often use in special summon
function rsef.FC_PhaseLeave(reg_list, leave_val, times, whos, phase, leaveway, reset_list) function rsef.FC_PhaseLeave(reg_list, leave_val, times, whos, phase, leaveway, val_reset_list)
--times: nil every phase --times: nil every phase
-- 0 next phase -- 0 next phase
-- 1 or + times phase -- 1 or + times phase
...@@ -1151,8 +1151,10 @@ function rsef.FC_PhaseLeave(reg_list, leave_val, times, whos, phase, leaveway, r ...@@ -1151,8 +1151,10 @@ function rsef.FC_PhaseLeave(reg_list, leave_val, times, whos, phase, leaveway, r
leaveway = leaveway or "des" leaveway = leaveway or "des"
local sg = rsgf.Mix2(leave_val) local sg = rsgf.Mix2(leave_val)
local fid = reg_owner:GetFieldID() local fid = reg_owner:GetFieldID()
val_reset_list = val_reset_list or rsrst.std
local reset = rsef.RegisterReset(nil, val_reset_list, true)
for tc in aux.Next(sg) do for tc in aux.Next(sg) do
tc:RegisterFlagEffect(rscode.Phase_Leave_Flag, rsrst.std, 0, 0, fid) tc:RegisterFlagEffect(rscode.Phase_Leave_Flag, reset, 0, 0, fid)
end end
sg:KeepAlive() sg:KeepAlive()
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)) 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))
...@@ -1191,7 +1193,7 @@ function rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times) ...@@ -1191,7 +1193,7 @@ function rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times)
solve = true solve = true
end end
-- case2, next phase -- case2, next phase
if times == 0 then if times and times == 0 then
if tct == 1 then if tct == 1 then
solve = true solve = true
elseif tct > 1 then elseif tct > 1 then
...@@ -1199,9 +1201,9 @@ function rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times) ...@@ -1199,9 +1201,9 @@ function rsef.FC_PhaseLeave_Con(phase, atct, whos, fid, times)
end end
end end
-- case3, 1+ phase -- case3, 1+ phase
if times>0 and times == tct then if times and times>0 and times == tct then
solve = true solve = true
elseif times>0 and tct > times then elseif times and times>0 and tct > times then
reset = true reset = true
end end
if reset then if reset then
...@@ -1215,7 +1217,6 @@ end ...@@ -1215,7 +1217,6 @@ end
function rsef.FC_PhaseLeave_Op(solve_str, fid) function rsef.FC_PhaseLeave_Op(solve_str, fid)
return function(e, tp, eg, ep, ev, re, r, rp) return function(e, tp, eg, ep, ev, re, r, rp)
local sg, tct, ph_chk = table.unpack(rsop.opinfo[e]) local sg, tct, ph_chk = table.unpack(rsop.opinfo[e])
e:Reset()
local c = e:GetOwner() local c = e:GetOwner()
Duel.Hint(HINT_CARD, 0, c:GetOriginalCode()) Duel.Hint(HINT_CARD, 0, c:GetOriginalCode())
local rg = sg:Filter(rsef.FC_PhaseLeave_Filter, nil, fid) local rg = sg:Filter(rsef.FC_PhaseLeave_Filter, nil, fid)
...@@ -1349,8 +1350,8 @@ function rssf.SpecialSummonEitherStep(sum_card, sum_eff, sum_type, sum_pl, loc_p ...@@ -1349,8 +1350,8 @@ function rssf.SpecialSummonEitherStep(sum_card, sum_eff, sum_type, sum_pl, loc_p
sum_type, sum_pl, loc_pl, ignore_con, ignore_revie, pos = rssf.GetSSDefaultParameter(sum_type, sum_pl, loc_pl, ignore_con, ignore_revie, pos) sum_type, sum_pl, loc_pl, ignore_con, ignore_revie, pos = rssf.GetSSDefaultParameter(sum_type, sum_pl, loc_pl, ignore_con, ignore_revie, pos)
if not sum_eff then sum_eff = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT) end if not sum_eff then sum_eff = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT) end
local tp = sum_pl local tp = sum_pl
local zone = {} local zone = { }
local flag = {} local flag = { }
if not zone2 then if not zone2 then
zone2 = { [0] = 0x1f, [1] = 0x1f } zone2 = { [0] = 0x1f, [1] = 0x1f }
end end
...@@ -1618,15 +1619,15 @@ end ...@@ -1618,15 +1619,15 @@ end
--Effect target: Target Cards Main Set --Effect target: Target Cards Main Set
function rsef.list(list_type_str, val1, val2, val3, ...) function rsef.list(list_type_str, val1, val2, val3, ...)
local value_list = {} local value_list = { }
if type(val1) == "table" and (not val2 or (type(val2) == "table" )) and (not val3 or type(val3) == "table") then if type(val1) == "table" and (not val2 or (type(val2) == "table" )) and (not val3 or type(val3) == "table") then
value_list = { val1, val2, val3, ... } value_list = { val1, val2, val3, ... }
else else
value_list = { { val1, val2, val3, ... } } value_list = { { val1, val2, val3, ... } }
end end
local par_list = {} local par_list = { }
for idx, val in pairs(value_list) do for idx, val in pairs(value_list) do
par_list[idx] = {} par_list[idx] = { }
local res = rsef.list_check_divide(val[1], list_type_str) local res = rsef.list_check_divide(val[1], list_type_str)
if not res then if not res then
par_list[idx][1] = list_type_str par_list[idx][1] = list_type_str
...@@ -1882,15 +1883,16 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total) ...@@ -1882,15 +1883,16 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total)
--1. Creat used check --1. Creat used check
local used_group = Group.CreateGroup() local used_group = Group.CreateGroup()
local used_count_list = { [0] = 0, [1] = 0, [1] = 0, [2] = 0} local used_count_list = { [0] = 0, [1] = 0, [1] = 0, [2] = 0}
local info_list = {} local info_list = { }
local selected_group_total_list = {} local selected_group_total_list = { }
local costed_grouo_total = Group.CreateGroup()
--2. Selecting --2. Selecting
--for idx, target_list in pairs(target_list_total) do --for idx, target_list in pairs(target_list_total) do
--cannot use above method because may have target_list_total[0] --cannot use above method because may have target_list_total[0]
for idx = 1, #target_list_total do for idx = 1, #target_list_total do
local target_list = target_list_total[idx] local target_list = target_list_total[idx]
--2.0. Get Next target_list --2.0. Get Next target_list
local target_list_next = {} local target_list_next = { }
for idx2, target_list_next_par in pairs(target_list_total) do for idx2, target_list_next_par in pairs(target_list_total) do
if idx2 > idx then if idx2 > idx then
table.insert(target_list_next, target_list_next_par) table.insert(target_list_next, target_list_next_par)
...@@ -1974,6 +1976,9 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total) ...@@ -1974,6 +1976,9 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total)
local cost_result = rscost.CostSolve(selected_group, category_str_list, category_fun, list_type, e, tp, eg, ep, ev, re, r, rp, used_group, used_count_list) local cost_result = rscost.CostSolve(selected_group, category_str_list, category_fun, list_type, e, tp, eg, ep, ev, re, r, rp, used_group, used_count_list)
if not cost_result or (type(cost_result) == "number" and cost_result <= 0) or (aux.GetValueType(cost_result) == "Group" and #cost_result <= 0) then if not cost_result or (type(cost_result) == "number" and cost_result <= 0) or (aux.GetValueType(cost_result) == "Group" and #cost_result <= 0) then
return return
else
--costed_grouo_total:Merge(Duel.GetOperatedGroup())
costed_grouo_total:Merge(selected_group)
end end
end end
--2.6. Register Operationinfo for target --2.6. Register Operationinfo for target
...@@ -2016,7 +2021,7 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total) ...@@ -2016,7 +2021,7 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total)
end end
end end
local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS) local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS)
return tg, selected_group_total_list return tg, selected_group_total_list, costed_grouo_total
end end
--Effect target: Target filter --Effect target: Target filter
function rstg.TargetFilter(c, e, tp, eg, ep, ev, re, r, rp, used_group, used_count_list, target_list1, target_list2, ...) function rstg.TargetFilter(c, e, tp, eg, ep, ev, re, r, rp, used_group, used_count_list, target_list1, target_list2, ...)
...@@ -2217,7 +2222,7 @@ function rscost.rmct(cttype, ct1, ct2, issetlabel) ...@@ -2217,7 +2222,7 @@ function rscost.rmct(cttype, ct1, ct2, issetlabel)
local maxct= rsof.Check_Boolean(ct2) and c:GetCounter(cttype) or ct2 local maxct= rsof.Check_Boolean(ct2) and c:GetCounter(cttype) or ct2
if chk == 0 then return c:IsCanRemoveCounter(tp, cttype, minct, REASON_COST) end if chk == 0 then return c:IsCanRemoveCounter(tp, cttype, minct, REASON_COST) end
if maxct > minct then if maxct > minct then
local rmlist = {} local rmlist = { }
for i = minct, maxct do for i = minct, maxct do
table.insert(rmlist, i) table.insert(rmlist, i)
end end
...@@ -2242,7 +2247,7 @@ function rscost.rmct2(cttype, loc_self, loc_oppo, ct1, ct2, issetlabel) ...@@ -2242,7 +2247,7 @@ function rscost.rmct2(cttype, loc_self, loc_oppo, ct1, ct2, issetlabel)
local maxct= rsof.Check_Boolean(ct2) and c:GetCounter(cttype) or ct2 local maxct= rsof.Check_Boolean(ct2) and c:GetCounter(cttype) or ct2
if chk == 0 then return Duel.IsCanRemoveCounter(tp, loc_self, loc_oppo, cttype, minct, REASON_COST) end if chk == 0 then return Duel.IsCanRemoveCounter(tp, loc_self, loc_oppo, cttype, minct, REASON_COST) end
if maxct > minct then if maxct > minct then
local rmlist = {} local rmlist = { }
for i = minct, maxct do for i = minct, maxct do
table.insert(rmlist, i) table.insert(rmlist, i)
end end
...@@ -2256,7 +2261,7 @@ function rscost.rmct2(cttype, loc_self, loc_oppo, ct1, ct2, issetlabel) ...@@ -2256,7 +2261,7 @@ function rscost.rmct2(cttype, loc_self, loc_oppo, ct1, ct2, issetlabel)
end end
end end
--cost: remove overlay card form self --cost: remove overlay card form self
function rscost.rmxyz(ct1, ct2, issetlabel) function rscost.rmxmat(ct1, ct2, issetlabel)
ct1 = ct1 or 1 ct1 = ct1 or 1
ct2 = ct2 or ct1 ct2 = ct2 or ct1
return function(e, tp, eg, ep, ev, re, r, rp, chk) return function(e, tp, eg, ep, ev, re, r, rp, chk)
...@@ -2304,7 +2309,7 @@ function rscost.lpcost2(base_pay, max_pay, is_lab) ...@@ -2304,7 +2309,7 @@ function rscost.lpcost2(base_pay, max_pay, is_lab)
end end
if chk == 0 then return Duel.CheckLPCost(tp, base_pay) end if chk == 0 then return Duel.CheckLPCost(tp, base_pay) end
local max_multiple = math.floor(max_lp / base_pay) local max_multiple = math.floor(max_lp / base_pay)
local pay_list = {} local pay_list = { }
for i = 1, max_multiple do for i = 1, max_multiple do
pay_list[i] = i * base_pay pay_list[i] = i * base_pay
end end
...@@ -2385,8 +2390,8 @@ function rscon.phase(p1, ...) ...@@ -2385,8 +2390,8 @@ function rscon.phase(p1, ...)
end end
local str_list = { "dp", "sp", "mp1", "bp", "bsp", "dam", "damndcal", "dambdcal", "dcal", "ndcal", "mp2", "ep", "mp" } local str_list = { "dp", "sp", "mp1", "bp", "bsp", "dam", "damndcal", "dambdcal", "dcal", "ndcal", "mp2", "ep", "mp" }
local phaselist = { PHASE_DRAW, PHASE_STANDBY, PHASE_MAIN1, phase_bp, PHASE_BATTLE_STEP, phase_dam, PHASE_DAMAGE, phase_dambdcal, PHASE_DAMAGE_CAL, phase_ndcal, PHASE_MAIN2, PHASE_END, phase_mp } local phaselist = { PHASE_DRAW, PHASE_STANDBY, PHASE_MAIN1, phase_bp, PHASE_BATTLE_STEP, phase_dam, PHASE_DAMAGE, phase_dambdcal, PHASE_DAMAGE_CAL, phase_ndcal, PHASE_MAIN2, PHASE_END, phase_mp }
local mainstr_list = {} local mainstr_list = { }
local turnplayerlist = {} local turnplayerlist = { }
local parlist2 = rsof.String_Number_To_Table(parlist) local parlist2 = rsof.String_Number_To_Table(parlist)
for _, pstring in pairs(parlist2) do for _, pstring in pairs(parlist2) do
local mainstring, splitstring = rsof.String_NoSymbol(pstring) local mainstring, splitstring = rsof.String_NoSymbol(pstring)
...@@ -2599,23 +2604,6 @@ function rsop.neg(dn_str, ex_op) ...@@ -2599,23 +2604,6 @@ function rsop.neg(dn_str, ex_op)
return rsop.disneg("neg", dn_str, ex_op)(...) return rsop.disneg("neg", dn_str, ex_op)(...)
end end
end end
--Operation: Select Card
function rsop.SelectCheck_Solve(solve_fun)
local solve_parama_list = {}
local len = 0
if type(solve_fun) == "table" then
for idx, par in pairs(solve_fun) do
if idx >= 2 then
len = len + 1
--table.insert(solve_parama_list, par)
solve_parama_list[len] = par
end
end
solve_fun = solve_fun[1]
end
return solve_fun, solve_parama_list, len
end
--Function:outer case function for SelectSolve --Function:outer case function for SelectSolve
function rsop.SelectOC(chk_hint, is_break, sel_hint, success_loc) function rsop.SelectOC(chk_hint, is_break, sel_hint, success_loc)
if type(chk_hint) == "string" then if type(chk_hint) == "string" then
...@@ -2635,47 +2623,56 @@ function rsop.SelectSolve(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, m ...@@ -2635,47 +2623,56 @@ function rsop.SelectSolve(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, m
local g = Duel.GetMatchingGroup(card_filter, tp, loc_self, loc_oppo, except_group, ...) local g = Duel.GetMatchingGroup(card_filter, tp, loc_self, loc_oppo, except_group, ...)
return rsgf.SelectSolve(g, sel_hint, 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 end
function rsop.GetFollowingSolvepar(solve_parama, parlen) function rsop.ReplaceSolveParama(solve_parama, parlen)
solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama } solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama }
rsop.solveprlen = parlen local new_parama = { }
return solve_parama local val
for idx = 1, parlen do
val = solve_parama[idx]
if type(val) == "nil" then
new_parama[idx] = rsnv
else
new_parama[idx] = val
end
end
return new_parama
end end
--Function:Select card and send to hand --Function:Select card and send to hand
function rsop.SelectToHand(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectToHand(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(solve_parama, 4)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_HAND rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_HAND
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("th", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoHand, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("th", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoHand, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and send to grave --Function:Select card and send to grave
function rsop.SelectToGrave(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectToGrave(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_GRAVE rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_GRAVE
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("tg", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoGrave, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("tg", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoGrave, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and release --Function:Select card and release
function rsop.SelectRelease(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectRelease(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("tg", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Release, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("tg", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Release, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and send to deck --Function:Select card and send to deck
function rsop.SelectToDeck(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectToDeck(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(solve_parama, 4)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or rsloc.de rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or rsloc.de
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("td", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoDeck, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("td", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.SendtoDeck, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and destroy --Function:Select card and destroy
function rsop.SelectDestroy(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectDestroy(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("des", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Destroy, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("des", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Destroy, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and remove --Function:Select card and remove
function rsop.SelectRemove(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectRemove(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 3) solve_parama = rsop.ReplaceSolveParama(solve_parama, 3)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_REMOVED rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_REMOVED
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve("rm", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Remove, table.unpack(solve_parama) }, ...) return rsop.SelectSolve("rm", sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.Remove, table.unpack(solve_parama) }, ...)
...@@ -2700,14 +2697,14 @@ function rsop.SelectSpecialSummon_Operation(sumfunvarlist) ...@@ -2700,14 +2697,14 @@ function rsop.SelectSpecialSummon_Operation(sumfunvarlist)
end end
--Function:Select card and move to field --Function:Select card and move to field
function rsop.SelectMoveToField(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectMoveToField(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 8) solve_parama = rsop.ReplaceSolveParama(solve_parama, 8)
solve_parama[1] = solve_parama[1] or sp solve_parama[1] = solve_parama[1] or sp
rshint.nohint_sel = true rshint.nohint_sel = true
return rsop.SelectSolve(HINTMSG_TOFIELD, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.MoveToField, table.unpack(solve_parama) }, ...) return rsop.SelectSolve(HINTMSG_TOFIELD, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, { rsop.MoveToField, table.unpack(solve_parama) }, ...)
end end
--Function:Select card and move to field and activate --Function:Select card and move to field and activate
function rsop.SelectMoveToField_Activate(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectMoveToField_Activate(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 7) solve_parama = rsop.ReplaceSolveParama(solve_parama, 7)
solve_parama[1] = solve_parama[1] or sp solve_parama[1] = solve_parama[1] or sp
maxct = 1 maxct = 1
rshint.nohint_sel = true rshint.nohint_sel = true
...@@ -2716,7 +2713,7 @@ end ...@@ -2716,7 +2713,7 @@ end
--Function:Select card and SSet --Function:Select card and SSet
function rsop.SelectSSet(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...) function rsop.SelectSSet(sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_parama, ...)
rshint.nohint_sel = true rshint.nohint_sel = true
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(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), ...) return rsop.SelectSolve(HINTMSG_SET, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, rsop.SelectSSet_Operation(sp, solve_parama), ...)
end end
function rsop.SelectSSet_Operation(sp, solve_parama) function rsop.SelectSSet_Operation(sp, solve_parama)
...@@ -2777,7 +2774,7 @@ function rsop.CheckOperateSuccess(solve_loc, check_count) ...@@ -2777,7 +2774,7 @@ function rsop.CheckOperateSuccess(solve_loc, check_count)
end end
--Operation: Send to Deck and Draw --Operation: Send to Deck and Draw
function rsop.ToDeckDraw(dp, dct, is_break, check_count) function rsop.ToDeckDraw(dp, dct, is_break, check_count)
local res, g = rsop.CheckSuccess(rsloc.de, check_count) local res, g = rsop.CheckOperateSuccess(rsloc.de, check_count)
if not res then return 0 end if not res then return 0 end
if g:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then if g:IsExists(Card.IsLocation, 1, nil, LOCATION_DECK) then
Duel.ShuffleDeck(dp) Duel.ShuffleDeck(dp)
...@@ -2917,7 +2914,7 @@ function rsop.MoveToField(corg, movep, targetp, loc, pos, enable, zone, hint, co ...@@ -2917,7 +2914,7 @@ function rsop.MoveToField(corg, movep, targetp, loc, pos, enable, zone, hint, co
targetp = targetp or movep targetp = targetp or movep
pos= pos or POS_FACEUP pos= pos or POS_FACEUP
enable = enable or true enable = enable or true
if #g <= 0 then return false end if #g <= 0 then return 0, nil end
local correctg = Group.CreateGroup() local correctg = Group.CreateGroup()
rsop.CheckOperationHint(g, hint) rsop.CheckOperationHint(g, hint)
for tc in aux.Next(g) do for tc in aux.Next(g) do
...@@ -2989,7 +2986,7 @@ function rsop.MoveToField_Activate(corg, movep, targetp, loc, pos, enable, zone, ...@@ -2989,7 +2986,7 @@ function rsop.MoveToField_Activate(corg, movep, targetp, loc, pos, enable, zone,
end end
return true, tc return true, tc
end end
return false return false, nil
end end
--Operation function:Deck Move to top --Operation function:Deck Move to top
function rsop.SortDeck(corg, seq, confirm) function rsop.SortDeck(corg, seq, confirm)
...@@ -3012,9 +3009,31 @@ function rsop.SortDeck(corg, seq, confirm) ...@@ -3012,9 +3009,31 @@ function rsop.SortDeck(corg, seq, confirm)
Duel.MoveSequence(mg:GetFirst(), 1) Duel.MoveSequence(mg:GetFirst(), 1)
end end
end end
return #g return #g, g
end
--Operation function:destroy and hint
--if you don't neet hint, best use normal Duel.Destroy
function rsop.Overlay(e, xyzc, mat_corg, ex_over, hint)
e = e or Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local g = rsgf.Mix2(mat_corg)
local img = g:Filter(Card.IsImmuneToEffect,nil,e)
g:Sub(img)
rsop.CheckOperationHint(g, hint)
if not xyzc or not xyzc:IsType(TYPE_XYZ) or #g <= 0 then return 0, nil end
local tg = Group.CreateGroup()
for tc in aux.Next(g) do
tg:Merge(tc:GetOverlayGroup())
end
if #tg > 0 then
if ex_over then
Duel.Overlay(xyzc, tg)
else
Duel.SendtoGrave(tg, REASON_RULE)
end
end
Duel.Overlay(xyzc, g)
return #g, g, g:GetFirst()
end end
--For rsop.Operation_Solve --For rsop.Operation_Solve
function rsop.OperationDestroy(reason0) function rsop.OperationDestroy(reason0)
return function(g, chk, reason) return function(g, chk, reason)
...@@ -3074,7 +3093,7 @@ function rsop.OperationDiscardDeck(selected_group, chk, reason, e, tp, eg, ep, e ...@@ -3074,7 +3093,7 @@ function rsop.OperationDiscardDeck(selected_group, chk, reason, e, tp, eg, ep, e
local dct = minct local dct = minct
if maxct < minct then return nil, 0 end if maxct < minct then return nil, 0 end
if maxct > minct then if maxct > minct then
local ct_list = {} local ct_list = { }
for i = minct, maxct do for i = minct, maxct do
if ( reason == REASON_COST and Duel.IsPlayerCanDiscardDeckAsCost(p, i) ) if ( reason == REASON_COST and Duel.IsPlayerCanDiscardDeckAsCost(p, i) )
or ( reason ~= REASON_COST and Duel.IsPlayerCanDiscardDeck(p, i) ) then or ( reason ~= REASON_COST and Duel.IsPlayerCanDiscardDeck(p, i) ) then
...@@ -3162,15 +3181,15 @@ end ...@@ -3162,15 +3181,15 @@ end
--zone[2] is the same, zone[3] is zone[1] + zone[2] (all players) --zone[2] is the same, zone[3] is zone[1] + zone[2] (all players)
--seq must use rsv.GetExcatlySequence to Get true sequence --seq must use rsv.GetExcatlySequence to Get true sequence
function rszsf.GetExcatlyColumnZone(seq) function rszsf.GetExcatlyColumnZone(seq)
local zone = {} local zone = { }
for i = 0, 1 do for i = 0, 1 do
zone[i] = {} zone[i] = { }
if i == 1 then seq = seq + 16 end if i == 1 then seq = seq + 16 end
zone[i][1] = 2^seq zone[i][1] = 2^seq
zone[i][2] = (2^seq) * 0x100 zone[i][2] = (2^seq) * 0x100
zone[i][3] = zone[i][1] + zone[i][2] zone[i][3] = zone[i][1] + zone[i][2]
end end
zone[3] = {} zone[3] = { }
zone[3][1] = zone[1][1] + zone[2][1] zone[3][1] = zone[1][1] + zone[2][1]
zone[3][2] = zone[1][2] + zone[2][2] zone[3][2] = zone[1][2] + zone[2][2]
zone[3][3] = zone[1][3] + zone[2][3] zone[3][3] = zone[1][3] + zone[2][3]
...@@ -3237,7 +3256,7 @@ function rszsf.GetSurroundingZone2(seq, loc, cp, p, truezone, contains) ...@@ -3237,7 +3256,7 @@ function rszsf.GetSurroundingZone2(seq, loc, cp, p, truezone, contains)
mzone[1 - p] = mzone[1 - p] * 0x10000 mzone[1 - p] = mzone[1 - p] * 0x10000
szone[1 - p] = szone[1 - p] * 0x10000 szone[1 - p] = szone[1 - p] * 0x10000
end end
local ozone = {} local ozone = { }
for i = 0, 1 do for i = 0, 1 do
ozone[i] = mzone[i] + szone[i] ozone[i] = mzone[i] + szone[i]
end end
...@@ -3328,7 +3347,7 @@ function rsgf.Mix2(...) ...@@ -3328,7 +3347,7 @@ function rsgf.Mix2(...)
end end
--Group effect:Change Group to Table --Group effect:Change Group to Table
function rsgf.Group_To_Table(g) function rsgf.Group_To_Table(g)
local cardlist = {} local cardlist = { }
for tc in aux.Next(g) do for tc in aux.Next(g) do
table.insert(cardlist, tc) table.insert(cardlist, tc)
end end
...@@ -3345,24 +3364,21 @@ function rsgf.Table_To_Group(list) ...@@ -3345,24 +3364,21 @@ function rsgf.Table_To_Group(list)
return group return group
end end
--Group:Select card from group and do operation on it --Group:Select card from group and do operation on it
function rsgf.SelectSolve(g, sel_hint, sp, filter, minct, maxct, except_obj, solve_fun, ...) function rsgf.SelectSolve(g, sel_hint, sp, filter, minct, maxct, except_obj, solve_parama, ...)
minct = minct or 1 minct = minct or 1
maxct = maxct or minct maxct = maxct or minct
local chk_hint, is_break, sel_hint2, success_loc = rsop.SelectOC_checkhint, rsop.SelectOC_isbreak, rsop.SelectOC_selecthint, rsop.SelectOC_successlocation local chk_hint, is_break, sel_hint2, success_loc = rsop.SelectOC_checkhint, rsop.SelectOC_isbreak, rsop.SelectOC_selecthint, rsop.SelectOC_successlocation
rsop.SelectOC(nil, nil, nil) rsop.SelectOC(nil, nil, nil)
local solvefun2, solvefunpar, len = rsop.SelectCheck_Solve(solve_fun)
filter = type(filter) == "table" and filter or { filter } filter = type(filter) == "table" and filter or { filter }
local card_filter, group_filter = table.unpack(filter) local card_filter, group_filter = table.unpack(filter)
card_filter = card_filter or aux.TRUE card_filter = card_filter or aux.TRUE
local tg = g:Filter(card_filter, except_obj, ...) local tg = g:Filter(card_filter, except_obj, ...)
-- case1 , no suit group for card_filter -- case1 , no suit group for card_filter
if #tg <= 0 or (type(minct) == "number" and #tg < minct) then if #tg <= 0 or (type(minct) == "number" and #tg < minct) then
rsop.solveprlen = nil
rshint.nohint_sel = false rshint.nohint_sel = false
return 0, Group.CreateGroup(), nil, 0 return 0, Group.CreateGroup(), nil, 0
end end
if chk_hint and not rshint.SelectYesNo(sp, chk_hint) then if chk_hint and not rshint.SelectYesNo(sp, chk_hint) then
rsop.solveprlen = nil
rshint.nohint_sel = false rshint.nohint_sel = false
return 0, Group.CreateGroup(), nil, 0 return 0, Group.CreateGroup(), nil, 0
end end
...@@ -3383,28 +3399,28 @@ function rsgf.SelectSolve(g, sel_hint, sp, filter, minct, maxct, except_obj, sol ...@@ -3383,28 +3399,28 @@ function rsgf.SelectSolve(g, sel_hint, sp, filter, minct, maxct, except_obj, sol
Duel.BreakEffect() Duel.BreakEffect()
end end
--under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil" --under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil"
local solve_parama_list = {} solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama }
local len2 = 0 local solve_fun2, solve_parama_list = solve_parama[1], { }
for idx, solve_parama in pairs(solvefunpar) do local len, parama = 0, 0
len2 = len2 + 1 if #solve_parama > 1 then
solve_parama_list[len2] = solve_parama for idx = 2, #solve_parama do
parama = solve_parama[idx]
if type(parama) == "string" and parama == rsnv then
parama = nil
end end
if rsop.solveprlen and rsop.solveprlen > len then len = len + 1
for i = 1, rsop.solveprlen - len do solve_parama_list[len] = parama
len2 = len2 + 1
solve_parama_list[len2] = nil
end end
end end
local solve_parama_len = select("#", ...) local ex_parama_len = select("#", ...)
for idx = 1, solve_parama_len do if ex_parama_len > 0 then
len2 = len2 + 1 for idx = 1, ex_parama_len do
solve_parama_list[len2] = ({ ... })[idx] len = len + 1
solve_parama_list[len] = ({ ... })[idx]
end end
if type(solve_fun) == "table" and #solve_fun == 0 then
solve_fun = nil
end end
local res = not solve_fun and { tg, tg:GetFirst() } or { solvefun2(tg, table.unpack(solve_parama_list)) } local res = not solve_fun2 and { tg, tg:GetFirst() } or { solve_fun2(tg, table.unpack(solve_parama_list)) }
if solve_fun and success_loc then if solve_fun2 and success_loc then
local success, success_g = rsop.CheckOperateSuccess(success_loc) local success, success_g = rsop.CheckOperateSuccess(success_loc)
table.insert(res, #success_g) table.insert(res, #success_g)
end end
...@@ -3415,7 +3431,7 @@ end ...@@ -3415,7 +3431,7 @@ end
Group.SelectSolve = rsgf.SelectSolve Group.SelectSolve = rsgf.SelectSolve
--Group:Select card from group and send to hand --Group:Select card from group and send to hand
function rsgf.SelectToHand(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectToHand(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(solve_parama, 4)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_HAND rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_HAND
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "th", sp, filter, minct, maxct, except_obj, { rsop.SendtoHand, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "th", sp, filter, minct, maxct, except_obj, { rsop.SendtoHand, table.unpack(solve_parama) }, ...)
...@@ -3423,7 +3439,7 @@ end ...@@ -3423,7 +3439,7 @@ end
Group.SelectToHand = rsgf.SelectToHand Group.SelectToHand = rsgf.SelectToHand
--Group:Select card from group and send to grave --Group:Select card from group and send to grave
function rsgf.SelectToGrave(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectToGrave(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_GRAVE rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_GRAVE
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "tg", sp, filter, minct, maxct, except_obj, { rsop.SendtoGrave, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "tg", sp, filter, minct, maxct, except_obj, { rsop.SendtoGrave, table.unpack(solve_parama) }, ...)
...@@ -3431,14 +3447,14 @@ end ...@@ -3431,14 +3447,14 @@ end
Group.SelectToGrave = rsgf.SelectToGrave Group.SelectToGrave = rsgf.SelectToGrave
--Group:Select card from group and release --Group:Select card from group and release
function rsgf.SelectRelease(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectRelease(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "tg", sp, filter, minct, maxct, except_obj, { rsop.Release, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "tg", sp, filter, minct, maxct, except_obj, { rsop.Release, table.unpack(solve_parama) }, ...)
end end
Group.SelectRelease = rsgf.SelectRelease Group.SelectRelease = rsgf.SelectRelease
--Group:Select card from group and send to deck --Group:Select card from group and send to deck
function rsgf.SelectToDeck(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectToDeck(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(solve_parama, 4)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or rsloc.de rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or rsloc.de
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "td", sp, filter, minct, maxct, except_obj, { rsop.SendtoDeck, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "td", sp, filter, minct, maxct, except_obj, { rsop.SendtoDeck, table.unpack(solve_parama) }, ...)
...@@ -3446,14 +3462,14 @@ end ...@@ -3446,14 +3462,14 @@ end
Group.SelectToDeck = rsgf.SelectToDeck Group.SelectToDeck = rsgf.SelectToDeck
--Group:Select card from group and destroy --Group:Select card from group and destroy
function rsgf.SelectDestroy(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectDestroy(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 2) solve_parama = rsop.ReplaceSolveParama(solve_parama, 2)
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "des", sp, filter, minct, maxct, except_obj, { rsop.Destroy, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "des", sp, filter, minct, maxct, except_obj, { rsop.Destroy, table.unpack(solve_parama) }, ...)
end end
Group.SelectDestroy = rsgf.SelectDestroy Group.SelectDestroy = rsgf.SelectDestroy
--Group:Select card from group and remove --Group:Select card from group and remove
function rsgf.SelectRemove(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectRemove(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 3) solve_parama = rsop.ReplaceSolveParama(solve_parama, 3)
rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_REMOVED rsop.SelectOC_successlocation = rsop.SelectOC_successlocation or LOCATION_REMOVED
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, "rm", sp, filter, minct, maxct, except_obj, { rsop.Remove, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, "rm", sp, filter, minct, maxct, except_obj, { rsop.Remove, table.unpack(solve_parama) }, ...)
...@@ -3461,7 +3477,7 @@ end ...@@ -3461,7 +3477,7 @@ end
Group.SelectRemove = rsgf.SelectRemove Group.SelectRemove = rsgf.SelectRemove
--Group:Select card from group and special summon --Group:Select card from group and special summon
function rsgf.SelectSpecialSummon(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectSpecialSummon(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
--solve_parama = rsop.GetFollowingSolvepar(solve_parama, 8) --solve_parama = rsop.ReplaceSolveParama(solve_parama, 8)
solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama } solve_parama = type(solve_parama) == "table" and solve_parama or { solve_parama }
local e = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT) local e = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT)
local parlen = select("#", ...) local parlen = select("#", ...)
...@@ -3475,7 +3491,7 @@ end ...@@ -3475,7 +3491,7 @@ end
Group.SelectSpecialSummon = rsgf.SelectSpecialSummon Group.SelectSpecialSummon = rsgf.SelectSpecialSummon
--Group:Select card and move to field --Group:Select card and move to field
function rsgf.SelectMoveToField(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectMoveToField(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 8) solve_parama = rsop.ReplaceSolveParama(solve_parama, 8)
solve_parama[1] = solve_parama[1] or sp solve_parama[1] = solve_parama[1] or sp
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, HINTMSG_TOFIELD, sp, filter, minct, maxct, except_obj, { rsop.MoveToField, table.unpack(solve_parama) }, ...) return rsgf.SelectSolve(g, HINTMSG_TOFIELD, sp, filter, minct, maxct, except_obj, { rsop.MoveToField, table.unpack(solve_parama) }, ...)
...@@ -3483,7 +3499,7 @@ end ...@@ -3483,7 +3499,7 @@ end
Group.SelectMoveToField = rsgf.SelectMoveToField Group.SelectMoveToField = rsgf.SelectMoveToField
--Function:Select card and move to field and activate --Function:Select card and move to field and activate
function rsgf.SelectMoveToField_Activate(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectMoveToField_Activate(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 7) solve_parama = rsop.ReplaceSolveParama(solve_parama, 7)
solve_parama[1] = solve_parama[1] or sp solve_parama[1] = solve_parama[1] or sp
maxct = 1 maxct = 1
rshint.nohint_sel = true rshint.nohint_sel = true
...@@ -3492,7 +3508,7 @@ end ...@@ -3492,7 +3508,7 @@ end
Group.SelectMoveToField_Activate = rsgf.SelectMoveToField_Activate Group.SelectMoveToField_Activate = rsgf.SelectMoveToField_Activate
--Function:Select card and SSet --Function:Select card and SSet
function rsgf.SelectSSet(g, sp, filter, minct, maxct, except_obj, solve_parama, ...) function rsgf.SelectSSet(g, sp, filter, minct, maxct, except_obj, solve_parama, ...)
solve_parama = rsop.GetFollowingSolvepar(solve_parama, 4) solve_parama = rsop.ReplaceSolveParama(solve_parama, 4)
rshint.nohint_sel = true rshint.nohint_sel = true
return rsgf.SelectSolve(g, HINTMSG_SET, sp, filter, minct, maxct, except_obj, rsop.SelectSSet_Operation(sp, solve_parama), ...) return rsgf.SelectSolve(g, HINTMSG_SET, sp, filter, minct, maxct, except_obj, rsop.SelectSSet_Operation(sp, solve_parama), ...)
end end
...@@ -3502,7 +3518,7 @@ Group.SelectSSet = rsgf.SelectSSet ...@@ -3502,7 +3518,7 @@ Group.SelectSSet = rsgf.SelectSSet
--Card function: local m and cm and cm.rssetcode --Card function: local m and cm and cm.rssetcode
function rscf.DefineCard(code, setcode) function rscf.DefineCard(code, setcode)
if not _G["c"..code] then _G["c"..code] = {} if not _G["c"..code] then _G["c"..code] = { }
setmetatable(_G["c"..code], Card) setmetatable(_G["c"..code], Card)
_G["c"..code].__index = _G["c"..code] _G["c"..code].__index = _G["c"..code]
end end
...@@ -3632,8 +3648,8 @@ rssf.SetSummonCondition = rscf.SetSummonCondition ...@@ -3632,8 +3648,8 @@ rssf.SetSummonCondition = rscf.SetSummonCondition
--Check Built - in SetCode / Series Main Set --Check Built - in SetCode / Series Main Set
function rscf.CheckSetCardMainSet(c, settype, series1, ...) function rscf.CheckSetCardMainSet(c, settype, series1, ...)
local serieslist = { series1, ... } local serieslist = { series1, ... }
local seriesnormallist = {} local seriesnormallist = { }
local seriescustomlist = {} local seriescustomlist = { }
for _, series in pairs(serieslist) do for _, series in pairs(serieslist) do
if type(series) == "number" then if type(series) == "number" then
table.insert(seriesnormallist, series) table.insert(seriesnormallist, series)
...@@ -3642,9 +3658,9 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...) ...@@ -3642,9 +3658,9 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...)
end end
end end
local str_list = rsof.String_Number_To_Table(seriescustomlist) local str_list = rsof.String_Number_To_Table(seriescustomlist)
local codelist = {} local codelist = { }
local effectlist = {} local effectlist = { }
local addcodelist = {} local addcodelist = { }
if settype == "base" then if settype == "base" then
if #seriesnormallist > 0 and c:IsSetCard(table.unpack(seriesnormallist)) then return true end if #seriesnormallist > 0 and c:IsSetCard(table.unpack(seriesnormallist)) then return true end
codelist = { c:GetCode() } codelist = { c:GetCode() }
...@@ -3660,7 +3676,7 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...) ...@@ -3660,7 +3676,7 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...)
elseif settype == "org" then elseif settype == "org" then
if #seriesnormallist > 0 and c:IsOriginalSetCard(table.unpack(seriesnormallist)) then return true end if #seriesnormallist > 0 and c:IsOriginalSetCard(table.unpack(seriesnormallist)) then return true end
codelist = { c:GetOriginalCode() } codelist = { c:GetOriginalCode() }
effectlist = {} effectlist = { }
elseif settype == "pre" then elseif settype == "pre" then
if #seriesnormallist > 0 and c:IsPreviousSetCard(table.unpack(seriesnormallist)) then return true end if #seriesnormallist > 0 and c:IsPreviousSetCard(table.unpack(seriesnormallist)) then return true end
codelist = { c:GetPreviousCodeOnField() } codelist = { c:GetPreviousCodeOnField() }
...@@ -3675,7 +3691,7 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...) ...@@ -3675,7 +3691,7 @@ function rscf.CheckSetCardMainSet(c, settype, series1, ...)
for _, code in ipairs(codelist) do for _, code in ipairs(codelist) do
local setcodestring local setcodestring
local res = not _G["c"..code] and true or false local res = not _G["c"..code] and true or false
if res then _G["c"..code] = {} end if res then _G["c"..code] = { } end
if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then if pcall(function() dofile("expansions/script/c"..code..".lua") end) or pcall(function() dofile("script/c"..code..".lua") end) then
setcodestring = _G["c"..code].rssetcode setcodestring = _G["c"..code].rssetcode
end end
...@@ -4158,7 +4174,7 @@ function rscf.XyzLevelFreeGoal2(minct, maxct, og) ...@@ -4158,7 +4174,7 @@ function rscf.XyzLevelFreeGoal2(minct, maxct, og)
local ug = g:Filter(Card.IsHasEffect, nil, rscode.Utility_Xyz_Material, tp) local ug = g:Filter(Card.IsHasEffect, nil, rscode.Utility_Xyz_Material, tp)
local mg = g:Clone() local mg = g:Clone()
mg:Sub(ug) mg:Sub(ug)
local totalreducelist = {} local totalreducelist = { }
local sumlist = { #mg } local sumlist = { #mg }
for tc in aux.Next(ug) do for tc in aux.Next(ug) do
local ct = 0 local ct = 0
...@@ -4602,7 +4618,7 @@ function rscf.GetSameType_Base(c, way_str, type1, ...) ...@@ -4602,7 +4618,7 @@ function rscf.GetSameType_Base(c, way_str, type1, ...)
end end
local type_list= type1 and { type1, ... } or { TYPE_MONSTER, TYPE_SPELL, TYPE_TRAP } local type_list= type1 and { type1, ... } or { TYPE_MONSTER, TYPE_SPELL, TYPE_TRAP }
local total_type = 0 local total_type = 0
local total_type_list = {} local total_type_list = { }
for _, ctype in pairs(type_list) do for _, ctype in pairs(type_list) do
if type_fun(c) & ctype == ctype then if type_fun(c) & ctype == ctype then
total_type = total_type | ctype total_type = total_type | ctype
...@@ -4715,8 +4731,8 @@ end ...@@ -4715,8 +4731,8 @@ end
function rshint.SelectOption(p, ...) function rshint.SelectOption(p, ...)
local fun_list = { ... } local fun_list = { ... }
local off = 1 local off = 1
local ops = {} local ops = { }
local opval = {} local opval = { }
for idx, val in pairs(fun_list) do for idx, val in pairs(fun_list) do
if rsof.Check_Boolean(val,true) then if rsof.Check_Boolean(val,true) then
local sel_hint = fun_list[idx + 1] local sel_hint = fun_list[idx + 1]
...@@ -4748,9 +4764,9 @@ function rshint.SelectOption_Page(p, hint_list1, ...) ...@@ -4748,9 +4764,9 @@ function rshint.SelectOption_Page(p, hint_list1, ...)
local op, currentpage = 0, 1 local op, currentpage = 0, 1
local len = #hint_list local len = #hint_list
local maxpage = len <= 4 and 1 or math.ceil((len - 1) / 3) local maxpage = len <= 4 and 1 or math.ceil((len - 1) / 3)
local pagehint = {} local pagehint = { }
for page = 1, maxpage do for page = 1, maxpage do
pagehint[page] = {} pagehint[page] = { }
if page == 1 then if page == 1 then
pagehint[page] = { hint_list[1], hint_list[2] or null, hint_list[3] or null, hint_list[4] or null } pagehint[page] = { hint_list[1], hint_list[2] or null, hint_list[3] or null, hint_list[4] or null }
elseif page > 1 then elseif page > 1 then
...@@ -4888,7 +4904,7 @@ end ...@@ -4888,7 +4904,7 @@ end
--split the string, ues ", " as delim_er --split the string, ues ", " as delim_er
function rsof.String_Split(str_input, delim_er) function rsof.String_Split(str_input, delim_er)
delim_er = delim_er or ',' delim_er = delim_er or ','
local pos, arr = 0, {} local pos, arr = 0, { }
--case string list --case string list
if delim_er == ',' then if delim_er == ',' then
for st, sp in function() return string.find(str_input, delim_er, pos, true) end do for st, sp in function() return string.find(str_input, delim_er, pos, true) end do
...@@ -4904,7 +4920,7 @@ function rsof.String_Split(str_input, delim_er) ...@@ -4904,7 +4920,7 @@ function rsof.String_Split(str_input, delim_er)
pos = sp + 1 pos = sp + 1
end end
table.insert(arr, string.sub(str_input, pos)) table.insert(arr, string.sub(str_input, pos))
local arr2 = {} local arr2 = { }
local str2 = arr[1] local str2 = arr[1]
for idx, val in ipairs(arr) do for idx, val in ipairs(arr) do
if idx == 1 then table.insert(arr2, str2) if idx == 1 then table.insert(arr2, str2)
...@@ -4939,7 +4955,7 @@ end ...@@ -4939,7 +4955,7 @@ end
--you can use "a, b, c" or { "a, b, c" } or { "a", "b", "c" } as same --you can use "a, b, c" or { "a, b, c" } or { "a", "b", "c" } as same
--return { "a", "b", "c" } --return { "a", "b", "c" }
function rsof.String_Number_To_Table(value) function rsof.String_Number_To_Table(value)
local table1 = {} local table1 = { }
if type(value) == "string" then if type(value) == "string" then
table1 = rsof.String_Split(value) table1 = rsof.String_Split(value)
elseif type(value) == "number" then elseif type(value) == "number" then
...@@ -4996,7 +5012,7 @@ function rsof.Table_List_Single(base_tab, check_val) ...@@ -4996,7 +5012,7 @@ function rsof.Table_List_Single(base_tab, check_val)
end end
function rsof.Table_List_Base(check_type, base_tab, check_val1, ...) function rsof.Table_List_Base(check_type, base_tab, check_val1, ...)
local check_list = { check_val1, ... } local check_list = { check_val1, ... }
local res_list = {} local res_list = { }
for idx, check_val in pairs(check_list) do for idx, check_val in pairs(check_list) do
local exist_res, exist_idx = rsof.Table_List_Single(base_tab, check_val) local exist_res, exist_idx = rsof.Table_List_Single(base_tab, check_val)
if check_type == "normal" then if check_type == "normal" then
...@@ -5024,7 +5040,7 @@ function rsof.Table_List_AND(base_tab, check_val1, ...) ...@@ -5024,7 +5040,7 @@ function rsof.Table_List_AND(base_tab, check_val1, ...)
end end
--other function: Find Intersection element in 2 table2 --other function: Find Intersection element in 2 table2
function rsof.Table_Intersection(tab1, ...) function rsof.Table_Intersection(tab1, ...)
local intersection_list = {} local intersection_list = { }
local tab_list = { ... } local tab_list = { ... }
for _, ele1 in pairs(tab1) do for _, ele1 in pairs(tab1) do
table.insert(intersection_list, ele1) table.insert(intersection_list, ele1)
...@@ -5039,7 +5055,7 @@ function rsof.Table_Intersection(tab1, ...) ...@@ -5039,7 +5055,7 @@ function rsof.Table_Intersection(tab1, ...)
end end
--other function: Clone Table --other function: Clone Table
function rsof.Table_Clone(tab) function rsof.Table_Clone(tab)
local tab2 = {} local tab2 = { }
for idx, val in pairs(tab) do for idx, val in pairs(tab) do
tab2[idx] = val tab2[idx] = val
end end
...@@ -5049,7 +5065,7 @@ end ...@@ -5049,7 +5065,7 @@ end
--error at "nil" value !!!!!!!!! --error at "nil" value !!!!!!!!!
--error at no number key !!!!!!!!! --error at no number key !!!!!!!!!
function rsof.Table_Mix(tab1, ...) function rsof.Table_Mix(tab1, ...)
local res_list = {} local res_list = { }
local list = { tab1, ... } local list = { tab1, ... }
local len = 0 local len = 0
for _, tab in pairs(list) do for _, tab in pairs(list) do
...@@ -5064,7 +5080,7 @@ function rsof.Table_Mix(tab1, ...) ...@@ -5064,7 +5080,7 @@ function rsof.Table_Mix(tab1, ...)
end end
--other function: table to desc ({ m, 1 } to aux.Stringid(m, 1)) --other function: table to desc ({ m, 1 } to aux.Stringid(m, 1))
function rsof.Table_To_Desc(hint_list) function rsof.Table_To_Desc(hint_list)
local res_list = {} local res_list = { }
for _, hint in pairs(hint_list) do for _, hint in pairs(hint_list) do
if type(hint) == "table" then if type(hint) == "table" then
table.insert(res_list, aux.Stringid(hint[1], hint[2])) table.insert(res_list, aux.Stringid(hint[1], hint[2]))
...@@ -5076,7 +5092,7 @@ function rsof.Table_To_Desc(hint_list) ...@@ -5076,7 +5092,7 @@ function rsof.Table_To_Desc(hint_list)
end end
--other function: Count for table value --other function: Count for table value
function rsof.Table_Count(tab, ct_val) function rsof.Table_Count(tab, ct_val)
local ct_list = {} local ct_list = { }
for idx, val in pairs(tab) do for idx, val in pairs(tab) do
if val == ct_val then if val == ct_val then
table.insert(ct_list, idx) table.insert(ct_list, idx)
......
...@@ -427,7 +427,7 @@ function rsof.Escape_Old_Functions() ...@@ -427,7 +427,7 @@ function rsof.Escape_Old_Functions()
rsef.ACT_EQUIP = rsef.A_Equip rsef.ACT_EQUIP = rsef.A_Equip
rsef.STO_FLIP = rsef.STO_Flip rsef.STO_FLIP = rsef.STO_Flip
rsef.STF_FLIP = rsef.STF_Flip rsef.STF_FLIP = rsef.STF_Flip
rsef.QO_NEGATE = rsef.QO_Negate
rsef.FC_PHASELEAVE = rsef.FC_PhaseLeave rsef.FC_PHASELEAVE = rsef.FC_PhaseLeave
rsef.ACT = rsef.A rsef.ACT = rsef.A
...@@ -474,8 +474,7 @@ function rsof.Escape_Old_Functions() ...@@ -474,8 +474,7 @@ function rsof.Escape_Old_Functions()
if type(dn_filter) == "number" then if type(dn_filter) == "number" then
dn_filter = dn_list[dn_filter] dn_filter = dn_list[dn_filter]
end end
if pl_fun then pl_fun = pl_fun and 1 or 0 end return rscon.disneg("neg", dn_filter, pl_fun and 1 or 0)(...)
return rscon.disneg("neg", dn_filter, pl_fun)(...)
end end
end end
rscon.discon = function(dn_filter, pl_fun) rscon.discon = function(dn_filter, pl_fun)
...@@ -484,8 +483,7 @@ function rsof.Escape_Old_Functions() ...@@ -484,8 +483,7 @@ function rsof.Escape_Old_Functions()
if type(dn_filter) == "number" then if type(dn_filter) == "number" then
dn_filter = dn_list[dn_filter] dn_filter = dn_list[dn_filter]
end end
if pl_fun then pl_fun = pl_fun and 1 or 0 end return rscon.disneg("dis", dn_filter, pl_fun and 1 or 0)(...)
return rscon.disneg("dis", dn_filter, pl_fun)(...)
end end
end end
rsef.QO_NEGATE = function(reg_list, dn_type, lim_list, dn_str, range, con, cost, desc_list, cate, flag, reset_list) rsef.QO_NEGATE = function(reg_list, dn_type, lim_list, dn_str, range, con, cost, desc_list, cate, flag, reset_list)
......
...@@ -75,13 +75,10 @@ function c12003016.negop(e,tp,eg,ep,ev,re,r,rp) ...@@ -75,13 +75,10 @@ function c12003016.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT) Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
end end
end end
function c12003016.target(e,c)
local g,te=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS,CHAININFO_TRIGGERING_EFFECT)
return not (te and te:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(c))
end
function c12003016.efilter(e,te) function c12003016.efilter(e,te)
return te:GetOwnerPlayer()~=e:GetHandlerPlayer() local g,te=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS,CHAININFO_TRIGGERING_EFFECT)
return ( not (te and te:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(c)) ) and te:GetOwnerPlayer()~=e:GetHandlerPlayer()
end end
function c12003016.cfilter(c,tp) function c12003016.cfilter(c,tp)
...@@ -102,6 +99,12 @@ end ...@@ -102,6 +99,12 @@ end
function c12003016.spfilter(c,e,tp,zone) function c12003016.spfilter(c,e,tp,zone)
return c:IsRace(RACE_SEASERPENT) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone,true) return c:IsRace(RACE_SEASERPENT) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone,true)
end end
function c12003016.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local zone=e:GetHandler():GetLinkedZone(tp)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,zone)>2
and Duel.IsExistingMatchingCard(c12003016.spfilter,tp,LOCATION_GRAVE,0,3,nil,e,tp,zone) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK)
end
function c12003016.spop(e,tp,eg,ep,ev,re,r,rp) function c12003016.spop(e,tp,eg,ep,ev,re,r,rp)
local zone=e:GetHandler():GetLinkedZone() local zone=e:GetHandler():GetLinkedZone()
if chk==0 then return zone~=0 if chk==0 then return zone~=0
......
...@@ -96,9 +96,10 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -96,9 +96,10 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
if tc:IsSetCard(0x3fa8) then if tc:IsSetCard(0x3fa8) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_EXTRA) local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
mat1:Sub(mat2) mat1:Sub(mat2)
Duel.SendtoGrave(mat1+mat2,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.Remove(mat2,POS_FACEUP,REASON_EFFECT)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
local e2=Effect.CreateEffect(e:GetHandler()) local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
...@@ -116,7 +116,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -116,7 +116,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
end end
end end
end end
function c1m.con4_4(e,tp,eg,ep,ev,re,r,rp) function cm.con4_4(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 return Duel.GetCurrentChain()==0
end end
function cm.op4_5(e,tp,eg,ep,ev,re,r,rp) function cm.op4_5(e,tp,eg,ep,ev,re,r,rp)
...@@ -131,7 +131,7 @@ end ...@@ -131,7 +131,7 @@ end
function cm.thfilter1(c) function cm.thfilter1(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsAbleToHand() return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsAbleToHand()
end end
function cm.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter1,tp,LOCATION_REMOVED,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter1,tp,LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,0)
end end
......
...@@ -87,7 +87,6 @@ function cm.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -87,7 +87,6 @@ function cm.effop(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetTarget(cm.etg)
e1:SetValue(cm.efilter) e1:SetValue(cm.efilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1,true) rc:RegisterEffect(e1,true)
...@@ -108,11 +107,8 @@ function cm.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -108,11 +107,8 @@ function cm.effop(e,tp,eg,ep,ev,re,r,rp)
rc:RegisterEffect(e2,true) rc:RegisterEffect(e2,true)
end end
end end
function cm.etg(e,c)
local g,te=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS,CHAININFO_TRIGGERING_EFFECT)
return not (te and te:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(c))
end
function cm.efilter(e,re,tp) function cm.efilter(e,re,tp)
return re:GetHandlerPlayer()~=e:GetHandlerPlayer() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not (re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(e:GetHandler())) and re:GetHandlerPlayer()~=e:GetHandlerPlayer()
end end
\ No newline at end of file
...@@ -80,7 +80,6 @@ function c16400025.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -80,7 +80,6 @@ function c16400025.effop(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetTarget(c16400025.etg)
e1:SetValue(c16400025.efilter) e1:SetValue(c16400025.efilter)
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
rc:RegisterEffect(e1,true) rc:RegisterEffect(e1,true)
...@@ -101,11 +100,8 @@ function c16400025.effop(e,tp,eg,ep,ev,re,r,rp) ...@@ -101,11 +100,8 @@ function c16400025.effop(e,tp,eg,ep,ev,re,r,rp)
rc:RegisterEffect(e2,true) rc:RegisterEffect(e2,true)
end end
end end
function c16400025.etg(e,c)
local g,te=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS,CHAININFO_TRIGGERING_EFFECT)
return not (te and te:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(c))
end
function c16400025.efilter(e,re,tp) function c16400025.efilter(e,re,tp)
return re:GetHandlerPlayer()~=e:GetHandlerPlayer() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not (re and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET))
or not (g and g:IsContains(e:GetHandler())) and re:GetHandlerPlayer()~=e:GetHandlerPlayer()
end end
\ No newline at end of file
...@@ -14,7 +14,7 @@ end ...@@ -14,7 +14,7 @@ end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac=Duel.AnnounceCard(tp) local ac=Duel.AnnounceCard(tp)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAINING) e1:SetCode(EVENT_CHAINING)
e1:SetLabel(ac) e1:SetLabel(ac)
......
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