--Some special effects like "black hole", affect the whole card group, record that group's cards count in scl.list_format_cost_or_target_or_operation
scl.black_hole_count=0
--For a mandatory trigger effect, the target check will always return TRUE, but if you want to copy that effect, you should do a common target check, like optional trigger effects.
Scl.Mandatory_Effect_Target_Check=false
--Attach extra effect
--Attach extra effect
EFFECT_ADDITIONAL_EFFECT_SCL = id + 100
EFFECT_ADDITIONAL_EFFECT_SCL = id + 100
...
@@ -98,6 +97,7 @@ EFFECT_SET_MATERIAL_SCL = id + 105
...
@@ -98,6 +97,7 @@ EFFECT_SET_MATERIAL_SCL = id + 105
--For special buff: activate spell & trap form any zone
--For special buff: activate spell & trap form any zone
EFFECT_ACTIVATE_SPELL_AND_TRAP_FROM_ANY_ZONE_SCL = id + 106
EFFECT_ACTIVATE_SPELL_AND_TRAP_FROM_ANY_ZONE_SCL = id + 106
["Look&ShuffleIn2Deck"]={"Send to Deck",CATEGORY_TODECK,HINTMSG_TODECK,{4779823,1},HINTMSG_WOULD_TO_DECK_SCL,{Scl.LookAndSend2Deck,4,sg,nil,SEQ_DECKSHUFFLE,r}},
["ShuffleIn2DeckTop"]={"Shuffle into Deck-Top",CATEGORY_TODECK,HINTMSG_TODECK,{55705473,1},HINTMSG_WOULD_TO_DECK_SCL,{Scl.Send2Deck,4,sg,nil,SEQ_DECKTOP,r}},
["ShuffleIn2DeckBottom"]={"Shuffle into Deck-Bottom",CATEGORY_TODECK,HINTMSG_TODECK,{55705473,2},HINTMSG_WOULD_TO_DECK_SCL,{Scl.Send2Deck,4,sg,nil,SEQ_DECKBOTTOM,r}},
["NormalSummon"]={"Normal Summon in attack position",CATEGORY_SUMMON,HINTMSG_SUMMON,{65247798,0},{41139112,0},{Scl.NormalSummon,7,sg,tp,true,nil,nil,nil,POS_FACEUP_ATTACK}},
["NormalSet"]={"Normal Summon in face-down position",CATEGORY_SUMMON,HINTMSG_SUMMON,{65247798,0},{41139112,0},{Scl.NormalSummon,7,sg,tp,true,nil,nil,nil,POS_FACEDOWN_DEFENSE}},
["PlaceInSpell&TrapZone"]={"Place in spell and trap zone",0,HINTMSG_TOFIELD,DESC_PLACE_TO_FIELD_SCL,nil,{Scl.PlaceOnField,7,sg,tp,tp,"Spell&TrapZone",POS_FACEUP,true}},
["PlaceInFieldZone"]={"Place in spell and trap zone",0,HINTMSG_TOFIELD,DESC_PLACE_TO_FIELD_SCL,nil,{Scl.PlaceOnField,7,sg,tp,tp,"FieldZone",POS_FACEUP,true}},
["PlaceInPendulumZone"]={"Place in spell and trap zone",0,HINTMSG_TOFIELD,DESC_PLACE_TO_FIELD_SCL,nil,{Scl.PlaceOnField,7,sg,tp,tp,"PendulumZone",POS_FACEUP,true}},
--default_value: use for some complex buff, like "UnaffectedByOpponentsCardEffects", its default_value = scl.value_unaffected_by_opponents_card_effects, if you set another value, the buff will only be applied when both the default_value and the another value are correct.
function s.cannot_be_fusion_summon_material_value(e, c, st)
function s.cannot_be_fusion_summon_material_value(e, c, st)
if not c then
if not c then
return false
return false
...
@@ -642,17 +622,14 @@ function s.create_buff_list()
...
@@ -642,17 +622,14 @@ function s.create_buff_list()
@@ -1004,9 +976,7 @@ function s.raise_global_event_op(con, event_code)
...
@@ -1004,9 +976,7 @@ function s.raise_global_event_op(con, event_code)
return function(e, tp, eg, ep, ev, re, r, rp)
return function(e, tp, eg, ep, ev, re, r, rp)
con = con or aux.TRUE
con = con or aux.TRUE
local res, sg = con(e, tp, eg, ep, ev, re, r, rp)
local res, sg = con(e, tp, eg, ep, ev, re, r, rp)
ifnotresthen
if not res then return end
return
end
sg = sg or eg
sg = sg or eg
Duel.RaiseEvent(sg, event_code, re, r, rp, ep, ev)
Duel.RaiseEvent(sg, event_code, re, r, rp, ep, ev)
for tc in aux.Next(sg) do
for tc in aux.Next(sg) do
...
@@ -1018,7 +988,7 @@ end
...
@@ -1018,7 +988,7 @@ end
--including normal set monster, special summon monster(s) in face-down position, change a face-up monster(s) to face-down position, set a Spell/Trap(s).
--including normal set monster, special summon monster(s) in face-down position, change a face-up monster(s) to face-down position, set a Spell/Trap(s).
--//return the trigger effect for EVENT_MSET, EVENT_SSET, EVENT_SPSUMMON_SUCCESS, EVENT_CHANGE_POS
--//return the trigger effect for EVENT_MSET, EVENT_SSET, EVENT_SPSUMMON_SUCCESS, EVENT_CHANGE_POS
--Register Condition, Cost, Target and Operation for reg_eff
--Register Condition, Cost, Target and Operation for reg_eff
--cost, target and operation can be function or array. If be array-format, it calls scl.list_format_cost_or_target_or_operation to change it to function.
--cost, target and operation can be function or array. If be array-format, it calls scl.list_format_cost_or_target_or_operation to change it to function.
local eff_val = val_arr[idx] or val_arr[1] or dft_val or 1
local eff_val = val_arr[idx] or val_arr[1] or dft_val or 1
--if eff_val == 1, it will first call the default value (for some complex buff like "UnaffectedByOpponentsCardEffects", if you set the value to 1, it will call the default value, rather than directly call "1", but some other buffs likes "+ATK", due to no default value, it will directly call "1".)
--case complex buff like "UnaffectedByOpponentsCardEffects", if you set an extra value for this buff, the buff must meets the default value (see in Scl.Buff_Code_List) and the extra value.
@@ -2005,7 +1934,7 @@ function Scl.CreateActivateEffect_Equip(reg_obj, eqfilter, desc_obj, lim_obj, co
...
@@ -2005,7 +1934,7 @@ function Scl.CreateActivateEffect_Equip(reg_obj, eqfilter, desc_obj, lim_obj, co
return e1, e2
return e1, e2
end
end
function s.create_activate_effect_equip_op(e, tp, eg, ep, ev, re, r, rp)
function s.create_activate_effect_equip_op(e, tp, eg, ep, ev, re, r, rp)
local_,c=Scl.GetActivateCard(true)
local _, c = Scl.GetFaceupActivateCard()
local _, tc = Scl.GetTargetsReleate2Chain(Card.IsFaceup)
local _, tc = Scl.GetTargetsReleate2Chain(Card.IsFaceup)
if c and tc then
if c and tc then
Duel.Equip(tp, c, tc)
Duel.Equip(tp, c, tc)
...
@@ -2046,12 +1975,12 @@ end
...
@@ -2046,12 +1975,12 @@ end
--"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 s.operate_selected_objects 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 (defualt = nil), means you must use that card as one of the fusion materials
--fcheck, gcheck (default == nil) use to limit your to select materials.
--fcheck, gcheck (defualt == nil) use to limit your to select materials.
--ex_ctgy (default == nil) means extra categroy(s) the ex_op and the function-format mat_fun brings to.
--ex_ctgy (defualt == nil) means extra categroy(s) the ex_op and the function-format mat_fun brings to.
--ex_flag (default == nil) means extra property(s) the ex_tg and ex_op brings to.
--ex_flag (defualt == nil) means extra property(s) the ex_tg and ex_op brings to.
--ex_tg (default == aux.TRUE) means add an additional target-check to this function.
--ex_tg (defualt == aux.TRUE) means add an additional target-check to this function.
--[[ex_op (default == nil) means add an additional operation to this function.
--[[ex_op (defualt == nil) means add an additional operation to this function.
call ex_op(e, tp, eg, ep, ev, re, r, rp, chk)
call ex_op(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0, means do this operation before select-material-operation, and only this function returns true, the select-material-operation will be continued.
if chk == 0, means do this operation before select-material-operation, and only this function returns true, the select-material-operation will be continued.
if chk == 1, means do this operation after the fuison-summon-operation be operated successfully (return true)
if chk == 1, means do this operation after the fuison-summon-operation be operated successfully (return true)
...
@@ -2202,7 +2131,7 @@ function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_inc
...
@@ -2202,7 +2131,7 @@ function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_inc
if sg2 then
if sg2 then
sg:Merge(sg2)
sg:Merge(sg2)
end
end
Scl.HintSelect(tp,"SpecialSummon")
Scl.SelectHint(tp, "SpecialSummon")
local tc = sg:Select(tp, 1, 1, nil):GetFirst()
local tc = sg:Select(tp, 1, 1, nil):GetFirst()
if not tc then
if not tc then
goto FINAL
goto FINAL
...
@@ -2468,10 +2397,10 @@ end
...
@@ -2468,10 +2397,10 @@ end
--con can be function, nil, or be a array { ... }, if be nil or array-format, it equals to call the scl.negate_activation_or_effect_con("NegateEffect" ,nil/ ...).
--con can be function, nil, or be a array { ... }, if be nil or array-format, it equals to call the scl.negate_activation_or_effect_con("NegateEffect" ,nil/ ...).
--automatic add "EFFECT_FLAG_DAMAGE_STEP" to the property if neg_typ == "NegateEffect".
--automatic add "EFFECT_FLAG_DAMAGE_STEP" to the property if neg_typ == "NegateEffect".
--automatic add "EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL" to the property if neg_typ == "NegateActivation".
--automatic add "EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL" to the property if neg_typ == "NegateActivation".
--ex_ctgy (default == nil) means extra categroy(s) the ex_op brings to.
--ex_ctgy (defualt == nil) means extra categroy(s) the ex_op brings to.
--ex_flag (default == nil) means extra property(s) the ex_tg and ex_op brings to.
--ex_flag (defualt == nil) means extra property(s) the ex_tg and ex_op brings to.
--ex_tg (default == aux.TRUE) means add an additional target-check to this function.
--ex_tg (defualt == aux.TRUE) means add an additional target-check to this function.
--[[ex_op (default == nil) means add an additional operation to this function.
--[[ex_op (defualt == nil) means add an additional operation to this function.
call ex_op(e, tp, eg, ep, ev, re, r, rp, chk)
call ex_op(e, tp, eg, ep, ev, re, r, rp, chk)
if chk == 0, means do this operation before negate-operation, and only this function returns true, the negate-operation will be continued.
if chk == 0, means do this operation before negate-operation, and only this function returns true, the negate-operation will be continued.
if chk == 1, means do this operation after both the negate-operation and the operate-negated-card-operation(if has) be operated successfully (return true)
if chk == 1, means do this operation after both the negate-operation and the operate-negated-card-operation(if has) be operated successfully (return true)
...
@@ -2699,19 +2628,19 @@ end
...
@@ -2699,19 +2628,19 @@ end
--[[times: nil every phase
--[[times: nil every phase
0 next phase
0 next phase
1 or + times phase
1 or + times phase
whos: nil/2 each player
whos: nil each player
tp yours phase
tp yours phase
1-tp your opponent's phase
1-tp your opponent's phase
--]]
--]]
--fun_obj can be string-format, as the index to find the operate function in Scl.Category_List, or can be a function that will be call operate(g, e, tp, ...)
--fun_obj can be string-format, as the index to find the operate function in Scl.Category_List, or can be a function that will be call operate(g, e, tp, ...)
{ 1.list_typ == "Cost/Target/~Target/Operation", 2.card filter or { card filter, group filter },
2.string-format categroy or {string-format categroy, repalce_operation}, 3.card filter or { card filter, group filter },
3.string-format categroy or {string-format categroy, repalce_operation}, 4.self's zonse, 5.opponent's zones,
4.self's zonse,
6.min count, 7.max count, 8.cannot check/select card or card group, 9.reuseable index }
5.opponent's zones,
6.min count,
7.max count,
8.cannot check/select card or card group,
9.reuseable index }
Paramas explain:
Paramas explain:
2.card filter (default == aux.TRUE): the checked/selected card(s) must meet the conditions this filter points to. If the filter is be defined by official "Card" or "aux" metatable, the function will call filter(c) to check, otherwise will call filter(c, e, tp, ...).
2.card filter (default == aux.TRUE): the checked/selected card(s) must meet the conditions this filter points to. If the filter is be defined by official "Card" or "aux" metatable, the function will call filter(c) to check, otherwise will call filter(c, e, tp, ...).
group filter (default == aux.TRUE): if check/select 2+ cards as a group at the same time, that group must meet the conditions this filter points to. If the filter is be defined by official "Group" or "aux" metatable, the function will call filter(g) to check, otherwise will call filter(g, e, tp, ...).
group filter (default == aux.TRUE): if check/select 2+ cards as a group at the same time, that group must meet the conditions this filter points to. If the filter is be defined by official "Group" or "aux" metatable, the function will call filter(g) to check, otherwise will call filter(g, e, tp, ...).
...
@@ -3308,7 +3212,7 @@ end
...
@@ -3308,7 +3212,7 @@ end
9.reuseable index (default == 0), if list-A with a reuseable index pass the check, the other lists with same index cannot duplicate check list-A's checked card(s).
9.reuseable index (default == 0), if list-A with a reuseable index pass the check, the other lists with same index cannot duplicate check list-A's checked card(s).
Example A, "You can send 1 monster on the field to GY, and if you do, banish 1 monster on the field" - If there is only one card on the field, and that card can either be sent to GY or banished, obviously, you cannot activate this effect, you cannot check that card twice, so you should set a same reuseable index in both 2 lists, to prevent the duplicate check.
Example A, "You can send 1 monster on the field to GY, and if you do, banish 1 monster on the field" - If there is only one card on the field, and that card can either be sent to GY or banished, obviously, you cannot activate this effect, you cannot check that card twice, so you should set a same reuseable index in both 2 lists, to prevent the duplicate check.
Example B, "You can negate the effects of 1 face-up monster on the field, and if you do, increase 1000 ATK to 1 face-up monster on the field." - If their is only 1 face-up card on the field, and that card's effects can be negated, obviously, you activate this effect, you can check that card twice, so you should set different reuseable indexes in that 2 lists, to allow the duplicate check.
Example B, "You can negate the effects of 1 face-up monster on the field, and if you do, increase 1000 ATK to 1 face-up monster on the field." - If their is only 1 face-up card on the field, and that card's effects can be negated, obviously, you activate this effect, you can check that card twice, so you should set different reuseable indexes in that 2 lists, to allow the duplicate check.
--there are some effects, that their real costs will affect their operations. If you register their costs by Effect.SetCost directly, it will cause bug when the effects are copied by other copy effects, because the copy effects only copy the effect targets and operations, ignore costs. To avoid the bugs, use Effect.SetLabel as a dummy cost, and register the real cost in effect target.
--there are some effects, that their real costs will affect their operations. If you register their costs by Effect.SetCost directly, it will cause bug when the effects are copied by other copy effects, because the copy effects only copy the effect targets and operations, ignore costs. To avoid the bugs, use Effect.SetLabel as a dummy cost, and register the real cost in effect target.
--code default == 100
--code default == 100
functionscl.cost_set_copy_status(code)
function scl.cost_check_copy_status(code)
return function(e, tp, eg, ep, ev, re, r, rp, chk)
return function(e, tp, eg, ep, ev, re, r, rp, chk)
e:SetLabel(code or 100)
e:SetLabel(code or 100)
return true
return true
...
@@ -3982,11 +3873,11 @@ end
...
@@ -3982,11 +3873,11 @@ end
--cost: once per chain
--cost: once per chain
--flag_code default == the effect handler's original code.
--flag_code default == the effect handler's original code.
--player_lim default == false, == true means "you can only use xxx's effect once per chain"
--player_lim default == false, == true means "you can only use xxx's effect once per chain"
--pos can be constant like POS_ATTACK, or can be string-format, "+" means faceup, "-" means facedown, "1" means attack, "0" means defense (see Scl.Position_List)
--the format of ... : phase_str1, player1, phase_str2, player2, ... ("Or" check)
--the format of ... : phase_str1, player1, phase_str2, player2, ... ("Or" check)
--OR can be { phase_str1, player1, phase_str2, player2, ... } ... ("And" check)
--OR can be { phase_str1, player1, phase_str2, player2, ... }, { phase_strA, playerA, phase_strB, playerB, ... }, ... ("And" check)
--phase_str can be string-fromat (like "MP" or "MP,BP"), the function will split phase_obj to single phase strings and use them as index to find the corresponding number or function format phase in Scl.Phase_List.
--phase_str can be string-fromat (like "MP" or "MP,BP"), the function will split phase_obj to single phase strings and use them as index to find the corresponding number or function format phase in Scl.Phase_List.
--you can add "~" as prefix to the phase_str, the function will turn to mean "excpet in XXX Phase".
--you can add "~" as prefix to the phase_str, the function will turn to mean "excpet in XXX Phase".
--player (default == nil): if == 0, means in your turn, if == 1, means in your opponent's turn, if == 2, means in any player's turn.
--player (default == nil): if == 0, means in your turn, if == 1, means in your opponent's turn, if == nil, means in any player's turn.
-->>eg1. scl.cond_in_phase("M1", 2)
-->>eg1. scl.cond_in_phase("M1")
-->>check the current phase is the Main Phase1 or not.
-->>check the current phase is the Main Phase1 or not.
-->>eg2. scl.cond_in_phase("M1,BP", 2)
-->>eg2. scl.cond_in_phase("M1,BP")
-->>check the current phase is the Main Phase1 or Battle Phase, or not.
-->>check the current phase is the Main Phase1 or Battle Phase, or not.
-->>eg3. scl.con_phase("~MP", 2)
-->>eg3. scl.con_phase("~MP")
-->>check the current phase is not Main Phase.
-->>check the current phase is not Main Phase.
-->>eg4. scl.con_phase("~MP", 0, "BP", 1)
-->>eg4. scl.con_phase("~MP", 0, "BP", 1)
-->>check the current phase is not in your turn's Main Phase, or in your opponent's Battle Phase.
-->>check the current phase is not in your turn's Main Phase, or in your opponent's Battle Phase.
-->>eg4. scl.con_phase({"~MP", 0, "~BP", 1})
-->>eg4. scl.con_phase({"~MP", 0}, {"~BP", 1})
-->>check the current phase is not in your turn's Main Phase, and not in your opponent's Battle Phase.
-->>check the current phase is not in your turn's Main Phase, and not in your opponent's Battle Phase.
function scl.cond_is_special_summon_from(zone_obj, player)
return function(e)
return function(e)
local c = e:GetHandler()
local c = e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_SPECIAL) and Scl.IsPreviouslyInZone(c, zone_obj) and (not player or (player == 0 and c:IsPreviousControler(tp)) or (player == 1 and c:IsPreviousControler(1 - tp)))
return c:IsSummonType(SUMMON_TYPE_SPECIAL) and Scl.IsPreviouslyInZone(c, zone_obj) and (not player or (player == 0 and c:IsPreviousControler(tp)) or (player == 1 and c:IsPreviousControler(1 - tp)))
...
@@ -4224,30 +4013,34 @@ function scl.cond_check_summon_zone(zone_obj, player)
...
@@ -4224,30 +4013,34 @@ function scl.cond_check_summon_zone(zone_obj, player)
end
end
--Nested function
--Nested function
--condition: if you/your opponent controls xxx, except "except_obj".
--condition: if you/your opponent controls xxx, except "except_obj".
--filter_obj can be card_filter or { card_filter, group_filter }, group_filter default == aux.TRUE
--xxx must meet card_filter(c, ...)
--xxx must meet card_filter(c, ...) and group_filter(g, ...)
--if faceup == true, means add additional check to the card, it must be faceup position.
--Select minct ~ maxct cards that meets filter_obj, from self_zone and/or oppo_zone, except except_obj.
--Select minct ~ maxct cards that meets filter_obj, from self_zone and/or oppo_zone, except except_obj.
--use sel_hint as select hint (see Scl.HintSelect)
--use sel_hint as select hint (see Scl.SelectHint)
--filter_obj can be single card_filter, or be { card_filter, group_filter }, the selected cards must meet card_filter(c, ...), and the selected group must meet group_filter(g, ...)
--filter_obj can be single card_filter, or be { card_filter, group_filter }, the selected cards must meet card_filter(c, ...), and the selected group must meet group_filter(g, ...)
@@ -4429,7 +4214,7 @@ function s.more_returns_operate(fun1, ...)
...
@@ -4429,7 +4214,7 @@ function s.more_returns_operate(fun1, ...)
end
end
return ct, og ,tc
return ct, og ,tc
end
end
--equip the "equip_obj" as equip card to "equip_target", on "ep"'s (default == e's handler player) field.
--equip the "equip_obj" as equip card to "equip_target", on "ep"'s (defualt == e's handler player) field.
--"equip_obj" can be card or group, if is a group, and there are not enough zones form all of them to equip, you will select cards witch you want to keep equip.
--"equip_obj" can be card or group, if is a group, and there are not enough zones form all of them to equip, you will select cards witch you want to keep equip.
--keep_face_up (default == true) == false, means equip with "equip_obj"'s current position.
--keep_face_up (default == true) == false, means equip with "equip_obj"'s current position.
--if the "equip_obj" don't have EFFECT_EQUIP_LIMIT buff, this function will auto register to it.
--if the "equip_obj" don't have EFFECT_EQUIP_LIMIT buff, this function will auto register to it.
...
@@ -4446,7 +4231,7 @@ function Scl.Equip(equip_obj, equip_target, ep, keep_face_up)
...
@@ -4446,7 +4231,7 @@ function Scl.Equip(equip_obj, equip_target, ep, keep_face_up)
local equip_group = Scl.Mix2Group(equip_obj):Filter(s.equip_filter, equip_target, tp, ep, equip_target)
local equip_group = Scl.Mix2Group(equip_obj):Filter(s.equip_filter, equip_target, tp, ep, equip_target)
local ft = Scl.GetSZoneCount(ep)
local ft = Scl.GetSZoneCount(ep)
if #equip_group > ft then
if #equip_group > ft then
Scl.HintSelect(HINTMSG_EQUIP)
Scl.SelectHint(HINTMSG_EQUIP)
equip_group = equip_group:Select(tp, ft, ft, nil)
equip_group = equip_group:Select(tp, ft, ft, nil)
end
end
local success_group = Group.CreateGroup()
local success_group = Group.CreateGroup()
...
@@ -4471,10 +4256,10 @@ function s.equip_filter(c, tp, ep, equip_target)
...
@@ -4471,10 +4256,10 @@ function s.equip_filter(c, tp, ep, equip_target)
if c:IsControler(tp) and tp ~= ep and not c:IsAbleToChangeControler() then
if c:IsControler(tp) and tp ~= ep and not c:IsAbleToChangeControler() then
--to spell and trap, use Duel.SSet, to monster, special summon them in facedown defense position
--to spell and trap, use Duel.SSet, to monster, special summon them in facedown defense position
--Bug in set extra deck monsters
--Bug in set extra deck monsters
--return set count, set group, first set card
--return set count, set group, first set card
functionScl.SetCard(card_obj,sp,tp,confirm)
function Scl.SetCards(card_obj, sp, tp, confirm)
local e, _, p = Scl.GetCurrentEffectInfo()
local e, _, p = Scl.GetCurrentEffectInfo()
sp = sp or p
sp = sp or p
tp = tp or sp
tp = tp or sp
...
@@ -5111,7 +4802,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
...
@@ -5111,7 +4802,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
end
end
local ct, og = 0, Group.CreateGroup()
local ct, og = 0, Group.CreateGroup()
if #stg > sft then
if #stg > sft then
Scl.HintSelect(sp,HINTMSG_SET)
Scl.SelectHint(sp, HINTMSG_SET)
sg = stg:Select(sp, sft, sft, nil)
sg = stg:Select(sp, sft, sft, nil)
end
end
if #sg > 0 then
if #sg > 0 then
...
@@ -5120,7 +4811,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
...
@@ -5120,7 +4811,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
og:Merge(og2)
og:Merge(og2)
end
end
if #mg > mft then
if #mg > mft then
Scl.HintSelect(sp,HINTMSG_SET)
Scl.SelectHint(sp, HINTMSG_SET)
sg = mg:Select(sp, mft, mft, nil)
sg = mg:Select(sp, mft, mft, nil)
end
end
if #sg > 0 then
if #sg > 0 then
...
@@ -5129,7 +4820,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
...
@@ -5129,7 +4820,7 @@ function Scl.SetCard(card_obj, sp, tp, confirm)
og:Merge(og2)
og:Merge(og2)
end
end
if confirm and #og > 0 then
if confirm and #og > 0 then
Duel.ConfirmCards(1-tp,og)
Duel.ConfirmCards(1-tp, og)
end
end
return ct, og, og:GetFirst()
return ct, og, og:GetFirst()
end
end
...
@@ -5349,7 +5040,7 @@ function Scl.GetSZoneCount(p1, leave_obj, p2, zone)
...
@@ -5349,7 +5040,7 @@ function Scl.GetSZoneCount(p1, leave_obj, p2, zone)
end
end
--Get surrounding zone (up, down, left & right zone)
--Get surrounding zone (up, down, left & right zone)
--obj: can be card or group, or zone index (if you want to transfer zone index, you can use aux.SequenceToGlobal to get that zone index).
--obj: can be card or group, or zone index (if you want to transfer zone index, you can use aux.SequenceToGlobal to get that zone index).
--lim_zone_obj (default == "OnField"): can be "OnField", "MonsterZone" or "Spell&TrapZone", means get which kind of surrounding zones.
--lim_zone_obj (defult == "OnField"): can be "OnField", "MonsterZone" or "Spell&TrapZone", means get which kind of surrounding zones.
--tp: use this player's camera to see the zone index
--tp: use this player's camera to see the zone index
--contain_self (default == false): include itself's zone (mid)
--contain_self (default == false): include itself's zone (mid)
--//return zones
--//return zones
...
@@ -5434,7 +5125,7 @@ function Scl.GetPreviousSurroundingZone(obj, lim_zone_obj, tp, contain_self)
...
@@ -5434,7 +5125,7 @@ function Scl.GetPreviousSurroundingZone(obj, lim_zone_obj, tp, contain_self)
end
end
--Get adjacent zone (left & right zone)
--Get adjacent zone (left & right zone)
--obj: can be card or group, or zone index (if you want to transfer zone index, you can use aux.SequenceToGlobal to get that zone index).
--obj: can be card or group, or zone index (if you want to transfer zone index, you can use aux.SequenceToGlobal to get that zone index).
--lim_zone_obj (default == "OnField"): can be "OnField", "MonsterZone" or "Spell&TrapZone", means get which kind of adjacent zones.
--lim_zone_obj (defult == "OnField"): can be "OnField", "MonsterZone" or "Spell&TrapZone", means get which kind of adjacent zones.
--tp: use this player's camera to see the zone index
--tp: use this player's camera to see the zone index
--contain_self (default == false): include itself's zone (mid)
--contain_self (default == false): include itself's zone (mid)
--//return zones
--//return zones
...
@@ -5649,18 +5340,20 @@ function Scl.define_inside_series(prefix, suffix, series_str)
...
@@ -5649,18 +5340,20 @@ function Scl.define_inside_series(prefix, suffix, series_str)
end
end
end
end
--Get the activate effect's handler, and if it is relate to chain
--Get the activate effect's handler, and if it is relate to chain
--if faceup == true, add the additional check that the handler must be faceup position.
--For continous effects, PLZ use Effect.GetHandler, don't use this function
--For continous effects, PLZ use Effect.GetHandler, don't use this function
--//return self, self releate to chain or nil
--//return self, self releate to chain or nil
functionScl.GetActivateCard(faceup)
function Scl.GetActivateCard()
local e = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT)
local e = Duel.GetChainInfo(0, CHAININFO_TRIGGERING_EFFECT)
localc1=e:GetHandler()
local c = e:GetHandler()
localc2=c1:IsRelateToChain()andc1ornil
return c, c:IsRelateToChain() and c or nil
ifnotfaceupthen
end
returnc1,c2
--Get the effect's handler that is in faceup position, and if it is relate to chain
else
--For continous effects, PLZ use Effect.GetHandler, don't use this function
--//return faceup self, faceup self releate to chain or nil
-->>eg1. Scl.GetFaceupActivateCard(e)
function Scl.GetFaceupActivateCard()
local c1, c2 = Scl.GetActivateCard()
return c1:IsFaceup() and c1 or nil, (c2 and c2:IsFaceup()) and c2 or nil
return c1:IsFaceup() and c1 or nil, (c2 and c2:IsFaceup()) and c2 or nil
end
end
end
--Get effect target(s) that is releate to chain and meets filter(c, ...)
--Get effect target(s) that is releate to chain and meets filter(c, ...)
--//return target group, first target card
--//return target group, first target card
...
@@ -5723,7 +5416,7 @@ function s.add_summon_procedure_con(con)
...
@@ -5723,7 +5416,7 @@ function s.add_summon_procedure_con(con)
end
end
end
end
--Add normal summon procedure
--Add normal summon procedure
--if the parama "limit" (default == false) == true, means force that monster's normal summon procedure by this function, it cannot be normal summoned by other ways, and the summon procedure will auto set property "!NegateEffect,Uncopyable".
--if the parama "limit" (defualt == false) == true, means force that monster's normal summon procedure by this function, it cannot be normal summoned by other ways, and the summon procedure will auto set property "!NegateEffect,Uncopyable".
--this function will also auto add c == nil check to "con", and add the parama "tp" to "con" check (return con(e, c, tp, minct))
--this function will also auto add c == nil check to "con", and add the parama "tp" to "con" check (return con(e, c, tp, minct))
return Scl.AddSummonProcedure(reg_obj, not limit and EFFECT_SUMMON_PROC or EFFECT_LIMIT_SUMMON_PROC, limit, con, tg, op, desc_obj, lim_obj, val, pos, tg_player, flag, rst_obj)
return Scl.AddSummonProcedure(reg_obj, not limit and EFFECT_SUMMON_PROC or EFFECT_LIMIT_SUMMON_PROC, limit, con, tg, op, desc_obj, lim_obj, val, pos, tg_player, flag, rst_obj)
end
end
--Add normal set procedure
--Add normal set procedure
--if the parama "limit" (default == false) == true, means force that monster's normal summon procedure by this function, it cannot be normal summoned by other ways, and the summon procedure will auto set property "!NegateEffect,Uncopyable".
--if the parama "limit" (defualt == false) == true, means force that monster's normal summon procedure by this function, it cannot be normal summoned by other ways, and the summon procedure will auto set property "!NegateEffect,Uncopyable".
--this function will also auto add c == nil check to "con", and add the parama "tp" to "con" check (return con(e, c, tp, minct))
--this function will also auto add c == nil check to "con", and add the parama "tp" to "con" check (return con(e, c, tp, minct))