Commit 2f0cfc2b authored by nanahira's avatar nanahira
parents 586418ad b407b8a2
language: cpp
dist: trusty
git:
submodules: false
addons:
ssh_known_hosts:
- github.com
apt:
packages:
- libevent-dev
- libsqlite3-dev
env:
- DATABASE_FILE=expansions/7cgl.cdb
before_install:
- git clone --depth=1 --branch=server --recursive https://github.com/purerosefallen/ygopro
- cd ygopro
- git submodule foreach git checkout master
- ln -s ./../expansions .
- wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz | tar zfx -
- wget -O - https://www.lua.org/ftp/lua-5.3.4.tar.gz | tar zfx -; cd lua-5.3.4; sudo make linux install; cd ..
- ./premake5 gmake
- cd build
- make config=release
- cd ..
- mv -f ./bin/release/ygopro .
- strip ygopro
- mkdir replay
script:
- echo "select id from datas;" | sqlite3 $DATABASE_FILE | xargs -I {} ./ygopro {} 2>&1 | tee ../redtext.txt
- cd ..
- bash -c "exit $(cat ./redtext.txt | wc -l)"
No preview for this file type
......@@ -31,11 +31,12 @@ function cm.initial_effect(c)
--xm
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_OVERLAY_REMOVE_COST_CHANGE_KOISHI)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(cm.rcon)
e2:SetOperation(aux.TRUE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetValue(cm.rval)
c:RegisterEffect(e2)
end
function cm.immfilter(e,te)
......@@ -77,9 +78,8 @@ end
function cm.xmfilter(c)
return Senya.check_set_elem(c) and c:IsType(TYPE_XYZ) and c:GetRank()==4
end
function cm.rcon(e,tp,eg,ep,ev,re,r,rp)
return (r & REASON_COST)~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and Senya.check_set_elem(re:GetHandler()) and e:GetHandler():GetOverlayGroup():IsExists(cm.xmfilter,1,nil)
and re:GetHandler()~=e:GetHandler()
function cm.rval(e,re,tp,ct,r,c)
if r&REASON_COST~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and Senya.check_set_elem(re:GetHandler()) and e:GetHandler():GetOverlayGroup():IsExists(cm.xmfilter,1,nil) and re:GetHandler()~=e:GetHandler() then return 0 else return ct end
end
......@@ -27,6 +27,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and Duel.GetMZoneCount(tp)>0
and Duel.GetLocationCountFromEx(tp)>0
and Senya.MustMaterialCheck(nil,tp,EFFECT_MUST_BE_XMATERIAL)
and Duel.IsExistingTarget(cm.filter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.GetFlagEffect(tp,m)==0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cm.filter1,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
......@@ -39,7 +40,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end
Duel.RegisterFlagEffect(tp,m,0,0,0)
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end
if Duel.GetLocationCountFromEx(tp,tp,tc)<=0 then return end
if Duel.GetLocationCountFromEx(tp,tp,tc)<=0 or not Senya.MustMaterialCheck(tc,tp,EFFECT_MUST_BE_XMATERIAL) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1)
local sc=g:GetFirst()
......
--元灵的彼岸·Senya
local m=37564058
local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
cm.Senya_name_with_elem=true
function cm.initial_effect(c)
Senya.AddSummonMusic(c,aux.Stringid(m,2),SUMMON_TYPE_LINK)
--link summon
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLevel,4),2,2)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_OVERLAY_REMOVE_COST_CHANGE_KOISHI)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetValue(cm.rval)
c:RegisterEffect(e2)
local e1=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetTarget(cm.tg)
e1:SetOperation(cm.op)
c:RegisterEffect(e1)
end
function cm.rval(e,re,tp,ct,r,c)
if r&REASON_COST~=0 and re:IsHasType(0x7e0) and re:IsActiveType(TYPE_XYZ) and Senya.check_set_elem(re:GetHandler()) and e:GetHandler():GetLinkedGroup():IsContains(re:GetHandler()) then return 0 else return ct end
end
function cm.filter(c,e,tp)
return c:IsFaceup() and e:GetHandler():GetLinkedGroup():IsContains(c)
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c)
end
function cm.spfilter(c,e,tp,tc)
return c:IsType(TYPE_XYZ) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Senya.check_set_elem(c) and tc:IsCanBeXyzMaterial(c) and Duel.GetLocationCountFromEx(tp,tp,tc,c)>0 and Senya.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and c:IsAttribute(tc:GetAttribute()) and cm.mcheck(c,tc)
end
function cm.mcheck(c,tc)
if tc:IsStatus(STATUS_NO_LEVEL) then
return false
elseif tc:IsType(TYPE_XYZ) then
return c:IsRank(tc:GetRank()+1)
elseif tc:IsType(TYPE_LINK) then
return c:IsRank(tc:GetLink()*2)
else
return c:IsRank(tc:GetLevel())
end
end
function cm.mcheck_chkc(c,tc)
if tc:IsStatus(STATUS_NO_LEVEL) then
return false
elseif tc:IsType(TYPE_XYZ) then
return c:IsRank(tc:GetRank())
elseif tc:IsType(TYPE_LINK) then
return c:IsLink(tc:GetLink())
else
return c:IsLevel(tc:GetLevel())
end
end
function cm.chkfilter(c,tc,e)
return c:IsFaceup() and c:GetType()&tc:GetType()==tc:GetType() and cm.mcheck_chkc(c,tc) and Duel.GetLocationCountFromEx(tp,tp,c)>0 and e:GetHandler():GetLinkedGroup():IsContains(c)
end
function cm.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and cm.chkfilter(chkc,e:GetLabelObject(),e) end
if chk==0 then return Duel.IsExistingTarget(cm.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,0))
local g=Duel.SelectTarget(tp,cm.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
e:SetLabelObject(g:GetFirst())
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
if #mg~=0 then
Duel.Overlay(sc,mg)
end
sc:SetMaterial(Group.FromCards(c))
Duel.Overlay(sc,tc)
Duel.SpecialSummon(g,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
......@@ -24,7 +24,8 @@ function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterEffect(e1,tp)
end
function cm.filter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,false,false)
local bool=aux.PendulumSummonableBool(c)
return c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
and (c:IsLocation(LOCATION_HAND) or c:IsFaceup())
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -33,7 +34,7 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,3,tp,LOCATION_HAND)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ft=math.min(Duel.GetMZoneCount(tp),3)
local ft=math.min((Duel.GetMZoneCount(tp)),3)
if ft<=0 then return end
if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end
local tg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_HAND,0,nil,e,tp)
......
......@@ -51,7 +51,7 @@ function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(cm.rmfilter,tp,0,LOCATION_GRAVE,nil)
local ct=math.min(Duel.GetLocationCount(tp,LOCATION_SZONE),#g)
local ct=math.min((Duel.GetLocationCount(tp,LOCATION_SZONE)),#g)
if ct==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local fg=Group.CreateGroup()
......
--群星的彼岸·罗莎塔
local m=37564344
local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2,4,cm.lcheck)
c:EnableReviveLimit()
Senya.AddSummonMusic(c,aux.Stringid(m,0),SUMMON_TYPE_LINK)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_IMMUNE_EFFECT)
e3:SetValue(cm.efilter)
c:RegisterEffect(e3)
Senya.NegateEffectModule(c,1,m,nil,function(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasProperty(EFFECT_FLAG_CARD_TARGET)
end)
end
function cm.lcheck(g,lc)
return g:IsExists(Card.IsLinkType,1,nil,TYPE_XYZ)
end
function cm.efilter(e,re,rp)
if e:GetHandlerPlayer()==re:GetHandlerPlayer() then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return true end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
return not g:IsContains(e:GetHandler())
end
\ No newline at end of file
......@@ -55,7 +55,7 @@ function cm.tdop(e,tp,eg,ep,ev,re,r,rp)
local rct=Duel.SendtoHand(g1,nil,REASON_EFFECT)
local tsg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_HAND,0,nil,e,tp)
local minct=math.min(#tsg,rct)
minct=math.min(minct,Duel.GetMZoneCount(tp,nil,tp,LOCATION_REASON_TOFIELD,z))
minct=math.min(minct,(Duel.GetMZoneCount(tp,nil,tp,LOCATION_REASON_TOFIELD,z)))
if minct<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g2=tsg:Select(tp,1,minct,nil)
......
......@@ -79,7 +79,7 @@ function cm.rmop(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(cm.sfilter,tp,LOCATION_DECK+LOCATION_EXTRA,0,nil,e,tp)
local ft=math.min(Duel.GetUsableMZoneCount(tp),ct)
local mft=Duel.GetMZoneCount(tp)
local eft=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and math.min(c29724053[tp],Duel.GetLocationCountFromEx(tp)) or Duel.GetLocationCountFromEx(tp)
local eft=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and math.min(c29724053[tp],(Duel.GetLocationCountFromEx(tp))) or Duel.GetLocationCountFromEx(tp)
local tg=Senya.SelectGroup(tp,HINTMSG_SPSUMMON,sg,cm.gcheck,nil,1,ft,mft,eft)
local etg=tg:Filter(Card.IsLocation,nil,LOCATION_EXTRA)
tg:Sub(etg)
......
--Sound Voltex
local m=37564567
local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_GRAVE)
e1:SetCost(aux.bfgcost)
e1:SetTarget(cm.target1)
e1:SetOperation(cm.activate1)
c:RegisterEffect(e1)
end
function cm.sfilter(c)
return c.Senya_desc_with_nanahira and (c:IsSpecialSummonable(SUMMON_TYPE_LINK) or c:IsSpecialSummonable(SUMMON_TYPE_SYNCHRO) or c:IsSpecialSummonable(SUMMON_TYPE_XYZ))
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_EXTRA,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,cm.sfilter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummonRule(tp,tc)
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function cm.filter(c,e)
local code=c:GetOriginalCode()
return c:IsFaceup() and c:IsCanBeEffectTarget(e) and (code==37564765 or code==37564565)
end
function cm.xyzfilter(c,mg)
return c:IsXyzSummonable(mg,2,2)
end
function cm.mfilter1(c,mg,exg,tp)
return mg:IsExists(cm.mfilter2,1,c,c,exg,tp)
end
function cm.mfilter2(c,mc,exg,tp)
local code1=c:GetOriginalCode()
local code2=mc:GetOriginalCode()
local g=Group.FromCards(c,mc)
return code1~=code2 and exg:IsExists(Card.IsXyzSummonable,1,nil,g) and Duel.GetLocationCountFromEx(tp,tp,g)>0
end
function cm.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(cm.filter,tp,LOCATION_MZONE,0,nil,e)
local exg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
if chk==0 then return mg:IsExists(cm.mfilter1,1,nil,mg,exg,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg1=mg:FilterSelect(tp,cm.mfilter1,1,1,nil,mg,exg,tp)
local tc1=sg1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local sg2=mg:FilterSelect(tp,cm.mfilter2,1,1,tc1,tc1,exg,tp)
sg1:Merge(sg2)
Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function cm.tfilter(c,e)
return c:IsRelateToEffect(e) and c:IsFaceup()
end
function cm.activate1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(cm.tfilter,nil,e)
if g:GetCount()<2 then return end
if Duel.GetLocationCountFromEx(tp,tp,g)<=0 then return end
local xyzg=Duel.GetMatchingGroup(cm.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
if xyzg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
local xyzmt=getmetatable(xyz)
local oldf=xyzmt.SetMaterial
xyzmt.SetMaterial=cm.ReplaceSetMaterial
Duel.XyzSummon(tp,xyz,g)
xyzmt.SetMaterial=oldf
end
end
function cm.ReplaceSetMaterial(c,...)
local res={Card.SetMaterial(c,...)}
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ADJUST)
e2:SetRange(LOCATION_MZONE)
e2:SetLabel(Senya.order_table_new({}))
e2:SetOperation(cm.op)
e2:SetReset(RESET_EVENT+0xfe0000)
c:RegisterEffect(e2,true)
local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(m-1000)
ex:SetReset(RESET_EVENT+0xfe0000)
c:RegisterEffect(ex,true)
local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetCode(EFFECT_ADD_CODE)
ex:SetValue(37564765)
ex:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
ex:SetReset(RESET_EVENT+0xfe0000)
c:RegisterEffect(ex,true)
cm.op(e2,c:GetControler())
return table.unpack(res)
end
function cm.copyfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not c:IsType(TYPE_TRAPMONSTER)
end
function cm.gfilter(c,g)
if not g then return true end
return not g:IsContains(c)
end
function cm.gfilter1(c,g)
if not g then return true end
return not g:IsExists(cm.gfilter2,1,nil,c:GetOriginalCode())
end
function cm.gfilter2(c,code)
return c:GetOriginalCode()==code
end
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local copyt=Senya.order_table[e:GetLabel()]
local exg=Group.CreateGroup()
for tc,cid in pairs(copyt) do
if tc and cid then exg:AddCard(tc) end
end
local g=Duel.GetMatchingGroup(cm.copyfilter,tp,0,LOCATION_MZONE,nil)
local dg=exg:Filter(cm.gfilter,nil,g)
for tc in aux.Next(dg) do
c:ResetEffect(copyt[tc],RESET_COPY)
exg:RemoveCard(tc)
copyt[tc]=nil
end
local cg=g:Filter(cm.gfilter1,nil,exg)
local f=Card.RegisterEffect
Card.RegisterEffect=function(tc,e,forced)
e:SetCondition(cm.rcon(e:GetCondition(),tc,copyt))
f(tc,e,forced)
end
for tc in aux.Next(cg) do
copyt[tc]=c:CopyEffect(tc:GetOriginalCode(),RESET_EVENT+0xfe0000,1)
end
Card.RegisterEffect=f
end
function cm.rcon(con,tc,copyt)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsHasEffect(m-1000) then
c:ResetEffect(c,copyt[tc],RESET_COPY)
copyt[tc]=nil
return false
end
return not con or con(e,tp,eg,ep,ev,re,r,rp)
end
end
\ No newline at end of file
......@@ -167,7 +167,7 @@ function cm.SelectGroupNew(tp,desc,cancelable,g,f,cg,min,max,...)
local seg=sg:Clone()
seg:Sub(cg)
local finish=(#sg>=min and #sg<=max and f(sg,...))
local cancel=finish or (cancelable and #seg==0)
local cancel=cancelable and not finish
local dmin=#sg
local dmax=math.min(max,#g)
local tc=nil
......@@ -257,19 +257,8 @@ end
function cm.XyzProcedureRankCheck(g,xyzc)
return g:GetClassCount(Card.GetRank)==1
end
function cm.XyzProcedureCustomTuneMagicianFilter(c,te)
local f=te:GetValue()
return f(te,c)
end
function cm.XyzProcedureCustomTuneMagicianCheck(c,g)
local eset={c:IsHasEffect(EFFECT_TUNE_MAGICIAN_X)}
for _,te in ipairs(eset) do
if g:IsExists(cm.XyzProcedureCustomTuneMagicianFilter,1,c,te) then return true end
end
return false
end
function cm.XyzProcedureCustomCheck(g,xyzc,tp,gf)
if g:IsExists(cm.XyzProcedureCustomTuneMagicianCheck,1,nil,g) then return false end
if g:IsExists(aux.TuneMagicianCheckX,nil,g,EFFECT_TUNE_MAGICIAN_X) then return false end
return not gf or gf(g,xyzc,tp)
end
function cm.AddXyzProcedureCustom(c,func,gf,minc,maxc,xm,exop,...)
......@@ -1034,7 +1023,8 @@ function cm.PConditionFilterNanahira(c,e,tp,lscale,rscale,f,tc)
else
lv=c:GetLevel()
end
return lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,false,false)
local bool=aux.PendulumSummonableBool(c)
return lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
and not c:IsForbidden() and (not f or f(c,tc))
end
function cm.PendConditionNanahira()
......@@ -1360,6 +1350,16 @@ function cm.CopySpellModule(c,loc1,loc2,f,con,cost,ctlm,ctlmid,eloc,x)
c:RegisterEffect(e3)
return e2,e3
end
function cm.ProtectedRun(f,...)
if not f then return true end
local params={...}
local ret={}
local res_test=pcall(function()
ret={f(table.unpack(params))}
end)
if not res_test then return false end
return table.unpack(ret)
end
function cm.ForbiddenCost(costf)
return function(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
......@@ -1377,7 +1377,7 @@ return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and (not tg or tg(e,tp,eg,ep,ev,re,r,rp,0,chkc))
return te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
local og=Duel.GetFieldGroup(tp,loc1,loc2)
if x then og:Merge(e:GetHandler():GetOverlayGroup()) end
......@@ -1416,7 +1416,7 @@ function cm.CopyOperation(e,tp,eg,ep,ev,re,r,rp)
if te:IsHasType(EFFECT_TYPE_ACTIVATE) then
e:GetHandler():ReleaseEffectRelation(e)
end
if op then op(e,tp,eg,ep,ev,re,r,rp) end
cm.ProtectedRun(op,e,tp,eg,ep,ev,re,r,rp)
end
function cm.CopySpellChainingFilter(c,e,tp,eg,ep,ev,re,r,rp,f)
if (c:GetType()==TYPE_SPELL or c:GetType()==TYPE_SPELL+TYPE_QUICKPLAY
......@@ -1425,7 +1425,7 @@ function cm.CopySpellChainingFilter(c,e,tp,eg,ep,ev,re,r,rp,f)
local te=c:GetActivateEffect()
if te:GetCode()~=EVENT_CHAINING then return false end
local tg=te:GetTarget()
if tg and not tg(e,tp,eg,ep,ev,re,r,rp,0) then return false end
if not cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,0) then return false end
return true
else return false end
end
......@@ -1460,9 +1460,9 @@ return function(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tg=te:GetTarget()
if tg then
if fchain then
tg(e,tp,ceg,cep,cev,cre,cr,crp,1)
cm.ProtectedRun(tg,e,tp,ceg,cep,cev,cre,cr,crp,1)
else
tg(e,tp,eg,ep,ev,re,r,rp,1)
cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,1)
end
end
te:SetLabelObject(e:GetLabelObject())
......@@ -1503,7 +1503,7 @@ function cm.InstantCopyTarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and (not tg or tg(e,tp,eg,ep,ev,re,r,rp,0,chkc))
return te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
local te=re:Clone()
local tg=te:GetTarget()
......@@ -1517,20 +1517,17 @@ function cm.InstantCopyTarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
e:SetLabel(0)
local res=false
if not tg then return true end
if not pcall(function()
if tres then res=tg(e,tp,teg,tep,tev,tre,tr,trp,0)
else res=tg(e,tp,eg,ep,ev,re,r,rp,0) end
end) then return false end
return res
if tres then return cm.ProtectedRun(tg,e,tp,teg,tep,tev,tre,tr,trp,0)
else return cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,0) end
end
e:SetLabel(te:GetLabel())
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
if tg then
if tres then
tg(e,tp,teg,tep,tev,tre,tr,trp,1)
cm.ProtectedRun(tg,e,tp,teg,tep,tev,tre,tr,trp,1)
else
tg(e,tp,eg,ep,ev,re,r,rp,1)
cm.ProtectedRun(tg,e,tp,eg,ep,ev,re,r,rp,1)
end
end
te:SetLabelObject(e:GetLabelObject())
......@@ -1609,7 +1606,7 @@ function cm.FusionFilter_3L(c,fc,mf,sub)
end
function cm.FusionCheck_3L(g,min,tp,fc,f,chkf,sub)
--check sayuri_3L
if g:IsExists(aux.FCheckTuneMagicianX,1,nil,g) then return false end
if g:IsExists(aux.TuneMagicianCheckX,nil,g,EFFECT_TUNE_MAGICIAN_F) then return false end
if chkf~=PLAYER_NONE and Duel.GetLocationCountFromEx(chkf,tp,g,fc)<=0 then return false end
if aux.FCheckAdditional and not aux.FCheckAdditional(tp,g,fc) then return false end
if #g==1 and fc:GetLevel()==7 and g:GetFirst():IsHasEffect(37564914) then return true end
......@@ -2333,31 +2330,13 @@ function cm.CheckSummonLocation(c,tp,g)
return Duel.GetMZoneCount(tp,g,tp)>0
end
function cm.AND(...)
local t={...}
return function(...)
local res=false
for i,f in pairs(t) do
res=f(...)
if not res then return res end
end
return res
end
return aux.AND(...)
end
function cm.OR(...)
local t={...}
return function(...)
local res=false
for i,f in pairs(t) do
res=f(...)
if res then return res end
end
return res
end
return aux.OR(...)
end
function cm.NOT(f)
return function(...)
return not f(...)
end
return aux.NOT(f)
end
function cm.DirectReturn(...)
local t={...}
......
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