Commit c0b340e1 authored by Vury Leo's avatar Vury Leo

add シンクロ・マテリアル

parent a4145eda
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
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 --hand synchro
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
...@@ -21,14 +21,14 @@ function s.initial_effect(c) ...@@ -21,14 +21,14 @@ function s.initial_effect(c)
e3:SetValue(s.matval) e3:SetValue(s.matval)
c:RegisterEffect(e3) 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))
......
...@@ -3383,6 +3383,44 @@ Synchro.Role={ ...@@ -3383,6 +3383,44 @@ Synchro.Role={
NON_TUNER=2, NON_TUNER=2,
} }
--- Shadowing Duel.GetSynchroMaterial as we have different definition on hand materials
function Synchro.GetSynchroMaterial(tp,tc)
local mg=Duel.GetMatchingGroup(function(mc) return mc:IsFaceup() and mc:IsOnField() end,tp,LOCATION_MZONE,0,nil)
local mg_hand=Duel.GetMatchingGroup(function(mc) return mc:IsFaceupEx() end,tp,LOCATION_HAND,0,nil)
local mg_oppoent=Duel.GetMatchingGroup(function(mc)
if not (mc:IsFaceup() and mc:IsOnField()) then
return false
end
local effs={mc:IsHasEffect(EFFECT_EXTRA_SYNCHRO_MATERIAL)}
for _,eff in ipairs(effs) do
local v=eff:GetValue()
if type(v)=='function' and v(eff,tc) then
return true
elseif v then
return true
end
end
return false
end,tp,0,LOCATION_MZONE,nil)
mg:Merge(mg_hand)
mg:Merge(mg_oppoent)
mg=mg:Filter(function(mc) return not mc:IsForbidden() end,nil)
mg=mg:Filter(function(mc) return mc:IsType(TYPE_MONSTER) end,nil)
mg=mg:Filter(function(mc)
local effs={mc:IsHasEffect(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)}
for _,eff in ipairs(effs) do
local v=eff:GetValue()
if type(v)=='function' and v(eff,tc)==true then
return false
elseif v then
return false
end
end
return true
end,nil)
return mg
end
--- Add Synchro procedure effect to a card using a single params table --- Add Synchro procedure effect to a card using a single params table
--- @param c Card -- the Synchro monster card --- @param c Card -- the Synchro monster card
--- @param params? table -- parameters table with keys: f1,f2,minc,maxc --- @param params? table -- parameters table with keys: f1,f2,minc,maxc
...@@ -3662,8 +3700,7 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f ...@@ -3662,8 +3700,7 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f
end end
local target_level=c:GetLevel() local target_level=c:GetLevel()
--- @param mc Card mg=mg or Synchro.GetSynchroMaterial(c:GetControler(),c)
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
...@@ -3702,7 +3739,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt ...@@ -3702,7 +3739,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
e:SetLabelObject(mg) e:SetLabelObject(mg)
return true return true
end end
mg=mg or Duel.GetMatchingGroup(function(mc) return mc:IsCanBeSynchroMaterial(mc,tc) end,tc:GetOwner(),LOCATION_MZONE+LOCATION_HAND,0,nil) mg=mg or Synchro.GetSynchroMaterial(tp,tc)
-- add リペア・ジェネクス・コントローラー to scheck -- add リペア・ジェネクス・コントローラー to scheck
if Duel.IsPlayerAffectedByEffect(tp,8173184) then if Duel.IsPlayerAffectedByEffect(tp,8173184) then
......
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