Commit 490635f6 authored by Tachibana's avatar Tachibana

tnndx

parent d975a03a
...@@ -1462,8 +1462,17 @@ function rstg.imntg(e, c) ...@@ -1462,8 +1462,17 @@ function rstg.imntg(e, c)
local te, g = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT, CHAININFO_TARGET_CARDS) local te, g = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT, CHAININFO_TARGET_CARDS)
return not te or not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) or not g or not g:IsContains(c) return not te or not te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) or not g or not g:IsContains(c)
end end
--Effect target: Token --Effect target: Token
function rsop.token_reg(tk_code) function rscf.AddTokenList(c,tk_code1,...)
local tk_code_list = { tk_code1, ... }
for _, tk_code in pairs(tk_code_list) do
aux.AddCodeList(c,tk_code)
if not rstg.tk_list[tk_code] then
local ge1 = rsef.FC_Global(0, EVENT_ADJUST, tk_code, nil, rsop.AddTokenList_Op(tk_code))
end
end
end
function rsop.AddTokenList_Op(tk_code)
if not rstg.tk_list[tk_code] then if not rstg.tk_list[tk_code] then
rstg.tk_list[tk_code] = { } rstg.tk_list[tk_code] = { }
end end
...@@ -1477,7 +1486,7 @@ function rsop.token_reg(tk_code) ...@@ -1477,7 +1486,7 @@ function rsop.token_reg(tk_code)
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)
if type(tk_code_or_fun) == "number" and not rstg.tk_list[tk_code_or_fun] then if type(tk_code_or_fun) == "number" and not rstg.tk_list[tk_code_or_fun] then
local ge1 = rsef.FC_Global(0, EVENT_ADJUST, tk_code_or_fun, nil, rsop.token_reg(tk_code_or_fun)) Debug.Message("Token " .. tk_code_or_fun .. " hasn't been registered by 'rscf.AddTokenList'")
end end
return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc) return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
tg_p = tg_p or 0 tg_p = tg_p or 0
...@@ -1496,6 +1505,10 @@ function rssf.CheckTokenSummonable(e, tp, tk_code_or_fun, sum_pos, tg_p, sum_zon ...@@ -1496,6 +1505,10 @@ function rssf.CheckTokenSummonable(e, tp, tk_code_or_fun, sum_pos, tg_p, sum_zon
local tk local tk
local tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type local tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type
if type(tk_code_or_fun) == "number" then if type(tk_code_or_fun) == "number" then
if not rstg.tk_list[tk_code_or_fun] then
local ge1 = rsef.FC_Global(0, EVENT_ADJUST, tk_code_or_fun, nil, rsop.token_reg(tk_code_or_fun))
Duel.RaiseEvent(c,EVENT_ADJUST,nil,0,PLAYER_NONE,PLAYER_NONE,0)
end
tk = rstg.tk_list[tk_code_or_fun][tp] tk = rstg.tk_list[tk_code_or_fun][tp]
elseif type(tk_code_or_fun) == "function" then elseif type(tk_code_or_fun) == "function" then
tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = tk_att_fun(e, tp, ...) tk_code, tk_set, tk_type, tk_atk, tk_def, tk_lv, tk_race, tk_att, sum_pos2, sp, sum_type = tk_att_fun(e, tp, ...)
...@@ -2282,7 +2295,10 @@ function rsop.Operation_Solve(selected_group, category_str, reason, ex_para_list ...@@ -2282,7 +2295,10 @@ function rsop.Operation_Solve(selected_group, category_str, reason, ex_para_list
end end
end end
end end
local res1, res2, res3 = op_fun(table.unpack(solve_list)) local sl = solve_list
--local res1, res2, res3 = op_fun(table.unpack(solve_list))
local res1, res2, res3 = op_fun(sl[1], sl[2], sl[3], sl[4], sl[5], sl[6], sl[7],
sl[8], sl[9], sl[10], sl[11], sl[12])
rsop.chk = 1 rsop.chk = 1
rsop.chk_e = nil rsop.chk_e = nil
rsop.chk_p = 0 rsop.chk_p = 0
...@@ -2757,19 +2773,24 @@ end ...@@ -2757,19 +2773,24 @@ end
function rsop.equip_val(e, c) function rsop.equip_val(e, c)
return c == e:GetLabelObject() return c == e:GetLabelObject()
end end
--Operation: Check sucessful solve --Operation: Get sucessful solve count
function rsop.CheckOperateSuccess(solve_loc, check_count) function rsop.GetOperatedCorrectlyCount(solve_loc)
local solve_g = Duel.GetOperatedGroup() local solve_g = Duel.GetOperatedGroup()
local success_g = solve_g:Filter(Card.IsLocation, nil, solve_loc) local success_g = solve_g:Filter(Card.IsLocation, nil, solve_loc)
return #success_g, success_g, solve_g
end
--Operation: Check sucessful solve
function rsop.CheckOperateCorrectly(solve_loc, check_count)
local success_ct, success_g = rsop.GetOperatedCorrectlyCount(solve_loc)
if check_count then if check_count then
return #success_g == check_count , success_g return #success_g == check_count, #success_g , success_g
else else
return #success_g > 0, #success_g, success_g return #success_g > 0, #success_g, success_g
end end
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.CheckOperateSuccess(rsloc.de, check_count) local res = rsop.CheckOperateCorrectly(solve_loc, 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)
...@@ -2952,15 +2973,34 @@ function rsop.ChangePosition(corg, p1, p2, p3, p4, ...) ...@@ -2952,15 +2973,34 @@ function rsop.ChangePosition(corg, p1, p2, p3, p4, ...)
f = Card.IsCanTurnSet f = Card.IsCanTurnSet
elseif p1 == POS_FACEUP_ATTACK then elseif p1 == POS_FACEUP_ATTACK then
f = aux.AND(Card.IsCanChangePosition, Card.IsDefensePos) f = aux.AND(Card.IsCanChangePosition, Card.IsDefensePos)
elseif p1 == POS_FACEDOWN_DEFENSE then elseif p1 == POS_FACEUP_DEFENSE then
f = aux.AND(Card.IsCanChangePosition, Card.IsAttackPos) f = aux.AND(Card.IsCanChangePosition, aux.OR(Card.IsAttackPos, Card.IsFacedown))
elseif p1 == POS_DEFENSE then
f = aux.OR(Card.IsCanTurnSet, aux.AND(Card.IsCanChangePosition, aux.OR(Card.IsFacedown, Card.IsAttackPos)))
end end
else else
f = Card.IsCanChangePosition f = Card.IsCanChangePosition
end end
return #sg >0 and sg:FilterCount(f, nil) == #sg return #sg >0 and sg:FilterCount(f, nil) == #sg
end end
return rsop.Operation(Duel.ChangePosition, sg, p1, p2, p3, p4, ...) if p1 == POS_DEFENSE then
local pos = 0
local ct, og = 0, Group.CreateGroup()
local ct2, og2
for tc in aux.Next(sg) do
if tc:IsCanTurnSet() then pos = pos | POS_FACEDOWN_DEFENSE end
if tc:IsCanChangePosition() and (tc:IsAttackPos() or tc:IsFacedown()) then
pos = pos | POS_FACEUP_DEFENSE
end
pos = Duel.SelectPosition(tp, pos)
ct2, og2 = rsop.Operation(Duel.ChangePosition, tc, pos)
ct = ct + ct2
og:Merge(og2)
end
return ct, og, og:GetFirst()
else
return rsop.Operation(Duel.ChangePosition, sg, p1, p2, p3, p4, ...)
end
end end
--Operation: Get control --Operation: Get control
function rsop.GetControl(corg, p, rst_ph, rst_tct, zone) function rsop.GetControl(corg, p, rst_ph, rst_tct, zone)
......
...@@ -194,6 +194,7 @@ function rsof.Get_Cate_Hint_Op_List() ...@@ -194,6 +194,7 @@ function rsof.Get_Cate_Hint_Op_List()
, ["upa"] = { "Change to POS_FACEUP_ATTACK", CATEGORY_POSITION, HINTMSG_POSCHANGE, { 359563,0 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEUP_ATTACK } } , ["upa"] = { "Change to POS_FACEUP_ATTACK", CATEGORY_POSITION, HINTMSG_POSCHANGE, { 359563,0 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEUP_ATTACK } }
, ["upd"] = { "Change to POS_FACEUP_DEFENSE", CATEGORY_POSITION, HINTMSG_POSCHANGE, { 52158283,1 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEUP_DEFENSE } } , ["upd"] = { "Change to POS_FACEUP_DEFENSE", CATEGORY_POSITION, HINTMSG_POSCHANGE, { 52158283,1 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEUP_DEFENSE } }
, ["dpd"] = { "Change to POS_FACEDOWN_DEFENSE", CATEGORY_POSITION, HINTMSG_SET, { 359563,0 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEDOWN_DEFENSE } } , ["dpd"] = { "Change to POS_FACEDOWN_DEFENSE", CATEGORY_POSITION, HINTMSG_SET, { 359563,0 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_FACEDOWN_DEFENSE } }
, ["posd"] = { "Change to POS_DEFENSE", CATEGORY_POSITION, HINTMSG_SET, { 359563,0 }, { m,2 }, { rsop.ChangePosition, 7, sg, POS_DEFENSE } }
, ["ctrl"] = { "Get Control", CATEGORY_CONTROL, HINTMSG_CONTROL, { 4941482,0 }, nil, { rsop.GetControl, 5, sg, tp, 0, 0, 0xff } } , ["ctrl"] = { "Get Control", CATEGORY_CONTROL, HINTMSG_CONTROL, { 4941482,0 }, nil, { rsop.GetControl, 5, sg, tp, 0, 0, 0xff } }
, ["sctrl"] = { "Switch Control", CATEGORY_CONTROL, HINTMSG_CONTROL, { 36331074,0 } } , ["sctrl"] = { "Switch Control", CATEGORY_CONTROL, HINTMSG_CONTROL, { 36331074,0 } }
...@@ -481,6 +482,7 @@ function rsof.Escape_Old_Functions() ...@@ -481,6 +482,7 @@ function rsof.Escape_Old_Functions()
rsop.eqop = rsop.Equip rsop.eqop = rsop.Equip
rsop.SelectOC = rsop.SelectExPara rsop.SelectOC = rsop.SelectExPara
rsop.CheckOperateSuccess = rsop.CheckOperateCorrectly
rsef.SV_UTILITY_XYZ_MATERIAL = rsef.SV_UtilityXyzMaterial rsef.SV_UTILITY_XYZ_MATERIAL = rsef.SV_UtilityXyzMaterial
rsef.SV_ACTIVATE_SPECIAL = rsef.SV_ActivateDirectly_Special rsef.SV_ACTIVATE_SPECIAL = rsef.SV_ActivateDirectly_Special
......
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