Commit b6f81f52 authored by REIKAI's avatar REIKAI 💬

Merge branch '2022.12.18' into 'master'

2022.12.18

See merge request !3
parents d74ebeeb 5f4e8054
Pipeline #18831 passed with stages
in 20 minutes and 34 seconds
......@@ -2,7 +2,7 @@
--the old library (c10199990.lua and c10199991.lua) has gone out of service, becuase it has become a SHIT MOUNTAIN, hard for reading.
--any problems, you can call me: QQ/VX 852415212, PLZ note sth. about YGO while you add me, otherwise I will reject your friend request.
local Version_Number = "2022.10.04"
local Version_Number = "2022.11.02"
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
--<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Constant <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
......@@ -303,6 +303,7 @@ function s.create_timing_list()
["BeSummoned"] = { EVENT_SUMMON_SUCCESS, aux.TRUE, aux.TRUE, EVENT_SPSUMMON_SUCCESS, aux.TRUE, aux.TRUE, EVENT_FLIP_SUMMON_SUCCESS, aux.TRUE, aux.TRUE },
["BeNormalSummoned"] = { EVENT_SUMMON_SUCCESS },
["BeSpecialSummoned"] = { EVENT_SPSUMMON_SUCCESS },
["BeNormal/SpecialSummoned"] = { EVENT_SUMMON_SUCCESS, aux.TRUE, aux.TRUE, EVENT_SPSUMMON_SUCCESS, aux.TRUE, aux.TRUE },
["BeRitualSummoned"] = { EVENT_SPSUMMON_SUCCESS, { Card.IsSummonType, SUMMON_TYPE_RITUAL } },
["BeFusionSummoned"] = { EVENT_SPSUMMON_SUCCESS, { Card.IsSummonType, SUMMON_TYPE_FUSION } },
["BeSynchroSummoned"] = { EVENT_SPSUMMON_SUCCESS, { Card.IsSummonType, SUMMON_TYPE_SYNCHRO } },
......@@ -327,8 +328,8 @@ function s.create_timing_list()
["DuringDamageCalculation"] = { EVENT_PRE_DAMAGE_CALCULATE },
["AfterDamageCalculation"] = { EVENT_BATTLED },
["AtEndOfDamageStep"] = { EVENT_DAMAGE_STEP_END },
["BeDestroyed"] = { EVENT_DESTROYED },
["BeDestroyedByBattle"] = { EVENT_BATTLE_DESTROYED },
["BeSent2GYByEffect"] = { EVENT_TO_GRAVE, { Scl.IsReason, 0, "Effect" } },
["BeDestroyedByEffect"] = { EVENT_DESTROYED, { Scl.IsReason, 0, "Effect" } },
["BeDestroyedByBattle/Effect"] = { EVENT_DESTROYED, { Scl.IsReason, 0, "Battle", "Effect" } },
["BeDestroyed&Sent2GY"] = { EVENT_TO_GRAVE, { Scl.IsReason, 0, "Destroy" } },
......@@ -340,6 +341,8 @@ function s.create_timing_list()
["DestroyOpponent'sMonsterByBattle"] = { EVENT_BATTLE_DESTROYING, s.bdocon },
["DestroyOpponent'sMonsterByBattle&Send2GY"] = { EVENT_BATTLE_DESTROYING, s.bdogcon },
["BeSent2GY"] = { EVENT_TO_GRAVE },
["BeSent2GYByEffect"] = { EVENT_TO_GRAVE, { Scl.IsReason, 0, "Effect" } },
["BeSentFromField2GY"] = { EVENT_TO_GRAVE, { Scl.IsPreviouslyInZone, "OnField" } },
["BeBanished"] = { EVENT_REMOVE },
["Draw"] = { EVENT_DRAW },
["Discard"] = { EVENT_DISCARD },
......@@ -408,7 +411,7 @@ Scl.Effect_Property_List = {
["Delay"] = EFFECT_FLAG_DELAY,
["DamageStep"] = EFFECT_FLAG_DAMAGE_STEP,
["DamageCalculation"] = EFFECT_FLAG_DAMAGE_CAL,
["IgnoreImmune"] = EFFECT_FLAG_IGNORE_IMMUNE,
["IgnoreUnaffected"] = EFFECT_FLAG_IGNORE_IMMUNE,
["SetAvailable"] = EFFECT_FLAG_SET_AVAILABLE,
["IgnoreZone"] = EFFECT_FLAG_IGNORE_RANGE,
["BuffZone"] = EFFECT_FLAG_SINGLE_RANGE,
......@@ -483,11 +486,13 @@ function s.create_category_list()
["SpecialSummonInFacedownDefensePosition"] = { "Special summon in defense position", CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEDOWN_DEFENSE } },
["IgnoreSummonCondition&SpecialSummon"] = { "Special summon ignore summon condition", CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, true, false, POS_FACEUP } },
["NegateEffect&SpecialSummon"] = { "Special summon, but negate its effects", { CATEGORY_SPECIAL_SUMMON, CATEGORY_DISABLE }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { s.negate_effect_and_special_summon, 10, sg, 0, tp, tp, true, false, POS_FACEUP } },
["SpecialSummonFromGY"] = { "Special Summon from GY", { CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, 0 },
["SpecialSummonFromDeck"] = { "Special Summon from deck", { CATEGORY_DECKDES, CATEGORY_SPECIAL_SUMMON }, 0 },
["SpecialSummonFromDeck/GY"] = { "Special Summon from deck or GY", { CATEGORY_DECKDES, CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, 0 },
["SpecialSummonFromHand/GY"] = { "Special Summon from hand or GY", { CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, 0 },
["SpecialSummonFromDeck/Extra"] = { "Special Summon from Deck or Extra", { CATEGORY_DECKDES, CATEGORY_SPECIAL_SUMMON }, 0 },
["SpecialSummonFromGY"] = { "Special Summon from GY", { CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromDeck"] = { "Special Summon from deck", { CATEGORY_DECKDES, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromExtra"] = { "Special Summon from extra", CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromHand/Deck/GY"] = { "Special Summon from hand, deck and/or GY", { CATEGORY_DECKDES, CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromDeck/GY"] = { "Special Summon from deck or GY", { CATEGORY_DECKDES, CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromHand/GY"] = { "Special Summon from hand or GY", { CATEGORY_GRAVE_SPSUMMON, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["SpecialSummonFromDeck/Extra"] = { "Special Summon from Deck or Extra", { CATEGORY_DECKDES, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 74892653, 2 }, { 17535764, 1 }, { Scl.SpecialSummon, 10, sg, 0, tp, tp, false, false, POS_FACEUP } },
["RitualSummon"] = { "Ritual Summon", CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, { 59514116, 1 } },
["FusionSummon"] = { "Fusion Summon", { CATEGORY_FUSION_SUMMON, CATEGORY_SPECIAL_SUMMON }, HINTMSG_SPSUMMON, { 7241272, 1 } },
["SynchroSummon"] = { "Synchro Summon", CATEGORY_SPECIAL_SUMMON, HINTMSG_SPSUMMON, { 30983281, 1 }, { 27503418, 0 } },
......@@ -528,10 +533,12 @@ function s.create_category_list()
["Reveal"] = { "Reveal, (cannot show public)", 0, HINTMSG_CONFIRM, {51351302, 0}, nil, { Scl.RevealCards, 2, sg, RESETS_SCL } },
["RevealUntilEP"] = { "Reveal until End-Phase", 0, HINTMSG_CONFIRM, {51351302, 0}, nil, { Scl.RevealCards, 2, sg, RESETS_EP_SCL } },
["PlaceOnField"] = { "Place on field", 0, HINTMSG_TOFIELD, DESC_PLACE_TO_FIELD_SCL, nil, { Scl.Place2Field, 7, sg, tp } },
["PlaceInSpell&TrapZone"] = { "Place in spell and trap zone", 0, HINTMSG_TOFIELD, DESC_PLACE_TO_FIELD_SCL, nil, { Scl.Place2Field, 7, sg, tp, tp, "Spell&TrapZone" } },
["PlaceInFieldZone"] = { "Place in spell and trap zone", 0, HINTMSG_TOFIELD, DESC_PLACE_TO_FIELD_SCL, nil, { Scl.Place2Field, 7, sg, tp, tp, "FieldZone" } },
["PlaceInPendulumZone"] = { "Place in spell and trap zone", 0, HINTMSG_TOFIELD, DESC_PLACE_TO_FIELD_SCL, nil, { Scl.Place2Field, 7, sg, tp, tp, "PendulumZone" } },
["ActivateCard"] = { "Activate", 0, HINTMSG_RESOLVEEFFECT, DESC_ACTIVATE_SCL, nil, { Scl.Activate2Field, 7, sg, tp } } ,
["PlaceInSpell&TrapZone"] = { "Place in spell and trap zone", 0, HINTMSG_TOFIELD, DESC_PLACE_TO_FIELD_SCL, nil, { Scl.Place2Field, 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.Place2Field, 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.Place2Field, 7, sg, tp, tp, "PendulumZone", POS_FACEUP, true } },
["ActivateSpell/Trap"] = { "Activate", 0, HINTMSG_RESOLVEEFFECT, DESC_ACTIVATE_SCL, nil, { Scl.ActivateSepllOrTrap, 4, sg, tp, false } } ,
["ActivateSpell"] = { "Activate", 0, HINTMSG_RESOLVEEFFECT, DESC_ACTIVATE_SCL, nil, { Scl.ActivateSepllOrTrap, 4, sg, tp, false } } ,
["ActivateTrap"] = { "Activate", 0, HINTMSG_RESOLVEEFFECT, DESC_ACTIVATE_SCL, nil, { Scl.ActivateSepllOrTrap, 4, sg, tp, false } } ,
["Return2Field"] = { "Return to field", 0, { 80335817, 0 }, nil, nil, { Scl.Return2Field, 3, sg } },
["ApplyEffect"] = { "Apply 1 Effect from Many", 0, HINTMSG_RESOLVEEFFECT, { 9560338, 0 } },
["SetTrap"] = { "SSet", 0, HINTMSG_SET, { 2521011, 0 }, { 30741503, 1 }, { Scl.SetSpellOrTrap, 4, sg, tp, tp } },
......@@ -604,8 +611,9 @@ function s.create_buff_list()
["!BeDestroyed"] = { EFFECT_INDESTRUCTABLE },
["!BeDestroyedCountPerTurn"] = { EFFECT_INDESTRUCTABLE_COUNT, false, scl.value_indestructable_count(REASON_EFFECT + REASON_BATTLE), 1 },
["!BeDestroyedByBattle"] = { EFFECT_INDESTRUCTABLE_BATTLE },
["!BeDestroyedByEffect"] = { EFFECT_INDESTRUCTABLE_EFFECT },
["ImmuneEffect"] = { EFFECT_IMMUNE_EFFECT, scl.value_immune_to_others },
["!BeDestroyedByEffects"] = { EFFECT_INDESTRUCTABLE_EFFECT },
["!BeDestroyedByBattle/Effects"] = { { "!BeDestroyedByBattle", "!BeDestroyedByEffects" } },
["UnaffectedByEffects"] = { EFFECT_IMMUNE_EFFECT, scl.value_unaffected_by_other_card_effects },
["SpecialSumCondition"] = { EFFECT_SPSUMMON_CONDITION },
["!BeUsedAsFusionMaterial"] = { EFFECT_CANNOT_BE_FUSION_MATERIAL },
["!BeUsedAsMaterial4FusionSummon"] = { EFFECT_CANNOT_BE_FUSION_MATERIAL, s.cannot_be_fusion_summon_material_value },
......@@ -649,6 +657,12 @@ function s.create_buff_list()
["Instead2Deck"] = { EFFECT_TO_DECK_REDIRECT, false, LOCATION_REMOVED, nil, EFFECT_FLAG_CANNOT_DISABLE, EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE, RESETS_REDIRECT },
["Instead2Hand"] = { EFFECT_TO_HAND_REDIRECT, false, LOCATION_REMOVED, nil, EFFECT_FLAG_CANNOT_DISABLE, EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE, RESETS_REDIRECT },
["InsteadLeaveField"] = { EFFECT_LEAVE_FIELD_REDIRECT, false, LOCATION_REMOVED, nil, EFFECT_FLAG_CANNOT_DISABLE, EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_SET_AVAILABLE, RESETS_REDIRECT },
["OpponentTakeBattleDamageInstead"] = { EFFECT_REFLECT_BATTLE_DAMAGE },
["ChangeBattleDamage"] = { EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE },
["HalveBattleDamageYouTake"] = { EFFECT_CHANGE_INVOLVING_BATTLE_DAMAGE, false, aux.ChangeBattleDamage(0,HALF_DAMAGE) },
["YouTakeNoBattleDamage"] = { EFFECT_AVOID_BATTLE_DAMAGE },
["YourOpponentTakesNoBattleDamage"] = { EFFECT_NO_BATTLE_DAMAGE },
["NeitherPlayerTakesNoBattleDamage"] = { { "YouTakeNoBattleDamage", "YourOpponentTakesNoBattleDamage" } },
["ActivateQuickPlaySpellFromHand"] = { EFFECT_QP_ACT_IN_NTPHAND },
["ActivateQuickPlaySpellInSetTurn"] = { EFFECT_QP_ACT_IN_SET_TURN, false,1, nil, EFFECT_FLAG_SET_AVAILABLE, EFFECT_FLAG_SET_AVAILABLE },
["ActivateTrapFromHand"] = { EFFECT_TRAP_ACT_IN_HAND },
......@@ -811,7 +825,7 @@ function s.add_additional_effect_regop(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
s.add_additional_effect_hint(ae, ap)
......@@ -837,7 +851,7 @@ function s.add_additional_effect_regop(e, p, eg, ep, ev, re, r, rp)
Duel.ConfirmCards(ap, sel_group[ap])
repeat
Duel.Hint(HINT_SELECTMSG, ap, HINTMSG_EXTRA_EFFECT_CARD_SCL)
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
s.add_additional_effect_hint2(ac)
Duel.Hint(HINT_SELECTMSG, ap, HINTMSG_EXTRA_EFFECT_SCL)
......@@ -886,7 +900,7 @@ function s.add_additional_effect_op(op, a_f_op, a_op)
end
end
function s.add_additional_effect_hint(ae, tp)
s.AttachEffect_Hint2(ae:GetHandler())
s.add_additional_effect_hint2(ae:GetHandler())
Duel.Hint(HINT_OPSELECTED, 1 - tp, ae:GetDescription())
end
function s.add_additional_effect_hint2(c)
......@@ -1179,14 +1193,14 @@ end
-->>return cloned Quick Effect, that effet's id.
function Scl.CloneEffectAsQucikEffect(reg_obj, base_eff, quick_con, tmg_arr)
tmg_arr = tmg_arr or { 0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE }
local quick_eff, quick_fid = Scl.CloneEffect(reg_obj, base_eff, "type", EFFECT_TYPE_QUICK_O, "code", EVENT_FREE_CHAIN, "tmg", tmg_arr)
local quick_eff, quick_fid = Scl.CloneEffect(reg_obj, base_eff, "Type", EFFECT_TYPE_QUICK_O, "Code", EVENT_FREE_CHAIN, "HintTiming", tmg_arr)
base_con = base_eff:GetCondition() or aux.TRUE
base_eff:SetCondition(aux.AND(base_con, aux.NOT(quick_con)))
quick_eff:SetCondition(aux.AND(base_con, quick_con))
return quick_eff, quick_fid
end
--Register Condition, Cost, Target and Operation for reg_eff
--cost, target and operation can be function or array. If be array-format, it calls s.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.
-->>eg1. Scl.RegisterSolvePart(e, s.con, s.cost, s.tg, s.op)
-->>eg1. Scl.RegisterSolvePart(e, s.con, s.cost, { "~Target", Card.IsAbleToHand, "Add2Hand", LOCATION_DECK }, s.op)
function Scl.RegisterSolvePart(reg_eff, con, cost, tg, op)
......@@ -1201,19 +1215,19 @@ function Scl.RegisterSolvePart(reg_eff, con, cost, tg, op)
if type(cost) ~= "function" and type(cost) ~= "table" then
Debug.Message(error_code .. " Scl.RegisterSolvePart cost must be function or table")
end
reg_eff:SetCost(s.list_format_cost_or_target_or_operation(cost))
reg_eff:SetCost(scl.list_format_cost_or_target_or_operation(cost))
end
if tg then
if type(tg) ~= "function" and type(tg) ~= "table" then
Debug.Message(error_code .. " Scl.RegisterSolvePart tg must be function or table")
end
reg_eff:SetTarget(s.list_format_cost_or_target_or_operation(tg))
reg_eff:SetTarget(scl.list_format_cost_or_target_or_operation(tg))
end
if op then
if type(op) ~= "function" then
Debug.Message(error_code .. " Scl.RegisterSolvePart op must be function")
end
reg_eff:SetOperation(s.list_format_cost_or_target_or_operation(op))
reg_eff:SetOperation(scl.list_format_cost_or_target_or_operation(op))
end
end
--Register property and category for reg_eff.
......@@ -1554,7 +1568,9 @@ end
--//return effect for code1, effect for code2, ...
-->>this function is an intermediate function, eg see Scl.CreateSingleBuffEffect, Scl.CreateSingleBuffCondition, Scl.CreateFieldBuffEffect, Scl.CreatePlayerBuffEffect and Scl.AddSingleBuff, Scl.AddEquipBuff
function Scl.CreateBuffEffect(reg_obj, eff_typ, base_att_str, val_obj, tg, tgrng_obj, rng, con, rst_obj, desc_obj, lim_obj, flag)
s.set_global_error_code(reg_obj)
local error_code = s.get_error_card_id()
Scl.Global_Effect_Owner_ID = nil
local eff_typ_arr = Scl.SplitString(eff_typ, ",")
local eff_typ1, eff_typ2 = eff_typ_arr[1], eff_typ_arr[2]
local reg_typ2 = 0
......@@ -1823,6 +1839,7 @@ end
function Scl.AddSingleBuff(reg_obj, ...)
if not reg_obj then
Scl.Single_Buff_List = { ... }
return true
else
return Scl.AddBuff(reg_obj, "SingleBuff", false, ...)
end
......@@ -1835,6 +1852,7 @@ end
function Scl.AddSingleBuff2Self(c, ...)
if not c then
Scl.Single_Buff_Affect_Self_List = { ... }
return true
else
return Scl.AddBuff(c, "SingleBuff", true, ...)
end
......@@ -1857,6 +1875,7 @@ end
function Scl.AddEquipBuff(reg_obj, ...)
if not reg_obj then
Scl.Equip_Buff_List = { ... }
return true
else
return Scl.AddBuff(reg_obj, "EquipBuff", false, ...)
end
......@@ -1896,13 +1915,13 @@ function Scl.CreateActivateEffect_Equip(reg_obj, eqfilter, desc_obj, lim_obj, co
local limf = function(c, e, tp)
return c:IsFaceup() and eqfilter(c, tp)
end
local e1 = Scl.CreateActivateEffect(reg_obj, nil, nil, lim_obj, "Equip", "Target", con, cost, {limf, "Equip", LOCATION_MZONE, LOCATION_MZONE}, s.create_activate_effect_equip_op)
local e2 = Scl.CreateSingleBuffEffect(reg_obj, EFFECT_EQUIP_LIMIT, s.create_activate_effect_equip_value(limf))
local e1 = Scl.CreateActivateEffect(reg_obj, nil, nil, lim_obj, "Equip", "Target", con, cost, { "Target", limf, "Equip", LOCATION_MZONE, LOCATION_MZONE}, s.create_activate_effect_equip_op)
local e2 = Scl.CreateSingleBuffCondition(reg_obj, "EquipLimit", s.create_activate_effect_equip_value(limf))
return e1, e2
end
function s.create_activate_effect_equip_op(e, tp, eg, ep, ev, re, r, rp)
local c = Scl.GetFaceupActivateCard()
local tc = Scl.GetTargetsReleate2Chain(Card.IsFaceup)
local _, c = Scl.GetFaceupActivateCard()
local _, tc = Scl.GetTargetsReleate2Chain(Card.IsFaceup)
if c and tc then
Duel.Equip(tp, c, tc)
end
......@@ -1910,7 +1929,7 @@ end
function s.create_activate_effect_equip_value(eqfilter)
return function(e, c)
local tp = e:GetHandlerPlayer()
return eqfilter(c, tp)
return eqfilter(c, e, tp)
end
end
--Create an activate effect, negate the card's effect.
......@@ -2050,7 +2069,7 @@ function s.fusion_summon_target(ex_tg, fus_filter, mat_obj, mat_fun, must_includ
aux.FGoalCheckAdditional = nil
return res
end
s.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)
if type(mat_fun) == "string" then
local reg_p
if mat:IsExists(Card.IsControler, 1, nil, tp) then
......@@ -2070,7 +2089,7 @@ function s.fusion_summon_target(ex_tg, fus_filter, mat_obj, mat_fun, must_includ
end
function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_include_card, fcheck, fgcheck, gcheck)
return function(e, tp, eg, ep, ev, re, r, rp)
local res = not ex_op and true or s.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 0)
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)
if Scl.CheckBoolean(res, true) or type(res) == "nil" then
local chkf=tp
local mat = type(mat_obj) == "function" and mat_obj(e, tp, eg, ep, ev, re, r, rp) or Scl.Mix2Group(mat_obj)
......@@ -2127,14 +2146,14 @@ function s.fusion_summon_operation(ex_op, fus_filter, mat_obj, mat_fun, must_inc
end
tc:CompleteProcedure()
if res or type(res) == "nil" then
s.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)
end
end
:: FINAL ::
aux.FCheckAdditional = nil
aux.FGoalCheckAdditional = nil
aux.GCheckAdditional = nil
s.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 2)
scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 2)
end
end
--Mix several single activate effects into one activate effect.
......@@ -2361,7 +2380,7 @@ function Scl.CreateQuickOptionalEffect(reg_obj, code, desc_obj, lim_obj, ctgy, f
end
--Create a quick effect, negate the card's effect (neg_typ == "NegateEffect") or activation (neg_typ == "NegateActivation").
--op_str is the index to find the corresponding operation and the extra category(s) in Scl.Category_List, means negate the effect/activation, and do that operation to the negated card.
--con can be function, nil, or be a array { ... }, if be nil or array-format, it equals to call the s.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 + EFFECT_FLAG_DAMAGE_CAL" to the property if neg_typ == "NegateActivation".
--ex_ctgy (defualt == nil) means extra categroy(s) the ex_op brings to.
......@@ -2381,9 +2400,9 @@ function Scl.CreateQuickOptionalEffect_Negate(reg_obj, neg_typ, op_str, lim_obj,
reg_ctgy = neg_typ == "NegateActivation" and reg_ctgy | CATEGORY_NEGATE or reg_ctgy | CATEGORY_DISABLE
local reg_flag = Scl.GetNumFormatProperty(ex_flag or 0)
reg_flag = neg_typ == "NegateActivation" and reg_flag | (EFFECT_FLAG_DAMAGE_CAL + EFFECT_FLAG_DAMAGE_STEP) or reg_flag | ( EFFECT_FLAG_DAMAGE_STEP)
local reg_con = con or s.negate_activation_or_effect_con(neg_typ)
local reg_con = con or scl.negate_activation_or_effect_con(neg_typ)
if type(con) == "table" then
reg_con = s.negate_activation_or_effect_con(neg_typ, table.unpack(con))
reg_con = scl.negate_activation_or_effect_con(neg_typ, table.unpack(con))
end
ex_tg = ex_tg or aux.TRUE
ex_op = ex_op or aux.TRUE
......@@ -2411,7 +2430,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)
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
function s.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)
eff_typ_obj = eff_typ_obj or "All"
local c = e:GetHandler()
......@@ -2451,24 +2470,24 @@ function s.negate_activation_or_effect_tg(neg_typ, op_str, ex_tg)
local rc = re:GetHandler()
local cgty, ctgy_arr = Scl.GetNumFormatCategory(op_str)
if chkc then
return s.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 0, chkc)
return scl.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 0, chkc)
end
if chk == 0 then
return (cgty & CATEGORY_REMOVE == 0 or aux.nbcon(tp, re)) and (s.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 0))
return (cgty & CATEGORY_REMOVE == 0 or aux.nbcon(tp, re)) and (scl.list_format_cost_or_target_or_operation(ex_tg)(e, tp, eg, ep, ev, re, r, rp, 0))
end
if rc:IsRelateToChain(ev) then
for _, ctgy in pairs(ctgy_arr) do
Duel.SetOperationInfo(0, ctgy, eg, 1, 0, 0)
end
end
s.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
function s.negate_activation_or_effect_op(neg_typ, op_str, ex_op)
return function(e, tp, eg, ep, ev, re, r, rp)
local c = e:GetHandler()
local rc = re:GetHandler()
local res = not ex_op and true or s.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 0)
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)
if Scl.CheckBoolean(res, true) or type(res) == "nil" then
if neg_typ == "NegateEffect" then
res = Duel.NegateEffect(ev)
......@@ -2481,10 +2500,10 @@ function s.negate_activation_or_effect_op(neg_typ, op_str, ex_op)
res = s.operate_selected_objects(eg, op_str, REASON_EFFECT, 1, e, tp, eg, ep, ev, re, r, rp)() > 0
end
if res or type(res) == "nil" then
s.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)
end
end
s.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 2)
scl.list_format_cost_or_target_or_operation(ex_op)(e, tp, eg, ep, ev, re, r, rp, 2)
end
end
......@@ -2553,15 +2572,16 @@ function Scl.CreateFieldTriggerContinousEffect(reg_obj, code, desc_obj, lim_obj,
end
--Create a field destroy replace effect.
--repfilter default == not c:IsReason(REASON_REPLACE), the card must first meet repfilter(c, e, tp, ...)
--if force(default == false) == true, it is a force-replace, won't ask you whether you want to replace or not.
--other parama format : see Scl.CreateEffect
--//return effect
-->>eg1. Scl.CreateFieldTriggerContinousEffect_DestroyReplace(c, 1, LOCATION_MZONE, nil, s.tg, s.op)
-->>If a card(s) meet s.tg(chk == 0) is destroyed by any ways except replace, you can do s.tg and s.op to replace the destroy.
function Scl.CreateFieldTriggerContinousEffect_DestroyReplace(reg_obj, lim_obj, range, repfilter, tg, op, con, flag, rst_obj)
function Scl.CreateFieldTriggerContinousEffect_DestroyReplace(reg_obj, lim_obj, range, repfilter, tg, op, con, force, flag, rst_obj)
repfilter = repfilter or aux.TRUE
local e1 = Scl.CreateFieldTriggerContinousEffect(reg_obj, EFFECT_DESTROY_REPLACE, nil, lim_obj, nil, range, con, op, rst_obj)
e1:SetValue(s.create_field_trigger_continous_effect_destroy_replace_value(repfilter))
e1:SetTarget(s.create_field_trigger_continous_effect_destroy_replace_tg(repfilter, tg))
e1:SetTarget(s.create_field_trigger_continous_effect_destroy_replace_tg(repfilter, tg, force))
local g = Group.CreateGroup()
g:KeepAlive()
e1:SetLabelObject(g)
......@@ -2572,14 +2592,14 @@ function s.create_field_trigger_continous_effect_destroy_replace_value(repfilter
return e:GetLabelObject():IsContains(c)
end
end
function s.create_field_trigger_continous_effect_destroy_replace_tg(repfilter, tg)
function s.create_field_trigger_continous_effect_destroy_replace_tg(repfilter, tg, force)
return function(e, tp, eg, ep, ev, re, r, rp, chk)
local c = e:GetHandler()
local rg = eg:Filter(s.create_single_trigger_continous_effect_destroy_replace_filter, nil, repfilter, e, tp, eg, ep, ev, re, r, rp)
if chk == 0 then
return #rg >0 and tg(e, tp, eg, ep, ev, re, r, rp, 0)
end
if Duel.SelectEffectYesNo(tp, c, 96) then
if force or Duel.SelectEffectYesNo(tp, c, 96) then
Scl.HintCard(c:GetOriginalCode())
local container=e:GetLabelObject()
container:Merge(rg)
......@@ -2626,7 +2646,7 @@ function Scl.CreateFieldTriggerContinousEffect_PhaseOpearte(reg_obj, op_obj, tim
tc:RegisterFlagEffect(FLAG_PHASE_OPERATE_SCL, RESETS_SCL, EFFECT_FLAG_CLIENT_HINT, 0, fid, desc)
end
sg:KeepAlive()
local e1 = Scl.CreateFieldTriggerContinousEffect(reg_obj, EVENT_PHASE + phase, DESC_PHASE_OPERATION_SCL, 1, "IgnoreImmune", nil, s.phase_opearte_con(phase, atct, whos, fid, times, ex_con), s.phase_opearte_op(fun_obj, fid))
local e1 = Scl.CreateFieldTriggerContinousEffect(reg_obj, EVENT_PHASE + phase, DESC_PHASE_OPERATION_SCL, 1, "IgnoreUnaffected", nil, s.phase_opearte_con(phase, atct, whos, fid, times, ex_con), s.phase_opearte_op(fun_obj, fid))
Scl.Operation_Info[e1] = {sg, 0, 0}
return e1
end
......@@ -2765,6 +2785,15 @@ end
--//return successfully, summon monster
function Scl.SpecialSummonStep(sum_card, sum_typ, sum_pl, zone_pl, ignore_con, ignore_revie, pos, zone)
local sum_res = false
sum_typ = sum_typ or 0
if not sum_pl then
local _, _, p = Scl.GetCurrentEffectInfo()
sum_pl = p
end
zone_pl = zone_pl or sum_pl
ignore_con = ignore_con or false
ignore_revie = ignore_revie or false
pos = pos or POS_FACEUP
if zone then
sum_res = Duel.SpecialSummonStep(sum_card, sum_typ, sum_pl, zone_pl, ignore_con, ignore_revie, pos, zone)
else
......@@ -2821,7 +2850,7 @@ function s.negate_effect_and_special_summon(sum_obj, sum_typ, sum_pl, zone_pl, i
if Scl.Operate_Check == 0 then
return Scl.SpecialSummon(sum_obj, sum_typ, sum_pl, zone_pl, ignore_con, ignore_revie, pos, zone)
end
Scl.AddSingleBuff(nil, "NegateCard", 1, "NegateEffect", 1, "Reset", RESETS_WITHOUT_TO_FIELD_SCL)
Scl.AddSingleBuff(nil, "NegateEffect", 1, "NegateActivatedEffect")
Scl.SpecialSummon(sum_obj, sum_typ, sum_pl, zone_pl, ignore_con, ignore_revie, pos, zone)
end
--Special Summon a monster to either player's field in step, call Scl.AddSingleBuff and Scl.AddSingleBuff2Self.
......@@ -2860,7 +2889,7 @@ function Scl.SpecialSummon2EitherFieldStep(sum_card, sum_typ, sum_pl, ignore_con
end
return Scl.SpecialSummonStep(sum_card, sum_typ, sum_pl, zone_pl, ignore_con, ignore_revie, pos, sel_zone)
end
--Special Summon a monster to either player's field, call Scl.AddSummonBuff and Scl.AddSummonBuff2Self.
--Special Summon a monster to either player's field, call Scl.AddSingleBuff and Scl.AddSingleBuff2Self.
--use nearly same as Duel.SpecialSummon.
--but the parama - zone_pl is useless, it is replaced by sum_eff (summon effect), to check whether the card(s) can be special summoned.
--also the parama - sum_zone is change to array-format { [0] = number-format zone0, [1] = number-format zone1 }, means can special summon to player 0's zone0, or special summon to player1's zone1 (default == { [0] == 0x1f }, { [1] == 0x1f }).
......@@ -3029,7 +3058,7 @@ function scl.target_special_summon_token(tk_code_or_fun, ct, sum_pos, tg_p, leav
return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
tg_p = tg_p or 0
local sp = tg_p == 0 and tp or 1 - tp
local res = Scl.IsTokenCanBeSpecialSummoned(e, tp, tk_code_or_fun, sum_pos, sp, nil, eg, ep, ev, re, r, rp, 0)
local res = Scl.IsCanSpecialSummonToken(e, tp, tk_code_or_fun, sum_pos, sp, nil, eg, ep, ev, re, r, rp, 0)
local ft = Duel.GetMZoneCount(sp, leave_obj, tp)
if Scl.IsAffectedByBlueEyesSpiritDragon(tp) and type(ct) == "number" and ct > 1 then res = false end
if type(ct) == "number" and ft < ct then res = false end
......@@ -3135,8 +3164,8 @@ function Scl.SpecialSummonToken(e, tp, tk_code_or_fun, minct, maxct, sum_pos, tg
local og = Duel.GetOperatedGroup()
return res_ct, og, og:GetFirst()
end
--Get effect cost/target/operation paramas form list, for quick set the effect cost/target/operation (s.list_format_cost_or_target_or_operation(list))
--"s.list_format_cost_or_target_or_operation" will first check if all lists is meet their condition, if the effect pass all lists' checks, you can activate/solve that effect, then do some different operations, depending on each list's first parama - list_typ
--Get effect cost/target/operation paramas form list, for quick set the effect cost/target/operation (scl.list_format_cost_or_target_or_operation(list))
--"scl.list_format_cost_or_target_or_operation" will first check if all lists is meet their condition, if the effect pass all lists' checks, you can activate/solve that effect, then do some different operations, depending on each list's first parama - list_typ
--[[
the first parama in the list always be list_typ, it means that list's kind.
list_typ == "Cost", means it is a cost-list (using in Effect.SetCost), when you activate the effect, you must select a number of cards (depending the list's "minct" and "maxct" prarmas) form the card groups that meet the condition, then immediately do cost on them. If a cost indicated by one of the lists cannot be operated correctly, the remainder costs indicated by the remainder lists will be immediately termination of operation.
......@@ -3241,14 +3270,14 @@ function s.get_cost_or_target_or_operation_paramas(arr, e, tp, eg, ep, ev, re, r
end
--Change a list-format effect cost/target/operation to function-format, using in Scl.CreatexxxEffect.
--list format and eg see s.get_cost_or_target_or_operation_paramas
function s.list_format_cost_or_target_or_operation(obj)
function scl.list_format_cost_or_target_or_operation(obj)
if type(obj) == "function" then
return obj
else
return function(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
Scl.Card_Target_Count_Check = 0
Scl.Player_Cost_And_Target_Value = { }
local arr = Scl.CloneArray(obj)
local arr = obj
arr = type(arr[1]) ~= "table" and { arr } or arr
local used_arr = { }
if chkc or chk == 0 then
......@@ -3340,7 +3369,7 @@ function s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re,
--case3 target effect check
elseif list_typ == "Target" or list_typ == "~Target" or list_typ == "Cost" or list_typ == "Operation" then
local target_effect = list_typ == "Target" and e or nil
local used_arr2, used_group_this_reuse_idx = s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, except_group)
local used_arr2, used_group_this_reuse_idx = s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, nil, except_group)
--case1 cost check
if (list_typ == "Cost" or list_typ == "PlayerCost") and not e:IsCostChecked() then
return s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re, r, rp, chk, chkc, used_arr, arr2, ...)
......@@ -3378,7 +3407,7 @@ function s.cost_or_target_or_operation_feasibility_check(e, tp, eg, ep, ev, re,
if Scl.CheckBoolean(minct, true) then
chk_minct, chk_maxct = #mandatory_group, #mandatory_group
end
return mandatory_group:CheckSubGroup(s.cost_or_target_or_operation_group_check, chk_minct, chk_maxct, e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr2, group_filter, arr2, ...)
return mandatory_group:CheckSubGroup(s.cost_or_target_or_operation_group_check, chk_minct, chk_maxct, {e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr2, group_filter}, arr2, ...)
end
end
end
......@@ -3444,7 +3473,7 @@ function s.do_cost_or_target_or_operation(e, tp, eg, ep, ev, re, r, rp, current_
local need_reg = list_typ == "Target" or list_typ == "~Target"
local need_operate = list_typ == "Cost" or list_typ == "Operation"
local target_effect = list_typ == "Target" and e or nil
local used_arr2, used_group_this_reuse_idx = s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, except_group)
local used_arr2, used_group_this_reuse_idx = s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, nil, except_group)
local current_sel_group2 = current_sel_group:Clone()
--case1 zone_self = nil, means do operation to the effect handler self.
local mandatory_group = Group.CreateGroup()
......@@ -3473,7 +3502,7 @@ function s.do_cost_or_target_or_operation(e, tp, eg, ep, ev, re, r, rp, current_
else
if need_sel then
Scl.SelectHint(tp, category_str)
mandatory_group = mandatory_group:SelectSubGroup(tp, s.cost_or_target_or_operation_group_check, false, minct, maxct, e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr2, group_filter, arr2, ...)
mandatory_group = mandatory_group:SelectSubGroup(tp, s.cost_or_target_or_operation_group_check, false, minct, maxct, {e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr2, group_filter}, arr2, ...)
end
end
--case6 no more cards
......@@ -3515,7 +3544,9 @@ function s.do_cost_or_target_or_operation(e, tp, eg, ep, ev, re, r, rp, current_
return s.do_cost_or_target_or_operation(e, tp, eg, ep, ev, re, r, rp, mandatory_group, total_sel_group2, used_arr2, arr2, ...)
end
end
function s.cost_or_target_or_operation_group_check(g, e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr, group_filter, arr1, ...)
function s.cost_or_target_or_operation_group_check(g, parama, arr1, ...)
--for some shenbi reasons, koshipro will lost paramas during the spell/trap card call this function, so I must use a table to protect the paramas, but original edition ygopro don't have this problem.
local e, tp, eg, ep, ev, re, r, rp, reuse_idx, used_arr, group_filter = table.unpack(parama)
local used_arr2, used_group_this_reuse_idx = s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, g)
if not s.operate_filter(group_filter)(g, e, tp, eg, ep, ev, re, r, rp) then
return false
......@@ -3571,11 +3602,11 @@ function s.get_tribute_group_filter(c, zone_self, tp, re)
end
return false
end
function s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, except_group)
function s.cost_or_target_or_operation_reuse_cards_check(used_arr, reuse_idx, used_group, except_group)
local used_arr2 = Scl.CloneArray(used_arr)
used_arr2[reuse_idx] = used_arr[reuse_idx] or { }
used_arr2[reuse_idx] = Scl.MixArrays(Scl.CloneArray(used_arr2[reuse_idx]), Scl.Group2CardList(except_group or Group.CreateGroup()))
return used_arr2, Scl.Mix2Group(used_arr2[reuse_idx])
used_arr2[reuse_idx] = Scl.MixArrays(Scl.CloneArray(used_arr2[reuse_idx]), Scl.Group2CardList(used_group or Group.CreateGroup()))
return used_arr2, Scl.Mix2Group(used_arr2[reuse_idx]) + (except_group or Group.CreateGroup())
end
function s.operate_selected_cost_or_operat_objects(current_sel_object, total_sel_group, category_str, replace_operation, reason, e, tp, eg, ep, ev, re, r, rp)
if replace_operation then
......@@ -3724,7 +3755,7 @@ function scl.cost_remove_counter_from_field(ct_typ, self_zone, oppo_zone, minct,
return function(e, tp, eg, ep, ev, re, r, rp, chk)
local minct2= Scl.CheckBoolean(minct) and Duel.GetCounter(self_zone, oppo_zone, ct_typ) or minct
local maxct2= Scl.CheckBoolean(maxct) and Duel.GetCounter(self_zone, oppo_zone, ct_typ) or maxct
local rmct = 0
local rmct = minct2
if chk == 0 then
return Duel.IsCanRemoveCounter(tp, self_zone, oppo_zone, ct_typ, minct2, REASON_COST)
end
......@@ -3960,7 +3991,7 @@ end
function scl.con_is_spsummon_from(zone_obj, player)
return function(e)
local c = e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_SPECIAL) and Scl.IsPreviousInZone(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)))
end
end
--Nested function
......@@ -3978,7 +4009,7 @@ function scl.cond_is_card_exists(card_filter, self_zone, oppo_zone, ct, except_o
return function(e)
local self_zone2 = Scl.GetNumFormatZone(self_zone or LOCATION_MZONE)
local oppo_zone2 = Scl.GetNumFormatZone(oppo_zone or 0)
return Duel.IsExistingMatchingCard(s.operatefilter(card_filter), e:GetHandlerPlayer(), self_zone2 , oppo_zone2, ct or 1, except_obj, table.unpack(arr))
return Duel.IsExistingMatchingCard(s.operate_filter(card_filter), e:GetHandlerPlayer(), self_zone2 , oppo_zone2, ct or 1, except_obj, table.unpack(arr))
end
end
--Nested function
......@@ -4082,6 +4113,9 @@ function Scl.SelectAndOperateCards(sel_hint, sp, filter_obj, tp, self_zone, oppo
local op_arr = { ... }
local sg = Scl.SelectCards(sel_hint, sp, filter_obj, tp, self_zone, oppo_zone, minct, maxct, except_obj, table.unpack(sel_list))
if #sg == 0 then
--reset special summon buff
Scl.Single_Buff_List = { }
Scl.Single_Buff_Affect_Self_List = { }
return 0, #sg
else
return s.operate_selected_objects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr))
......@@ -4144,6 +4178,9 @@ function Scl.SelectAndOperateCardsFromGroup(sel_hint, g, sp, filter, minct, maxc
local op_arr = { ... }
local sg = Scl.SelectCardsFromGroup(sel_hint, g, sp, filter, minct, maxct, except_obj, table.unpack(sel_arr))
if #sg == 0 then
--reset special summon buff
Scl.Single_Buff_List = { }
Scl.Single_Buff_Affect_Self_List = { }
return 0, #sg
else
return s.operate_selected_objects(sg, sel_hint, REASON_EFFECT, 1)(table.unpack(op_arr))
......@@ -4402,7 +4439,7 @@ function Scl.Send2Grave(card_obj, reason)
end
return s.more_returns_operate(Duel.SendtoGrave, sg, reason)
end
--Discard card, using in s.list_format_cost_or_target_or_operation
--Discard card, using in scl.list_format_cost_or_target_or_operation
--selected_obj : { [0] = player 0's min count, [1] = player 1's min count, [2] = player 0's max count, [3] = player 1's max count }
--//return discarded count, discarded group, first discarded card
function s.discard_hand_special(selected_obj, reason)
......@@ -4422,7 +4459,7 @@ function s.discard_hand_special(selected_obj, reason)
end
return ct, og, og:GetFirst()
end
--draw, using in s.list_format_cost_or_target_or_operation
--draw, using in scl.list_format_cost_or_target_or_operation
--selected_obj : { [0] = player 0's min count, [1] = player 1's min count, [2] = player 0's max count, [3] = player 1's max count }
function s.draw_special(selected_obj, reason)
if Scl.Operate_Check == 0 then
......@@ -4457,7 +4494,7 @@ function s.draw_special(selected_obj, reason)
end
return ct, og, og:GetFirst()
end
--send deck top to graveyard, using in s.list_format_cost_or_target_or_operation
--send deck top to graveyard, using in scl.list_format_cost_or_target_or_operation
--selected_obj : { [0] = player 0's min count, [1] = player 1's min count, [2] = player 0's max count, [3] = player 1's max count }
function s.discard_deck_special(selected_obj, reason)
if Scl.Operate_Check == 0 then
......@@ -4587,17 +4624,14 @@ end
--//return placed count, placed group, first placed card
function Scl.Place2Field(card_obj, movep, targetp, zone, pos, enable, lim_zone)
local g = Scl.Mix2Group(card_obj)
targetp = targetp or movep
local zone2 = Scl.GetNumFormatZone(zone)
pos= pos or POS_FACEUP
enable = enable or true
if Scl.Operate_Check == 0 then
return g:FilterCount(Card.IsForbidden, nil) == 0 and Duel.GetLocationCount(targetp, loc, movep, LOCATION_REASON_TOFIELD, zone) >= #g
return g:FilterCount(Card.IsForbidden, nil) == 0 and Duel.GetLocationCount(targetp, zone2, movep, LOCATION_REASON_TOFIELD, lim_zone) >= #g
end
if #g <= 0 then return 0, nil end
local correctg = Group.CreateGroup()
for tc in aux.Next(g) do
local fc = Duel.GetFieldCard(tp, LOCATION_FZONE, 0)
local fc = Duel.GetFieldCard(targetp, LOCATION_FZONE, 0)
if fc and zone2 == LOCATION_FZONE then
Duel.SendtoGrave(fc, REASON_RULE)
Duel.BreakEffect()
......@@ -4613,56 +4647,65 @@ function Scl.Place2Field(card_obj, movep, targetp, zone, pos, enable, lim_zone)
end
end
local facedowng = correctg:Filter(Card.IsFacedown, nil)
if #facedowng > 0 then
Duel.ConfirmCards(1 - movep, facedowng)
if #facedowng > 0 and targetp == movep then
Duel.ConfirmCards(1 - targetp, facedowng)
end
return #correctg, correctg, correctg:GetFirst()
end
--Operation: activate "tc" to field
--use nearly same as Duel.MoveToField, but switch the sequence of the format "card_obj" and "movep"
--Operation: activate "tc" to field.
--if you want to activate a field spell, and there is a card currently in the field zone, this function will first send that card to GY, and will raise an event for "Ancient Pixie Dragon" after activated.
--it will do the cost of the activated card
--it will do the cost of the activated effect
--if apply_effect == true (default == false), it will do the target and operation of the activated effect.
--//return activated count, activated group, first activated card
-->>eg1. Scl.Activate2Field(tc, tp, tp, LOCATION_FZONE, POS_FACEUP, true)
-->>activate tc to your field zone.
function Scl.Activate2Field(tc, movep, targetp, zone, pos, enable, lim_zone)
local error_code = s.get_error_card_id()
targetp = targetp or movep
local zone2 = Scl.GetNumFormatZone(zone)
pos = POS_FACEUP
enable = enable or true
if zone2 == LOCATION_MZONE then
Debug.Message(error_code .. "-- Scl.Operation_Activate can only activate Spell / Trap!")
return 0
-->>eg1. Scl.ActivateSepllOrTrap(tc, tp)
-->>activate tc, not apply effect.
-->>eg2. Scl.ActivateSepllOrTrap(tc, 1 - tp, true)
-->>your opponent activate tc and apply its effect immediately.
function Scl.ActivateSepllOrTrap(tc, actp, apply_effect, lim_zone)
if aux.GetValueType(tc) == "Group" then
tc = tc:GetFirst()
end
local zone = LOCATION_SZONE
if tc:IsType(TYPE_FIELD) then
zone = LOCATION_FZONE
elseif tc:IsType(TYPE_PENDULUM) then
zone = LOCATION_PZONE
end
if Scl.Operate_Check == 0 then
return tc and tc:GetActivateEffect() and tc:GetActivateEffect():IsActivatable(movep,true,true)
return tc and tc:GetActivateEffect() and tc:GetActivateEffect():IsActivatable(actp,true,true)
end
if not tc then
return 0
end
local fc = Duel.GetFieldCard(tp, LOCATION_FZONE, 0)
if fc and zone2 == LOCATION_FZONE then
if fc and zone == LOCATION_FZONE then
Duel.SendtoGrave(fc, REASON_RULE)
Duel.BreakEffect()
end
local bool = false
if lim_zone then
bool = Duel.MoveToField(tc, movep, targetp, zone2, pos, enable, lim_zone)
bool = Duel.MoveToField(tc, actp, actp, zone, POS_FACEUP, true, lim_zone)
else
bool = Duel.MoveToField(tc, movep, targetp, zone2, pos, enable)
bool = Duel.MoveToField(tc, actp, actp, zone, POS_FACEUP, true)
end
if bool then
local te = tc:GetActivateEffect()
local te, ceg, cep, cev, cre, cr, crp = tc:CheckActivateEffect(false, false, true)
if te then
te:UseCountLimit(tp, 1, true)
local tep = tc:GetControler()
local cost = te:GetCost()
if cost then cost(te, tep, eg, ep, ev, re, r, rp, 1) end
local cost = te:GetCost() or aux.TRUE
cost(te, actp, ceg, cep, cev, cre, cr, crp, 1)
end
if ploc == LOCATION_FZONE then
if apply_effect then
local tg = te:GetTarget() or aux.TRUE
local op = te:GetOperation() or aux.TRUE
tg(te, actp, ceg, cep, cev, cre, cr, crp, 1)
op(te, actp, ceg, cep, cev, cre, cr, crp)
end
if zone == LOCATION_FZONE then
Duel.RaiseEvent(tc, 4179255, te, 0, tp, tp, Duel.GetCurrentChain())
end
return 1, Group.FromCards(tc), tc
end
return 0
......@@ -4712,6 +4755,10 @@ function Scl.SetSpellOrTrap(card_obj, sp, tp, confirm)
return #sg > 0 and sg:FilterCount(Card.IsSSetable, nil, true) == #sg and Duel.GetSZoneCount(tp) >= #sg
end
end
if not sp then
local _, _, p = Scl.GetCurrentEffectInfo()
sp = p
end
tp = tp or sp
return s.more_returns_operate(Duel.SSet, sp, sg, tp, confirm)
end
......@@ -4720,7 +4767,8 @@ end
--Bug in set extra deck monsters
--return set count, set group, first set card
function Scl.SetCards(card_obj, sp, tp, confirm)
local e = Scl.GetCurrentEffectInfo()
local e, _, p = Scl.GetCurrentEffectInfo()
sp = sp or p
tp = tp or sp
if type(confirm) == "nil" then
confirm = true
......@@ -4781,7 +4829,7 @@ function Scl.NegateCardEffects(card_obj, force, reset)
end
for tc in aux.Next(sg) do
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1,e2 = Scl.AddSingleBuff({neg_owner, tc, force}, "NegateEffect,NegateCard", 1, "Reset", reset)
local e1,e2 = Scl.AddSingleBuff({neg_owner, tc, force}, "NegateEffect,NegateActivatedEffect", 1, "Reset", reset)
if not force then
e2:SetValue(RESET_TURN_SET)
end
......@@ -4983,11 +5031,28 @@ end
-->>get zones that surround to card c on the field, include c's zone.
-->>eg2. Scl.GetSurroundingZone(0x100, "MonsterZone", tp)
-->>get monster zones that surround to the zone "0x100"
function s.switch_zone_camera(base_zone, tp)
local _, _, p = Scl.GetCurrentEffectInfo()
if tp == p then
return base_zone
end
local zone_arr = Scl.SplitNumber2PowerOf2(base_zone)
local zone = 0
for _, sgl_zone in pairs(zone_arr) do
if sgl_zone >= 0x10000 then
zone = zone | (sgl_zone / 0x10000)
else
zone = zone | (sgl_zone * 0x10000)
end
end
return zone
end
function Scl.GetSurroundingZone(obj, lim_zone_obj, tp, contain_self)
local zone_arr = { }
if aux.GetValueType(obj) == "Card" or aux.GetValueType(obj) == "Group" then
local g = Scl.Mix2Group(obj):Filter(Scl.IsInZone, nil, "OnField")
for tc in aux.Next(g) do
table.insert(zone_arr, aux.SequenceToGlobal(tp, tc:GetLocation(), tc:GetSequence()))
table.insert(zone_arr, aux.SequenceToGlobal(tc:GetControler(), tc:GetLocation(), tc:GetSequence()))
end
elseif type(obj) == "number" then
zone_arr = Scl.SplitNumber2PowerOf2(obj)
......@@ -5025,6 +5090,9 @@ function Scl.GetSurroundingZone(obj, lim_zone_obj, tp, contain_self)
if lim_zone == LOCATION_MZONE then
srd_zone = srd_zone & (0x7f007f)
end
if tp then
srd_zone = s.switch_zone_camera(srd_zone, tp)
end
return srd_zone
end
--Get pervious surrounding zone (up, down, left & right zone)
......@@ -5034,7 +5102,7 @@ function Scl.GetPreviousSurroundingZone(obj, lim_zone_obj, tp, contain_self)
local g = Scl.Mix2Group(obj):Filter(Scl.IsPreviouslyInZone, nil, "OnField")
local zone = 0
for tc in aux.Next(g) do
zone = zone | aux.SequenceToGlobal(tp, tc:GetPreviousLocation(), tc:GetPreviousSequence())
zone = zone | aux.SequenceToGlobal(tc:GetPreviousControler(), tc:GetPreviousLocation(), tc:GetPreviousSequence())
end
return Scl.GetSurroundingZone(zone, lim_zone_obj, tp, contain_self)
end
......@@ -5049,10 +5117,11 @@ end
-->>eg2. Scl.GetAdjacentZone(0x100, "MonsterZone", tp)
-->>get monster zones that adjacent to the zone "0x100"
function Scl.GetAdjacentZone(obj, lim_zone_obj, tp, contain_self)
local zone_arr = { }
if aux.GetValueType(obj) == "Card" or aux.GetValueType(obj) == "Group" then
local g = Scl.Mix2Group(obj):Filter(Scl.IsInZone, nil, "OnField")
for tc in aux.Next(g) do
table.insert(zone_arr, aux.SequenceToGlobal(tp, tc:GetLocation(), tc:GetSequence()))
table.insert(zone_arr, aux.SequenceToGlobal(tc:GetControler(), tc:GetLocation(), tc:GetSequence()))
end
elseif type(obj) == "number" then
zone_arr = Scl.SplitNumber2PowerOf2(obj)
......@@ -5078,6 +5147,7 @@ function Scl.GetAdjacentZone(obj, lim_zone_obj, tp, contain_self)
if lim_zone == LOCATION_MZONE then
ajt_zone = ajt_zone & (0x7f007f)
end
ajt_zone = s.switch_zone_camera(ajt_zone, tp)
return ajt_zone
end
......@@ -5120,18 +5190,18 @@ end
-->>eg2. Scl.GetSurroundingGroup(0x1000)
-->>return cards surround to zone 0x1000
function Scl.GetSurroundingGroup(obj, contains)
local srd_zone = Scl.GetSurroundingZone(obj, "OnField", 0, contains)
local srd_zone = Scl.GetSurroundingZone(obj, "OnField", nil, contains)
return Duel.GetMatchingGroup(s.get_matching_zone_group_filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, nil, srd_zone)
end
function s.get_matching_zone_group_filter(c, srd_zone)
local zone = aux.SequenceToGlobal(0, c:IsOnField() and c:GetLocation() or c:GetPreviousLocation(), c:IsOnField() and c:GetSequence() or c:GetPreviousSequence())
local zone = aux.SequenceToGlobal(c:GetControler(), c:IsOnField() and c:GetLocation() or c:GetPreviousLocation(), c:IsOnField() and c:GetSequence() or c:GetPreviousSequence())
return zone & srd_zone == zone
end
--Get cards surround to obj while obj is leaves the field (up, down, left & right zone)
--paramas see Scl.GetSurroundingGroup
--//return group
function Scl.GetPreviousSurroundingGroup(obj, contains)
local srd_zone = Scl.GetPreviousSurroundingZone(obj, "OnField", 0, contains)
local srd_zone = Scl.GetPreviousSurroundingZone(obj, "OnField", nil, contains)
return Duel.GetMatchingGroup(s.get_matching_zone_group_filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, nil, srd_zone)
end
--Get cards adjacent to obj (left & right zone)
......@@ -5143,7 +5213,7 @@ end
-->>eg2. Scl.GetAdjacentGroup(0x1000)
-->>return cards adjacent to zone 0x1000
function Scl.GetAdjacentGroup(obj, contains)
local ajt_zone = Scl.GetAdjacentZone(obj, "OnField", 0, contains)
local ajt_zone = Scl.GetAdjacentZone(obj, "OnField", nil, contains)
return Duel.GetMatchingGroup(s.get_matching_zone_group_filter, 0, LOCATION_ONFIELD, LOCATION_ONFIELD, nil, ajt_zone)
end
--Mix cards or groups into a new group.
......@@ -5198,14 +5268,14 @@ function Scl.SetID(code, inside_series_str)
local series_arr = { }
local arr = Scl.SplitString(inside_series_str)
for _, str in pairs(arr) do
local arr2 = Scl.SplitString(str)
local arr2 = Scl.SplitString(str, "_")
for _, str2 in pairs(arr2) do
table.insert(series_arr, str2)
end
end
ccodem.scl_inside_series = series_arr
end
return ccodem, ccode
return ccodem, code
end
--Create check inside series function series_mata.IsXSetXX
--"series_mata": inside series matatable
......@@ -5276,8 +5346,12 @@ end
-->>return tg with faceup cards, faceup tc or nil.
function Scl.GetTargetsReleate2Chain(filter, ...)
filter = card_filter or aux.TRUE
if not Duel.GetFirstTarget() then
return Group.CreateGroup()
else
local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(s.get_target_releate_filter, nil, filter, ...)
return g, g:GetFirst()
end
end
function s.get_target_releate_filter(c, filter, ...)
filter = filter or aux.TRUE
......@@ -5399,7 +5473,7 @@ function Scl.SetSummonCondition(reg_obj, revive, spsum_lim, lim_ct_sum_typ)
e1 = Scl.CreateSingleBuffCondition(reg_obj, EFFECT_SPSUMMON_CONDITION, spsum_lim)
end
if lim_ct_sum_typ then
e2 = Scl.CreateSingleTriggerContinousEffect(reg_obj, EVENT_SPSUMMON_SUCCESS, nil, nil, "~NegateCard,Uncopyable", scl.cond_is_summon_type(lim_ct_sum_typ), s.summon_count_limit_op(lim_ct_sum_typ))
e2 = Scl.CreateSingleTriggerContinousEffect(reg_obj, EVENT_SPSUMMON_SUCCESS, nil, nil, "!NegateEffect,Uncopyable", scl.cond_is_summon_type(lim_ct_sum_typ), s.summon_count_limit_op(lim_ct_sum_typ))
end
return e1, e2
end
......@@ -5433,7 +5507,7 @@ function Scl.AddSynchroProcedure(c, f1, f2, f3, f4, minc, maxc, gc)
return e1
end
function s.GetSynMaterials(tp, syncard)
local mg1 = Scl.Group_GetSynMaterials_R(tp, syncard)
local mg1 = Scl.GetSynMaterials_R(tp, syncard)
local mg2 = Duel.GetMatchingGroup(s.SExtraFilter, tp, 0xff, 0xff, mg1, syncard, tp)
return mg1 + mg2
end
......@@ -5500,24 +5574,24 @@ function s.SynMixCheckGoal(tp, sg, minc, ct, syncard, sg1, smat, gc, mgchk)
end
function s.SynMixCondition(f1,f2,f3,f4,minc,maxc,gc)
return function(e,c,smat,mg1,min,max)
--Scl.Group_GetSynMaterials_R = aux.GetSynMaterials
Scl.GetSynMaterials_R = aux.GetSynMaterials
aux.GetSynMaterials = s.GetSynMaterials
s.SynMixCheckGoal_R = aux.SynMixCheckGoal
aux.SynMixCheckGoal = s.SynMixCheckGoal
local res = aux.SynMixCondition(f1,f2,f3,f4,minc,maxc,gc)(e,c,smat,mg1,min,max)
aux.GetSynMaterials = Scl.Group_GetSynMaterials_R
aux.GetSynMaterials = Scl.GetSynMaterials_R
aux.SynMixCheckGoal = s.SynMixCheckGoal_R
return res
end
end
function s.SynMixTarget(f1,f2,f3,f4,minc,maxc,gc)
return function(e,tp,eg,ep,ev,re,r,rp,chk,c,smat,mg1,min,max)
Scl.Group_GetSynMaterials_R = aux.GetSynMaterials
Scl.GetSynMaterials_R = aux.GetSynMaterials
aux.GetSynMaterials = s.GetSynMaterials
s.SynMixCheckGoal_R = aux.SynMixCheckGoal
aux.SynMixCheckGoal = s.SynMixCheckGoal
local res = aux.SynMixTarget(f1,f2,f3,f4,minc,maxc,gc)(e,tp,eg,ep,ev,re,r,rp,chk,c,smat,mg1,min,max)
aux.GetSynMaterials = Scl.Group_GetSynMaterials_R
aux.GetSynMaterials = Scl.GetSynMaterials_R
aux.SynMixCheckGoal = s.SynMixCheckGoal_R
return res
end
......@@ -5617,9 +5691,9 @@ function Scl.AddlXyzProcedure(c, f, gf, minc, maxc, alterf, desc, op)
e1:SetRange(LOCATION_EXTRA)
--if alterf then
maxc= maxc or minc
e1:SetCondition(s.XyzLevelFreeCondition2(f, gf, minc, maxc, alterf, desc, op))
e1:SetTarget(s.XyzLevelFreeTarget2(f, gf, minc, maxc, alterf, desc, op))
e1:SetOperation(s.XyzLevelFreeOperation2(f, gf, minc, maxc, alterf, desc, op))
e1:SetCondition(s.XyzLevelFreeConditionAlter(f, gf, minc, maxc, alterf, desc, op))
e1:SetTarget(s.XyzLevelFreeTargetAlter(f, gf, minc, maxc, alterf, desc, op))
e1:SetOperation(s.XyzLevelFreeOperationAlter(f, gf, minc, maxc, alterf, desc, op))
--[[else
e1:SetCondition(Auxiliary.XyzLevelFreeCondition(f, gf, minc, maxc))
e1:SetTarget(Auxiliary.XyzLevelFreeTarget(f, gf, minc, maxc))
......@@ -5665,7 +5739,7 @@ end
function s.XyzLevelFreeFilter(c, xyzc, f)
return (not c:IsOnField() or c:IsFaceup()) and s.IsCanBeXyzMaterial(c, xyzc) and (not f or f(c, xyzc))
end
function s.XyzLevelFreeCondition2(f, gf, minct, maxct, alterf, desc, op)
function s.XyzLevelFreeConditionAlter(f, gf, minct, maxct, alterf, desc, op)
return function(e, c, og, min, max)
Scl.Group_XyzLevelFreeGoal_R = aux.XyzLevelFreeGoal
aux.XyzLevelFreeGoal = s.XyzLevelFreeGoal(minct, maxct, og)
......@@ -5673,7 +5747,7 @@ function s.XyzLevelFreeCondition2(f, gf, minct, maxct, alterf, desc, op)
Duel.GetFieldGroup = s.GetXyzMaterials_X(e:GetHandlerPlayer(), c)
Scl.Card_XyzLevelFreeFilter_R = aux.XyzLevelFreeFilter
aux.XyzLevelFreeFilter = s.XyzLevelFreeFilter
local res = aux.XyzLevelFreeCondition2(f, gf, 1, maxct, alterf, desc, op)(e, c, og, min, max)
local res = aux.XyzLevelFreeConditionAlter(f, gf, 1, maxct, alterf, desc, op)(e, c, og, min, max)
aux.XyzLevelFreeGoal = Scl.Group_XyzLevelFreeGoal_R
Duel.GetFieldGroup = Scl.Group_GetFieldGroup_R
aux.XyzLevelFreeFilter = Scl.Card_XyzLevelFreeFilter_R
......@@ -5709,7 +5783,9 @@ function s.XyzLevelFreeGoal(minct, maxct, og)
end
end
for _, matct in pairs(sumlist) do
if matct >= minct and matct <= maxct then return true end
if matct >= minct and matct <= maxct then
return true
end
end
return false
end
......@@ -5734,7 +5810,7 @@ function s.XCheckUtilityMaterial(c, mg, xyzc, tp)
local le = { c:IsHasEffect(EFFECT_UTILITY_XYZ_MATERIAL_SCL, tp) }
if #le == 0 then return 1, { 1 } end
local max_reduce = 1
local reduce_arr = { 1}
local reduce_arr = { 1 }
for _, te in pairs(le) do
local val = te:GetValue()
local reduce = 1
......@@ -5746,7 +5822,7 @@ function s.XCheckUtilityMaterial(c, mg, xyzc, tp)
table.sort(reduce_arr)
return max_reduce, reduce_arr
end
function s.XyzLevelFreeTarget2(f, gf, minct, maxct, alterf, desc, op)
function s.XyzLevelFreeTargetAlter(f, gf, minct, maxct, alterf, desc, op)
return function(e, tp, eg, ep, ev, re, r, rp, chk, c, og, min, max)
Scl.Group_XyzLevelFreeGoal_R = aux.XyzLevelFreeGoal
aux.XyzLevelFreeGoal = s.XyzLevelFreeGoal(minct, maxct, og)
......@@ -5754,20 +5830,20 @@ function s.XyzLevelFreeTarget2(f, gf, minct, maxct, alterf, desc, op)
Duel.GetFieldGroup = s.GetXyzMaterials_X(tp, c)
Scl.Card_XyzLevelFreeFilter_R = aux.XyzLevelFreeFilter
aux.XyzLevelFreeFilter = s.XyzLevelFreeFilter
local res = aux.XyzLevelFreeTarget2(f, gf, 1, maxct, alterf, desc, op)(e, tp, eg, ep, ev, re, r, rp, chk, c, og, min, max)
local res = aux.XyzLevelFreeTargetAlter(f, gf, 1, maxct, alterf, desc, op)(e, tp, eg, ep, ev, re, r, rp, chk, c, og, min, max)
aux.XyzLevelFreeGoal = Scl.Group_XyzLevelFreeGoal_R
Duel.GetFieldGroup = Scl.Group_GetFieldGroup_R
aux.XyzLevelFreeFilter = Scl.Card_XyzLevelFreeFilter_R
return res
end
end
function s.XyzLevelFreeOperation2(f, gf, minct, maxct, alterf, desc, op)
function s.XyzLevelFreeOperationAlter(f, gf, minct, maxct, alterf, desc, op)
return function(e, tp, eg, ep, ev, re, r, rp, c, og, min, max)
local res
local mg = e:GetLabelObject()
s.XExtraMaterialCount(mg, c, tp)
if not Scl.CustomXyzMaterialAction and not c.scl_custom_xyz_material_action then
res = aux.XyzLevelFreeOperation2(f, gf, 1, maxct, alterf, desc, op)(e, tp, eg, ep, ev, re, r, rp, c, og, min, max)
res = aux.XyzLevelFreeOperationAlter(f, gf, 1, maxct, alterf, desc, op)(e, tp, eg, ep, ev, re, r, rp, c, og, min, max)
else
if Scl.CustomXyzMaterialAction then
res = Scl.CustomXyzMaterialAction(mg, c, e, tp)
......@@ -5865,9 +5941,14 @@ function Scl.IsPreviouslySurrounding(obj, tc)
if not tc:IsOnField() then
return false
end
local g = Scl.Mix2Group(obj):Filter(Scl.IsPreviousInZone, nil, "OnField")
local sg = Scl.GetPreviousSurroundingGroup(tc, true)
return g:IsExists(aux.IsInGroup, 1, nil, sg)
local g = Scl.Mix2Group(obj):Filter(Scl.IsPreviouslyInZone, nil, "OnField")
for tc2 in aux.Next(g) do
local sg = Scl.GetPreviousSurroundingGroup(tc2, true)
if sg:IsContains(tc) then
return true
end
end
return false
end
--Filter
--check is player "tp" can special summon obj to his field in faceup position, won't check whether there are enough zones.
......@@ -5913,6 +5994,7 @@ end
--check whether obj can replace destroy
--//return bool
function Scl.IsDestructableForReplace(obj)
local e = Scl.GetCurrentEffectInfo()
local f = function(c)
return c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED+STATUS_BATTLE_DESTROYED)
end
......@@ -6016,19 +6098,19 @@ end
function Scl.IsReason(obj, public_reason, ...)
local g = Scl.Mix2Group(obj)
public_reason = public_reason or 0
local num_public_typ = Scl.GetNumFormatCardType(public_reason)
local num_public_rsn = Scl.GetNumFormatCardType(public_reason)
local res_arr = { ... }
if Scl.Global_Reason then
for _, reason in pairs(res_arr) do
local num_reason = Scl.GetNumFormatCardType(public_typ)
if Scl.Global_Reason & (num_reason | num_public_typ) == (num_reason | num_public_typ) then
local num_reason = Scl.GetNumFormatCardType(reason)
if Scl.Global_Reason & (num_reason | num_public_rsn) == (num_reason | num_public_rsn) then
return true
end
end
else
for _, reason in pairs(res_arr) do
local num_reason = Scl.GetNumFormatCardType(public_typ)
if g:IsExists(s.is_reason_check, 1, nil, num_reason, num_public_typ) then
local num_reason = Scl.GetNumFormatCardType(reason)
if g:IsExists(s.is_reason_check, 1, nil, num_reason, num_public_rsn) then
return true
end
end
......@@ -6191,11 +6273,11 @@ end
function Scl.IsPreviouslyInZone(obj, zone_obj)
for tc in aux.Next(Scl.Mix2Group(obj)) do
if type(zone_obj) == "number" then
return c:IsPreviousPosition(zone_obj)
return c:IsPreviousLocation(zone_obj)
end
local zone_arr = Scl.SplitString(zone_obj)
for _, zone_str in pairs(zone_arr) do
if c:IsPreviousPosition(Scl.List(zone_str)) then
if tc:IsPreviousLocation(Scl.Zone_List[zone_str]) then
return true
end
end
......
......@@ -63,6 +63,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()==tp then return end
Duel.Destroy(e:GetHandler(),REASON_RULE)
end
function cm.splimit(e,c,tp,sumtp,sumpos)
......
......@@ -9,14 +9,14 @@ function s.initial_effect(c)
"Damage,NegateEffect", nil, "MonsterZone", nil, nil, {
{ "PlayerTarget", "Damage", 1000, 1000 },
{ "~Target", aux.NegateAnyFilter, "NegateEffect",
0, "Field", B2Sayaka.LPDifferentChk } }, s.damop)
0, "OnField", B2Sayaka.LPDifferentChk } }, s.damop)
B2Sayaka.Effect2Condition(id, e2, EVENT_SUMMON_SUCCESS, s.regop,
EVENT_FLIP_SUMMON_SUCCESS, EVENT_SPSUMMON_SUCCESS)
local e3 = Scl.CreateSingleTriggerOptionalEffect(c, EVENT_RELEASE,
"ShuffleIn2Deck", {1, id + 200},
"ShuffleIn2Deck", "Delay", B2Sayaka.ExtraLimit, nil, {
"~Target", Card.IsAbleToDeck, "ShuffleIn2Deck",
0, "Field", B2Sayaka.LPDifferent2Chk }, s.tdop)
0, "OnField", B2Sayaka.LPDifferent2Chk }, s.tdop)
end
function s.damop(e,tp)
if not B2Sayaka.Damage(tp) then return end
......@@ -30,5 +30,5 @@ function s.regop(e,tp,eg)
end
function s.tdop(e,tp)
local ct = B2Sayaka.LPDifferent2()
Scl.SelectAndOperateCards("ShuffleIn2Deck", tp, Card.IsAbleToDeck, tp, 0, "Field", 1, ct, nil)()
Scl.SelectAndOperateCards("ShuffleIn2Deck", tp, Card.IsAbleToDeck, tp, 0, "OnField", 1, ct, nil)()
end
\ No newline at end of file
......@@ -9,7 +9,7 @@ function s.initial_effect(c)
"GainLP,Send2GY", nil, "MonsterZone", nil, nil, {
{ "PlayerTarget", "GainLP", 1000 },
{ "~Target", Card.IsAbleToGrave, "Send2GY",
0, "Field", B2Sayaka.LPDifferentAdd1000Chk} }, s.damop)
0, "OnField", B2Sayaka.LPDifferentAdd1000Chk} }, s.damop)
B2Sayaka.Effect2Condition(id, e2, EVENT_DAMAGE, s.regop)
local e3 = Scl.CreateSingleTriggerOptionalEffect(c, EVENT_RELEASE,
"ShuffleIn2Deck", {1, id + 200},
......@@ -20,11 +20,11 @@ end
function s.damop(e,tp)
if Duel.Recover(tp, 1000, REASON_EFFECT) <= 0 then return end
local ct = B2Sayaka.LPDifferent()
Scl.SelectAndOperateCards("Send2GY",tp,Card.IsAbleToGrave,tp,0,"Field",1,ct,nil)()
Scl.SelectAndOperateCards("Send2GY",tp,Card.IsAbleToGrave,tp,0,"OnField",1,ct,nil)()
end
function s.regop(e,tp,eg,ep)
Duel.RegisterFlagEffect(ep, id, RESET_EP_SCL, 0 , 1)
end
function s.drop(e,tp)
Scl.SelectAndOperateCards("ShuffleIn2Deck&Draw",tp,Card.IsAbleToDeck,tp,"Banish,GY",0,1,3,nil)(nil, 2, tp, 1)
Scl.SelectAndOperateCards("ShuffleIn2Deck&Draw",tp,Card.IsAbleToDeck,tp,"Banished,GY",0,1,3,nil)(nil, 2, tp, 1)
end
\ No newline at end of file
......@@ -6,7 +6,7 @@ function s.initial_effect(c)
e1:SetCondition(B2Sayaka.ExtraLimit)
local e2 = Scl.CreateFieldBuffEffect(c, "!BeEffectTarget", 1, s.tg,
{"MonsterZone", 0}, "FieldZone")
local e3 = Scl.CreateFieldBuffEffect(c, "!BeDestroyedByEffect", 1, s.tg,
local e3 = Scl.CreateFieldBuffEffect(c, "!BeDestroyedByEffects", 1, s.tg,
{"MonsterZone", 0}, "FieldZone")
local e4 = Scl.CreateIgnitionEffect(c, "ChangeLevel", 1, "ChangeLevel", nil,
"FieldZone", nil, nil, {
......
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