Commit c0b340e1 authored by Vury Leo's avatar Vury Leo

add シンクロ・マテリアル

parent a4145eda
......@@ -3,14 +3,14 @@
local s,id,o=GetID()
function s.initial_effect(c)
--hand synchro
-- local e1=Effect.CreateEffect(c)
-- e1:SetType(EFFECT_TYPE_SINGLE)
-- e1:SetCode(EFFECT_EXTRA_SYNCHRO_MATERIAL)
-- e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
-- e1:SetRange(LOCATION_HAND)
-- e1:SetCountLimit(1,id)
-- e1:SetValue(s.matval)
-- c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_SYNCHRO_MATERIAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
e1:SetValue(s.matval)
c:RegisterEffect(e1)
--hand synchro
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
......@@ -21,14 +21,14 @@ function s.initial_effect(c)
e3:SetValue(s.matval)
c:RegisterEffect(e3)
--register HOpT
-- local e0=Effect.CreateEffect(c)
-- e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
-- e0:SetCode(EVENT_BE_PRE_MATERIAL)
-- e0:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE)
-- e0:SetLabelObject(e1)
-- e0:SetCondition(s.hsyncon)
-- e0:SetOperation(s.hsynreg)
-- c:RegisterEffect(e0)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_BE_PRE_MATERIAL)
e0:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE)
e0:SetLabelObject(e1)
e0:SetCondition(s.hsyncon)
e0:SetOperation(s.hsynreg)
c:RegisterEffect(e0)
--spsum self
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
......
......@@ -3383,6 +3383,44 @@ Synchro.Role={
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
--- @param c Card -- the Synchro monster card
--- @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
end
local target_level=c:GetLevel()
--- @param mc Card
mg=mg or Duel.GetMatchingGroup(function(mc) return mc:IsFaceupEx() and mc:IsCanBeSynchroMaterial(c) end,c:GetControler(),LOCATION_MZONE+LOCATION_HAND,0,nil)
mg=mg or Synchro.GetSynchroMaterial(c:GetControler(),c)
local smat_states=nil
local smat_arr=nil
......@@ -3702,7 +3739,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
e:SetLabelObject(mg)
return true
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
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