Commit 7858e9ea authored by Vury Leo's avatar Vury Leo

Add レボリューション・シンクロン

parent 46387862
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
function c63265554.initial_effect(c) function c63265554.initial_effect(c)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
Synchro.AddSynchroProcedure(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--equip --equip
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
function c80696379.initial_effect(c) function c80696379.initial_effect(c)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
Synchro.AddSynchroProcedure(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--special summon --special summon
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
...@@ -3,23 +3,32 @@ ...@@ -3,23 +3,32 @@
local s,id,o=GetID() local s,id,o=GetID()
function s.initial_effect(c) function s.initial_effect(c)
--hand synchro --hand synchro
local e1=Effect.CreateEffect(c) -- local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) -- e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_SYNCHRO_MATERIAL) -- e1:SetCode(EFFECT_EXTRA_SYNCHRO_MATERIAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) -- e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_HAND) -- e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id) -- e1:SetCountLimit(1,id)
e1:SetValue(s.matval) -- e1:SetValue(s.matval)
c:RegisterEffect(e1) -- c:RegisterEffect(e1)
--hand synchro
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(id)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_HAND)
e3:SetCountLimit(1,id)
e3:SetValue(s.matval)
c:RegisterEffect(e3)
--register HOpT --register HOpT
local e0=Effect.CreateEffect(c) -- local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) -- e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_BE_PRE_MATERIAL) -- e0:SetCode(EVENT_BE_PRE_MATERIAL)
e0:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE) -- e0:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetLabelObject(e1) -- e0:SetLabelObject(e1)
e0:SetCondition(s.hsyncon) -- e0:SetCondition(s.hsyncon)
e0:SetOperation(s.hsynreg) -- e0:SetOperation(s.hsynreg)
c:RegisterEffect(e0) -- c:RegisterEffect(e0)
--spsum self --spsum self
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0)) e2:SetDescription(aux.Stringid(id,0))
......
...@@ -3652,7 +3652,7 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f ...@@ -3652,7 +3652,7 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f
local target_level=c:GetLevel() local target_level=c:GetLevel()
--- @param mc Card --- @param mc Card
mg=mg or Duel.GetMatchingGroup(function(mc) return mc:IsCanBeSynchroMaterial(c) end,c:GetControler(),LOCATION_MZONE+LOCATION_HAND,0,nil) mg=mg or Duel.GetMatchingGroup(function(mc) return mc:IsFaceupEx() and mc:IsCanBeSynchroMaterial(c) end,c:GetControler(),LOCATION_MZONE+LOCATION_HAND,0,nil)
local smat_states=nil local smat_states=nil
local smat_arr=nil local smat_arr=nil
...@@ -3743,6 +3743,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3743,6 +3743,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
end end
end end
end end
assert(#selected_states>0,"we selected an invalid state")
for _,candidate in ipairs(cg_arr) do for _,candidate in ipairs(cg_arr) do
for _,state in ipairs(selected_states) do for _,state in ipairs(selected_states) do
...@@ -3785,6 +3786,9 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3785,6 +3786,9 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
break break
end end
end end
if addable:IsContains(candidate) then
break
end
end end
end end
end end
...@@ -3793,7 +3797,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3793,7 +3797,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
break break
end end
local finishable=Synchro.IsSelectionValid(sg_arr,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max) local finishable=Synchro.IsSelectionValid(sg_arr,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,base_mapper)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local picked=Group.SelectUnselect(addable,sg,tp,finishable,true,selected_level_min,target_level) local picked=Group.SelectUnselect(addable,sg,tp,finishable,true,selected_level_min,target_level)
...@@ -3831,6 +3835,14 @@ function Synchro.SynOperation() ...@@ -3831,6 +3835,14 @@ function Synchro.SynOperation()
-- confirm hand hard -- confirm hand hard
local hand_cards=g:Filter(function(c) return c:IsLocation(LOCATION_HAND) end,nil) local hand_cards=g:Filter(function(c) return c:IsLocation(LOCATION_HAND) end,nil)
Duel.ConfirmCards(1-tp,hand_cards) Duel.ConfirmCards(1-tp,hand_cards)
for mc in aux.Next(g) do
if Synchro.IsRevolution(mc,c) then
local revo_effect=mc:IsHasEffect(97682931)
Duel.Hint(HINT_CARD,0,mc:GetCode())
revo_effect:UseCountLimit(mc:GetControler())
end
end
-- Detect whether Tatsunecro’s effect was actually used: -- Detect whether Tatsunecro’s effect was actually used:
-- (a) Tatsunecro itself was used as material, AND -- (a) Tatsunecro itself was used as material, AND
-- (b) At least one hand card was included. -- (b) At least one hand card was included.
...@@ -3871,12 +3883,12 @@ function Synchro.SynOperation() ...@@ -3871,12 +3883,12 @@ function Synchro.SynOperation()
end end
end end
function Synchro.IsSelectionValid(selection,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max) function Synchro.IsSelectionValid(selection,target_level,tuner_race,tuner_filter,non_tuner_race,non_tuner_filter,tc,tuner_min,tuner_max,non_tuner_min,non_tuner_max,base_mapper)
local states=Synchro.BuildStatesFromSelection( local states=Synchro.BuildStatesFromSelection(
selection, selection,
tuner_race,tuner_filter, tuner_race,tuner_filter,
non_tuner_race,non_tuner_filter, non_tuner_race,non_tuner_filter,
Synchro.DefaultLevelMapper, base_mapper,
tc,target_level tc,target_level
) )
for _,state in ipairs(states) do for _,state in ipairs(states) do
...@@ -4051,6 +4063,15 @@ function Synchro.IsTatsunecro(c) ...@@ -4051,6 +4063,15 @@ function Synchro.IsTatsunecro(c)
return c:IsHasEffect(3096468)~=nil return c:IsHasEffect(3096468)~=nil
end end
--- @param c Card
function Synchro.IsRevolution(c,tc)
local revo_e=c:IsHasEffect(97682931)
if revo_e==nil or revo_e:CheckCountLimit(c:GetControler())==false then
return false
end
return revo_e:GetValue()(revo_e,tc)
end
--- @param c Card --- @param c Card
function Synchro.IsGenomix(c) function Synchro.IsGenomix(c)
return c:IsHasEffect(42155488)~=nil return c:IsHasEffect(42155488)~=nil
...@@ -4127,10 +4148,8 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun ...@@ -4127,10 +4148,8 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun
local declared_race=card:IsHasEffect(42155488):GetLabel() local declared_race=card:IsHasEffect(42155488):GetLabel()
if st.genomix_race~=nil then if st.genomix_race~=nil then
assert(declared_race==st.genomix_race,"we activated 2 Genomix Fighter with 2 different races but we still have monster to summon") assert(declared_race==st.genomix_race,"we activated 2 Genomix Fighter with 2 different races but we still have monster to summon")
table.insert(base_variants,{})
else
table.insert(base_variants,{genomix_race=declared_race})
end end
table.insert(base_variants,{genomix_race=declared_race})
end end
-- Normal branch -- Normal branch
...@@ -4162,6 +4181,17 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun ...@@ -4162,6 +4181,17 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun
end end
-- now wrap each base_variant in role‐specific diffs -- now wrap each base_variant in role‐specific diffs
-- Revolution Synchron effect
local hand_delta=0
if card:IsLocation(LOCATION_HAND) then
if Synchro.IsRevolution(card,tc) then
hand_delta=0
else
hand_delta=1
end
end
local variants={} local variants={}
local can_be_tuner=tuner_filter(card,tc) local can_be_tuner=tuner_filter(card,tc)
local can_be_non_tuner=non_tuner_filter(card,tc) local can_be_non_tuner=non_tuner_filter(card,tc)
...@@ -4176,6 +4206,7 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun ...@@ -4176,6 +4206,7 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun
hand_count_limit=base.hand_count_limit, hand_count_limit=base.hand_count_limit,
append_material_limit_filter=base.append_material_limit_filter, append_material_limit_filter=base.append_material_limit_filter,
genomix_race=base.genomix_race, genomix_race=base.genomix_race,
hand_delta=hand_delta,
-- role-specific -- role-specific
tuner_delta=1, tuner_delta=1,
non_tuner_delta=0, non_tuner_delta=0,
...@@ -4191,6 +4222,7 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun ...@@ -4191,6 +4222,7 @@ function Synchro.GenerateVariantForCard(st,card,selected_count,tc,tuner_race,tun
hand_count_limit=base.hand_count_limit, hand_count_limit=base.hand_count_limit,
append_material_limit_filter=base.append_material_limit_filter, append_material_limit_filter=base.append_material_limit_filter,
genomix_race=base.genomix_race, genomix_race=base.genomix_race,
hand_delta=hand_delta,
tuner_delta=0, tuner_delta=0,
non_tuner_delta=1, non_tuner_delta=1,
role=Synchro.Role.NON_TUNER, role=Synchro.Role.NON_TUNER,
...@@ -4207,7 +4239,7 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune ...@@ -4207,7 +4239,7 @@ function Synchro.ApplyVariantState(st,card,diff,tuner_race,tuner_filter,non_tune
-- compute increments using provided filters -- compute increments using provided filters
local tuner_inc=diff.tuner_delta local tuner_inc=diff.tuner_delta
local non_tuner_inc=diff.non_tuner_delta local non_tuner_inc=diff.non_tuner_delta
local hand_inc=card:IsLocation(LOCATION_HAND) and 1 or 0 local hand_inc=diff.hand_delta
local new_selected_roles={ table.unpack(st.selected_roles) } local new_selected_roles={ table.unpack(st.selected_roles) }
table.insert(new_selected_roles,diff.role) table.insert(new_selected_roles,diff.role)
local possible_sums=Synchro.UpdatepossibleSums( local possible_sums=Synchro.UpdatepossibleSums(
...@@ -4253,7 +4285,6 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc, ...@@ -4253,7 +4285,6 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc,
level_prune_index=math.huge, level_prune_index=math.huge,
} }
index=index or -1 index=index or -1
-- build a temporary Group = already selected cards + this mc -- build a temporary Group = already selected cards + this mc
local sg=Group.FromCards(table.unpack(selected)) local sg=Group.FromCards(table.unpack(selected))
sg:AddCard(mc) sg:AddCard(mc)
...@@ -4272,7 +4303,6 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc, ...@@ -4272,7 +4303,6 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc,
-- per-card EFFECT_TUNER_MATERIAL_LIMIT check against already‐selected -- per-card EFFECT_TUNER_MATERIAL_LIMIT check against already‐selected
local eff=mc:IsHasEffect(EFFECT_TUNER_MATERIAL_LIMIT) local eff=mc:IsHasEffect(EFFECT_TUNER_MATERIAL_LIMIT)
if eff then if eff then
assert(eff:GetTarget(),"EFFECT_TUNER_MATERIAL_LIMIT has no target function")
append_material_limit_filter=function(c) return eff:GetTarget()(eff,c) end append_material_limit_filter=function(c) return eff:GetTarget()(eff,c) end
for _, sel in ipairs(selected) do for _, sel in ipairs(selected) do
if not append_material_limit_filter(sel) then if not append_material_limit_filter(sel) then
...@@ -4287,10 +4317,12 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc, ...@@ -4287,10 +4317,12 @@ function Synchro.CanIncludeMaterial(mc,state,selected,tc,
end end
-- hand‐location count limit -- hand‐location count limit
if mc:IsLocation(LOCATION_HAND) if mc:IsLocation(LOCATION_HAND) and index>prune_indexes.hand_prune_index then
and index>prune_indexes.hand_prune_index if not Synchro.IsRevolution(mc,tc) then
and state.hand_count+1>state.hand_count_limit then if state.hand_count+1>state.hand_count_limit then
return false,nil return false,nil
end
end
end end
return true,append_material_limit_filter return true,append_material_limit_filter
......
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