Commit 4af8223b authored by CubeRuler's avatar CubeRuler

fix

parent e706a0ab
Pipeline #17104 passed with stages
in 35 minutes and 26 seconds
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -137,39 +137,6 @@ function rshint.SwitchHintFormat(string_prefix, hint_val1, hint_val2, ...)
end
return table.unpack(res_list)
end
--Effect: Get default hint string for Duel.Hint ,use in effect target
function rsef.GetDefaultSelectHint(cate_val, loc_self, loc_oppo, hint_val)
if hint_val then
return rshint.SwitchHintFormat("s", hint_val)
end
local total_cate, total_cate_list, cate_str_list, sel_hint_list = rsef.GetRegisterCategory(nil, cate_val)
local hint = sel_hint_list[1] or 0
if hint == 0 then
--if istarget then hint = HINTMSG_TARGET end
if (type(loc_self) ~= "number" or (loc_self and loc_self > 0)) and (not loc_oppo or loc_oppo == 0) then hint = HINTMSG_SELF end
if (type(loc_oppo) == "number" and loc_oppo > 0) and (not loc_self or loc_self == 0) then hint = HINTMSG_OPPO end
end
-- destroy and remove
if rsof.Table_List_OR(cate_str_list, "des_rm", "des, rm") or rsof.Table_List_AND(cate_str_list, "des", "rm") then
hint = HINTMSG_DESTROY
end
-- return to hand
if rsof.Table_List(cate_str_list, "th") and
((type(loc_self) == "number" and loc_self & LOCATION_ONFIELD ~=0) or (loc_oppo and loc_oppo & LOCATION_ONFIELD ~=0)) then
hint = HINTMSG_RTOHAND
end
-- return to grave
if rsof.Table_List(cate_str_list, "tg") and
((type(loc_self) == "number" and loc_self & LOCATION_REMOVED ~=0) or (loc_oppo and loc_oppo & LOCATION_REMOVED ~=0)) then
hint = rshint.srtg
end
-- return to hand
if rsof.Table_List(cate_str_list, "th") and
((type(loc_self) == "number" and loc_self & (rsloc.og + LOCATION_REMOVED) ~=0) or (loc_oppo and loc_oppo & (rsloc.og + LOCATION_REMOVED) ~=0)) then
hint = rshint.srth
end
return hint
end
--Effect: Get register card
function rsef.GetRegisterCard(reg_list)
reg_list = type(reg_list) == "table" and reg_list or { reg_list }
......@@ -233,7 +200,6 @@ function rsef.GetRegisterCategory(reg_list, cate_param)
if cate_list[2] & total_cate ~= 0 then
table.insert(total_cate_list, cate_list[2])
table.insert(total_str_list, cate_str)
table.insert(total_selhint_list, cate_list[3])
end
end
elseif type(cate_param) == "string" then
......@@ -249,10 +215,9 @@ function rsef.GetRegisterCategory(reg_list, cate_param)
total_cate = total_cate | current_cate
table.insert(total_cate_list, current_cate)
table.insert(total_str_list, cate_str)
table.insert(total_selhint_list, rscate.cate_selhint_list[cate_str][3])
end
end
return total_cate, total_cate_list, total_str_list, total_selhint_list
return total_cate, total_cate_list, total_str_list
end
rscate.GetRegisterCategory = rsef.GetRegisterCategory
--Effect: Clone Effect
......@@ -849,8 +814,8 @@ function rsef.QO_Negate(reg_list, dn_type, dn_str, lim_list, range, con, cost, e
if type(dn_str) == "string" then
reg_cate = reg_cate | rscate.cate_selhint_list[dn_str][2]
end
reg_cate = reg_cate | rsef.GetRegisterCategory(ex_cate or 0)
reg_flag = reg_flag | rsef.GetRegisterProperty(ex_flag or 0)
reg_cate = reg_cate | rsef.GetRegisterCategory(nil,ex_cate or 0)
reg_flag = reg_flag | rsef.GetRegisterProperty(nil,ex_flag or 0)
reg_flag = type(dn_type) == "dis" and reg_flag or reg_flag | (EFFECT_FLAG_DAMAGE_CAL + EFFECT_FLAG_DAMAGE_STEP)
range = range or rsef.GetRegisterRange(reg_list)
desc_list = desc_list or dn_type
......@@ -943,7 +908,7 @@ function rsef.SV_AttachEffect_OP(e, p, eg, ep, ev, re, r, rp)
for _, ae in pairs(arr) do
ac = ae:GetHandler()
local av = ae:GetValue()
local con, op, force= av(ae, ap, re, rp)
local con, op, force= av(ae, ap, ev, re, rp)
if con then
if force then
rsef.AttachEffect_Hint(ae, ap)
......@@ -969,7 +934,7 @@ function rsef.SV_AttachEffect_OP(e, p, eg, ep, ev, re, r, rp)
Duel.ConfirmCards(ap, sel_group[ap])
repeat
Duel.Hint(HINT_SELECTMSG, ap, rshint.attach_card)
ac = sel_group[ap]:SelectUnselect(sel_group_x, tp, true, true, 1, 1)
ac = sel_group[ap]:SelectUnselect(sel_group_x, ap, true, true, 1, 1)
if ac then
rsef.AttachEffect_Hint2(ac)
Duel.Hint(HINT_SELECTMSG, ap, rshint.attach_effect)
......@@ -987,37 +952,47 @@ function rsef.SV_AttachEffect_OP(e, p, eg, ep, ev, re, r, rp)
end
end
if #attach_op_force_final > 0 or #attach_op_final > 0 then
Duel.ChangeChainOperation(ev, rsef.SV_AttachEffect_Change_OP(re:GetOperation() or aux.TRUE, attach_op_force_final, attach_op_final))
local base_op = re:GetOperation() or aux.TRUE
re:SetOperation(rsef.SV_AttachEffect_Change_OP(base_op, attach_op_force_final, attach_op_final))
local e1 = rsef.FC_Easy({e:GetHandler(),0},EVENT_CHAIN_SOLVED, nil, nil, rsef.SV_AttachEffect_Reset_CON(re),rsef.SV_AttachEffect_Reset_OP(re, base_op))
end
end
function rsef.SV_AttachEffect_Reset_CON(re)
return function(e, tp, eg, ep, ev0, re0, r, rp)
return re == re0
end
end
function rsef.SV_AttachEffect_Reset_OP(re, op)
return function(e, ...)
e:Reset()
re:SetOperation(op)
end
end
function rsef.SV_AttachEffect_Change_OP(op, a_f_op, a_op)
return function(e, tp, eg, ep, ev0, re, r, rp)
local c = e:GetHandler()
if e:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsType(TYPE_CONTINUOUS + TYPE_EQUIP + TYPE_PENDULUM) then
c:CancelToGrave(true)
end
e:SetOperation(op)
local ev = Duel.GetCurrentChain()
for _, aop in pairs(a_f_op) do
aop(e, tp, eg, ep, ev, re, r, rp, 0)
aop(e, tp, eg, ep, ev0, re, r, rp, 0)
table.insert(rsef.attach_before_arr[ev], aop)
end
for _, aop in pairs(a_op) do
aop(e, tp, eg, ep, ev, re, r, rp, 0)
aop(e, tp, eg, ep, ev0, re, r, rp, 0)
table.insert(rsef.attach_before_arr[ev], aop)
end
op(e, tp, eg, ep, ev, re, r, rp)
op(e, tp, eg, ep, ev0, re, r, rp)
table.insert(rsef.attach_base_arr[ev], op)
for _, aop in pairs(a_f_op) do
aop(e, tp, eg, ep, ev, re, r, rp, 1)
aop(e, tp, eg, ep, ev0, re, r, rp, 1)
table.insert(rsef.attach_after_arr[ev], aop)
end
for _, aop in pairs(a_op) do
aop(e, tp, eg, ep, ev, re, r, rp, 1)
aop(e, tp, eg, ep, ev0, re, r, rp, 1)
table.insert(rsef.attach_after_arr[ev], aop)
end
end
end
--Effect Function:XXX card / group will leave field in XXX Phase , often use in special summon
function rsef.FC_PhaseOpearte(reg_list, leave_val, times, whos, phase, ex_con, leaveway, val_reset_list)
--times: nil every phase
......@@ -1394,7 +1369,7 @@ function rsop.AddTokenList_Op(tk_code)
end
end
end
function rstg.token(tk_code_or_fun, ct, sum_pos, tg_p)
function rstg.token(tk_code_or_fun, ct, sum_pos, tg_p, leave_val)
if type(tk_code_or_fun) == "number" and not rstg.tk_list[tk_code_or_fun] then
Debug.Message("Token " .. tk_code_or_fun .. " hasn't been registered by 'rscf.AddTokenList'")
end
......@@ -1402,7 +1377,7 @@ function rstg.token(tk_code_or_fun, ct, sum_pos, tg_p)
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)
local ft = Duel.GetMZoneCount(sp, leave_val, tp)
if rssf.CheckBlueEyesSpiritDragon(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
......@@ -1468,6 +1443,15 @@ function rssf.SpecialSummonToken(e, tp, tk_code_or_fun, minct, maxct, sum_pos, t
sum_min, sum_max = 1, 1
end
if sum_min > sum_max then return res_ct end
local chk_hint, is_break = rsop.SelectExPara_checkhint, rsop.SelectExPara_isbreak
rsop.SelectExPara(nil, nil, nil)
if chk_hint and not rshint.SelectYesNo(sp, chk_hint) then
return 0, Group.CreateGroup()
end
if is_break then
Duel.BreakEffect()
end
local sp_ct = sum_min
if sum_max > sum_min then
local list = { }
......@@ -1882,9 +1866,8 @@ function rstg.TargetSelect(e, tp, eg, ep, ev, re, r, rp, target_list_total)
end
--2.4.2. Base Selecting
local sel_fun = list_type == "tg" and Duel.SelectTarget or Duel.SelectMatchingCard
local sel_hint2 = rsef.GetDefaultSelectHint(category_list, loc_self, loc_oppo, sel_hint)
rshint.Select(tp, sel_hint or category_str_list[1])
local selected_group
Duel.Hint(HINT_SELECTMSG, tp, sel_hint2)
--2.4.2.1. Select from must select group
if must_sel_group then
if filter_group then
......@@ -2374,8 +2357,8 @@ function rscon.phase(p1, ...)
local phase_mp = function()
return Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2
end
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 str_list = { "dp", "sp", "mp1", "bp", "bsp", "dam", "damndcal", "dambdcal", "dcal", "ndcal", "mp2", "ep", "mp", "m1", "m2" }
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, PHASE_MAIN1, PHASE_MAIN2 }
local mainstr_list = { }
local turnplayerlist = { }
local parlist2 = rsof.String_Number_To_Table(parlist)
......@@ -2467,7 +2450,7 @@ end
function rscon.disneg(dn_type, dn_filter, pl_fun)
return function(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local loc = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_LOCATION)
local loc, atp = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CONTROLER)
local seq = nil
if loc & LOCATION_MZONE ~=0 or loc & LOCATION_SZONE ~=0 then
seq = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_SEQUENCE)
......@@ -2479,7 +2462,7 @@ function rscon.disneg(dn_type, dn_filter, pl_fun)
if dn_type == "dis" and not Duel.IsChainDisablable(ev) then return false end
if dn_type == "neg" and not Duel.IsChainNegatable(ev) then return false end
dn_filter = dn_filter or aux.TRUE
if type(dn_filter) == "function" and dn_filter(e, tp, re, rp, tg, loc, seq) then return true end
if type(dn_filter) == "function" and dn_filter(e, tp, re, rp, tg, loc, seq, atp) then return true end
if type(dn_filter) == "string" then
local str_list = rsof.String_Split(dn_filter)
for _, dn_str in pairs(str_list) do
......@@ -2560,19 +2543,16 @@ function rsop.disneg(dn_type, dn_str, ex_op)
local c = e:GetHandler()
local rc = re:GetHandler()
local res = not ex_op and true or ex_op(e, tp, eg, ep, ev, re, r, rp, 0)
if rsof.Check_Boolean(res,true) then
if rsof.Check_Boolean(res,true) or type(res) == "nil" then
if dn_type == "dis" then
res = Duel.NegateEffect(ev)
else
res = Duel.NegateActivation(ev)
end
if rsof.Check_Boolean(res,true) then
if dn_str and dn_str ~= "dum" and not rc:IsRelateToEffect(re) then
res = false
end
if dn_str and rc:IsRelateToEffect(re) then
res = rsop.Operation_Solve(eg, dn_str, REASON_EFFECT, { }, 1, e, tp, eg, ep, ev, re, r, rp) > 0
end
if dn_str and dn_str ~= "dum" and not rc:IsRelateToEffect(re) then
res = false
else
res = rsop.Operation_Solve(eg, dn_str, REASON_EFFECT, { }, 1, e, tp, eg, ep, ev, re, r, rp) > 0
end
if res or type(res) == "nil" then
ex_op(e, tp, eg, ep, ev, re, r, rp, 1)
......@@ -2609,13 +2589,17 @@ function rsop.SelectCards(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, m
local g = Duel.GetMatchingGroup(card_filter, tp, loc_self, loc_oppo, except_obj, ...)
return rsgf.SelectCards(sel_hint, g, sp, { aux.TRUE, group_filter }, minct, maxct, except_obj, ...)
end
--Function: Select and solve
function rsop.SelectOperate(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, solve_list, ...)
local sg = rsop.SelectCards(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, ...)
if #sg == 0 then
return 0, #sg
else
return rsop.Operation_Solve(sg, sel_hint, REASON_EFFECT, solve_list, 1, nil, sp)
--Select cards and operate them.
function rsop.OperateCards(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, ...)
local sel_list = { ... }
return function(...)
local op_list = { ... }
local sg = rsop.SelectCards(sel_hint, sp, filter, tp, loc_self, loc_oppo, minct, maxct, except_obj, table.unpack(sel_list))
if #sg == 0 then
return 0, #sg
else
return rsop.Operation_Solve(sg, sel_hint, REASON_EFFECT, op_list, 1, nil, sp)
end
end
end
--Group:Select card from group
......@@ -2635,7 +2619,6 @@ function rsgf.SelectCards(sel_hint, g, sp, filter, minct, maxct, except_obj, ...
if chk_hint and not rshint.SelectYesNo(sp, chk_hint) then
return Group.CreateGroup()
end
if not rsof.Check_Boolean(minct) then
rshint.Select(sp, sel_hint2 or sel_hint)
if not group_filter then
......@@ -2654,12 +2637,16 @@ function rsgf.SelectCards(sel_hint, g, sp, filter, minct, maxct, except_obj, ...
return tg, tg:GetFirst()
end
--Group:Select card from group and do operation on it
function rsgf.SelectOperate(sel_hint, g, sp, filter, minct, maxct, except_obj, solve_list, ...)
local sg = rsgf.SelectCards(sel_hint, g, sp, filter, minct, maxct, except_obj, ...)
if #sg == 0 then
return 0, #sg
else
return rsop.Operation_Solve(sg, sel_hint, REASON_EFFECT, solve_list, 1, e, tp, eg, ep, ev, re, r, rp)
function rsgf.OperateCards(sel_hint, g, sp, filter, minct, maxct, except_obj, solve_list, ...)
local sel_arr = { ... }
return function(...)
local op_arr = { ... }
local sg = rsgf.SelectCards(sel_hint, g, sp, filter, minct, maxct, except_obj, table.unpack(sel_arr))
if #sg == 0 then
return 0, #sg
else
return rsop.Operation_Solve(sg, sel_hint, REASON_EFFECT, op_arr, 1, e, tp, eg, ep, ev, re, r, rp)
end
end
end
--Operation: Equip
......@@ -3174,8 +3161,8 @@ function rsop.Overlay(e, xyzc, mat_corg, set_sum_mat, ex_over)
end
----------------"Part_ZoneSequence_Function"------------------
--Get pend zone
function rszsf.GetUseAblePZoneCount(tp, g_or_c)
--Get PZONE count
function rszsf.GetPZoneCount(tp, g_or_c)
local ft = 0
if Duel.CheckLocation(tp, LOCATION_PZONE, 0) then ft = ft + 1 end
if Duel.CheckLocation(tp, LOCATION_PZONE, 1) then ft = ft + 1 end
......@@ -3187,7 +3174,74 @@ function rszsf.GetUseAblePZoneCount(tp, g_or_c)
end
return ft
end
--zone filter : get MZONE count
function rszsf.GetMZoneCount(p1, leave_val, p2, c, zone)
p2 = p2 or p1
zone = zone or 0xff
if (aux.GetValueType(c) == "Card" and c:IsLocation(LOCATION_EXTRA)) or type(c) == "number" then
return Duel.GetLocationCountFromEx(p1, p2, leave_val, c, zone)
else
return Duel.GetMZoneCount(p1, leave_val, p2, LOCATION_REASON_TOFIELD, zone)
end
end
--zone filter: get summonable zone combine for multiple monsters
function rszsf.GetMZoneCombineForFirstMonster(p1, leave_obj, p2, m1, zone1, m2, zone2, ... )
local combine = 0
local usable_zarr = rsof.Number_Split_To_Power_of_2(zone1)
for _, usable_z in pairs(usable_zarr) do
if rszsf.GetMZoneCount(p1, leave_obj, p2, m1, usable_z) > 0 and
rszsf.GetMZoneCombineForMultipleMonsters_Recursion(p1, leave_obj, p2, usable_z, m2, zone2, ...) then
combine = combine | usable_z
end
end
return combine
end
function rszsf.GetMZoneCombineForMultipleMonsters_Recursion(p1, leave_obj, p2, used_z, m2, zone2, m3, zone3, ...)
local used_z2 = used_z
if not m2 then
return true
end
local usable_zarr = rsof.Number_Split_To_Power_of_2(zone2 - (zone2 & used_z2))
if #usable_zarr == 0 then
return false
end
for _, usable_z in pairs(usable_zarr) do
local used_z3 = used_z2 | usable_z
if rszsf.GetMZoneCount(p1, leave_obj, p2, m2, usable_z) > 0 and
rszsf.GetMZoneCombineForMultipleMonsters_Recursion(p1, leave_obj, p2, used_z3, m3, zone3, ...) then
return true
end
end
return false
end
--Get SZONE count
function rszsf.GetSZoneCount(p1, leave_val, p2, zone)
zone = zone or 0x1f
local ct, useless_zone = Duel.GetLocationCount(p1, LOCATION_SZONE, p2, LOCATION_REASON_TOFIELD, zone)
local g = rsgf.Mix2(leave_val)
local eg, zone2
for tc in aux.Next(g) do
if tc:IsLocation(LOCATION_MZONE) then
eg = tc:GetEquipGroup()
for ec in aux.Next(eg) do
zone2 = aux.SequenceToGlobal(p1, LOCATION_SZONE, ec:GetSequence()) / 0x100
if ec:IsLocation(LOCATION_SZONE) and ec:IsControler(p1) and zone2 & zone > 0 then
ct = ct + 1
else
useless_zone = useless_zone | zone2
end
end
elseif tc:IsLocation(LOCATION_SZONE) then
zone2 = aux.SequenceToGlobal(p1, LOCATION_SZONE, tc:GetSequence()) / 0x100
if tc:GetSequence() < 5 and zone2 & zone > 0 then
ct = ct + 1
else
useless_zone = useless_zone | zone2
end
end
end
return ct, useless_zone
end
--get excatly colomn zone, import the seq
--zone[1][1] means your colomn Mzone, zone[1][2] means your colomn Szone, zone[1][3] means your colomn Mzone + Szone
--zone[2] is the same, zone[3] is zone[1] + zone[2] (all players)
......@@ -4087,20 +4141,6 @@ function rscf.fufilter(f, ...)
return f(target, table.unpack(ext_paramms)) and target:IsFaceup()
end
end
--zone filter : get location count
function rszsf.GetUseAbleMZoneCount(c, reason_pl, leave_val, use_pl, zone)
if c:GetOriginalType() & TYPE_MONSTER == 0 then return 0 end
reason_pl = reason_pl or c:GetControler()
use_pl = use_pl or reason_pl
zone = zone or 0xff
if c:IsLocation(LOCATION_EXTRA) then return
Duel.GetLocationCountFromEx(use_pl, reason_pl, leave_val, c, zone)
elseif leave_val then return
Duel.GetMZoneCount(reason_pl, leave_val, use_pl, LOCATION_REASON_TOFIELD, zone)
else
return Duel.GetLocationCount(reason_pl, LOCATION_MZONE, use_pl, LOCATION_REASON_TOFIELD, zone)
end
end
--Card filter function: Special Summon Filter
function rscf.spfilter(f, ...)
local ext_paramms = { ... }
......@@ -4111,7 +4151,7 @@ end
function rscf.spfilter2(f, ...)
local ext_paramms = { ... }
return function(c, e, tp)
return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not f or f(c, table.unpack(rsof.Table_Mix(ext_paramms, { e, tp })))) and rszsf.GetUseAbleMZoneCount(c, tp) > 0 and c:GetOriginalType() & TYPE_MONSTER > 0
return c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and (not f or f(c, table.unpack(rsof.Table_Mix(ext_paramms, { e, tp })))) and rszsf.GetMZoneCount(tp, nil, tp, c) > 0 and c:GetOriginalType() & TYPE_MONSTER > 0
end
end
--Card filter function : Face - up from Remove
......@@ -4224,11 +4264,19 @@ Card.IsComplexReason = rscf.IsComplexReason
-------------------"Part_Hint_Function"---------------------
--Hint function: HINT_SELECTMSG
function rshint.Select(p, cate_or_str_or_num)
function rshint.Select(p, hint_val)
local hint_str = nil
if type(cate_or_str_or_num) ~= "string" then hint_str = cate_or_str_or_num end
local hint_msg = rsef.GetDefaultSelectHint(cate_or_str_or_num, nil, nil, hint_str)
Duel.Hint(HINT_SELECTMSG, p, hint_msg)
local vtyp = type(hint_val)
if vtyp == "string" then
hint_str = rshint.SwitchHintFormat("s", hint_val)
elseif vtyp == "number" then
hint_str = vtyp
elseif vtyp == "table" then
hint_str = aux.Stringid(hint_val[1], hint_val[2])
else
hint_str = 0
end
Duel.Hint(HINT_SELECTMSG, p, hint_str)
end
--Hint function: HINT_CARD
function rshint.Card(code)
......@@ -4518,6 +4566,21 @@ function rsof.Check_Boolean(check_val, bool_val)
return type(check_val) == "boolean" and check_val == false
end
end
--this function use to split a num to different power-of-2 num's sum.
--return the splitted array
function rsof.Number_Split_To_Power_of_2(num)
local arr = { }
local chk = 1
local sum = 0
repeat
if num & chk == chk then
table.insert(arr, chk)
sum = sum + chk
end
chk = chk * 2
until sum >= num
return arr
end
-------------------"Hape"---------------------
rsof.Escape_Old_Functions()
rsof.Get_Cate_Hint_Op_List()
......
......@@ -59,13 +59,13 @@ function cm.check(c,e,tp)
return c:IsRace(RACE_ROCK) and c:IsLevelAbove(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsSummonableCard()
end
function cm.chtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.check,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK)
if chk==0 then return Duel.IsExistingMatchingCard(cm.check,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK+LOCATION_GRAVE)
end
function cm.chop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.check,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local g=Duel.SelectMatchingCard(tp,cm.check,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)
Duel.ConfirmCards(1-tp,g)
......
......@@ -13,29 +13,39 @@ function c33400114.initial_effect(c)
e1:SetOperation(c33400114.activate)
c:RegisterEffect(e1)
end
function c33400114.tfilter(c,e,tp)
return c:IsCode(33400011) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
function c33400114.tfilter(c,e,tp,tc)
return c:IsCode(33400011) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,tc,c)>0
end
function c33400114.filter(c,e,tp)
return c:IsSetCard(0x3341) and c:IsAbleToGraveAsCost()
and Duel.IsExistingMatchingCard(c33400114.tfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp)
and Duel.IsExistingMatchingCard(c33400114.tfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c)
end
function c33400114.chkfilter(c)
return c:IsFaceup() and c:IsSetCard(0x3341)
end
function c33400114.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c33400114.filter,tp,LOCATION_MZONE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c33400114.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SendtoGrave(g,REASON_COST)
e:SetLabel(100)
return true
end
function c33400114.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(c33400114.tfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
if chk==0 then
if e:GetLabel()==100 then
return Duel.IsExistingMatchingCard(c33400114.filter,tp,LOCATION_MZONE,0,1,nil,e,tp)
else
return Duel.IsExistingMatchingCard(c33400114.tfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,nil)
end
end
if e:GetLabel() == 100 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c33400114.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SendtoGrave(g,REASON_COST)
e:SetLabel(0)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c33400114.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c33400114.tfilter),tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local sg=Duel.SelectMatchingCard(tp,c33400114.tfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil)
if sg:GetCount()>0 then
Duel.BreakEffect()
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)
......
......@@ -3,6 +3,8 @@ local m=33502916
local cm=_G["c"..m]
function cm.initial_effect(c)
aux.AddCodeList(c,33502900)
c:EnableReviveLimit()
aux.AddXyzProcedure(c,cm.xyzfilter,4,2)
--code
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
......@@ -28,6 +30,9 @@ function cm.initial_effect(c)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
end
function cm.xyzfilter(c)
return c:IsRace(RACE_MACHINE)
end
function cm.filter(c)
return aux.IsCodeListed(c,33502900)
end
......
......@@ -1773,7 +1773,7 @@ function cm.SRoverDrawOp(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnCount()==1 then
ct=1
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_DRAW_COUNT)}
for _,te in pairs(eset) do if te:GetValue()>dt then dt=te:GetValue() end end
for _,te in pairs(eset) do if te:GetValue()>ct then ct=te:GetValue() end end
end
if ct>3 then return end
Duel.Hint(HINT_CARD,0,c:GetOriginalCode())
......
......@@ -19,7 +19,7 @@ end
function c71400053.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=yume.YumeFieldCheck(tp,0,2,LOCATION_GRAVE) and Duel.IsPlayerCanDraw(tp,1)
local ct=Duel.GetMatchingGroupCount(c71400053.filterlink1,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
local b2=yume.IsYumeFieldOnField(tp) and Duel.IsExistingMatchingCard(c71400053.filter1,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp) and ct>0 and g:GetCount()>0
if chk==0 then return b1 or b2 end
local op=0
......
......@@ -19,7 +19,7 @@ function c71400058.initial_effect(c)
--material
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(71400058,1))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_FZONE)
......
......@@ -39,7 +39,7 @@ end
function c71400066.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end
if chk==0 then
return Duel.CheckLPCost(tp,1000) and yume.YumeFieldCheck(tp,0,2,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
return Duel.CheckLPCost(tp,1000) and yume.YumeFieldCheck(tp,0,0,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
if not Duel.CheckPhaseActivity() then e:SetLabel(1) else e:SetLabel(0) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
......@@ -76,7 +76,7 @@ end
function c71400066.tg1a(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end
if chk==0 then
return Duel.CheckLPCost(tp,1000) and yume.YumeFieldCheck(tp,0,2,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.IsExistingMatchingCard(c71400066.filter1a,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil)
return Duel.CheckLPCost(tp,1000) and yume.YumeFieldCheck(tp,0,0,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.IsExistingMatchingCard(c71400066.filter1a,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil)
end
if not Duel.CheckPhaseActivity() then e:SetLabel(1) else e:SetLabel(0) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
......
......@@ -51,7 +51,7 @@ function c71400069.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
end
function c71400069.tg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),tp,POS_FACEDOWN)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler(),tp,POS_FACEDOWN) end
end
function c71400069.filter1(c)
return c:IsCode(71400038) and c:IsAbleToHand()
......
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