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