Commit d6e07563 authored by Nemo Ma's avatar Nemo Ma

fix

parent a3b64f1a
...@@ -2052,7 +2052,7 @@ function Scl.CreateActivateEffect_NegateActivation(reg_obj, op_str, lim_obj, con ...@@ -2052,7 +2052,7 @@ function Scl.CreateActivateEffect_NegateActivation(reg_obj, op_str, lim_obj, con
end end
--Create an activate effect, fusion summon a monster meets "fus_filter", use cards from "mat_obj" as fusion materials, and do "mat_fun" to those materials, the materials must meet "fcheck" and "gcheck" --Create an activate effect, fusion summon a monster meets "fus_filter", use cards from "mat_obj" as fusion materials, and do "mat_fun" to those materials, the materials must meet "fcheck" and "gcheck"
--"mat_obj" should be function-format, call mat_obj(e, tp, eg, ...) to get materials. --"mat_obj" should be function-format, call mat_obj(e, tp, eg, ...) to get materials.
--"mat_fun" can be string-format (like "Send2GY", "Bainsh", see Scl.Category_List), call s.operate_selected_objects to do the operation on the selected materials and set operation info due to the categroy. --"mat_fun" can be string-format (like "Send2GY", "Bainsh", see Scl.Category_List), call Scl.OperateSelectedObjects to do the operation on the selected materials and set operation info due to the categroy.
--OR can be function-format, call mat_fun(selected_materials, e, tp, eg, ep, ev, re, r, rp) to do the operation on the selected materials. --OR can be function-format, call mat_fun(selected_materials, e, tp, eg, ep, ev, re, r, rp) to do the operation on the selected materials.
--only after all the selected materials be operated successfully by "mat_fun", the fusion summon will be continued, so if you used function-format "mat_fun", PLZ noticed that you should return a boolean value to make this function to distinguish whether you have operated successfully (like return Duel.Destroy(g, REASON_MATERIAL + REASON_EFFECT + REASON_FUSION) == #g) --only after all the selected materials be operated successfully by "mat_fun", the fusion summon will be continued, so if you used function-format "mat_fun", PLZ noticed that you should return a boolean value to make this function to distinguish whether you have operated successfully (like return Duel.Destroy(g, REASON_MATERIAL + REASON_EFFECT + REASON_FUSION) == #g)
--if you set the parama must_include_card (default = nil), means you must use that card as one of the fusion materials --if you set the parama must_include_card (default = nil), means you must use that card as one of the fusion materials
...@@ -2223,7 +2223,7 @@ function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_inc ...@@ -2223,7 +2223,7 @@ function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_inc
local mat0 = Duel.SelectFusionMaterial(tp, tc, mat, must_include_card, chkf) local mat0 = Duel.SelectFusionMaterial(tp, tc, mat, must_include_card, chkf)
tc:SetMaterial(mat0) tc:SetMaterial(mat0)
if type(mat_fun) == "string" then if type(mat_fun) == "string" then
res = s.operate_selected_objects(mat0, mat_fun, REASON_FUSION + REASON_MATERIAL + REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() == #mat0 res = Scl.OperateSelectedObjects(mat0, mat_fun, REASON_FUSION + REASON_MATERIAL + REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() == #mat0
else else
res = mat_fun(mat0, e, tp, eg, ep, ev, re, r, rp, 1) res = mat_fun(mat0, e, tp, eg, ep, ev, re, r, rp, 1)
end end
...@@ -2573,7 +2573,7 @@ function Scl.CreateQuickOptionalEffect_Negate(reg_obj, neg_typ, op_str, lim_obj, ...@@ -2573,7 +2573,7 @@ function Scl.CreateQuickOptionalEffect_Negate(reg_obj, neg_typ, op_str, lim_obj,
ex_tg = ex_tg or aux.TRUE ex_tg = ex_tg or aux.TRUE
ex_op = ex_op or aux.TRUE ex_op = ex_op or aux.TRUE
local reg_tg = s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg) local reg_tg = s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg)
local reg_op = s.negate_activation_or_effect_op(neg_typ, op_str, ex_op) local reg_op = scl.negate_activation_or_effect_op(neg_typ, op_str, ex_op)
return Scl.CreateQuickOptionalEffect(reg_obj, EVENT_CHAINING, desc_obj or neg_typ, lim_obj, reg_ctgy, reg_flag, rng, reg_con, cost, reg_tg, reg_op, nil, rst_obj) return Scl.CreateQuickOptionalEffect(reg_obj, EVENT_CHAINING, desc_obj or neg_typ, lim_obj, reg_ctgy, reg_flag, rng, reg_con, cost, reg_tg, reg_op, nil, rst_obj)
end end
--Create a quick effect, negate the card's effect. --Create a quick effect, negate the card's effect.
...@@ -2596,6 +2596,7 @@ end ...@@ -2596,6 +2596,7 @@ end
function Scl.CreateQuickOptionalEffect_NegateActivation(reg_obj, op_str, lim_obj, rng, con, cost, ex_ctgy, ex_flag, ex_tg, ex_op, desc_obj, rst_obj) function Scl.CreateQuickOptionalEffect_NegateActivation(reg_obj, op_str, lim_obj, rng, con, cost, ex_ctgy, ex_flag, ex_tg, ex_op, desc_obj, rst_obj)
return Scl.CreateQuickOptionalEffect_Negate(reg_obj, "NegateActivation", op_str, lim_obj, rng, con, cost, ex_ctgy, ex_flag, ex_tg, ex_op, desc_obj, rst_obj) return Scl.CreateQuickOptionalEffect_Negate(reg_obj, "NegateActivation", op_str, lim_obj, rng, con, cost, ex_ctgy, ex_flag, ex_tg, ex_op, desc_obj, rst_obj)
end end
--warning: this function use "scl" beacuse this function must be referenced in the old library, do not refer to this function anywhere else.
function scl.negate_activation_or_effect_con(neg_typ, eff_typ_obj, player) function scl.negate_activation_or_effect_con(neg_typ, eff_typ_obj, player)
return function(e, tp, eg, ep, ev, re, r, rp) return function(e, tp, eg, ep, ev, re, r, rp)
eff_typ_obj = eff_typ_obj or "All" eff_typ_obj = eff_typ_obj or "All"
...@@ -2632,7 +2633,7 @@ function scl.negate_activation_or_effect_con(neg_typ, eff_typ_obj, player) ...@@ -2632,7 +2633,7 @@ function scl.negate_activation_or_effect_con(neg_typ, eff_typ_obj, player)
end end
function s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg) function s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg)
return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc) return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
op_str = op_str or "Dummy" op_str = op_str or aux.TRUE
local rc = re:GetHandler() local rc = re:GetHandler()
local cgty, ctgy_arr = Scl.GetNumFormatCategory(op_str) local cgty, ctgy_arr = Scl.GetNumFormatCategory(op_str)
if chkc then if chkc then
...@@ -2649,11 +2650,13 @@ function s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg) ...@@ -2649,11 +2650,13 @@ function s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg)
scl.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 1) scl.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 1)
end end
end end
function s.negate_activation_or_effect_op(neg_typ, op_str, ex_op) --warning: this function use "scl" beacuse this function must be referenced in the old library, do not refer to this function anywhere else.
function scl.negate_activation_or_effect_op(neg_typ, op_str, ex_op)
return function(e, tp, eg, ep, ev, re, r, rp) return function(e, tp, eg, ep, ev, re, r, rp)
ex_op = ex_op or aux.TRUE
local c = e:GetHandler() local c = e:GetHandler()
local rc = re:GetHandler() local rc = re:GetHandler()
local res = not ex_op and true or scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 0) local res = scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 0)
if Scl.CheckBoolean(res, true) or type(res) == "nil" then if Scl.CheckBoolean(res, true) or type(res) == "nil" then
if neg_typ == "NegateEffect" then if neg_typ == "NegateEffect" then
res = Duel.NegateEffect(ev) res = Duel.NegateEffect(ev)
...@@ -2663,7 +2666,7 @@ function s.negate_activation_or_effect_op(neg_typ, op_str, ex_op) ...@@ -2663,7 +2666,7 @@ function s.negate_activation_or_effect_op(neg_typ, op_str, ex_op)
if op_str and op_str ~= "Dummy" and not rc:IsRelateToChain(ev) then if op_str and op_str ~= "Dummy" and not rc:IsRelateToChain(ev) then
res = false res = false
else else
res = s.operate_selected_objects(eg, op_str, REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() > 0 res = Scl.OperateSelectedObjects(eg, op_str, REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() > 0
end end
if res or type(res) == "nil" then if res or type(res) == "nil" then
scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 1) scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 1)
...@@ -2879,7 +2882,7 @@ function s.phase_opearte_op(fun_obj, fid) ...@@ -2879,7 +2882,7 @@ function s.phase_opearte_op(fun_obj, fid)
if typ == "function" then if typ == "function" then
fun_obj(rg, e, tp, eg, ep, ev, re, r, rp) fun_obj(rg, e, tp, eg, ep, ev, re, r, rp)
elseif typ == "string" then elseif typ == "string" then
s.operate_selected_objects(rg, fun_obj, REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() Scl.OperateSelectedObjects(rg, fun_obj, REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)()
end end
end end
end end
...@@ -3560,7 +3563,7 @@ function s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re, ...@@ -3560,7 +3563,7 @@ function s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re,
elseif list_typ == "PlayerTarget" or list_typ == "PlayerCost" then elseif list_typ == "PlayerTarget" or list_typ == "PlayerCost" then
local op_arr = { [tp] = self_minct, [1 - tp] = oppo_minct, [tp + 2] = self_maxct, [3 - tp] = oppo_maxct } local op_arr = { [tp] = self_minct, [1 - tp] = oppo_minct, [tp + 2] = self_maxct, [3 - tp] = oppo_maxct }
Scl.Player_Cost_And_Target_Value[category_str] = Scl.CloneArray(op_arr) Scl.Player_Cost_And_Target_Value[category_str] = Scl.CloneArray(op_arr)
if not s.operate_selected_objects(Scl.Player_Cost_And_Target_Value[category_str], category_str, reason, 0, e, tp, eg, ep, ev, re, r, rp)() then if not Scl.OperateSelectedObjects(Scl.Player_Cost_And_Target_Value[category_str], category_str, reason, 0, e, tp, eg, ep, ev, re, r, rp)() then
return false return false
else else
return s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re, r, rp, chk, chkc, used_arr, arr2, ...) return s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re, r, rp, chk, chkc, used_arr, arr2, ...)
...@@ -3816,10 +3819,10 @@ function s.operate_selected_cost_or_operat_objects(current_sel_object, total_sel ...@@ -3816,10 +3819,10 @@ function s.operate_selected_cost_or_operat_objects(current_sel_object, total_sel
if replace_operation then if replace_operation then
return replace_operation(current_sel_object, total_sel_group, e, tp, eg, ep, ev, re, r, rp) return replace_operation(current_sel_object, total_sel_group, e, tp, eg, ep, ev, re, r, rp)
else else
return s.operate_selected_objects(current_sel_object, category_str, reason, 1, e, tp, eg, ep, ev, re, r, rp)() return Scl.OperateSelectedObjects(current_sel_object, category_str, reason, 1, e, tp, eg, ep, ev, re, r, rp)()
end end
end end
--some functions like Scl.SelectAndOperateCards, you cannot transfer parama "e" and "tp" to s.operate_selected_objects, so you first need to use this function to get the current checking/solving effect "e". --some functions like Scl.SelectAndOperateCards, you cannot transfer parama "e" and "tp" to Scl.OperateSelectedObjects, so you first need to use this function to get the current checking/solving effect "e".
--//return the current checking/solving effect. --//return the current checking/solving effect.
function Scl.GetCurrentEffectInfo() function Scl.GetCurrentEffectInfo()
if not Scl.Token_List[4392470] or not Scl.Token_List[4392470][1] then if not Scl.Token_List[4392470] or not Scl.Token_List[4392470][1] then
...@@ -3849,7 +3852,7 @@ end ...@@ -3849,7 +3852,7 @@ end
--if chk == 0, this function won't do operation, but check whether it can be operated successfully. --if chk == 0, this function won't do operation, but check whether it can be operated successfully.
-- ... is the parama of the operate function, if you don't set those parama(s), it will use the default parama (see Scl.Category_List) -- ... is the parama of the operate function, if you don't set those parama(s), it will use the default parama (see Scl.Category_List)
--//return that operate function's return., --//return that operate function's return.,
function s.operate_selected_objects(sel_obj, ctgy_str, reason, chk, e, tp, eg, ep, ev, re, r, rp) function Scl.OperateSelectedObjects(sel_obj, ctgy_str, reason, chk, e, tp, eg, ep, ev, re, r, rp)
return function(...) return function(...)
local ex_para_arr = { ... } local ex_para_arr = { ... }
local op_arr = Scl.Category_List[ctgy_str][6] local op_arr = Scl.Category_List[ctgy_str][6]
...@@ -4431,7 +4434,7 @@ function Scl.SelectAndOperateCards(sel_hint, sp, filter_obj, tp, self_zone, oppo ...@@ -4431,7 +4434,7 @@ function Scl.SelectAndOperateCards(sel_hint, sp, filter_obj, tp, self_zone, oppo
Scl.Single_Buff_Affect_Self_List = { } Scl.Single_Buff_Affect_Self_List = { }
return 0, #sg return 0, #sg
else else
return s.operate_selected_objects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr)) return Scl.OperateSelectedObjects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr))
end end
end end
end end
...@@ -4496,7 +4499,7 @@ function Scl.SelectAndOperateCardsFromGroup(sel_hint, g, sp, filter, minct, maxc ...@@ -4496,7 +4499,7 @@ function Scl.SelectAndOperateCardsFromGroup(sel_hint, g, sp, filter, minct, maxc
Scl.Single_Buff_Affect_Self_List = { } Scl.Single_Buff_Affect_Self_List = { }
return 0, #sg return 0, #sg
else else
return s.operate_selected_objects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr)) return Scl.OperateSelectedObjects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr))
end end
end end
end end
......
...@@ -730,12 +730,13 @@ function rstg.neg(dn_str, ex_tg) ...@@ -730,12 +730,13 @@ function rstg.neg(dn_str, ex_tg)
local dn_str2 = s.ctgy_list[dn_str] local dn_str2 = s.ctgy_list[dn_str]
local c = e:GetHandler() local c = e:GetHandler()
local rc = re:GetHandler() local rc = re:GetHandler()
ex_tg = ex_tg or aux.TRUE
if chkc then return ex_tg(e, tp, eg, ep, ev, re, r, rp, chk, chkc) end if chkc then return ex_tg(e, tp, eg, ep, ev, re, r, rp, chk, chkc) end
if chk == 0 then return (dn_str ~= "rm" or aux.nbcon(tp, re)) and (ex_tg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)) end if chk == 0 then return (dn_str ~= "rm" or aux.nbcon(tp, re)) and (ex_tg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)) end
local op_cate = Scl.Category_List[dn_str2][2] local op_cate = Scl.Category_List[dn_str2][2]
local ctgy_list = type(op_cate) == "number" and {op_cate} or op_cate local ctgy_list = type(op_cate) == "number" and {op_cate} or op_cate
if #ctgy_list > 0 and rc:IsRelateToEffect(re) then if #ctgy_list > 0 and rc:IsRelateToEffect(re) then
local res = rsop.Operation_Solve(eg, dn_str, REASON_EFFECT, { }, 0, e, tp, eg, ep, ev, re, r, rp) local res = Scl.OperateSelectedObjects(eg, dn_str2, REASON_EFFECT, 0, e, tp, eg, ep, ev, re, r, rp)()
if res then if res then
for ctgy in pairs(ctgy_list) do for ctgy in pairs(ctgy_list) do
Duel.SetOperationInfo(0, ctgy, eg, 1, 0, 0) Duel.SetOperationInfo(0, ctgy, eg, 1, 0, 0)
...@@ -747,12 +748,14 @@ function rstg.neg(dn_str, ex_tg) ...@@ -747,12 +748,14 @@ function rstg.neg(dn_str, ex_tg)
end end
function rsop.neg(dn_str, ex_op) function rsop.neg(dn_str, ex_op)
return function(...) return function(...)
return s.negate_activation_or_effect_op("NegateActivation", s.ctgy_list[dn_str], ex_op)(...) local dn_str2 = dn_str or "dum"
return scl.negate_activation_or_effect_op("NegateActivation", s.ctgy_list[dn_str2], ex_op)(...)
end end
end end
function rsop.dis(dn_str, ex_op) function rsop.dis(dn_str, ex_op)
return function(...) return function(...)
return s.negate_activation_or_effect_op("NegateEffect", s.ctgy_list[dn_str], ex_op)(...) local dn_str2 = dn_str or "dum"
return scl.negate_activation_or_effect_op("NegateEffect", s.ctgy_list[dn_str2], ex_op)(...)
end end
end end
function s.get_effect_array(checkfun, endfun, list_typ, a1, a2, a3, ...) function s.get_effect_array(checkfun, endfun, list_typ, a1, a2, a3, ...)
...@@ -1390,8 +1393,14 @@ rscon.negcon = function(dn_filter, pl_fun) ...@@ -1390,8 +1393,14 @@ rscon.negcon = function(dn_filter, pl_fun)
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
local dn_filter2 = dn_filter
if type(dn_filter) == "function" then
dn_filter2 = function(e, tp, ev, re, rp, tg, loc, seq, cp)
return dn_filter(e, tp, re, rp, tg)
end
end
if pl_fun then pl_fun = pl_fun and 1 or 0 end if pl_fun then pl_fun = pl_fun and 1 or 0 end
return scl.negate_activation_or_effect_con("NegateActivation", dn_filter, pl_fun)(...) return scl.negate_activation_or_effect_con("NegateActivation", dn_filter2, pl_fun)(...)
end end
end end
rscon.discon = function(dn_filter, pl_fun) rscon.discon = function(dn_filter, pl_fun)
...@@ -1400,8 +1409,14 @@ rscon.discon = function(dn_filter, pl_fun) ...@@ -1400,8 +1409,14 @@ rscon.discon = function(dn_filter, pl_fun)
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
local dn_filter2 = dn_filter
if type(dn_filter) == "function" then
dn_filter2 = function(e, tp, ev, re, rp, tg, loc, seq, cp)
return dn_filter(e, tp, re, rp, tg)
end
end
if pl_fun then pl_fun = pl_fun and 1 or 0 end if pl_fun then pl_fun = pl_fun and 1 or 0 end
return scl.negate_activation_or_effect_con("NegateEffect", dn_filter, pl_fun)(...) return scl.negate_activation_or_effect_con("NegateEffect", dn_filter2, 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)
...@@ -1416,7 +1431,7 @@ end ...@@ -1416,7 +1431,7 @@ end
rstg.negtg = rstg.neg rstg.negtg = rstg.neg
rstg.distg = rstg.neg rstg.distg = rstg.neg
rsop.negop = rsop.neg rsop.negop = rsop.neg
rsop.negop = rsop.dis rsop.disop = rsop.dis
--// --//
rscf.SetSpecialSummonProduce = function(reg_list,range,con,op,desc_list,lim_list,reset_list) rscf.SetSpecialSummonProduce = function(reg_list,range,con,op,desc_list,lim_list,reset_list)
......
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