Commit c20d2b09 authored by Vury Leo's avatar Vury Leo

Add アマゾネスの秘術 to new fusion

parent 5b64710b
Pipeline #37033 failed with stages
in 3 minutes and 6 seconds
--アマゾネスの秘術
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=FusionSpell.CreateSummonEffect(c,{
fusfilter=s.fusfilter
})
e1:SetDescription(aux.Stringid(id,0))
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetCountLimit(1,id)
c:RegisterEffect(e1)
--to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,id)
e2:SetCost(aux.bfgcost)
e2:SetOperation(s.fusop)
c:RegisterEffect(e2)
end
function s.fusfilter(c)
return c:IsSetCard(0x4)
end
function s.fusop(e,tp,eg,ep,ev,re,r,rp)
--Once this turn, if you Fusion Summon an "Amazoness" Fusion Monster this turn, you can also send 1 "Amazoness" monster from your Extra Deck to the GY 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_EXTRA,0)
e1:SetTarget(function(_,c) return c:IsAbleToGrave() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x4) end)
e1:SetOperation(function() return FusionSpell.FUSION_OPERATION_GRAVE end)
e1:SetValue(function(fusion_effect,c) return c and c:IsSetCard(0x4) and c:IsControler(fusion_effect:GetHandlerPlayer()) end)
e1:SetLabel(1) --- at most 1 material per fusion effect
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
......@@ -2389,7 +2389,8 @@ FusionSpell = {}
--- Opponent-side locations to search for materials before they are selected.
--- Add LOCATION_EXTRA and oppoent mzone to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated
--- Add LOCATION_EXTRA and opponent mzone to EFFECT_EXTRA_FUSION_MATERIAL list, remove once core updated
function FusionSpell.GetFusionMaterial(tp,locations)
local res=Duel.GetFusionMaterial(tp,locations)
local g_from_extra=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_EXTRA,0,nil,EFFECT_EXTRA_FUSION_MATERIAL)
......@@ -2461,7 +2462,7 @@ function FusionSpell.CreateSummonEffect(c,opts)
local sumpos=opts.sumpos or POS_FACEUP
local stage_x_operation=opts.stage_x_operation or aux.TRUE
local extra_target=opts.extra_target or aux.TRUE
local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location
local pre_select_mat_opponent_location=opts.pre_select_mat_opponent_location or 0
-- Ensure material operation fallbacks are present
table.insert(mat_operation_code_map,{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH })
......@@ -2515,7 +2516,7 @@ end
---@param sumtype integer summon type
---@param sumpos integer summon position
---@param extra_target fun(e:Effect, tp:integer, eg:Group, ep:integer, ev:integer, re:Effect, r:integer, rp:integer, chk:integer):nil extra target function to add opration info etc
---@param pre_select_mat_opponent_location (integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION)? location where to find the materials before known the materials on opponent location
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
function FusionSpell.GetSummonTarget(
fusfilter,
matfilter,
......@@ -2566,7 +2567,7 @@ end
---@param sumtype integer summon type
---@param sumpos integer summon position
---@param stage_x_operation function callback function when special summon is in progress. will be called with different stage name
---@param pre_select_mat_opponent_location (integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION)? location where to find the materials before known the materials on opponent location
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
function FusionSpell.GetSummonOperation(
fusfilter,
matfilter,
......@@ -2637,6 +2638,7 @@ function FusionSpell.GetSummonOperation(
pre_select_mat_location,
mat_operation_code_map,
post_select_mat_location,
sumtype,
pre_select_mat_opponent_location)
aux.FCheckAdditional=FusionSpell.GetFusionSpellFCheckAdditionalFunction(additional_fcheck,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
materials=Duel.SelectFusionMaterial(tp,tc,mg,nil,tp)
......@@ -2792,7 +2794,7 @@ end
---@param matfilter fun(c:Card):boolean filter for the materials, use it only under very strong limitation like D-Fusion.
---@param pre_select_mat_location integer|function location where to find the materials before known the materials
---@param pre_select_mat_opponent_location? integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION? location where to find the materials before known the materials on opponent location
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
function FusionSpell.GetMaterialsGroupForTargetCard(
tc,
tp,
......@@ -2806,16 +2808,16 @@ function FusionSpell.GetMaterialsGroupForTargetCard(
)
local all_locations=FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location)
local mg=FusionSpell.GetFusionMaterial(tp,all_locations)
if pre_select_mat_opponent_location~=nil then
local calculated_mat_opponent_location=0
if type(pre_select_mat_opponent_location)=="function" then
pre_select_mat_opponent_location=pre_select_mat_opponent_location(tc,tp)
calculated_mat_opponent_location=pre_select_mat_opponent_location(tc,tp)
else
calculated_mat_opponent_location=pre_select_mat_opponent_location
end
local opponent_mg=FusionSpell.GetFusionMaterialFromOpponentLocation(tp,pre_select_mat_opponent_location)
local opponent_mg=FusionSpell.GetFusionMaterialFromOpponentLocation(tp,calculated_mat_opponent_location)
if #opponent_mg>0 then
mg:Merge(opponent_mg)
end
end
-- filter by the strong material filter, target card can not be fusion material of itself
mg=mg:Filter(matfilter,tc)
......@@ -3065,20 +3067,19 @@ end
--Returns a list of effect, if element is the EFFECT_EXTRA_FUSION_MATERIAL, stands for it can be included by that extra material effect.
--if element is true, stands for it can be included by the fusion effect itself.
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION? location where to find the materials before known the materials on opponent location
---@param pre_select_mat_opponent_location integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION location where to find the materials before known the materials on opponent location
---@return (true|Effect)[]
function FusionSpell.GetMaterialEffects(c,tp,summon_card,matlocation,pre_select_mat_opponent_location)
local res={}
if pre_select_mat_opponent_location~=nil then
local calculated_mat_opponent_location=0
if type(pre_select_mat_opponent_location)=="function" then
pre_select_mat_opponent_location=pre_select_mat_opponent_location(summon_card,tp)
end
calculated_mat_opponent_location=pre_select_mat_opponent_location(summon_card,tp)
else
pre_select_mat_opponent_location=0
calculated_mat_opponent_location=pre_select_mat_opponent_location
end
if c:IsControler(tp) and c:IsLocation(matlocation) then
table.insert(res,true)
elseif c:IsControler(1-tp) and c:IsLocation(pre_select_mat_opponent_location) then
elseif c:IsControler(1-tp) and c:IsLocation(calculated_mat_opponent_location) then
table.insert(res,true)
end
local extra_effs={c:IsHasEffect(EFFECT_EXTRA_FUSION_MATERIAL)}
......@@ -3145,13 +3146,18 @@ end
--- for each extra material effect, check the maximuim size is not exceeded.
--As of 2025 May, if a material could be used as extra material, it must be able to be used as fusion spell material. The code below is based on this assumption.
-- If we have Aiラブ融合 + 影牢の呪縛 or 多層融合 + アマゾネスの秘術 in same archetype, is code would fail in some scenario.
--- @param fusion_spell_additional_fcheck_function FUSION_FGCHECK_FUNCTION
function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additional_fcheck_function,tp,tc,pre_select_mat_location,post_select_mat_oppoent_location,pre_select_mat_oppoent_location)
---@param fusion_spell_additional_fcheck_function FUSION_FGCHECK_FUNCTION
---@param tp integer
---@param tc Card
---@param pre_select_mat_location integer|function location where to find the materials before known the materials (default LOCATION_HAND|LOCATION_MZONE)
---@param post_select_mat_location integer?
---@param pre_select_mat_opponent_location (integer|FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION)? location where to find the materials before known the materials on opponent location
function FusionSpell.GetFusionSpellFCheckAdditionalFunction(fusion_spell_additional_fcheck_function,tp,tc,pre_select_mat_location,post_select_mat_location,pre_select_mat_opponent_location)
---@param mg Group
return (function(f_tp,mg,fc)
--- filter out materials that can only be added by extra material effects, and check the count limit
local mandartory_extra_mg=mg:Filter(function (mc)
local material_effects=FusionSpell.GetMaterialEffects(mc,tp,tc,FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_oppoent_location),pre_select_mat_oppoent_location)
local material_effects=FusionSpell.GetMaterialEffects(mc,tp,tc,FusionSpell.GetAllLocationsForTargetCard(tc,tp,pre_select_mat_location,post_select_mat_location),pre_select_mat_opponent_location)
if (#material_effects)==1 and material_effects[1]~=true then
return true
end
......
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