Commit 53a8e51f authored by Vury Leo's avatar Vury Leo

space to tab

parent d1b00fd6
Pipeline #37000 failed with stages
in 1 minute and 34 seconds
...@@ -80,17 +80,17 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -80,17 +80,17 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
local dg=sg:Select(tp,1,1,nil) local dg=sg:Select(tp,1,1,nil)
Duel.ShuffleHand(tp) Duel.ShuffleHand(tp)
Duel.SendtoGrave(dg,REASON_EFFECT+REASON_DISCARD) Duel.SendtoGrave(dg,REASON_EFFECT+REASON_DISCARD)
--Once this turn, if you Fusion Summon a "Lunalight" monster, you can also banish monsters from your grave as material --Once this turn, if you Fusion Summon a "Lunalight" monster, you can also banish monsters from your grave as material
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL) e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetTargetRange(LOCATION_GRAVE,0) e1:SetTargetRange(LOCATION_GRAVE,0)
e1:SetTarget(function(_,c) return c:IsAbleToRemove() and c:IsType(TYPE_MONSTER) end) e1:SetTarget(function(_,c) return c:IsAbleToRemove() and c:IsType(TYPE_MONSTER) end)
e1:SetOperation(function() return FusionSpell.FUSION_OPERATION_BANISH end) e1:SetOperation(function() return FusionSpell.FUSION_OPERATION_BANISH end)
e1:SetValue(function(fusion_effect,c) return c and c:IsSetCard(0xdf) and c:IsControler(fusion_effect:GetHandlerPlayer()) end) e1:SetValue(function(fusion_effect,c) return c and c:IsSetCard(0xdf) and c:IsControler(fusion_effect:GetHandlerPlayer()) end)
e1:SetReset(RESET_PHASE|PHASE_END) e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
end end
end end
end end
......
...@@ -10,26 +10,26 @@ end ...@@ -10,26 +10,26 @@ end
---@param c Card ---@param c Card
function s.fusfilter(c) function s.fusfilter(c)
return c:IsRace(RACE_MACHINE) return c:IsRace(RACE_MACHINE)
end end
---@type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION ---@type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
function s.stage_x_operation(e,tc,tp,stage,mg_fuison_spell,mg_all) function s.stage_x_operation(e,tc,tp,stage,mg_fuison_spell,mg_all)
--- register if the summon is finished --- register if the summon is finished
if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
-- if base ATK is 0, do nothing -- if base ATK is 0, do nothing
local atk=tc:GetBaseAttack() local atk=tc:GetBaseAttack()
if atk<=0 then if atk<=0 then
return return
end end
---increase ATK ---increase ATK
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(tc:GetBaseAttack()) e1:SetValue(tc:GetBaseAttack())
e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true) tc:RegisterEffect(e1,true)
--- do damage on end phase --- do damage on end phase
if e:IsHasType(EFFECT_TYPE_ACTIVATE) then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then
local e2=Effect.CreateEffect(e:GetHandler()) local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--Activate --Activate
local e1=FusionSpell.CreateSummonEffect(c,{ local e1=FusionSpell.CreateSummonEffect(c,{
pre_select_mat_location=LOCATION_ONFIELD, pre_select_mat_location=LOCATION_ONFIELD,
pre_select_mat_opponent_location=LOCATION_ONFIELD, pre_select_mat_opponent_location=LOCATION_ONFIELD,
extra_target=s.extra_target extra_target=s.extra_target
}) })
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCost(s.cost) e1:SetCost(s.cost)
c:RegisterEffect(e1) c:RegisterEffect(e1)
......
...@@ -45,7 +45,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -45,7 +45,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
end end
-- Can only use Dragon or Machine "Cyber" monsters as Fusion Material this turn -- Can only use Dragon or Machine "Cyber" monsters as Fusion Material this turn
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
...@@ -55,7 +55,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -55,7 +55,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(s.fuslimit) e1:SetValue(s.fuslimit)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
--Can also banish monsters from your GY as material once when you Fusion Summon this turn --Can also banish monsters from your GY as material once when you Fusion Summon this turn
local e2=Effect.CreateEffect(e:GetHandler()) local e2=Effect.CreateEffect(e:GetHandler())
e2:SetDescription(aux.Stringid(id,2)) e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
...@@ -63,7 +63,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,7 +63,7 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
e2:SetTargetRange(LOCATION_GRAVE,0) e2:SetTargetRange(LOCATION_GRAVE,0)
e2:SetCountLimit(1) e2:SetCountLimit(1)
e2:SetTarget(s.mttg) e2:SetTarget(s.mttg)
e2:SetOperation(function() return FusionSpell.FUSION_OPERATION_BANISH end) e2:SetOperation(function() return FusionSpell.FUSION_OPERATION_BANISH end)
e2:SetValue(1) e2:SetValue(1)
e2:SetReset(RESET_PHASE+PHASE_END) e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
......
...@@ -15,16 +15,16 @@ end ...@@ -15,16 +15,16 @@ end
---@param c Card ---@param c Card
function s.fusfilter(c) function s.fusfilter(c)
return c:IsSetCard(0xdf) return c:IsSetCard(0xdf)
end end
---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION ---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
function s.pre_select_mat_location(tc,tp) function s.pre_select_mat_location(tc,tp)
local res=LOCATION_HAND|LOCATION_ONFIELD local res=LOCATION_HAND|LOCATION_ONFIELD
if Duel.IsExistingMatchingCard(s.cfilter,tp,0,LOCATION_MZONE,1,nil) then if Duel.IsExistingMatchingCard(s.cfilter,tp,0,LOCATION_MZONE,1,nil) then
res=res|LOCATION_DECK|LOCATION_EXTRA res=res|LOCATION_DECK|LOCATION_EXTRA
end end
return res return res
end end
function s.cfilter(c) function s.cfilter(c)
......
...@@ -2391,12 +2391,12 @@ FusionSpell = {} ...@@ -2391,12 +2391,12 @@ FusionSpell = {}
--- Add LOCATION_EXTRA to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated --- Add LOCATION_EXTRA to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated
function FusionSpell.GetFusionMaterial(tp,locations) function FusionSpell.GetFusionMaterial(tp,locations)
local res=Duel.GetFusionMaterial(tp,locations) local res=Duel.GetFusionMaterial(tp,locations)
local g=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_EXTRA,0,nil,EFFECT_EXTRA_FUSION_MATERIAL) local g=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_EXTRA,0,nil,EFFECT_EXTRA_FUSION_MATERIAL)
if #g>0 then if #g>0 then
res:Merge(g) res:Merge(g)
end end
return res return res
end end
--- Get possible materials from opponent locations, must be face-up --- Get possible materials from opponent locations, must be face-up
...@@ -2406,12 +2406,12 @@ end ...@@ -2406,12 +2406,12 @@ end
--- Registers a Fusion Summon effect to a card. --- Registers a Fusion Summon effect to a card.
--- @param c Card -- The card to register the effect to. --- @param c Card -- The card to register the effect to.
--- @param opts FusionEffectParams --- @param opts? FusionEffectParams
--- @return Effect -- The registered effect object. --- @return Effect -- The registered effect object.
function FusionSpell.RegisterSummonEffect(c,opts) function FusionSpell.RegisterSummonEffect(c,opts)
local e1 = FusionSpell.CreateSummonEffect(c,opts) local e1 = FusionSpell.CreateSummonEffect(c,opts)
Card.RegisterEffect(c, e1) Card.RegisterEffect(c, e1)
return e1 return e1
end end
--- Creates and returns a Fusion Summon effect, attached to the specified card. --- Creates and returns a Fusion Summon effect, attached to the specified card.
...@@ -2421,59 +2421,59 @@ end ...@@ -2421,59 +2421,59 @@ end
--- @return Effect The created and configured `Effect` object. --- @return Effect The created and configured `Effect` object.
function FusionSpell.CreateSummonEffect(c,opts) function FusionSpell.CreateSummonEffect(c,opts)
opts=opts or {} opts=opts or {}
local fusfilter=opts.fusfilter local fusfilter=opts.fusfilter
local matfilter=opts.matfilter or aux.TRUE local matfilter=opts.matfilter or aux.TRUE
local pre_select_mat_location=opts.pre_select_mat_location or (LOCATION_HAND | LOCATION_MZONE) local pre_select_mat_location=opts.pre_select_mat_location or (LOCATION_HAND | LOCATION_MZONE)
local mat_operation_code_map=opts.mat_operation_code_map or {} local mat_operation_code_map=opts.mat_operation_code_map or {}
local post_select_mat_location=opts.post_select_mat_location local post_select_mat_location=opts.post_select_mat_location
local additional_fcheck=opts.additional_fcheck local additional_fcheck=opts.additional_fcheck
local additional_gcheck=opts.additional_gcheck local additional_gcheck=opts.additional_gcheck
local fuslocation=opts.fuslocation or LOCATION_EXTRA local fuslocation=opts.fuslocation or LOCATION_EXTRA
local sumtype=opts.sumtype or SUMMON_TYPE_FUSION local sumtype=opts.sumtype or SUMMON_TYPE_FUSION
local sumpos=opts.sumpos or POS_FACEUP local sumpos=opts.sumpos or POS_FACEUP
local stage_x_operation=opts.stage_x_operation or aux.TRUE local stage_x_operation=opts.stage_x_operation or aux.TRUE
local extra_target=opts.extra_target local extra_target=opts.extra_target
local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location
-- Ensure material operation fallbacks are present -- Ensure material operation fallbacks are present
table.insert(mat_operation_code_map,{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH }) table.insert(mat_operation_code_map,{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH })
table.insert(mat_operation_code_map,{ [0xff] = FusionSpell.FUSION_OPERATION_GRAVE }) table.insert(mat_operation_code_map,{ [0xff] = FusionSpell.FUSION_OPERATION_GRAVE })
-- Build and return the effect -- Build and return the effect
local e1 = Effect.CreateEffect(c) local e1 = Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(FusionSpell.GetSummonTarget( e1:SetTarget(FusionSpell.GetSummonTarget(
fusfilter, fusfilter,
matfilter, matfilter,
pre_select_mat_location, pre_select_mat_location,
mat_operation_code_map, mat_operation_code_map,
post_select_mat_location, post_select_mat_location,
additional_fcheck, additional_fcheck,
additional_gcheck, additional_gcheck,
fuslocation, fuslocation,
sumtype, sumtype,
sumpos, sumpos,
extra_target, extra_target,
pre_select_mat_opponent_location pre_select_mat_opponent_location
)) ))
e1:SetOperation(FusionSpell.GetSummonOperation( e1:SetOperation(FusionSpell.GetSummonOperation(
fusfilter, fusfilter,
matfilter, matfilter,
pre_select_mat_location, pre_select_mat_location,
mat_operation_code_map, mat_operation_code_map,
post_select_mat_location, post_select_mat_location,
additional_fcheck, additional_fcheck,
additional_gcheck, additional_gcheck,
fuslocation, fuslocation,
sumtype, sumtype,
sumpos, sumpos,
stage_x_operation, stage_x_operation,
pre_select_mat_opponent_location pre_select_mat_opponent_location
)) ))
return e1 return e1
end end
---@param fusfilter (fun(c:Card):boolean)? filter for the monster to be Fusion Summoned ---@param fusfilter (fun(c:Card):boolean)? filter for the monster to be Fusion Summoned
...@@ -2501,9 +2501,9 @@ function FusionSpell.GetSummonTarget( ...@@ -2501,9 +2501,9 @@ function FusionSpell.GetSummonTarget(
sumpos, sumpos,
extra_target, extra_target,
pre_select_mat_opponent_location) pre_select_mat_opponent_location)
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local sg=Duel.IsExistingMatchingCard( local sg=Duel.IsExistingMatchingCard(
FusionSpell.SummonTargetFilter,tp,fuslocation,0,1,nil, FusionSpell.SummonTargetFilter,tp,fuslocation,0,1,nil,
--- FusionSpell.SummonTargetFilter param --- FusionSpell.SummonTargetFilter param
fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location) fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location)
...@@ -2518,12 +2518,12 @@ function FusionSpell.GetSummonTarget( ...@@ -2518,12 +2518,12 @@ function FusionSpell.GetSummonTarget(
end end
end end
return false return false
end end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,fuslocation) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,fuslocation)
if extra_target~=nil then if extra_target~=nil then
extra_target(e,tp,eg,ep,ev,re,r,rp,chk) extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
end end
end end
end end
---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned ---@param fusfilter fun(c:Card):boolean filter for the monster to be Fusion Summoned
...@@ -2551,8 +2551,8 @@ function FusionSpell.GetSummonOperation( ...@@ -2551,8 +2551,8 @@ function FusionSpell.GetSummonOperation(
sumpos, sumpos,
stage_x_operation, stage_x_operation,
pre_select_mat_opponent_location) pre_select_mat_opponent_location)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup( local sg=Duel.GetMatchingGroup(
FusionSpell.SummonTargetFilter,tp,fuslocation,0,nil, FusionSpell.SummonTargetFilter,tp,fuslocation,0,nil,
--- FusionSpell.SummonTargetFilter param --- FusionSpell.SummonTargetFilter param
fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location) fusfilter,matfilter,e,tp,pre_select_mat_location,mat_operation_code_map,post_select_mat_location,additional_fcheck,sumtype,sumpos,pre_select_mat_opponent_location)
...@@ -2569,19 +2569,19 @@ function FusionSpell.GetSummonOperation( ...@@ -2569,19 +2569,19 @@ function FusionSpell.GetSummonOperation(
end end
local tc=nil local tc=nil
if #sg>0 or can_chain_material==true then if #sg>0 or can_chain_material==true then
local materials=Group.CreateGroup() local materials=Group.CreateGroup()
local fusion_effect=nil local fusion_effect=nil
while #materials==0 do while #materials==0 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
---@type Group ---@type Group
local fusion_targets=sg:Clone() local fusion_targets=sg:Clone()
for _, ce_sg in pairs(ce_sgs) do for _, ce_sg in pairs(ce_sgs) do
fusion_targets:Merge(ce_sg) fusion_targets:Merge(ce_sg)
end end
tc=fusion_targets:Select(tp,1,1,nil):GetFirst() tc=fusion_targets:Select(tp,1,1,nil):GetFirst()
---@type Effect[] ---@type Effect[]
local avaliable_fusion_effect = {} local avaliable_fusion_effect = {}
...@@ -2626,12 +2626,12 @@ function FusionSpell.GetSummonOperation( ...@@ -2626,12 +2626,12 @@ function FusionSpell.GetSummonOperation(
materials=Duel.SelectFusionMaterial(tp,tc,chain_mg) materials=Duel.SelectFusionMaterial(tp,tc,chain_mg)
aux.FCheckAdditional=nil aux.FCheckAdditional=nil
end end
end end
assert(tc~=nil) assert(tc~=nil)
assert(fusion_effect~=nil) assert(fusion_effect~=nil)
if #materials>0 then if #materials>0 then
if fusion_effect==e then if fusion_effect==e then
--- fusion with fusion spell --- fusion with fusion spell
tc:SetMaterial(materials) tc:SetMaterial(materials)
...@@ -2696,16 +2696,16 @@ function FusionSpell.GetSummonOperation( ...@@ -2696,16 +2696,16 @@ function FusionSpell.GetSummonOperation(
fusion_effect:Reset() fusion_effect:Reset()
end end
end end
end end
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE) stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE)
Duel.SpecialSummonComplete() Duel.SpecialSummonComplete()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE) stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE)
tc:CompleteProcedure() tc:CompleteProcedure()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH) stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH)
end end
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_ALL_OPERATION_FINISH) stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_ALL_OPERATION_FINISH)
end end
end end
---@param pre_select_mat_location integer|(fun(tc:Card,tp:integer):integer) location where to find the materials before known the materials ---@param pre_select_mat_location integer|(fun(tc:Card,tp:integer):integer) location where to find the materials before known the materials
...@@ -2997,21 +2997,21 @@ end ...@@ -2997,21 +2997,21 @@ end
--if element is true, stands for it can be included by the fusion effect itself. --if element is true, stands for it can be included by the fusion effect itself.
---@return (true|Effect)[] ---@return (true|Effect)[]
function FusionSpell.GetMaterialEffects(c,summon_card,matlocation,materials) function FusionSpell.GetMaterialEffects(c,summon_card,matlocation,materials)
local res={} local res={}
if c:IsLocation(matlocation) then if c:IsLocation(matlocation) then
table.insert(res,true) table.insert(res,true)
end end
local extra_effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)} local extra_effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)}
for _,eff in ipairs(extra_effs) do for _,eff in ipairs(extra_effs) do
if not summon_card then if not summon_card then
table.insert(res,eff) table.insert(res,eff)
end end
local val=eff:GetValue() local val=eff:GetValue()
if (type(val)=="function" and val(eff,summon_card)) or val==1 then if (type(val)=="function" and val(eff,summon_card)) or val==1 then
table.insert(res,eff) table.insert(res,eff)
end end
end end
return res return res
end end
--Returns the 1st EFFECT_EXTRA_FUSION_MATERIAL is applied on Card c. --Returns the 1st EFFECT_EXTRA_FUSION_MATERIAL is applied on Card c.
......
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