Commit 06a8a0f8 authored by Nemo Ma's avatar Nemo Ma

fix

parent e1ac32cb
--version 20.02.04 --version 20.02.18
if not pcall(function() require("expansions/script/c10199991") end) then require("script/c10199991") end if not pcall(function() require("expansions/script/c10199991") end) then require("script/c10199991") end
local m=10199990 local m=10199990
local vm=10199991 local vm=10199991
local Version_Number=20200204 local Version_Number=20200218
-----------------------"Part_Effect_Base"----------------------- -----------------------"Part_Effect_Base"-----------------------
...@@ -138,11 +138,12 @@ function rsef.RegisterClone(cardtbl,e1,...) ...@@ -138,11 +138,12 @@ function rsef.RegisterClone(cardtbl,e1,...)
local f=effecttypelist1[k] local f=effecttypelist1[k]
f(e2,value2) f(e2,value2)
end end
if value=="flag" then e2:SetProperty(rsflag.GetRegisterProperty(value2)) end if value1=="desc" then rsef.RegisterDescription(e2,value2) end
if value=="cate" then e2:SetCategory(rscate.GetRegisterCategory(value2)) end if value1=="flag" then e2:SetProperty(rsflag.GetRegisterProperty(value2)) end
if value=="reset" then rsef.RegisterReset(e2,value2) end if value1=="cate" then e2:SetCategory(rscate.GetRegisterCategory(value2)) end
if value=="timing" then rsef.RegisterTiming(e2,value2) end if value1=="reset" then rsef.RegisterReset(e2,value2) end
if value=="tgrange" then rsef.RegisterTargetRange(e2,value2) end if value1=="timing" then rsef.RegisterTiming(e2,value2) end
if value1=="tgrange" then rsef.RegisterTargetRange(e2,value2) end
end end
end end
local _,fid=rsef.RegisterEffect(cardtbl,e2) local _,fid=rsef.RegisterEffect(cardtbl,e2)
...@@ -615,7 +616,7 @@ function rsef.FV_UPDATE(cardtbl,uptypetbl,valtbl,tg,tgrangetbl,con,resettbl,flag ...@@ -615,7 +616,7 @@ function rsef.FV_UPDATE(cardtbl,uptypetbl,valtbl,tg,tgrangetbl,con,resettbl,flag
local codetbl1={"atk","def","lv","rk","ls","rs"} local codetbl1={"atk","def","lv","rk","ls","rs"}
local codetbl2={ EFFECT_UPDATE_ATTACK,EFFECT_UPDATE_DEFENSE,EFFECT_UPDATE_LEVEL,EFFECT_UPDATE_RANK,EFFECT_UPDATE_LSCALE,EFFECT_UPDATE_RSCALE } local codetbl2={ EFFECT_UPDATE_ATTACK,EFFECT_UPDATE_DEFENSE,EFFECT_UPDATE_LEVEL,EFFECT_UPDATE_RANK,EFFECT_UPDATE_LSCALE,EFFECT_UPDATE_RSCALE }
local effectcodetbl,effectvaluetbl=rsof.Table_Suit(uptypetbl,codetbl1,codetbl2,valtbl) local effectcodetbl,effectvaluetbl=rsof.Table_Suit(uptypetbl,codetbl1,codetbl2,valtbl)
if not tgrangetbl then tgrangetbl={ LOCATION_MZONE,0 } end if not tgrangetbl then tgrangetbl={ LOCATION_MZONE,LOCATION_MZONE } end
local resulteffecttbl={} local resulteffecttbl={}
local range=rsef.GetRegisterRange(cardtbl) local range=rsef.GetRegisterRange(cardtbl)
for k,effectcode in ipairs(effectcodetbl) do for k,effectcode in ipairs(effectcodetbl) do
...@@ -648,6 +649,20 @@ function rsef.FV_CHANGE(cardtbl,changetypetbl,valtbl,tg,tgrangetbl,con,resettbl, ...@@ -648,6 +649,20 @@ function rsef.FV_CHANGE(cardtbl,changetypetbl,valtbl,tg,tgrangetbl,con,resettbl,
end end
return table.unpack(resulteffecttbl) return table.unpack(resulteffecttbl)
end end
--Field Val Effect: Directly set other card attribute,except ATK & DEF
function rsef.FV_ADD(cardtbl,addtypetbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl)
local codetbl1={"code","set","att","race","fuscode","fusset","fusatt","linkcode","linkset","linkatt","linkrace"}
local codetbl2={ EFFECT_ADD_CODE,EFFECT_ADD_SETCODE,EFFECT_ADD_ATTRIBUTE,EFFECT_ADD_RACE,EFFECT_ADD_FUSION_CODE,EFFECT_ADD_FUSION_SETCODE,EFFECT_ADD_FUSION_ATTRIBUTE,EFFECT_ADD_LINK_CODE,EFFECT_ADD_LINK_SETCODE,EFFECT_ADD_LINK_ATTRIBUTE,EFFECT_ADD_LINK_RACE }
local effectcodetbl,effectvaluetbl=rsof.Table_Suit(addtypetbl,codetbl1,codetbl2,valtbl)
local resulteffecttbl={}
local range=rsef.GetRegisterRange(cardtbl)
local tgrangetbl2=tgrangetbl or { LOCATION_MZONE,LOCATION_MZONE }
for k,effectcode in ipairs(effectcodetbl) do
local e1=rsef.FV(cardtbl,effectcode,effectvaluetbl[k],tg,tgrangetbl2,range,con,resettbl,flag,desctbl)
table.insert(resulteffecttbl,e1)
end
return table.unpack(resulteffecttbl)
end
--Field Val Effect: Cannot Disable --Field Val Effect: Cannot Disable
function rsef.FV_CANNOT_DISABLE(cardtbl,distbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl) function rsef.FV_CANNOT_DISABLE(cardtbl,distbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl)
local codetbl1={"dis","dise","act","sum","sp"} local codetbl1={"dis","dise","act","sum","sp"}
...@@ -739,8 +754,8 @@ function rsef.FV_LIMIT(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desc ...@@ -739,8 +754,8 @@ function rsef.FV_LIMIT(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desc
end end
--Field Val Effect: Other Limit (affect Player) --Field Val Effect: Other Limit (affect Player)
function rsef.FV_LIMIT_PLAYER(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl) function rsef.FV_LIMIT_PLAYER(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl)
local codetbl1={"act","sum","sp","th","dr","td","tg","res","rm","sbp","sm1","sm2","sdp","ssp","sset","mset","dish","disd"} local codetbl1={"act","sum","sp","th","dr","td","tg","res","rm","sbp","sm1","sm2","sdp","ssp","sset","mset","dish","disd","fp"}
local codetbl2={ EFFECT_CANNOT_ACTIVATE,EFFECT_CANNOT_SUMMON,EFFECT_CANNOT_SPECIAL_SUMMON,EFFECT_CANNOT_TO_HAND,EFFECT_CANNOT_DRAW,EFFECT_CANNOT_TO_DECK,EFFECT_CANNOT_TO_GRAVE,EFFECT_CANNOT_RELEASE,EFFECT_CANNOT_REMOVE,EFFECT_CANNOT_BP,EFFECT_SKIP_M1,EFFECT_SKIP_M2,EFFECT_SKIP_DP,EFFECT_SKIP_SP,EFFECT_CANNOT_SSET,EFFECT_CANNOT_MSET,EFFECT_CANNOT_DISCARD_HAND,EFFECT_CANNOT_DISCARD_DECK } local codetbl2={ EFFECT_CANNOT_ACTIVATE,EFFECT_CANNOT_SUMMON,EFFECT_CANNOT_SPECIAL_SUMMON,EFFECT_CANNOT_TO_HAND,EFFECT_CANNOT_DRAW,EFFECT_CANNOT_TO_DECK,EFFECT_CANNOT_TO_GRAVE,EFFECT_CANNOT_RELEASE,EFFECT_CANNOT_REMOVE,EFFECT_CANNOT_BP,EFFECT_SKIP_M1,EFFECT_SKIP_M2,EFFECT_SKIP_DP,EFFECT_SKIP_SP,EFFECT_CANNOT_SSET,EFFECT_CANNOT_MSET,EFFECT_CANNOT_DISCARD_HAND,EFFECT_CANNOT_DISCARD_DECK,EFFECT_CANNOT_FLIP_SUMMON }
local effectcodetbl,effectvaluetbl=rsof.Table_Suit(lotbl,codetbl1,codetbl2,valtbl) local effectcodetbl,effectvaluetbl=rsof.Table_Suit(lotbl,codetbl1,codetbl2,valtbl)
local resulteffecttbl={} local resulteffecttbl={}
local range=rsef.GetRegisterRange(cardtbl) local range=rsef.GetRegisterRange(cardtbl)
...@@ -2204,12 +2219,24 @@ function rscost.regflag(flagcode,resettbl) ...@@ -2204,12 +2219,24 @@ function rscost.regflag(flagcode,resettbl)
return function(e,tp,eg,ep,ev,re,r,rp,chk) return function(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
local code=c:GetOriginalCode() local code=c:GetOriginalCode()
if not flagcode then flagcode=code end flagcode = flagcode or code
if chk==0 then return c:GetFlagEffect(flagcode)==0 end if chk==0 then return c:GetFlagEffect(flagcode)==0 end
c:RegisterFlagEffect(flagcode,resettbl[1],0,resetcount) c:RegisterFlagEffect(flagcode,resettbl[1],0,resetcount)
end end
end end
function rscost.regflag2(flagcode,resettbl)
if not resettbl then resettbl=RESET_CHAIN end
if type(resettbl)~="table" then resettbl={resettbl} end
local resetcount= resettbl[2]
if not resetcount then resetcount=1 end
return function(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local code=c:GetOriginalCode()
flagcode = flagcode or code
if chk==0 then return Duel.GetFlagEffect(tp,flagcode)==0 end
Duel.RegisterFlagEffect(tp,flagcode,RESET_CHAIN,0,1)
end
end
-------------------"Part_Condition_Function"--------------------- -------------------"Part_Condition_Function"---------------------
--Condition in Self Turn --Condition in Self Turn
...@@ -2239,17 +2266,19 @@ function rscon.phase(p1,...) ...@@ -2239,17 +2266,19 @@ function rscon.phase(p1,...)
local phase_ndcal=function() local phase_ndcal=function()
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated() return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end end
local stringlist={"dp","sp","m1","bp","bsp","dam","damndcal","dambdcal","dcal","ndcal","m2","ep"} local stringlist={"dp","sp","mp1","bp","bsp","dam","damndcal","dambdcal","dcal","ndcal","mp2","ep"}
local phaselist={PHASE_DRAW,PHASE_STANDBY,PHASE_MAIN1,phase_bp,PHASE_BATTLE_STEP,phase_dam,PHASE_DAMAGE,phase_dambdcal,PHASE_DAMAGE_CAL,phase_ndcal,PHASE_MAIN2,PHASE_END } local phaselist={PHASE_DRAW,PHASE_STANDBY,PHASE_MAIN1,phase_bp,PHASE_BATTLE_STEP,phase_dam,PHASE_DAMAGE,phase_dambdcal,PHASE_DAMAGE_CAL,phase_ndcal,PHASE_MAIN2,PHASE_END }
local mainstringlist={}
local turnplayerlist={} local turnplayerlist={}
local parlist2=rsof.String_Number_To_Table(parlist) local parlist2=rsof.String_Number_To_Table(parlist)
for _,pstring in pairs(parlist2) do for _,pstring in pairs(parlist2) do
local _,splitstring=rsof.String_NoSymbol(pstring) local mainstring,splitstring=rsof.String_NoSymbol(pstring)
table.insert(mainstringlist,mainstring)
table.insert(turnplayerlist,splitstring) table.insert(turnplayerlist,splitstring)
end end
local phaselist2=rsof.Table_Suit(parlist2,stringlist,phaselist) local phaselist2=rsof.Table_Suit(mainstringlist,stringlist,phaselist)
for index,phase in pairs(phaselist2) do for index,phase in pairs(phaselist2) do
if turnplayerlist[index] then if turnplayerlist[index] then
if (turnplayerlist[index]=="_s" and turnp~=tp) or (turnplayerlist[index]=="_o" and turnp==tp ) then return false end if (turnplayerlist[index]=="_s" and turnp~=tp) or (turnplayerlist[index]=="_o" and turnp==tp ) then return false end
end end
if type(phase)=="number" and Duel.GetCurrentPhase()==phase then return true if type(phase)=="number" and Duel.GetCurrentPhase()==phase then return true
...@@ -2261,7 +2290,7 @@ function rscon.phase(p1,...) ...@@ -2261,7 +2290,7 @@ function rscon.phase(p1,...)
end end
--Condition in Main Phase --Condition in Main Phase
function rscon.phmp(e) function rscon.phmp(e)
return rscon.phase("m1,m2") return rscon.phase("mp1,mp2")
end end
--Condition: Phase no damage calculate , for change atk/def --Condition: Phase no damage calculate , for change atk/def
function rscon.adcon(e) function rscon.adcon(e)
...@@ -2279,7 +2308,10 @@ end ...@@ -2279,7 +2308,10 @@ end
function rscon.sumtype(sumtbl,sumfilter,matchall) function rscon.sumtype(sumtbl,sumfilter,matchall)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local checkg=e:IsHasType(EFFECT_TYPE_FIELD) and rsgf.Mix2(c) or eg:Clone() sumfilter=sumfilter or aux.TRUE
local code=e:GetCode()
local fieldres=(code==EVENT_SUMMON_SUCCESS or code==EVENT_SPSUMMON_SUCCESS or code==EVENT_FLIP_SUMMON_SUCCESS ) and e:IsHasType(EFFECT_TYPE_FIELD)
local checkg=not fieldres and rsgf.Mix2(c) or eg:Clone()
sumtbl=sumtbl or "sp" sumtbl=sumtbl or "sp"
local tf=false local tf=false
local codetbl1={"sp","adv","rit","fus","syn","xyz","link","pen"} local codetbl1={"sp","adv","rit","fus","syn","xyz","link","pen"}
...@@ -2293,19 +2325,19 @@ function rscon.sumtype(sumtbl,sumfilter,matchall) ...@@ -2293,19 +2325,19 @@ function rscon.sumtype(sumtbl,sumfilter,matchall)
stypeg:AddCard(tc) stypeg:AddCard(tc)
end end
end end
if #stypeg<=0 or (matchall and not stypeg:Equal(checkg)) then
return false
end
local mat=tc:GetMaterial() local mat=tc:GetMaterial()
if sumfilter then if sumfilter then
local res=sumfilter(tc,e,tp,re,rp,mat) local res=sumfilter(tc,e,tp,re,rp,mat)
if res then filterg:AddCard(tc) end if res then filterg:AddCard(tc) end
end end
if #filterg<=0 or (matchall and not filterg:Equal(checkg)) then
return false
end
return true
end end
if #stypeg<=0 or (matchall and not stypeg:Equal(checkg)) then
return false
end
if #filterg<=0 or (matchall and not filterg:Equal(checkg)) then
return false
end
return true
end end
end end
--Condition: Negate Effect/Activation --Condition: Negate Effect/Activation
...@@ -2477,166 +2509,130 @@ function rsop.negsumop(waystring) ...@@ -2477,166 +2509,130 @@ function rsop.negsumop(waystring)
end end
end end
--Operation: Select Card --Operation: Select Card
function rsop.SelectCheck_Hint(loc1,loc2,minct,checkhint,checkselection)
local res1,res2=false,false
if checkhint then
res1= (loc1 and loc1&LOCATION_DECK+LOCATION_EXTRA+LOCATION_HAND ~=0) or (loc2 and loc2&LOCATION_DECK+LOCATION_EXTRA+LOCATION_HAND ~=0)
end
if checkselection then
res2= ((loc1 and loc1&LOCATION_ONFIELD+LOCATION_REMOVED ~=0) or (loc2 and loc2&LOCATION_ONFIELD+LOCATION_REMOVED ~=0)) and not rsof.Check_Boolean(minct)
end
if checkhint and not checkselection then return res1
elseif not checkhint and checkselection then return res2
else return res1,res2
end
end
function rsop.SelectCheck_Filter(filter,...) function rsop.SelectCheck_Filter(filter,...)
local filterpar={...} local filterpar={...}
local filterpar2={} local filterpar2={}
if type(filter)=="table" then if type(filter)=="table" then
for index,par in pairs(filter) do for index,par in pairs(filter) do
if index>=2 then if index>=2 then
table.insert(filterpar2,par) --table.insert(filterpar2,par)
filterpar2[index-1]=par
end end
end end
filter=filter[1] filter=filter[1]
filterpar=rsof.Table_Mix(filterpar2,filterpar) filterpar=rsof.Table_Mix(filterpar2,filterpar)
end end
return filter,filterpar return filter or aux.TRUE,filterpar
end end
function rsop.SelectCheck_Solve(solvefun) function rsop.SelectCheck_Solve(solvefun)
local solveparlist={} local solveparlist={}
local len=0
if type(solvefun)=="table" then if type(solvefun)=="table" then
for index,par in pairs(solvefun) do for index,par in pairs(solvefun) do
if index>=2 then if index>=2 then
table.insert(solveparlist,par) len=len+1
--table.insert(solveparlist,par)
solveparlist[len]=par
end end
end end
solvefun=solvefun[1] solvefun=solvefun[1]
end end
return solvefun,solveparlist return solvefun,solveparlist,len
end end
--Function:Select card by filter and do operation on it --Function:Select card by filter and do operation on it
function rsop.SelectSolve(selecthint,sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvefun,...) function rsop.SelectSolve(selecthint,sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvefun,...)
minct=minct or 1 minct=minct or 1
maxct=maxct or minct maxct=maxct or minct
local filter2,filterpar=rsop.SelectCheck_Filter(filter,...) local filter2,filterpar=rsop.SelectCheck_Filter(filter,...)
local solvefun2,solvefunpar=rsop.SelectCheck_Solve(solvefun) local solvefun2,solvefunpar,len=rsop.SelectCheck_Solve(solvefun)
if rsof.Check_Boolean(minct) then if rsof.Check_Boolean(minct) then
local g=Duel.GetMatchingGroup(sp,filter2,tp,loc1,loc2,exceptg,...) local g=Duel.GetMatchingGroup(sp,filter2,tp,loc1,loc2,exceptg,...)
return rsgf.SelectSolve(g,selecthint,sp,filter2,minct,maxct,exceptg,solvefun,table.unpack(filterpar)) return rsgf.SelectSolve(g,selecthint,sp,filter2,minct,maxct,exceptg,solvefun,table.unpack(filterpar))
else else
rshint.Select(sp,selecthint) rshint.Select(sp,selecthint)
local g=Duel.SelectMatchingCard(sp,filter2,tp,loc1,loc2,minct,maxct,exceptg,table.unpack(filterpar)) local g=Duel.SelectMatchingCard(sp,filter2,tp,loc1,loc2,minct,maxct,exceptg,table.unpack(filterpar))
if not solvefun then return g if g:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not rsop.nohint then
else Duel.HintSelection(g)
return solvefun2(tg,table.unpack(solvefunpar)) end
--under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil"
local solveparlist={}
local len2=0
for index,solvepar in pairs(solvefunpar) do
len2=len2+1
solveparlist[len2]=solvepar
end
if rsop.solveprlen and rsop.solveprlen>len then
for i=1,rsop.solveprlen-len do
len2=len2+1
solveparlist[len2]=nil
end
end
for index,solvepar in pairs({...}) do
len2=len2+1
solveparlist[len2]=solvepar
end end
local res=not solvefun and {g,g:GetFirst()} or {solvefun2(g,table.unpack(solveparlist))}
rsop.solveprlen=nil
rsop.nohint=false
return table.unpack(res)
end end
end end
--Function:Select card and send to hand function rsop.GetFollowingSolvepar(solvepar,parlen)
function rsop.SelectToHand(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=type(solvepar)=="table" and solvepar or {solvepar}
return rsop.SelectSolve("th",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectToHand_Operation(res,table.unpack(solvepar)),...) rsop.solveprlen=parlen
return solvepar
end end
function rsop.SelectToHand_Operation(res,sp2,reason) --Function:Select card and send to hand
return function(tg) function rsop.SelectToHand(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
if #tg<=0 then return 0,tg end solvepar=rsop.GetFollowingSolvepar(solvepar,4)
if not res then rsop.nohint=true
Duel.HintSelection(tg) return rsop.SelectSolve("th",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoHand,table.unpack(solvepar)},...)
end
local ct=Duel.SendtoHand(tg,sp2,reason or REASON_EFFECT)
local og=Duel.GetOperatedGroup()
if res then
Duel.ConfirmCards(sp2 and 1-sp2 or 1-sp,og)
end
return ct,og
end
end end
--Function:Select card and send to grave --Function:Select card and send to grave
function rsop.SelectToGrave(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,reason,...) function rsop.SelectToGrave(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true) solvepar=rsop.GetFollowingSolvepar(solvepar,2)
reason=type(reason)=="table" and reason[1] or reason rsop.nohint=true
return rsop.SelectSolve("tg",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectToGrave_Operation(res,reason),...) return rsop.SelectSolve("tg",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoGrave,table.unpack(solvepar)},...)
end end
function rsop.SelectToGrave_Operation(res,sp2,reason) --Function:Select card and release
return function(tg) function rsop.SelectRelease(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
if #tg<=0 then return 0,tg end solvepar=rsop.GetFollowingSolvepar(solvepar,2)
if rsop.SelectCheck_Hint(loc1,loc2,false,true) then rsop.nohint=true
Duel.HintSelection(tg) return rsop.SelectSolve("tg",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Release,table.unpack(solvepar)},...)
end
local ct=Duel.SendtoGrave(tg,reason or REASON_EFFECT)
local og=Duel.GetOperatedGroup()
return ct,og
end
end end
--Function:Select card and send to deck --Function:Select card and send to deck
function rsop.SelectToDeck(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...) function rsop.SelectToDeck(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true) solvepar=rsop.GetFollowingSolvepar(solvepar,4)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} rsop.nohint=true
return rsop.SelectSolve("td",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectToDeck_Operation(res,table.unpack(solvepar)),...) return rsop.SelectSolve("td",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoDeck,table.unpack(solvepar)},...)
end
function rsop.SelectToDeck_Operation(res,sp2,deckseq,reason)
return function(tg)
if #tg<=0 then return 0,tg end
if res then
Duel.HintSelection(tg)
end
local ct=Duel.SendtoDeck(tg,sp2,deckseq or 2,reason or REASON_EFFECT )
local og=Duel.GetOperatedGroup()
return ct,og
end
end end
--Function:Select card and destroy --Function:Select card and destroy
function rsop.SelectDestroy(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...) function rsop.SelectDestroy(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true) solvepar=rsop.GetFollowingSolvepar(solvepar,2)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} rsop.nohint=true
return rsop.SelectSolve("des",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectDestroy_Operation(res,table.unpack(solvepar)),...) return rsop.SelectSolve("des",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Destroy,table.unpack(solvepar)},...)
end
function rsop.SelectDestroy_Operation(res,reason,desloc)
return function(tg)
if #tg<=0 then return 0,tg end
if res then
Duel.HintSelection(tg)
end
local ct=Duel.Destroy(tg,reason or REASON_EFFECT,desloc or LOCATION_GRAVE )
local og=Duel.GetOperatedGroup()
return ct,og
end
end end
--Function:Select card and remove --Function:Select card and remove
function rsop.SelectRemove(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...) function rsop.SelectRemove(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true) solvepar=rsop.GetFollowingSolvepar(solvepar,3)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} rsop.nohint=true
return rsop.SelectSolve("rm",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectRemove_Operation(res,table.unpack(solvepar)),...) return rsop.SelectSolve("rm",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Remove,table.unpack(solvepar)},...)
end
function rsop.SelectRemove_Operation(res,reason,desloc)
return function(tg)
if #tg<=0 then return 0,tg end
if res then
Duel.HintSelection(tg)
end
local ct=Duel.Remove(tg,rmpos or POS_FACEUP,reason or REASON_EFFECT)
local og=Duel.GetOperatedGroup()
return ct,og
end
end end
--Function:Select card and special summon --Function:Select card and special summon
function rsop.SelectSpecialSummon(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...) function rsop.SelectSpecialSummon(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
local res=rsop.SelectCheck_Hint(loc1,loc2,minct,true)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=type(solvepar)=="table" and solvepar or {solvepar}
return rsop.SelectSolve("sp",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(res,solvepar),...) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local ex_par=not ... and {e,sp} or {...}
return rsop.SelectSolve("sp",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),table.unpack(ex_par) )
end end
function rsop.SelectSpecialSummon_Operation(res,sumfunvarlist) function rsop.SelectSpecialSummon_Operation(sumfunvarlist)
return function(tg) return function(tg)
if #tg<=0 then return 0,tg end if #tg<=0 then return 0,tg end
if res then local hintg=tg:Filter(Card.IsLocation,nil,LOCATION_SZONE+LOCATION_GRAVE+LOCATION_REMOVED)
if #hintg>0 then
Duel.HintSelection(tg) Duel.HintSelection(tg)
end end
local ct=rssf.SpecialSummon(tg,table.unpakc(sumfunvarlist)) return rssf.SpecialSummon(tg,table.unpack(sumfunvarlist))
local og=Duel.GetOperatedGroup()
return ct,og
end end
end end
--Operation: Equip --Operation: Equip
...@@ -2681,78 +2677,99 @@ function rsop.eqop(e,eqc,eqtc,pos,opside) ...@@ -2681,78 +2677,99 @@ function rsop.eqop(e,eqc,eqtc,pos,opside)
end end
return false return false
end end
--Operation function: for following operation, check hint
function rsop.CheckOperationHint(g,hint,confirm)
local ishint,isconfirm=false
if rsof.Check_Boolean(hint,true) then ishint=true end
if type(hint)=="nil" then ishint=g:FilterCount(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)==#g end
if rsof.Check_Boolean(confirm,true) then isconfirm=true end
if type(confirm)=="nil" then isconfirm=g:FilterCount(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)~=#g end
if ishint then
Duel.HintSelection(g)
end
return ishint,isconfirm
end
--Operation function:Send to hand and confirm or hint --Operation function:Send to hand and confirm or hint
--if you don't neet confirm or hint, best use normal Duel.SendtoHand function rsop.SendtoHand(corg,p,reason,hint,confirm)
function rsop.SendtoHand(corg,p,reason,noconfirm,nohint)
reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg) local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end if #g<=0 then return 0,nil end
local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) reason= reason or REASON_EFFECT
if #hintg>0 and #hintg==#g and not nohint then local ishint,isconfirm=rsop.CheckOperationHint(g,hint,confirm)
Duel.HintSelection(hintg)
end
local ct=Duel.SendtoHand(g,p,reason) local ct=Duel.SendtoHand(g,p,reason)
if ct>0 and #hintg~=#g and not noconfirm then if ct>0 and isconfirm then
p=p or g:GetFirst():GetControler() p=p or g:GetFirst():GetControler()
Duel.ConfirmCards(1-p,g) Duel.ConfirmCards(1-p,g)
end end
return ct,Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end end
--Operation function:Send to deck and hint --Operation function:Send to deck and hint
--if you don't neet hint, best use normal Duel.SendtoDeck --if you don't neet hint, best use normal Duel.SendtoDeck
function rsop.SendtoDeck(corg,p,seq,reason,nohint) function rsop.SendtoDeck(corg,p,seq,reason,hint)
reason= reason or REASON_EFFECT reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg) local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end if #g<=0 then return 0,nil end
local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) rsop.CheckOperationHint(g,hint)
if #hintg>0 and not nohint then
Duel.HintSelection(hintg)
end
local ct=Duel.SendtoDeck(g,p,seq,reason) local ct=Duel.SendtoDeck(g,p,seq,reason)
return ct,Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end end
--Operation function:Send to grave and hint --Operation function:Send to grave and hint
--if you don't neet hint, best use normal Duel.SendtoDeck --if you don't neet hint, best use normal Duel.SendtoDeck
function rsop.SendtoGrave(corg,reason,nohint) function rsop.SendtoGrave(corg,reason,hint)
reason= reason or REASON_EFFECT reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg) local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end if #g<=0 then return 0,nil end
local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_REMOVED) rsop.CheckOperationHint(g,hint)
if #hintg>0 and not nohint then
Duel.HintSelection(hintg)
end
if g:IsExists(Card.IsLocation,1,nil,LOCATION_REMOVED) then if g:IsExists(Card.IsLocation,1,nil,LOCATION_REMOVED) then
reason=reason|REASON_RETURN reason=reason|REASON_RETURN
end end
local ct=Duel.SendtoGrave(g,reason) local ct=Duel.SendtoGrave(g,reason)
return ct,Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end end
--Operation function:Send to grave and hint --Operation function:Release and hint
--if you don't neet hint, best use normal Duel.Destroy --if you don't neet hint, best use normal Duel.SendtoDeck
function rsop.Destroy(corg,reason,nohint) function rsop.Release(corg,reason,hint)
reason= reason or REASON_EFFECT reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg) local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end if #g<=0 then return 0,nil end
local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD) rsop.CheckOperationHint(g,hint)
if #hintg>0 and not nohint then local f=function(c)
Duel.HintSelection(hintg) return (c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsOnField()) or c:IsLocation(LOCATION_DECK+LOCATION_EXTRA)
end
local ct=0
if g:IsExists(f,1,nil,LOCATION_DECK+LOCATION_EXTRA+LOCATION_HAND) then
ct=Duel.SendtoGrave(g,reason|REASON_RELEASE)
else
ct=Duel.Release(g,reason)
end end
local ct=Duel.Destroy(g,reason) local og=Duel.GetOperatedGroup()
return ct,Duel.GetOperatedGroup() return ct,og,og:GetFirst()
end
--Operation function:destroy and hint
--if you don't neet hint, best use normal Duel.Destroy
function rsop.Destroy(corg,reason,desloc,hint)
reason= reason or REASON_EFFECT
desloc= desloc or LOCATION_GRAVE
local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end
rsop.CheckOperationHint(g,hint)
local ct=Duel.Destroy(g,reason,desloc)
local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end end
--Operation function:Remove and hint --Operation function:Remove and hint
--if you don't neet hint, best use normal Duel.Remove --if you don't neet hint, best use normal Duel.Remove
function rsop.Remove(corg,pos,reason,nohint) function rsop.Remove(corg,pos,reason,hint)
pos= pos or POS_FACEUP pos= pos or POS_FACEUP
reason= reason or REASON_EFFECT reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg) local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end if #g<=0 then return 0,nil end
local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE) rsop.CheckOperationHint(g,hint)
if #hintg>0 and not nohint then
Duel.HintSelection(hintg)
end
local ct=Duel.Remove(g,pos,reason) local ct=Duel.Remove(g,pos,reason)
return ct,Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end end
--Function: N effects select 1 --Function: N effects select 1
function rsop.SelectOption(p,...) function rsop.SelectOption(p,...)
...@@ -2855,7 +2872,7 @@ function rsop.AnnounceNumber(tp,maxdigit) ...@@ -2855,7 +2872,7 @@ function rsop.AnnounceNumber(tp,maxdigit)
num=0 num=0
elseif op==1 then elseif op==1 then
for digit=1,maxdigit do for digit=1,maxdigit do
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m+3,7-digitindex)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m+2,7-digitindex))
num=num+Duel.AnnounceNumber(tp,1,2,3,4,5,6,7,8,9,0)*digitlevel num=num+Duel.AnnounceNumber(tp,1,2,3,4,5,6,7,8,9,0)*digitlevel
digitlevel=digitlevel/10 digitlevel=digitlevel/10
digitindex=digitindex-1 digitindex=digitindex-1
...@@ -3105,52 +3122,82 @@ function rsgf.SelectSolve(g,selecthint,sp,filter,minct,maxct,exceptg,solvefun,.. ...@@ -3105,52 +3122,82 @@ function rsgf.SelectSolve(g,selecthint,sp,filter,minct,maxct,exceptg,solvefun,..
minct=minct or 1 minct=minct or 1
maxct=maxct or minct maxct=maxct or minct
local filter2,filterpar=rsop.SelectCheck_Filter(filter,...) local filter2,filterpar=rsop.SelectCheck_Filter(filter,...)
local solvefun2,solvefunpar=rsop.SelectCheck_Solve(solvefun) local solvefun2,solvefunpar,len=rsop.SelectCheck_Solve(solvefun)
local tg=Group.CreateGroup() local tg=Group.CreateGroup()
if rsof.Check_Boolean(minct) then if rsof.Check_Boolean(minct) then
tg=g tg=g
else else
rshint.Select(sp,selecthint) rshint.Select(sp,selecthint)
tg=g:FilterSelect(sp,filter2,minct,maxct,exceptg,table.unpack(filterpar)) tg=g:FilterSelect(sp,filter2,minct,maxct,exceptg,table.unpack(filterpar))
if tg:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not rsop.nohint then
Duel.HintSelection(tg)
end
end end
if not solvefun then return tg end --under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil"
return solvefun2(tg,table.unpack(solvefunpar)) local solveparlist={}
local len2=0
for index,solvepar in pairs(solvefunpar) do
len2=len2+1
solveparlist[len2]=solvepar
end
if rsop.solveprlen and rsop.solveprlen>len then
for i=1,rsop.solveprlen-len do
len2=len2+1
solveparlist[len2]=nil
end
end
for index,solvepar in pairs({...}) do
len2=len2+1
solveparlist[len2]=solvepar
end
local res=not solvefun and {tg,tg:GetFirst()} or {solvefun2(tg,table.unpack(solveparlist))}
rsop.nohint=false
rsop.solveprlen=nil
return table.unpack(res)
end end
Group.SelectSolve=rsgf.SelectSolve Group.SelectSolve=rsgf.SelectSolve
--Group:Select card from group and send to hand --Group:Select card from group and send to hand
function rsgf.SelectToHand(g,sp,filter,minct,maxct,exceptg,solvepar,...) function rsgf.SelectToHand(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=rsop.GetFollowingSolvepar(solvepar,4)
return rsgf.SelectSolve(g,"th",sp,filter,minct,maxct,exceptg,{rsop.SendtoHand,table.unpack(solvepar)},...) return rsgf.SelectSolve(g,"th",sp,filter,minct,maxct,exceptg,{rsop.SendtoHand,table.unpack(solvepar)},...)
end end
Group.SelectToHand=rsgf.SelectToHand Group.SelectToHand=rsgf.SelectToHand
--Group:Select card from group and send to grave --Group:Select card from group and send to grave
function rsgf.SelectToGrave(g,sp,filter,minct,maxct,exceptg,reason,...) function rsgf.SelectToGrave(g,sp,filter,minct,maxct,exceptg,solvepar,...)
reason=type(reason)=="table" and reason[1] or reason solvepar=rsop.GetFollowingSolvepar(solvepar,2)
return rsgf.SelectSolve(g,"tg",sp,filter,minct,maxct,exceptg,{rsop.SendtoGrave,reason},...) return rsgf.SelectSolve(g,"tg",sp,filter,minct,maxct,exceptg,{rsop.SendtoGrave,table.unpack(solvepar)},...)
end end
Group.SelectToGrave=rsgf.SelectToGrave Group.SelectToGrave=rsgf.SelectToGrave
--Group:Select card from group and release
function rsgf.SelectRelease(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=rsop.GetFollowingSolvepar(solvepar,2)
return rsgf.SelectSolve(g,"tg",sp,filter,minct,maxct,exceptg,{rsop.Release,table.unpack(solvepar)},...)
end
Group.SelectRelease=rsgf.SelectRelease
--Group:Select card from group and send to deck --Group:Select card from group and send to deck
function rsgf.SelectToDeck(g,sp,filter,minct,maxct,exceptg,solvepar,...) function rsgf.SelectToDeck(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=rsop.GetFollowingSolvepar(solvepar,4)
return rsgf.SelectSolve(g,"td",sp,filter,minct,maxc,t,exceptg,{rsop.SendtoDeck,table.unpack(solvepar)},...) return rsgf.SelectSolve(g,"td",sp,filter,minct,maxc,t,exceptg,{rsop.SendtoDeck,table.unpack(solvepar)},...)
end end
Group.SelectToDeck=rsgf.SelectToDeck Group.SelectToDeck=rsgf.SelectToDeck
--Group:Select card from group and destroy --Group:Select card from group and destroy
function rsgf.SelectDestroy(g,sp,filter,minct,maxct,exceptg,solvepar,...) function rsgf.SelectDestroy(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=rsop.GetFollowingSolvepar(solvepar,2)
return rsgf.SelectSolve(g,"des",sp,filter,minct,maxct,exceptg,{rsop.Destroy,table.unpack(solvepar)},...) return rsgf.SelectSolve(g,"des",sp,filter,minct,maxct,exceptg,{rsop.Destroy,table.unpack(solvepar)},...)
end end
Group.SelectDestroy=rsgf.SelectDestroy Group.SelectDestroy=rsgf.SelectDestroy
--Group:Select card from group and remove --Group:Select card from group and remove
function rsgf.SelectRemove(g,sp,filter,minct,maxct,exceptg,solvepar,...) function rsgf.SelectRemove(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=rsop.GetFollowingSolvepar(solvepar,3)
return rsgf.SelectSolve(g,"rm",sp,filter,minct,maxct,exceptg,{rsop.Remove,table.unpack(solvepar)},...) return rsgf.SelectSolve(g,"rm",sp,filter,minct,maxct,exceptg,{rsop.Remove,table.unpack(solvepar)},...)
end end
Group.SelectRemove=rsgf.SelectRemove Group.SelectRemove=rsgf.SelectRemove
--Group:Select card from group and special summon --Group:Select card from group and special summon
function rsgf.SelectSpecialSummon(g,sp,filter,minct,maxct,exceptg,solvepar,...) function rsgf.SelectSpecialSummon(g,sp,filter,minct,maxct,exceptg,solvepar,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=rsop.GetFollowingSolvepar(solvepar,8)
return rsgf.SelectSolve(g,"sp",sp,filter,minct,maxct,exceptg,{rssf.SpecialSummon,table.unpack(solvepar)},...) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local ex_par=not ... and {e,sp} or {...}
return rsgf.SelectSolve(g,"sp",sp,filter,minct,maxct,exceptg,{rssf.SpecialSummon,table.unpack(solvepar)},table.unpack(ex_par))
end end
Group.SelectSpecialSummon=rsgf.SelectSpecialSummon Group.SelectSpecialSummon=rsgf.SelectSpecialSummon
...@@ -3159,8 +3206,12 @@ Group.SelectSpecialSummon=rsgf.SelectSpecialSummon ...@@ -3159,8 +3206,12 @@ Group.SelectSpecialSummon=rsgf.SelectSpecialSummon
--Card function: local m and cm and cm.rssetcode --Card function: local m and cm and cm.rssetcode
function rscf.DefineCard(code,setcode) function rscf.DefineCard(code,setcode)
local ccodem=_G["c"..code] if not _G["c"..code] then _G["c"..code]={}
if setcode and ccodem then setmetatable(_G["c"..code],Card)
_G["c"..code].__index=_G["c"..code]
end
local ccodem=_G["c"..code]
if setcode and not ccodem.rssetcode then
ccodem.rssetcode=setcode ccodem.rssetcode=setcode
end end
return code,ccodem return code,ccodem
...@@ -4002,11 +4053,11 @@ function rscf.LinkCustomOperation(mg,c,e,tp,checkog) ...@@ -4002,11 +4053,11 @@ function rscf.LinkCustomOperation(mg,c,e,tp,checkog)
end end
--case 1, Summon Effect Custom --case 1, Summon Effect Custom
if rssf.LinkMaterialAction then if rssf.LinkMaterialAction then
rssf.LinkMaterialAction(mg,c,e,tp) rssf.LinkMaterialAction(mg,c,e,tp,checkog)
rssf.LinkMaterialAction=nil rssf.LinkMaterialAction=nil
--case 2, Summon Procedure Custom --case 2, Summon Procedure Custom
elseif c.rs_link_material_action then elseif c.rs_link_material_action then
c.rs_link_material_action(mg,c,e,tp) c.rs_link_material_action(mg,c,e,tp,checkog)
--case 3, Base Summon Procedure --case 3, Base Summon Procedure
else else
Duel.SendtoGrave(mg,REASON_LINK+REASON_MATERIAL) Duel.SendtoGrave(mg,REASON_LINK+REASON_MATERIAL)
...@@ -4163,7 +4214,9 @@ end ...@@ -4163,7 +4214,9 @@ end
function rscf.spfilter2(f,...) function rscf.spfilter2(f,...)
local ext_params={...} local ext_params={...}
return function(c,e,tp) return function(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 or Duel.GetLocationCount(tp,LOCATION_MZONE)>0) and (not f or f(c,table.unpack(rsof.Table_Mix(ext_params,{e,tp})))) if c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)<=0 then return false end
if not c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (not f or f(c,table.unpack(rsof.Table_Mix(ext_params,{e,tp}))))
end end
end end
--Card function: Get same type base set --Card function: Get same type base set
...@@ -4441,9 +4494,12 @@ end ...@@ -4441,9 +4494,12 @@ end
function rsof.Table_Mix(table1,...) function rsof.Table_Mix(table1,...)
local resultlist={} local resultlist={}
local list={table1,...} local list={table1,...}
local len=0
for _,tab in pairs(list) do for _,tab in pairs(list) do
for _,value in pairs(tab) do for _,value in pairs(tab) do
table.insert(resultlist,value) --table.insert(resultlist,value)
len=len+1
resultlist[len]=value
end end
end end
return resultlist return resultlist
...@@ -4468,3 +4524,5 @@ function rsof.Check_Boolean(value,booleanvaule) ...@@ -4468,3 +4524,5 @@ function rsof.Check_Boolean(value,booleanvaule)
return type(value)=="boolean" and value==false return type(value)=="boolean" and value==false
end end
end end
-------------------"Hape"---------------------
rsof.Escape_Old_Functions()
\ No newline at end of file
--Real Scl Version - Variable --Real Scl Version - Variable
local Version_Number=200119 local Version_Number=20200218
local m=10199990 local m=10199990
local vm=10199991 local vm=10199991
rsv={} --"Base Function" rsv={} --"Base Function"
...@@ -19,6 +19,7 @@ rscate={} --"Category Function" ...@@ -19,6 +19,7 @@ rscate={} --"Category Function"
rsflag={} --"Property Function" rsflag={} --"Property Function"
rsreset={} --"Reset Function" rsreset={} --"Reset Function"
rshint={} --"Hint Function" rshint={} --"Hint Function"
rsloc={} --"Location Function"
--Info Variable --Info Variable
rsef.valinfo ={} --"Value for inside series, inside type etc." rsef.valinfo ={} --"Value for inside series, inside type etc."
...@@ -107,18 +108,31 @@ rscf.extype_r = rscf.extype + TYPE_RITUAL ...@@ -107,18 +108,31 @@ rscf.extype_r = rscf.extype + TYPE_RITUAL
rscf.extype_np = rscf.extype - TYPE_PENDULUM rscf.extype_np = rscf.extype - TYPE_PENDULUM
rscf.exlist = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK } rscf.exlist = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK }
--Location Variable
rsloc.hd=LOCATION_HAND+LOCATION_DECK
rsloc.dg=LOCATION_DECK+LOCATION_GRAVE
rsloc.gr=LOCATION_GRAVE+LOCATION_REMOVED
rsloc.hdg=LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE
rsloc.de=LOCATION_DECK+LOCATION_EXTRA
rsloc.mg=LOCATION_MZONE+LOCATION_GRAVE
rsloc.hmg=LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE
rsloc.hog=LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE
rsloc.all=0xff
--Escape Old Functions --Escape Old Functions
rsof.DefineCard = rscf.DefineCard function rsof.Escape_Old_Functions()
rsof.SendtoHand = rsop.SendtoHand rsof.DefineCard = rscf.DefineCard
rsof.SendtoDeck = rsop.SendtoDeck rsof.SendtoHand = rsop.SendtoHand
rsof.SendtoGrave = rsop.SendtoGrave rsof.SendtoDeck = rsop.SendtoDeck
rsof.Destroy = rsop.Destroy rsof.SendtoGrave = rsop.SendtoGrave
rsof.Remove = rsop.Remove rsof.Destroy = rsop.Destroy
rsof.SelectHint = rshint.Select rsof.Remove = rsop.Remove
rsof.SelectOption= rsop.SelectOption rsof.SelectHint = rshint.Select
rsof.SelectOption_Page= rsop.SelectOption_Page rsof.SelectOption= rsop.SelectOption
rsof.SelectNumber= rsop.AnnounceNumber rsof.SelectOption_Page= rsop.SelectOption_Page
rsof.SelectNumber_List= rsop.AnnounceNumber_List rsof.SelectNumber= rsop.AnnounceNumber
rsof.IsSet = rscf.DefineSet rsof.SelectNumber_List= rsop.AnnounceNumber_List
rsof.IsSet = rscf.DefineSet
end
--Record Author --Record Author
local am=10199992 local am=10199992
local Version_Number=200129 local Version_Number=20200323
#Scl #Scl
local rsdka = Dakyria local rsdka = Dakyria
local rsdio = Diablo local rsdio = Diablo
...@@ -12,6 +12,8 @@ local rsos = Oracle_Smith ...@@ -12,6 +12,8 @@ local rsos = Oracle_Smith
local rssp = Stellar_Pearl local rssp = Stellar_Pearl
//local rsgd = Ghostdom_Dragon //local rsgd = Ghostdom_Dragon
local rsed = Epic_Dragon local rsed = Epic_Dragon
local rsdh = Devil_Hunter
local rsds = Dark_Souls
#Scl - Special Mode #Scl - Special Mode
local rssm = Special_Mode local rssm = Special_Mode
...@@ -22,6 +24,7 @@ local rssms = Special_Mode_Skill_Duel ...@@ -22,6 +24,7 @@ local rssms = Special_Mode_Skill_Duel
local rssmi = Special_Mode_Infinite_Duel local rssmi = Special_Mode_Infinite_Duel
local rssmf = Special_Mode_Fast_Duel local rssmf = Special_Mode_Fast_Duel
local rssmm = Special_Mode_Multiple_Duel local rssmm = Special_Mode_Multiple_Duel
local rssmu = Special_Mode_Universal_Duel
#Gale #Gale
local rsve = Voison local rsve = Voison
...@@ -68,17 +71,20 @@ local rsgc = Guard_City ...@@ -68,17 +71,20 @@ local rsgc = Guard_City
#ZhenDong #ZhenDong
local rsfv = Fgo/Assassin local rsfv = Fgo/Assassin
#JingJing
local rsba = BlueAngel
--Set Code --Set Code
#Scl #Scl
local Chaos_Alchemy = 0x1330 --local = 0x1330
local Alchement_Bio = 0x3330 local Alchement_Bio = 0x3330
local = 0x5330 local Chaos_Alchemy = 0x5330
local Azure-Wing_Mercenary = 0x6330 local Azure-Wing_Mercenary = 0x6330
local Oracleoath = 0x9330 local Oracleoath = 0x9330
local Zrouf_Mantra = 0xa330 local Zrouf_Mantra = 0xa330
local Autumntale = 0xc330 local Autumntale = 0xc330
local = 0x1331 --local = 0x1331
local Night_Raven = 0x3331 local Night_Raven = 0x3331
local Rainsoon = 0x5331 local Rainsoon = 0x5331
local Monsoonangel = 0x6331 local Monsoonangel = 0x6331
...@@ -86,7 +92,7 @@ local Dakyria = 0x9331 ...@@ -86,7 +92,7 @@ local Dakyria = 0x9331
local Diablo = 0xa331 local Diablo = 0xa331
local Pure_Wing = 0xc331 local Pure_Wing = 0xc331
local = 0x1332 --local = 0x1332
local Little_Fight = 0x3332 local Little_Fight = 0x3332
local Spellbinder = 0x5332 local Spellbinder = 0x5332
local Soulgem = 0x6332 local Soulgem = 0x6332
...@@ -94,7 +100,7 @@ local Eridiument = 0x9332 ...@@ -94,7 +100,7 @@ local Eridiument = 0x9332
local Comic_Clown = 0xa332 local Comic_Clown = 0xa332
local Gorkha = 0xc332 local Gorkha = 0xc332
local = 0x1333 --local = 0x1333
local T.T.Hunter = 0x3333 local T.T.Hunter = 0x3333
local Treagon = 0x5333 local Treagon = 0x5333
local Treasure_Trove = 0x6333 local Treasure_Trove = 0x6333
...@@ -102,40 +108,40 @@ local Epic_Dragon = 0x9333 ...@@ -102,40 +108,40 @@ local Epic_Dragon = 0x9333
local Stellar_Pearl = 0xa333 local Stellar_Pearl = 0xa333
local Utoland = 0xc333 local Utoland = 0xc333
local = 0x1334 --local = 0x1334
local = 0x3334 local = 0x3334
local Summerlover = 0x5334 local Summerlover = 0x5334
local Quasi_Beast = 0x6334 local Quasi_Beast = 0x6334
local Bite_Teech = 0x9334 local Bite_Teech = 0x9334
local = 0xa334 local = 0xa334
local = 0xc334 local = 0xc334
local Oraclesmith = 0x1335 --local = 0x1335
local = 0x3335 local Oraclesmith = 0x3335
local = 0x5335 local DevilHunter = 0x5335
local = 0x6335 local DevilSlayer = 0x6335
local = 0x9335 local DMC = 0x9335
local = 0xa335 local Ashenone = 0xa335
local = 0xc335 local Cinderlord = 0xc335
local = 0x1336 --local = 0x1336
local = 0x3336 local = 0x3336
local = 0x5336 local = 0x5336
local Fantastory = 0x6336 local Fantastory = 0x6336
local = 0x9336 local = 0x9336
local Quantum_Driver = 0xa336 local Quantum_Driver = 0xa336
local = 0xc336 local = 0xc336
local Ghostdom_Dragon = 0x337 local Ghostdom_Dragon = 0x337
local Ghosaom_Dragon_King = 0x1337 local Ghosaom_Dragon_King = 0x1337
local = 0x1338 --local = 0x1338
local Ectopialord = 0x3338 local Ectopialord = 0x3338
local Freedom_Fighter= 0x5338 local Freedom_Fighter= 0x5338
local Zombieraser = 0x6338 local Zombieraser = 0x6338
local Sweet_Baby = 0x9338 local Sweet_Baby = 0x9338
local = 0xa338 local = 0xa338
local = 0xc338 local = 0xc338
local S.W. = 0x339 local S.W. = 0x339
local S.W.C.C = 0x1339 local S.W.C.C = 0x1339
...@@ -144,4 +150,6 @@ local XB = 0x340 ...@@ -144,4 +150,6 @@ local XB = 0x340
local XB_Z = 0x1340 local XB_Z = 0x1340
local Action_Card = 0x3341
local Multiple_Deck = 0x5341
local Skill_Card = 0x6341
...@@ -181,7 +181,7 @@ function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -181,7 +181,7 @@ function cm.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return cm.isherald(c) and c:GetCode()~=m and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return cm.isherald(c) and not c:IsCode(m,46935289) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.spfilter(chkc,e,tp) end if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cm.spfilter(chkc,e,tp) end
......
...@@ -49,12 +49,12 @@ function c117981478.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -49,12 +49,12 @@ function c117981478.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP)
Duel.SpecialSummonComplete() Duel.SpecialSummonComplete()
g:AddCard(c) g:AddCard(c)
local sg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,g) local sg=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,c,g)
if sg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(117981478,0)) then if sg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(117981478,0)) then
if not sg then return end if not sg then return end
local sc=sg:Select(tp,1,1,nil):GetFirst() local sc=sg:Select(tp,1,1,nil):GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.SynchroSummon(tp,sc,nil,g) Duel.SynchroSummon(tp,sc,c,g)
end end
end end
function c117981478.bftg(e,tp,eg,ep,ev,re,r,rp) function c117981478.bftg(e,tp,eg,ep,ev,re,r,rp)
...@@ -72,10 +72,10 @@ function c117981478.bfop(e,tp,eg,ep,ev,re,r,rp) ...@@ -72,10 +72,10 @@ function c117981478.bfop(e,tp,eg,ep,ev,re,r,rp)
e1:SetCondition(c117981478.discon) e1:SetCondition(c117981478.discon)
e1:SetOperation(c117981478.disop) e1:SetOperation(c117981478.disop)
e1:SetCode(EVENT_CHAIN_SOLVING) e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetAbsoluteRange(ep,0,1) e1:SetAbsoluteRange(ep,0,1)
rc:RegisterEffect(e1,tp) rc:RegisterEffect(e1,tp)
rc:RegisterFlagEffect(117981478,RESET_EVENT+0x1fe0000,0,1) rc:RegisterFlagEffect(117981478,RESET_EVENT+RESETS_STANDARD,0,1)
end end
end end
function c117981478.discon(e,tp,eg,ep,ev,re,r,rp) function c117981478.discon(e,tp,eg,ep,ev,re,r,rp)
......
function c118817732.initial_effect(c) function c118817732.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddXyzProcedure(c,nil,4,2) aux.AddXyzProcedure(c,nil,8,2)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(118817732,0)) e1:SetDescription(aux.Stringid(118817732,0))
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
......
...@@ -68,7 +68,7 @@ function c121082832.desop(e,tp,eg,ep,ev,re,r,rp) ...@@ -68,7 +68,7 @@ function c121082832.desop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_SZONE) e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1) e1:SetCountLimit(1+EFFECT_COUNT_CODE_DUEL)
e1:SetTarget(c121082832.target2) e1:SetTarget(c121082832.target2)
e1:SetOperation(c121082832.operation2) e1:SetOperation(c121082832.operation2)
c:RegisterEffect(e1) c:RegisterEffect(e1)
......
--时崎狂三-梦魇 --时崎狂三-梦魇
function c33400010.initial_effect(c) function c33400010.initial_effect(c)
c:EnableCounterPermit(0x34f)
--link summon --link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x341),3,99,c33400010.lcheck) aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,0x341),3,99,c33400010.lcheck)
c:EnableReviveLimit() c:EnableReviveLimit()
...@@ -89,10 +90,10 @@ function c33400010.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -89,10 +90,10 @@ function c33400010.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c33400010.dstg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c33400010.dstg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler() local c=e:GetHandler()
if chkc then return chkc:IsOnField() and chkc:IsFaceup() and chkc~=c end if chkc then return chkc:IsOnField() and chkc~=c end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end end
function c33400010.dsop(e,tp,eg,ep,ev,re,r,rp) function c33400010.dsop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -29,7 +29,7 @@ function cm.repfilter(c,tp) ...@@ -29,7 +29,7 @@ function cm.repfilter(c,tp)
and c:IsOnField() and c:IsControler(tp) and c:IsReason(REASON_EFFECT+REASON_BATTLE) and not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsControler(tp) and c:IsReason(REASON_EFFECT+REASON_BATTLE) and not c:IsReason(REASON_REPLACE)
end end
function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk) function cm.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(cm.repfilter,1,c:IsCode(m),tp) end if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(cm.repfilter,1,e:GetHandler():IsCode(m),tp) end
return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) return Duel.SelectEffectYesNo(tp,e:GetHandler(),96)
end end
function cm.repval(e,c) function cm.repval(e,c)
......
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