Commit 9977b62c authored by Vury Leo's avatar Vury Leo

fix link

parent c0b340e1
--TG サイバー・マジシャン
function c64910482.initial_effect(c)
local s,id,o=GetID()
function s.initial_effect(c)
--synchro custom
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetTarget(c64910482.syntg)
e1:SetTarget(s.syntg)
e1:SetValue(1)
e1:SetOperation(c64910482.synop)
e1:SetOperation(s.synop)
c:RegisterEffect(e1)
--to grave
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetOperation(c64910482.regop)
e2:SetOperation(s.regop)
c:RegisterEffect(e2)
--hand synchro
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EFFECT_HAND_SYNCHRO)
e3:SetTarget(c64910482.hsyntg)
e3:SetTarget(s.hsyntg)
c:RegisterEffect(e3)
--hand synchro
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(id)
e4:SetTarget(s.hsyntg)
c:RegisterEffect(e4)
end
function c64910482.synfilter1(c,syncard,tuner,f)
function s.synfilter1(c,syncard,tuner,f)
return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function c64910482.synfilter2(c,syncard,tuner,f)
function s.synfilter2(c,syncard,tuner,f)
return c:IsSetCard(0x27) and c:IsNotTuner(syncard) and c:IsCanBeSynchroMaterial(syncard,tuner) and (f==nil or f(c,syncard))
end
function c64910482.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
function s.syncheck(c,g,mg,tp,lv,syncard,minc,maxc)
g:AddCard(c)
local ct=g:GetCount()
local res=c64910482.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(c64910482.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
local res=s.syngoal(g,tp,lv,syncard,minc,ct)
or (ct<maxc and mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc))
g:RemoveCard(c)
return res
end
function c64910482.syngoal(g,tp,lv,syncard,minc,ct)
function s.syngoal(g,tp,lv,syncard,minc,ct)
return ct>=minc
and g:CheckWithSumEqual(Card.GetSynchroLevel,lv,ct,ct,syncard)
and Duel.GetLocationCountFromEx(tp,tp,g,syncard)>0
and aux.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL)
end
function c64910482.syntg(e,syncard,f,min,max)
function s.syntg(e,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
......@@ -52,29 +60,29 @@ function c64910482.syntg(e,syncard,f,min,max)
local lv=syncard:GetLevel()
if lv<=c:GetLevel() then return false end
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(c64910482.synfilter1,c,syncard,c,f)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter1,c,syncard,c,f)
if syncard:IsSetCard(0x27) then
local exg=Duel.GetMatchingGroup(c64910482.synfilter2,tp,LOCATION_HAND,0,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(s.synfilter2,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
end
return mg:IsExists(c64910482.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
return mg:IsExists(s.syncheck,1,g,g,mg,tp,lv,syncard,minc,maxc)
end
function c64910482.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
function s.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
local minc=min+1
local maxc=max+1
local c=e:GetHandler()
local lv=syncard:GetLevel()
local g=Group.FromCards(c)
local mg=Duel.GetSynchroMaterial(tp):Filter(c64910482.synfilter1,c,syncard,c,f)
local mg=Duel.GetSynchroMaterial(tp):Filter(s.synfilter1,c,syncard,c,f)
if syncard:IsSetCard(0x27) then
local exg=Duel.GetMatchingGroup(c64910482.synfilter2,tp,LOCATION_HAND,0,c,syncard,c,f)
local exg=Duel.GetMatchingGroup(s.synfilter2,tp,LOCATION_HAND,0,c,syncard,c,f)
mg:Merge(exg)
end
for i=1,maxc do
local cg=mg:Filter(c64910482.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
local cg=mg:Filter(s.syncheck,g,g,mg,tp,lv,syncard,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if c64910482.syngoal(g,tp,lv,syncard,minc,i) then
if s.syngoal(g,tp,lv,syncard,minc,i) then
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
......@@ -84,37 +92,37 @@ function c64910482.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,min,max)
end
Duel.SetSynchroMaterial(g)
end
function c64910482.regop(e,tp,eg,ep,ev,re,r,rp)
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_DESTROY) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64910482,0))
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_GRAVE)
e1:SetTarget(c64910482.thtg)
e1:SetOperation(c64910482.thop)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c64910482.filter(c)
return c:IsSetCard(0x27) and not c:IsCode(64910482) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
function s.filter(c)
return c:IsSetCard(0x27) and not c:IsCode(id) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c64910482.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c64910482.filter,tp,LOCATION_DECK,0,1,nil) end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c64910482.thop(e,tp,eg,ep,ev,re,r,rp)
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c64910482.filter,tp,LOCATION_DECK,0,1,1,nil)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c64910482.hsyntg(e,c,syncard)
function s.hsyntg(e,c,syncard)
return c:IsSetCard(0x27) and c:IsNotTuner(syncard)
end
......@@ -3384,40 +3384,48 @@ Synchro.Role={
}
--- Shadowing Duel.GetSynchroMaterial as we have different definition on hand materials
function Synchro.GetSynchroMaterial(tp,tc)
function Synchro.GetSynchroMaterial(tp,tc,base_mapper)
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
if not (mc:IsFaceup() and mc:IsOnField()) then
return false
end,tp,0,LOCATION_MZONE,nil)
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
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
return true
end,nil)
end
return true
end,nil)
--- it must have a level
mg=mg:Filter(function(mc)
local lvls=base_mapper(mc,tc)
if #lvls==0 then
return false
end
return true
end,nil)
return mg
end
......@@ -3700,7 +3708,7 @@ function Synchro.SynCondition(tuner_race,tuner_filter,non_tuner_race,non_tuner_f
end
local target_level=c:GetLevel()
mg=mg or Synchro.GetSynchroMaterial(c:GetControler(),c)
mg=mg or Synchro.GetSynchroMaterial(c:GetControler(),c,base_mapper)
local smat_states=nil
local smat_arr=nil
......@@ -3739,7 +3747,7 @@ function Synchro.SynTarget(tuner_race,tuner_filter,non_tuner_race,non_tuner_filt
e:SetLabelObject(mg)
return true
end
mg=mg or Synchro.GetSynchroMaterial(tp,tc)
mg=mg or Synchro.GetSynchroMaterial(tp,tc,base_mapper)
-- add リペア・ジェネクス・コントローラー to scheck
if Duel.IsPlayerAffectedByEffect(tp,8173184) then
......@@ -3979,6 +3987,7 @@ function Synchro.DefaultLevelMapper(card,tc)
level_dict[val]=true
end
end
effs={card:IsHasEffect(61052897)} --- レアル・ジェネクス・チューリング
if #effs>0 then
local val=effs[1]:GetValue()(effs[1],tc)
......@@ -3989,7 +3998,9 @@ function Synchro.DefaultLevelMapper(card,tc)
if not mandatory then
-- include original level
level_dict[card:GetLevel()]=true
if card:IsLevelAbove(1) then
level_dict[card:GetLevel()]=true
end
end
-- Convert dictionary keys back to array
......
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