Commit e1488f56 authored by Nemo Ma's avatar Nemo Ma

fix

parent 0a0f3645
No preview for this file type
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
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=20200409 local Version_Number=20200218
-----------------------"Part_Effect_Base"----------------------- -----------------------"Part_Effect_Base"-----------------------
--Effect: Get default hint string for Duel.Hint ,use in effect target --Effect: Get default hint string for Duel.Hint ,use in effect target
...@@ -113,7 +114,7 @@ function rsef.GetRegisterRange(cardtbl) ...@@ -113,7 +114,7 @@ function rsef.GetRegisterRange(cardtbl)
end end
--Effect: Get Flag for SetProperty --Effect: Get Flag for SetProperty
function rsef.GetRegisterProperty(mixflag) function rsef.GetRegisterProperty(mixflag)
local flagstringlist={"tg","ptg","de","dsp","dcal","ii","sa","ir","sr","bs","uc","cd","cn","ch","lz","at","sp","ep"} local flagstringlist={"tg","ptg","de","dsp","dcal","ii","sa","ir","sr","bs","uc","cd","cn","ch","lz","at","sp"}
return rsof.Mix_Value_To_Table(mixflag,flagstringlist,rsflag.flaglist) return rsof.Mix_Value_To_Table(mixflag,flagstringlist,rsflag.flaglist)
end end
rsflag.GetRegisterProperty=rsef.GetRegisterProperty rsflag.GetRegisterProperty=rsef.GetRegisterProperty
...@@ -137,12 +138,11 @@ function rsef.RegisterClone(cardtbl,e1,...) ...@@ -137,12 +138,11 @@ function rsef.RegisterClone(cardtbl,e1,...)
local f=effecttypelist1[k] local f=effecttypelist1[k]
f(e2,value2) f(e2,value2)
end end
if value1=="desc" then rsef.RegisterDescription(e2,value2) end if value=="flag" then e2:SetProperty(rsflag.GetRegisterProperty(value2)) end
if value1=="flag" then e2:SetProperty(rsflag.GetRegisterProperty(value2)) end if value=="cate" then e2:SetCategory(rscate.GetRegisterCategory(value2)) end
if value1=="cate" then e2:SetCategory(rscate.GetRegisterCategory(value2)) end if value=="reset" then rsef.RegisterReset(e2,value2) end
if value1=="reset" then rsef.RegisterReset(e2,value2) end if value=="timing" then rsef.RegisterTiming(e2,value2) end
if value1=="timing" then rsef.RegisterTiming(e2,value2) end if value=="tgrange" then rsef.RegisterTargetRange(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)
...@@ -445,14 +445,14 @@ function rsef.SV_ATTRIBUTE(cardtbl,atttbl,valtbl,con,resettbl,flag,desctbl,ctlim ...@@ -445,14 +445,14 @@ function rsef.SV_ATTRIBUTE(cardtbl,atttbl,valtbl,con,resettbl,flag,desctbl,ctlim
for k,effectcode in ipairs(effectcodetbl) do for k,effectcode in ipairs(effectcodetbl) do
local range=rsef.GetRegisterRange(cardtbl) local range=rsef.GetRegisterRange(cardtbl)
if rsof.Table_List(rangelist["pzone"],effectcode) then range=LOCATION_PZONE end if rsof.Table_List(rangelist["pzone"],effectcode) then range=LOCATION_PZONE end
--if rsof.Table_List(rangelist["nil"],effectcode) then range=nil end if rsof.Table_List(rangelist["nil"],effectcode) then range=nil end
if effectvaluetbl[k] then if effectvaluetbl[k] then
local e1=nil local e1=nil
if type(effectvaluetbl[k])~="string" then if type(effectvaluetbl[k])~="string" then
e1=rsef.SV(cardtbl,effectcode,effectvaluetbl[k],range,con,resettbl,flag,desctbl) e1=rsef.SV(cardtbl,effectcode,effectvaluetbl[k],range,con,resettbl,flag,desctbl)
else -- use for set code else -- use for set code
e1=rsef.SV(cardtbl,effectcode,0,range,con,resettbl,flag,desctbl) e1=rsef.SV(cardtbl,effectcode,0,range,con,resettbl,flag,desctbl)
rsval.valinfo[e1]=effectvaluetbl[k] rsef.valinfo[e1]=effectvaluetbl[k]
if c2:GetFlagEffect(rscode.Previous_Set_Code)==0 then if c2:GetFlagEffect(rscode.Previous_Set_Code)==0 then
local e2=rsef.SC({c2,true},EVENT_LEAVE_FIELD_P,nil,nil,"cd,uc",nil,rsef.presetop) local e2=rsef.SC({c2,true},EVENT_LEAVE_FIELD_P,nil,nil,"cd,uc",nil,rsef.presetop)
c2:RegisterFlagEffect(rscode.Previous_Set_Code,0,0,1) c2:RegisterFlagEffect(rscode.Previous_Set_Code,0,0,1)
...@@ -739,24 +739,22 @@ function rsef.FV_INDESTRUCTABLE(cardtbl,indstbl,valtbl,tg,tgrangetbl,con,resettb ...@@ -739,24 +739,22 @@ function rsef.FV_INDESTRUCTABLE(cardtbl,indstbl,valtbl,tg,tgrangetbl,con,resettb
end end
--Field Val Effect: Other Limit --Field Val Effect: Other Limit
function rsef.FV_LIMIT(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl) function rsef.FV_LIMIT(cardtbl,lotbl,valtbl,tg,tgrangetbl,con,resettbl,flag,desctbl)
local codetbl1={"dis","dise","tri","atk","atkan","datk","res","ress","resns","td","th","cp","cpe"} local codetbl1={"dis","dise","tri","atk","atkan","datk","ress","resns","td","th","cp","res"}
local codetbl2={ EFFECT_DISABLE,EFFECT_DISABLE_EFFECT,EFFECT_CANNOT_TRIGGER,EFFECT_CANNOT_ATTACK,EFFECT_CANNOT_ATTACK_ANNOUNCE,EFFECT_CANNOT_DIRECT_ATTACK,EFFECT_CANNOT_RELEASE,EFFECT_UNRELEASABLE_SUM,EFFECT_UNRELEASABLE_NONSUM,EFFECT_CANNOT_TO_DECK,EFFECT_CANNOT_TO_HAND,EFFECT_CANNOT_CHANGE_POSITION,EFFECT_CANNOT_CHANGE_POS_E } local codetbl2={ EFFECT_DISABLE,EFFECT_DISABLE_EFFECT,EFFECT_CANNOT_TRIGGER,EFFECT_CANNOT_ATTACK,EFFECT_CANNOT_ATTACK_ANNOUNCE,EFFECT_CANNOT_DIRECT_ATTACK,EFFECT_CANNOT_RELEASE,EFFECT_UNRELEASABLE_SUM,EFFECT_UNRELEASABLE_NONSUM,EFFECT_CANNOT_TO_DECK,EFFECT_CANNOT_TO_HAND,EFFECT_CANNOT_CHANGE_POSITION }
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)
if not tgrangetbl then tgrangetbl={ 0,LOCATION_MZONE } end if not tgrangetbl then tgrangetbl={ 0,LOCATION_MZONE } end
for k,effectcode in ipairs(effectcodetbl) do for k,effectcode in ipairs(effectcodetbl) do
local flag2=rsef.GetRegisterProperty(flag)|EFFECT_FLAG_SET_AVAILABLE local e1=rsef.FV(cardtbl,effectcode,effectvaluetbl[k],tg,tgrangetbl,range,con,resettbl,flag,desctbl)
flag2=effectcode==EFFECT_CANNOT_CHANGE_POSITION and flag2 or flag2|EFFECT_FLAG_IGNORE_IMMUNE
local e1=rsef.FV(cardtbl,effectcode,effectvaluetbl[k],tg,tgrangetbl,range,con,resettbl,flag2,desctbl)
table.insert(resulteffecttbl,e1) table.insert(resulteffecttbl,e1)
end end
return table.unpack(resulteffecttbl) return table.unpack(resulteffecttbl)
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","fp","cp"} 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,EFFECT_CANNOT_FLIP_SUMMON,EFFECT_CANNOT_CHANGE_POSITION } 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)
...@@ -856,23 +854,23 @@ function rsef.ACT(cardtbl,code,desctbl,ctlimittbl,cate,flag,con,cost,tg,op,timin ...@@ -856,23 +854,23 @@ function rsef.ACT(cardtbl,code,desctbl,ctlimittbl,cate,flag,con,cost,tg,op,timin
end end
--Activate Effect: Equip Spell --Activate Effect: Equip Spell
function rsef.ACT_EQUIP(cardtbl,eqfilter,desctbl,ctlimittbl,con,cost) function rsef.ACT_EQUIP(cardtbl,eqfilter,desctbl,ctlimittbl,con,cost)
desctbl=desctbl or rshint.eq if not desctbl then desctbl=rshint.eq end
eqfilter=eqfilter or Card.IsFaceup if not eqfilter then eqfilter=Card.IsFaceup end
local eqfilter2=eqfilter local eqfilter2=eqfilter
eqfilter=function(c,e,tp) eqfilter=function(c,e,tp)
return c:IsFaceup() and eqfilter2(c,tp) return c:IsFaceup() and eqfilter2(c,tp)
end end
local e1=rsef.ACT(cardtbl,nil,desctbl,ctlimittbl,"eq","tg",con,cost,rstg.target({eqfilter,"eq",LOCATION_MZONE,LOCATION_MZONE,1}),rsef.ACT_EQUIP_Op) local e1=rsef.ACT(cardtbl,nil,desctbl,ctlimittbl,"eq","tg",con,cost,rstg.target({eqfilter,"eq",LOCATION_MZONE,LOCATION_MZONE,1}),rsef.ACT_EQUIP_op)
local e2=rsef.SV(cardtbl,EFFECT_EQUIP_LIMIT,rsef.ACT_EQUIP_Val(eqfilter),nil,nil,nil,"cd") local e2=rsef.SV(cardtbl,EFFECT_EQUIP_LIMIT,rsef.ACT_EQUIP_val(eqfilter),nil,nil,nil,"cd")
return e1,e2 return e1,e2
end end
function rsef.ACT_EQUIP_Op(e,tp,eg,ep,ev,re,r,rp) function rsef.ACT_EQUIP_op(e,tp,eg,ep,ev,re,r,rp)
local tc=rscf.GetTargetCard(Card.IsFaceup) local tc=rscf.GetTargetCard(Card.IsFaceup)
if e:GetHandler():IsRelateToEffect(e) and tc then if e:GetHandler():IsRelateToEffect(e) and tc then
Duel.Equip(tp,e:GetHandler(),tc) Duel.Equip(tp,e:GetHandler(),tc)
end end
end end
function rsef.ACT_EQUIP_Val(eqfilter) function rsef.ACT_EQUIP_val(eqfilter)
return function(e,c) return function(e,c)
local tp=e:GetHandlerPlayer() local tp=e:GetHandlerPlayer()
return eqfilter(c,tp) return eqfilter(c,tp)
...@@ -965,355 +963,357 @@ function rsef.FC(cardtbl,code,desctbl,ctlimittbl,flag,range,con,op,resettbl) ...@@ -965,355 +963,357 @@ function rsef.FC(cardtbl,code,desctbl,ctlimittbl,flag,range,con,op,resettbl)
return rsef.Register(cardtbl,EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS,code,desctbl,ctlimittbl,nil,flag,range,con,nil,nil,op,nil,nil,nil,resettbl) return rsef.Register(cardtbl,EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS,code,desctbl,ctlimittbl,nil,flag,range,con,nil,nil,op,nil,nil,nil,resettbl)
end end
--Field Continues: Attach an extra effect when base effect is activating --Field Continues: Attach an extra effect when base effect is activating
function rsef.FC_AttachEffect_Activate(cardtbl,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl,force) function rsef.FC_AttachEffect_Activate(cardtbl,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
return rsef.FC_AttachEffect(cardtbl,force,0x1,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl) return rsef.FC_AttachEffect(cardtbl,0x1,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
end end
--Field Continues: Attach an extra effect before the base effect solving --Field Continues: Attach an extra effect before the base effect solving
function rsef.FC_AttachEffect_BeforeResolve(cardtbl,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl,force) function rsef.FC_AttachEffect_BeforeResolve(cardtbl,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
return rsef.FC_AttachEffect(cardtbl,force,0x2,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl) return rsef.FC_AttachEffect(cardtbl,0x2,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
end end
--Field Continues: Attach an extra effect after the base effect solving --Field Continues: Attach an extra effect after the base effect solving
function rsef.FC_AttachEffect_Resolve(cardtbl,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl,force) function rsef.FC_AttachEffect_Resolve(cardtbl,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
return rsef.FC_AttachEffect(cardtbl,force,0x4,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl) return rsef.FC_AttachEffect(cardtbl,0x4,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
end end
function rsef.FC_AttachEffect(cardtbl,force,attachtime,desctbl,ctlimittbl,flag,range,attachcon,attachop,resettbl) --Field Continues: base set
--for old version see code 10199981
function rsef.FC_AttachEffect(cardtbl,attachtime,desctbl1,ctlimittbl,flag,range,attachcon,attachop,resettbl,force)
if not range then range=rsef.GetRegisterRange(cardtbl) end
local c1,var2=rsef.GetRegisterCard(cardtbl) local c1,var2=rsef.GetRegisterCard(cardtbl)
range=range or rsef.GetRegisterRange(cardtbl) local flag2=rsflag.GetRegisterProperty({flag,"ptg"})
local attachcode=rscode.Extra_Effect_Activate local code=not force and rscode.Extra_Effect or rscode.Extra_Effect_FORCE
if attachtime==0x2 then attachcode=rscode.Extra_Effect_BSolve end local e1=rsef.FV(cardtbl,code,attachcon,nil,{1,0},range,rsef.FC_AttachEffect_setcon,resettbl,flag2,desctbl1)
if attachtime==0x4 then attachcode=rscode.Extra_Effect_ASolve end e1:SetOperation(attachop)
local e0=rsef.I(cardtbl,nil,ctlimittbl,nil,flag,range,aux.FALSE,nil,nil,nil,resettbl) e1:SetCategory(attachtime)
local e1=rsef.FC(cardtbl,attachcode,desctbl,nil,flag,range,rsef.FC_AttachEffect_Con(e0,attachcon),rsef.FC_AttachEffect_Op(e0,force),resettbl) local e2=rsef.I(cardtbl,nil,ctlimittbl,nil,nil,range,aux.FALSE,nil,nil,nil,resettbl)
e1:SetValue(attachop) e2:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_CONTINUOUS)
e1:SetLabelObject(e0) if flag2&EFFECT_FLAG_NO_TURN_RESET~=0 then
local desc=not desctbl and 0 or rsef.RegisterDescription(nil,desctbl,true) e2:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
end
rsef.attachinfo[e1]=e2
local reset,resetct=0,0
if resettbl then
reset,resetct=rsef.RegisterReset(nil,resettbl,true)
end
local desc=not desctbl1 and 0 or rsef.RegisterDescription(nil,desctbl1,true)
if aux.GetValueType(var2)=="Card" then if aux.GetValueType(var2)=="Card" then
var2:RegisterFlagEffect(attachcode,reset,EFFECT_FLAG_CLIENT_HINT,resetct,e1:GetFieldID(),desc) var2:RegisterFlagEffect(code,reset,EFFECT_FLAG_CLIENT_HINT,resetct,e1:GetFieldID(),desc)
else
local e1=Effect.CreateEffect(c1)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(0x10000000+attachcode)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetDescription(desc)
e1:SetTargetRange(1,0)
e1:SetReset(reset,resetct)
Duel.RegisterEffect(e1,var2)
end
if rsef.FC_AttachEffect_Switch then return e1 end
rsef.FC_AttachEffect_Switch=true
for p=0,1 do
local e2=Effect.GlobalEffect()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetOperation(rsef.FC_AttachEffect_ChangeOp)
e2:SetOwnerPlayer(p)
Duel.RegisterEffect(e2,p)
end end
if not rsef.FC_AttachEffect_Switch then
rsef.FC_AttachEffect_Switch=true
for i=0,1 do
local e3=Effect.GlobalEffect()
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_CHAIN_SOLVING)
e3:SetCondition(rsef.FC_AttachEffect_changecon)
e3:SetOperation(rsef.FC_AttachEffect_changeop)
e3:SetOwnerPlayer(i)
Duel.RegisterEffect(e3,i)
end
--reset chain op information
local e4=Effect.GlobalEffect()
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_CHAINING)
e4:SetOperation(rsef.FC_AttachEffect_resetinfo)
e4:SetOwnerPlayer(i)
Duel.RegisterEffect(e4,0)
rsef.ChangeChainOperation=Duel.ChangeChainOperation rsef.ChangeChainOperation=Duel.ChangeChainOperation
Duel.ChangeChainOperation=rsef.ChangeChainOperation2 Duel.ChangeChainOperation=rsef.ChangeChainOperation2
return e1
end
function rsef.FC_AttachEffect_Con(e0,attachcon)
return function(e,tp,eg,ep,ev,re,r,rp)
if not e0:CheckCountLimit(tp) then return false end
return not attachcon or attachcon(e,tp,eg,ep,ev,re,r,rp)
end end
return e1,e2
end end
function rsef.FC_AttachEffect_Op(e0,force) function rsef.FC_AttachEffect_resetinfo(e,tp,eg,ep,ev,re,r,rp)
return function(e,tp,eg,ep,ev,re,r,rp) local baseop=re:GetOperation()
rsef.attacheffect[ev]=rsef.attacheffect[ev] or {} if not baseop then
rsef.attacheffectf[ev]=rsef.attacheffectf[ev] or {} baseop=function(e2)
if force then table.insert(rsef.attacheffectf[ev],e) return
else
table.insert(rsef.attacheffect[ev],e)
end end
end end
rsef.attachinfo[ev]=baseop
end end
function rsef.FC_AttachEffect_GetGroup(selectlist) function rsef.ChangeChainOperation2(chainev,changeop,ischange)
local attachgroup=Group.CreateGroup() rsef.ChangeChainOperation(chainev,changeop)
local attacheffectlist={} if not ischange then
for _,ae in pairs(selectlist) do rsef.attachinfo[chainev]=changeop
local tc=ae:GetOwner()
attachgroup:AddCard(tc)
attacheffectlist[tc]=attacheffectlist[tc] or {}
table.insert(attacheffectlist[tc],ae)
end end
return attachgroup,attacheffectlist
end
function rsef.ChangeChainOperation2(ev,changeop,ischange)
rsef.ChangeChainOperation(ev,changeop)
if ischange then return end
rsop.baseop[ev]=changeop
end end
function rsef.FC_AttachEffect_ChangeOp(e,tp,eg,ep,ev,re,r,rp) function rsef.GetOperation(e,chainev)
local baseop=re:GetOperation() or aux.TRUE return rsef.attachinfo[chainev]
baseop=rsop.baseop[ev] or baseop
local e1=Effect.GlobalEffect()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVED)
e1:SetReset(RESET_CHAIN)
e1:SetOperation(rsef.FC_AttachEffect_Reset(re,baseop))
Duel.RegisterEffect(e1,0)
rsef.ChangeChainOperation2(ev,rsef.FC_AttachEffect_ChangeOp2(baseop),true)
end end
function rsef.FC_AttachEffect_Reset(re1,baseop) function rsef.FC_AttachEffect_setcon(e)
local tp=e:GetHandlerPlayer()
local te=rsef.attachinfo[e]
te:SetCondition(aux.TRUE)
local bool=te:IsActivatable(tp)
te:SetCondition(aux.FALSE)
return bool
end
function rsef.FC_AttachEffect_changecon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,rscode.Extra_Effect) or Duel.IsPlayerAffectedByEffect(tp,rscode.Extra_Effect_FORCE)
end
function rsef.FC_AttachEffect_changeop(e,tp,eg,ep,ev,re,r,rp)
local parameterlistcheck={e,tp,eg,ep,ev,re,r,rp}
local attachlist=rsef.FC_AttachEffect_geteffect(parameterlistcheck,{},0x1,{})
local baseop=rsef.GetOperation(re,ev)
Duel.ChangeChainOperation(ev,rsef.FC_AttachEffect_changeop2(parameterlistcheck,baseop,attachlist),true)
end
function rsef.FC_AttachEffect_changeop2(parameterlistcheck,baseop,attachlist)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
if re1~=re then return end local c=e:GetHandler()
rsef.attacheffect[ev]=nil if (c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS) or c:IsLocation(LOCATION_PZONE)) and not c:IsRelateToEffect(e) then
rsef.attacheffectf[ev]=nil return
rsef.solveeffect[ev]=nil end
rsop.baseop[ev]=nil local attachlisttotal={}
local rc=re:GetHandler() local parameterlistsolve={e,tp,eg,ep,ev,re,r,rp}
local res1=re:IsHasType(EFFECT_TYPE_ACTIVATE) and rc:IsType(TYPE_PENDULUM+TYPE_FIELD+TYPE_CONTINUOUS+TYPE_EQUIP) --before base effect solve
local res2=#({rc:IsHasEffect(EFFECT_REMAIN_FIELD)})>0 rsef.FC_AttachEffect_geteffect(parameterlistcheck,parameterlistsolve,0x2,attachlisttotal)
if (res1 or res2) and not rsop.baseop[ev2] then --base effect
re:SetOperation(baseop) --Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
rc:CancelToGrave(true) baseop(e,tp,eg,ep,ev,re,r,rp)
end table.insert(attachlisttotal,baseop)
end --attachlist
end for _,attacheffect in pairs(attachlist) do
function rsef.FC_AttachEffect_Solve(solveeffectlist,attachtime,e,tp,eg,ep,ev,re,r,rp) table.insert(attachlisttotal,attacheffect)
local actuselist={} rsef.FC_AttachEffect_Operation_Solve(parameterlistsolve,attacheffect,attachlisttotal)
local ev2=Duel.GetCurrentChain() end
local attachcode=rscode.Extra_Effect_Activate --after base effect solve
if attachtime==0x2 then attachcode=rscode.Extra_Effect_BSolve end rsef.FC_AttachEffect_geteffect(parameterlistcheck,parameterlistsolve,0x4,attachlisttotal)
if attachtime==0x4 then attachcode=rscode.Extra_Effect_ASolve end end
Duel.RaiseEvent(e:GetHandler(),attachcode,e,0,tp,tp,ev2) end
local forcelist=rsef.attacheffectf[ev2] or {} function rsef.FC_AttachEffect_getgroup(parameterlistcheck,cardlist,attachtime)
local selectablelist=rsef.attacheffect[ev2] or {} local e,tp,eg,ep,ev,re,r,rp=table.unpack(parameterlistcheck)
for _,ae in pairs(forcelist) do local effectlist={Duel.IsPlayerAffectedByEffect(tp,rscode.Extra_Effect)}
local tc=ae:GetOwner() local g=Group.CreateGroup()
for _,effect in pairs(effectlist) do
local con=effect:GetValue()
local cate=effect:GetCategory()
if (not con or con(effect,tp,eg,ep,ev,re,r,rp)) and effect:GetHandlerPlayer()==e:GetOwnerPlayer() and cate==attachtime then
local tc=effect:GetHandler()
if not cardlist[tc] then
cardlist[tc]={}
end
table.insert(cardlist[tc],effect)
g:AddCard(tc)
end
end
return g
end
function rsef.FC_AttachEffect_geteffect(parameterlistcheck,parameterlistsolve,attachtime,attachlisttotal)
local cardlist={}
local attachlist={}
local e,tp,eg,ep,ev,re,r,rp=table.unpack(parameterlistcheck)
--get force effect
local effectlist={Duel.IsPlayerAffectedByEffect(tp,rscode.Extra_Effect_FORCE)}
if #effectlist>0 then
for _,effect in pairs(effectlist) do
local con=effect:GetValue()
local cate=effect:GetCategory()
if (not con or con(effect,tp,eg,ep,ev,re,r,rp)) and effect:GetHandlerPlayer()==e:GetOwnerPlayer() and cate==attachtime then
local tc=effect:GetHandler()
if tc:IsOnField() then if tc:IsOnField() then
Duel.HintSelection(rsgf.Mix2(tc)) Duel.HintSelection(rsgf.Mix2(tc))
else else
Duel.Hint(HINT_CARD,0,tc:GetOriginalCodeRule()) Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
end end
Duel.Hint(HINT_OPSELECTED,1-tp,ae:GetDescription()) Duel.Hint(HINT_OPSELECTED,1-tp,effect:GetDescription())
table.insert(actuselist,ae)
ae:GetLabelObject():UseCountLimit(tp,1)
if attachtime~=0x1 then if attachtime~=0x1 then
table.insert(solveeffectlist,ae) table.insert(attachlisttotal,effect)
ae:GetValue()(e,tp,eg,ep,ev,re,r,rp) rsef.FC_AttachEffect_Operation_Solve(parameterlistsolve,effect,attachlisttotal)
end
table.insert(attachlist,effect)
local te=rsef.attachinfo[effect]
te:UseCountLimit(tp,1)
end
end end
end end
local attachgroup,attacheffectlist=rsef.FC_AttachEffect_GetGroup(selectablelist) --get not force
local selecthint=8 local g=rsef.FC_AttachEffect_getgroup(parameterlistcheck,cardlist,attachtime)
if attachtime==0x2 then selecthint=9 end if #g<=0 then return attachlist end
if attachtime==0x4 then selecthint=10 end local hint=aux.Stringid(m,8)
if #attachgroup>0 and Duel.SelectYesNo(tp,aux.Stringid(m,selecthint)) then if attachtime==0x2 then hint=aux.Stringid(m,9) end
::Select:: if attachtime==0x4 then hint=aux.Stringid(m,10) end
if not Duel.SelectYesNo(tp,hint) then return attachlist end
local ct=1
repeat
ct=ct+1
cardlist={}
local g=rsef.FC_AttachEffect_getgroup(parameterlistcheck,cardlist,attachtime)
if #g<=0 then break end
rshint.Select(tp,HINTMSG_TARGET) rshint.Select(tp,HINTMSG_TARGET)
local tc=attachgroup:Select(tp,1,1,nil):GetFirst() local tc=g:Select(tp,1,1,nil):GetFirst()
if tc:IsOnField() then if tc:IsOnField() then
Duel.HintSelection(rsgf.Mix2(tc)) Duel.HintSelection(rsgf.Mix2(tc))
else else
Duel.Hint(HINT_CARD,0,tc:GetOriginalCodeRule()) Duel.Hint(HINT_CARD,0,tc:GetOriginalCode())
end end
local effectlist2=cardlist[tc]
local hintlist={} local hintlist={}
for _,ae in pairs(attacheffectlist[tc]) do for _,effect in pairs(effectlist2) do
local hint=ae:GetDescription() local hint=effect:GetDescription()
table.insert(hintlist,hint) table.insert(hintlist,hint)
end end
local opt=Duel.SelectOption(tp,table.unpack(hintlist))+1 local op=Duel.SelectOption(tp,table.unpack(hintlist))+1
local ae=attacheffectlist[tc][opt] local effect=effectlist2[op]
Duel.Hint(HINT_OPSELECTED,1-tp,ae:GetDescription()) --Duel.Hint(HINT_OPSELECTED,1-tp,effect:GetDescription())
table.insert(actuselist,ae)
ae:GetLabelObject():UseCountLimit(tp,1)
if attachtime~=0x1 then if attachtime~=0x1 then
table.insert(solveeffectlist,ae) table.insert(attachlisttotal,effect)
ae:GetValue()(e,tp,eg,ep,ev,re,r,rp) rsef.FC_AttachEffect_Operation_Solve(parameterlistsolve,effect,attachlisttotal)
end end
local _,index=rsof.Table_List(selectablelist,ae) table.insert(attachlist,effect)
table.remove(selectablelist,index) local te=rsef.attachinfo[effect]
attachgroup,attacheffectlist=rsef.FC_AttachEffect_GetGroup(selectablelist) te:UseCountLimit(tp,1)
if #attachgroup>0 and Duel.SelectYesNo(tp,aux.Stringid(m,11)) then goto Select end local g2=rsef.FC_AttachEffect_getgroup(parameterlistcheck,cardlist,attachtime)
end until (ct>1 and #g2<=0) or (ct>1 and not Duel.SelectYesNo(tp,aux.Stringid(m,11)))
rsef.attacheffect[ev2]=nil return attachlist
rsef.attacheffectf[ev2]=nil end
return actuselist function rsef.FC_AttachEffect_Operation_Solve(parameterlistsolve,currenteffect,attachlisttotal)
end --local e=table.unpack(parameterlistsolve)
function rsef.FC_AttachEffect_ChangeOp2(baseop) if aux.GetValueType(currenteffect)~="Effect" then
return function(e,tp,eg,ep,ev,re,r,rp) --Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCode())
local ev2=Duel.GetCurrentChain() currenteffect(table.unpack(parameterlistsolve))
local c=e:GetHandler() else
if (c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS) or c:IsLocation(LOCATION_PZONE)) and not c:IsRelateToEffect(e) then --Duel.Hint(HINT_CARD,0,currenteffect:GetHandler():GetOriginalCode())
return local operation=currenteffect:GetOperation()
operation(table.unpack(parameterlistsolve))
end end
rsef.solveeffect[ev2]={} if rsef.FC_AttachEffect_Repeat then
--baseop record rsef.FC_AttachEffect_Repeat=false
table.insert(rsef.solveeffect[ev2],baseop) for index,attacheffect in pairs(attachlisttotal) do
--activate select local _,indexrepeat=rsof.Table_List(attachlisttotal,currenteffect)
local actuselist=rsef.FC_AttachEffect_Solve(rsef.solveeffect[ev2],0x1,e,tp,eg,ep,ev,re,r,rp) if index>=indexrepeat then break end
--before solve rsef.FC_AttachEffect_Operation_Solve(parameterlistsolve,attacheffect,attachlisttotal)
rsef.FC_AttachEffect_Solve(rsef.solveeffect[ev2],0x2,e,tp,eg,ep,ev,re,r,rp)
--baseop solve
baseop(e,tp,eg,ep,ev,re,r,rp)
--activate solve
for _,ae in pairs(actuselist) do
table.insert(rsef.solveeffect[ev2],ae)
ae:GetValue()(e,tp,eg,ep,ev,re,r,rp)
ae:GetLabelObject():UseCountLimit(tp,1)
end end
--after solve
rsef.FC_AttachEffect_Solve(rsef.solveeffect[ev2],0x4,e,tp,eg,ep,ev,re,r,rp)
end end
end end
--Effect Function:XXX card/group will leave field in XXX Phase , often use in special summon ----------------"Part_Effect_SingleContinuous"----------------
function rsef.FC_PHASELEAVE(cardtbl,sg,times,whos,phase,leaveway,resettbl)
--times: nil every phase --Single Continues: Base set
-- 0 next phase function rsef.SC(cardtbl,code,desctbl,ctlimittbl,flag,con,op,resettbl)
-- 1 or + times phase return rsef.Register(cardtbl,EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS,code,desctbl,ctlimittbl,nil,flag,nil,con,nil,nil,op,nil,nil,nil,resettbl)
--whos: nil each player end
-- 0 yours phase (tp)
-- 1 your opponent's phase (1-tp)
local c1,var2=rsef.GetRegisterCard(cardtbl) -------------------"Part_Summon_Function"---------------------
local cphase=Duel.GetCurrentPhase()
local turnctlist={Duel.GetTurnCount(),Duel.GetTurnCount(var2),Duel.GetTurnCount(1-var2)} --Summon Function: Quick Special Summon buff
local turnp=Duel.GetTurnPlayer() --valtbl:{atk,def,lv}
phase=phase or PHASE_END --waytbl:{way,resettbl}
leaveway=leaveway or "des" function rssf.SummonBuff(valtbl,dis,trigger,leaveloc,waytbl)
if times==0 and whos==0 and turnp==tp then return function(c,sc,e,tp,sg)
times=cphase<=phase and 2 or 1 local reset=((c==sc and not sg or #sg==1) and rsreset.est_d or rsreset.est)
end if valtbl then
if times==0 and whos==1 and turnp~=tp then local atk,def,lv=valtbl[1],valtbl[2],valtbl[3]
times=cphase<=phase and 2 or 1 rsef.SV_SET({c,sc,true},"atk,def",{atk,def},nil,reset)
end rsef.SV_CHANGE({c,sc,true},"lv",lv,nil,reset)
local fid=c1:GetFieldID() end
if dis then
rsef.SV_LIMIT({c,sc,true},"dis,dise",nil,nil,reset)
end
if trigger then
rsef.SV_LIMIT({c,tc,true},"tri",nil,nil,reset)
end
if type(leaveloc)=="number" then
local flag=nil
if c==sc then flag=EFFECT_CANNOT_DISABLE end
rsef.SV_REDIRECT({c,sc,true},"leave",leaveloc,nil,rsreset.ered,flag)
end
if waytbl then
if type(waytbl)=="string" then waytbl={waytbl} end
if type(waytbl)=="boolean" then waytbl={"des"} end
local way=waytbl[1]
local resettbl=waytbl[2]
if not resettbl then resettbl={0,1} end
local reset2,resetct,resetplayer=resettbl[1],resettbl[2],resettbl[3]
local fid=c:GetFieldID()
for tc in aux.Next(sg) do for tc in aux.Next(sg) do
tc:RegisterFlagEffect(rscode.Phase_Leave_Flag,rsreset.est+RESET_PHASE+phase,0,0,fid) tc:RegisterFlagEffect(rscode.Summon_Flag,rsreset.est+reset2,0,resetct,fid)
end end
local e1=rsef.FC(cardtbl,EVENT_PHASE+phase,rshint.epleave,1,"ii",nil,rsef.FC_PhaseLeave_Con(cphase,turnctlist,turnp,fid,times,whos),rsef.FC_PhaseLeave_Op(leaveway,fid),resettbl) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
if reset2 and reset2~=0 then
e1:SetReset(reset2,resetct)
end
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
sg:KeepAlive() sg:KeepAlive()
e1:SetLabelObject(sg) e1:SetLabelObject(sg)
return e1 e1:SetCondition(rssf.SummonBuff_Con(fid,resetct,resetplayer))
e1:SetOperation(rssf.SummonBuff_Op(fid,way))
Duel.RegisterEffect(e1,tp)
end
end
end end
function rsef.FC_PhaseLeave_Filter(c,fid) function rssf.SummonBuff_Filter(c,e,fid)
return c:GetFlagEffectLabel(rscode.Phase_Leave_Flag)==fid return c:GetFlagEffectLabel(rscode.Summon_Flag)==fid
end end
function rsef.FC_PhaseLeave_Con(cphase,turnctlist,turnp,fid,times,whos) function rssf.SummonBuff_Con(fid,resetct,resetplayer)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local ecphase=Duel.GetCurrentPhase()
local eturnp=Duel.GetTurnPlayer()
local eturnct,eturncttp,eturnctop=Duel.GetTurnCount(),Duel.GetTurnCount(tp),Duel.GetTurnCount()
local turnct,turncttp,turnctop=turnctlist[1],turnctlist[2],turnctlist[3]
local g=e:GetLabelObject() local g=e:GetLabelObject()
local rg=g:Filter(rsef.FC_PhaseLeave_Filter,nil,fid) local rg=g:Filter(rssf.SummonBuff_Filter,nil,e,fid)
local reset=false if rg:GetCount()<=0 then
local solve=false g:DeleteGroup() e:Reset()
if #rg<=0 then reset=true end
if times and times>0 and not whos then
if eturnct>turnct+(times-1) then reset=true end
if eturnct==turnct+(times-1) then solve=true end
end
if times and times>0 and whos==0 and eturnp==tp then
if eturncttp>turncttp+(times-1) then reset=true end
if eturncttp==turncttp+(times-1) then solve=true end
end
if times and times>0 and whos==0 and eturnp~=tp then
if eturnctop>turnctop+(times-1) then reset=true end
if eturnctop==turnctop+(times-1) then solve=true end
end
if not times then
solve=true
end
if reset then
g:DeleteGroup()
e:Reset()
return false return false
end end
return solve if resetplayer and resetplayer~=Duel.GetTurnPlayer() then return false
end
local tid1=rg:GetFirst():GetTurnID()
local tid2=Duel.GetTurnCount()
if resetct==0 and tid1~=tid2 then return false end
if resetct>1 and tid1==tid2 then return false end
return true
end end
end end
function rsef.FC_PhaseLeave_Op(way,fid) function rssf.SummonBuff_Op(fid,way)
return function(e,tp,eg,ep,ev,re,r,rp) return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner() local c=e:GetOwner()
Duel.Hint(HINT_CARD,0,c:GetOriginalCode()) Duel.Hint(HINT_CARD,0,c:GetOriginalCode())
local g=e:GetLabelObject() local g=e:GetLabelObject()
local rg=g:Filter(rsef.FC_PhaseLeave_Filter,nil,fid) local rg=g:Filter(rssf.SummonBuff_Filter,nil,e,fid)
if type(way)=="function" then way(rg,e,tp,eg,ep,ev,re,r,rp) if way=="des" then Duel.Destroy(rg,REASON_EFFECT)
elseif way=="des" then Duel.Destroy(rg,REASON_EFFECT)
elseif way=="th" then Duel.SendtoHand(rg,nil,REASON_EFFECT) elseif way=="th" then Duel.SendtoHand(rg,nil,REASON_EFFECT)
elseif way=="td" then Duel.SendtoDeck(rg,nil,2,REASON_EFFECT) elseif way=="td" then Duel.SendtoDeck(rg,nil,2,REASON_EFFECT)
elseif way=="tdt" then Duel.SendtoDeck(rg,nil,0,REASON_EFFECT) elseif way=="tdt" then Duel.SendtoDeck(rg,nil,0,REASON_EFFECT)
elseif way=="tdb" then Duel.SendtoDeck(rg,nil,1,REASON_EFFECT) elseif way=="tdb" then Duel.SendtoDeck(rg,nil,1,REASON_EFFECT)
elseif way=="rm" then Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) elseif way=="rm" then Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)
elseif way=="tg" then Duel.SendtoGrave(rg,REASON_EFFECT) elseif way=="rg" then Duel.SendtoGrave(rg,REASON_EFFECT)
end
if g:FilterCount(rssf.SummonBuff_Filter,nil,e,fid)<=0 then
g:DeleteGroup()
e:Reset()
end end
end end
end
----------------"Part_Effect_SingleContinuous"----------------
--Single Continues: Base set
function rsef.SC(cardtbl,code,desctbl,ctlimittbl,flag,con,op,resettbl)
return rsef.Register(cardtbl,EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS,code,desctbl,ctlimittbl,nil,flag,nil,con,nil,nil,op,nil,nil,nil,resettbl)
end
-------------------"Part_Summon_Function"---------------------
--Summon Function: Set Default Parameter
function rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
sstype= sstype or 0
ssplayer=ssplayer or Duel.GetChainInfo(0,CHAININFO_TRIGGERING_PLAYER)
tplayer=tplayer or ssplayer
ignorecon=ignorecon or false
ignorerevie=ignorerevie or false
pos=pos or POS_FACEUP
return sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos
end end
--Summon Function: Duel.SpecialSummon + buff --Summon Function: Duel.SpecialSummon + buff
function rssf.SpecialSummon(ssgorc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone,sumcardfun,sumgroupfun) function rssf.SpecialSummon(ssgorc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone,sumfun)
sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos=rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos) sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos=rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
local ct=0 local ct=0
local g=Group.CreateGroup() if zone then
local sg=rsgf.Mix2(ssgorc) ct=Duel.SpecialSummon(ssgorc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone)
for sc in aux.Next(sg) do else
if rssf.SpecialSummonStep(sc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone,sumcardfun) then ct=Duel.SpecialSummon(ssgorc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
ct=ct+1
g:AddCard(sc)
end
end
if ct>0 then
Duel.SpecialSummonComplete()
end
for sc in aux.Next(g) do
if sc:GetFlagEffect(rscode.Pre_Complete_Proc)>0 then
sc:CompleteProcedure()
sc:ResetFlagEffect(rscode.Pre_Complete_Proc)
end
end end
local e=g:GetFirst():GetReasonEffect() local g=Duel.GetOperatedGroup()
local tp=e:GetHandlerPlayer() if #g>0 and sumfun then
local c=g:GetFirst():GetReasonEffect():GetHandler() local c=g:GetFirst():GetReasonEffect():GetHandler()
if #g>0 and sumgroupfun then for tc in aux.Next(g) do
if type(sumgroupfun)=="table" then sumfun(c,tc,e,tp,g)
rsef.FC_PHASELEAVE({c,tp},g,table.unpack(sumgroupfun))
elseif type(sumgroupfun)=="string" then
rsef.FC_PHASELEAVE({c,tp},g,nil,nil,PHASE_END,sumgroupfun)
elseif type(sumcardfun)=="function" then
sumgroupfun(g,c,e,tp)
end end
end end
return ct,g,g:GetFirst() return ct,g
end end
--Summon Function: Duel.SpecialSummonStep + buff --Summon Function: Duel.SpecialSummonStep + buff
function rssf.SpecialSummonStep(sc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone,sumcardfun) function rssf.SpecialSummonStep(sscard,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone,sumfun)
sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos=rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos) sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos=rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
local tf=false local tf=false
if zone then if zone then
tf=Duel.SpecialSummonStep(sc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone) tf=Duel.SpecialSummonStep(sscard,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos,zone)
else else
tf=Duel.SpecialSummonStep(sc,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos) tf=Duel.SpecialSummonStep(sscard,sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
end
if tf and sumcardfun then
local e=sc:GetReasonEffect()
local tp=e:GetHandlerPlayer()
local c=sc:GetReasonEffect():GetHandler()
if type(sumcardfun)=="table" then
rscf.QuickBuff({c,sc,true},table.unpack(sumcardfun))
elseif type(sumcardfun)=="function" then
sumcardfun(c,sc,e,tp,g)
end end
if tf and sumfun then
local c=sscard:GetReasonEffect():GetHandler()
sumfun(c,sscard,e,tp)
end end
return tf,sscard return tf,sscard
end end
...@@ -1357,7 +1357,17 @@ function rssf.SpecialSummonEither(ssgorc,e,sstype,ssplayer,tplayer,ignorecon,ign ...@@ -1357,7 +1357,17 @@ function rssf.SpecialSummonEither(ssgorc,e,sstype,ssplayer,tplayer,ignorecon,ign
if #ssg>0 then if #ssg>0 then
Duel.SpecialSummonComplete() Duel.SpecialSummonComplete()
end end
return #ssg,ssg,ssg:GetFirst() return #ssg,ssg
end
--Summon Function: Set Default Parameter
function rssf.GetSSDefaultParameter(sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos)
if not sstype then sstype=0 end
if not ssplayer then ssplayer=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_PLAYER) end
if not tplayer then tplayer=ssplayer end
if not ignorecon then ignorecon=false end
if not ignorerevie then ignorerevie=false end
if not pos then pos=POS_FACEUP end
return sstype,ssplayer,tplayer,ignorecon,ignorerevie,pos
end end
-------------------"Part_Value_Function"--------------------- -------------------"Part_Value_Function"---------------------
...@@ -1388,7 +1398,7 @@ function rsval.indct(string1,string2) ...@@ -1388,7 +1398,7 @@ function rsval.indct(string1,string2)
end end
--value: unaffected by opponent's card effects --value: unaffected by opponent's card effects
function rsval.imoe(e,re) function rsval.imoe(e,re)
return e:GetOwnerPlayer()~=re:GetHandlerPlayer() return e:GetOwnerPlayer()~=re:GetOwnerPlayer()
end end
--value: unaffected by other card effects --value: unaffected by other card effects
function rsval.imes(e,re) function rsval.imes(e,re)
...@@ -1415,7 +1425,7 @@ function rsval.cdisneg(filter) ...@@ -1415,7 +1425,7 @@ function rsval.cdisneg(filter)
return function(e,ct) return function(e,ct)
local p=e:GetHandlerPlayer() local p=e:GetHandlerPlayer()
local te,tp,loc=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_LOCATION) local te,tp,loc=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_LOCATION)
return (not filter and p==tp) or (filter and filter(e,p,te,tp,loc)) return (not filter and p==tp) or filter(e,p,te,tp,loc)
end end
end end
...@@ -1445,7 +1455,6 @@ function rstg.disnegtg(disorneg,waystring) ...@@ -1445,7 +1455,6 @@ function rstg.disnegtg(disorneg,waystring)
local _,_,filterfun=rsof.Table_Suit(waystring,waylist,waylist2) local _,_,filterfun=rsof.Table_Suit(waystring,waylist,waylist2)
local _,_,filterfun2,cate=rsof.Table_Suit(waystring,waylist,waylist3,catelist) local _,_,filterfun2,cate=rsof.Table_Suit(waystring,waylist,waylist3,catelist)
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 rc=re:GetHandler() local rc=re:GetHandler()
if chk==0 then return if chk==0 then return
--filterfun(rc) --filterfun(rc)
...@@ -1457,11 +1466,6 @@ function rstg.disnegtg(disorneg,waystring) ...@@ -1457,11 +1466,6 @@ function rstg.disnegtg(disorneg,waystring)
Duel.SetOperationInfo(0,cate,eg,1,0,0) Duel.SetOperationInfo(0,cate,eg,1,0,0)
end end
end end
if c:IsType(TYPE_CONTINUOUS+TYPE_FIELD+TYPE_PENDULUM) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsOnField() and c:IsRelateToEffect(e) then
rsef.relationinfo[Duel.GetCurrentChain()]=true
else
rsef.relationinfo[Duel.GetCurrentChain()]=false
end
end end
end end
function rstg.distg(waystring) function rstg.distg(waystring)
...@@ -1508,12 +1512,7 @@ function rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetlist) ...@@ -1508,12 +1512,7 @@ function rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetlist)
selecthint=catevalue[3] selecthint=catevalue[3]
end end
end end
local listtype=targetlist[10]
local _,catelist2,catestringlist=rsef.GetRegisterCategory(catelist) local _,catelist2,catestringlist=rsef.GetRegisterCategory(catelist)
if listtype and listtype=="cost" and rsof.Table_List(catelist2,CATEGORY_HANDES) then
catelist2={ CATEGORY_TOGRAVE }
selecthint=selecthint or HINTMSG_DISCARD
end
local loc1,loc2=targetlist[3],targetlist[4] local loc1,loc2=targetlist[3],targetlist[4]
if type(loc1)=="function" then if type(loc1)=="function" then
loc1=loc1(e,tp,eg,ep,ev,re,r,rp) loc1=loc1(e,tp,eg,ep,ev,re,r,rp)
...@@ -1532,6 +1531,7 @@ function rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetlist) ...@@ -1532,6 +1531,7 @@ function rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetlist)
local exceptfun=targetlist[7] local exceptfun=targetlist[7]
local isoptional=targetlist[8] local isoptional=targetlist[8]
--local selecthint=targetlist[9] --local selecthint=targetlist[9]
local listtype=targetlist[10]
if not listtype then if not listtype then
listtype="target" listtype="target"
end end
...@@ -1615,41 +1615,15 @@ end ...@@ -1615,41 +1615,15 @@ end
function rstg.GetTargetCheckAndSelectFun(b2,catelist) function rstg.GetTargetCheckAndSelectFun(b2,catelist)
local targetcheckfun= not b2 and Duel.IsExistingMatchingCard or Duel.IsExistingTarget local targetcheckfun= not b2 and Duel.IsExistingMatchingCard or Duel.IsExistingTarget
local targetselectfun= not b2 and Duel.SelectMatchingCard or Duel.SelectTarget local targetselectfun= not b2 and Duel.SelectMatchingCard or Duel.SelectTarget
local playertargetlist={ CATEGORY_DRAW,CATEGORY_DECKDES,CATEGORY_RECOVER,CATEGORY_DAMAGE,CATEGORY_HANDES } -- local playertargetlist={ CATEGORY_DRAW,CATEGORY_DECKDES,CATEGORY_RECOVER,CATEGORY_DAMAGE } --CATEGORY_HANDES
for _,cate in pairs(playertargetlist) do for _,cate in pairs(playertargetlist) do
if rsof.Table_List(catelist,cate) then if rsof.Table_List(catelist,cate) then
targetcheckfun=rstg.PlayerTarget_Set_Usingct(cate) targetcheckfun=rstg.Target_Fun_Check_Fun(cate)
targetselectfun=rstg.Target_Fun_Select_Fun(cate) targetselectfun=rstg.Target_Fun_Select_Fun(cate)
end end
end end
return targetcheckfun,targetselectfun return targetcheckfun,targetselectfun
end end
function rstg.PlayerTarget_Set_Usingct(cate)
return function(filter,tp,spct,opct,minct2_nouse,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,targetvalue2,...)
if spct>0 then
usingct[tp][cate]=usingct[tp][cate] or 0
local spct2=usingct[tp][cate]+spct
usingct[tp][cate]=spct2
if cate==CATEGORY_DRAW and not Duel.IsPlayerCanDraw(tp,spct2) then return false end
if cate==CATEGORY_HANDES and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)<spct2 then return false end
if cate==CATEGORY_DECKDES and not Duel.IsPlayerCanDiscardDeck(tp,spct2) then return false end
end
if opct>0 then
usingct[1-tp][cate]=usingct[1-tp][cate] or 0
local opct2=usingct[1-tp][cate]+opct
usingct[1-tp][cate]=opct2
if cate==CATEGORY_DRAW and not Duel.IsPlayerCanDraw(1-tp,opct2) then return false end
if cate==CATEGORY_HANDES and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)<opct2 then return false end
if cate==CATEGORY_DECKDES and not Duel.IsPlayerCanDiscardDeck(1-tp,opct2) then return false end
end
return spct>0 or opct>0
end
end
function rstg.Target_Fun_Select_Fun(cate)
return function(selectp,filter_nouse,locp_nouse,spct,opct,minct_nouse,maxct_nouse,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,...)
rstg.PlayerTarget_Set_Usingct(cate,tp,spct,opct,usingct)
end
end
--Effect target: Check chkc & chk --Effect target: Check chkc & chk
function rstg.TargetCheck(e,tp,eg,ep,ev,re,r,rp,chk,chkc,valuetype,...) function rstg.TargetCheck(e,tp,eg,ep,ev,re,r,rp,chk,chkc,valuetype,...)
local targetlist={rstg.list(valuetype,...)} local targetlist={rstg.list(valuetype,...)}
...@@ -1690,6 +1664,50 @@ function rstg.TargetCheck(e,tp,eg,ep,ev,re,r,rp,chk,chkc,valuetype,...) ...@@ -1690,6 +1664,50 @@ function rstg.TargetCheck(e,tp,eg,ep,ev,re,r,rp,chk,chkc,valuetype,...)
end end
end end
end end
function rstg.PlayerTarget_Set_Usingct(cate,tp,spct,opct,usingct)
if spct>0 then
usingct[tp][cate]=usingct[tp][cate] or 0
local spct2=usingct[tp][cate]+spct
usingct[tp][cate]=spct2
if cate==CATEGORY_DRAW and not Duel.IsPlayerCanDraw(tp,spct2) then return false end
--if cate==CATEGORY_HANDES and not Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>=spct2 then return false end
if cate==CATEGORY_DECKDES and not Duel.IsPlayerCanDiscardDeck(tp,spct2) then return false end
end
if opct>0 then
usingct[1-tp][cate]=usingct[1-tp][cate] or 0
local opct2=usingct[1-tp][cate]+opct
usingct[1-tp][cate]=opct2
if cate==CATEGORY_DRAW and not Duel.IsPlayerCanDraw(1-tp,opct2) then return false end
--if cate==CATEGORY_HANDES and not Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>=opct2 then return false end
if cate==CATEGORY_DECKDES and not Duel.IsPlayerCanDiscardDeck(1-tp,opct2) then return false end
end
return true
end
function rstg.Target_Fun_Check_Fun(cate)
return function(filter,tp,spct,opct,minct2_nouse,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,targetvalue2,...)
if not rstg.PlayerTarget_Set_Usingct(cate,tp,spct,opct,usingct) then return false end
if not targetvalue2 then return true end
local ffunction,catelist,catestringlist,catefun,selecthint,loc1,loc2,minct,maxct,exceptfun,isoptional,listtype = rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetvalue2)
local b1,b2,b3,b4,b5=rstg.CheckTargetlistType(listtype)
local targetfun=rstg.GetTargetCheckAndSelectFun(b2,catelist)
local exceptg=rsgf.GetExceptGroup(exceptfun,b4,e,tp,eg,ep,ev,re,r,rp)
return targetfun(rstg.TargetFilter,tp,loc1,loc2,minct2,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue2,...)
end
end
function rstg.Target_Fun_Select_Fun(cate)
return function(selectp,filter_nouse,locp_nouse,spct,opct,minct_nouse,maxct_nouse,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,...)
rstg.PlayerTarget_Set_Usingct(cate,tp,spct,opct,usingct)
return Group.CreateGroup(),{[tp]=spct,[1-tp]=opct}
end
end
function rstg.Target_Fun_Check_NullFun(filter,tp,spct,opct,minct2_nouse,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,targetvalue2,...)
if not targetvalue2 then return true end
local ffunction,catelist,catestringlist,catefun,selecthint,loc1,loc2,minct,maxct,exceptfun,isoptional,listtype = rstg.GetTargetAttribute(e,tp,eg,ep,ev,re,r,rp,targetvalue2)
local b1,b2,b3,b4,b5=rstg.CheckTargetlistType(listtype)
local targetfun=rstg.GetTargetCheckAndSelectFun(b2,catelist)
local exceptg=rsgf.GetExceptGroup(exceptfun,b4,e,tp,eg,ep,ev,re,r,rp)
return targetfun(rstg.TargetFilter,tp,loc1,loc2,minct2,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue2,...)
end
--Effect target: Target filter --Effect target: Target filter
function rstg.TargetFilter(c,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,targetvalue2,...) function rstg.TargetFilter(c,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,targetvalue1,targetvalue2,...)
local usingg2=usingg:Clone() local usingg2=usingg:Clone()
...@@ -1795,7 +1813,7 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...) ...@@ -1795,7 +1813,7 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...)
end end
--target --target
if b4 and type(loc1)=="table" then if b4 and type(loc1)=="table" then
local solvelist=rstg.targetlist[chainid] local solvelist=rsef.targetlist[chainid]
local solvegroup=Group.CreateGroup() local solvegroup=Group.CreateGroup()
for _,listindex in pairs(loc1) do for _,listindex in pairs(loc1) do
if listindex==0 then if listindex==0 then
...@@ -1809,7 +1827,7 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...) ...@@ -1809,7 +1827,7 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...)
selectgroup=solvegroup:Filter(rstg.targetsolvefilter,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,ffunction) selectgroup=solvegroup:Filter(rstg.targetsolvefilter,exceptg,e,tp,eg,ep,ev,re,r,rp,usingg,usingct,ffunction)
end end
--operation info catelist --operation info catelist
local playertargetcatelist={ CATEGORY_DRAW,CATEGORY_RECOVER,CATEGORY_DAMAGE,CATEGORY_DECKDES,CATEGORY_HANDES } -- local playertargetcatelist={ CATEGORY_DRAW,CATEGORY_RECOVER,CATEGORY_DAMAGE,CATEGORY_DECKDES } --CATEGORY_HANDES
for _,cate in ipairs(catelist) do for _,cate in ipairs(catelist) do
local selectinfolist=b1 and costinfolist or cateinfolist local selectinfolist=b1 and costinfolist or cateinfolist
--because player use 0 and 1 , some caculate like 0+1=1 ,cannot get PLAYER_ALL(3) ,so first treat base player as 1 and 2 --because player use 0 and 1 , some caculate like 0+1=1 ,cannot get PLAYER_ALL(3) ,so first treat base player as 1 and 2
...@@ -1868,10 +1886,10 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...) ...@@ -1868,10 +1886,10 @@ function rstg.TargetSelectNoInfo(e,tp,eg,ep,ev,re,r,rp,valuetype,...)
if not costres or (aux.GetValueType(costres)=="Group" and #costres<=0) then return end if not costres or (aux.GetValueType(costres)=="Group" and #costres<=0) then return end
elseif b2 or b3 then elseif b2 or b3 then
if b2 then if b2 then
if not rstg.targetlist[chainid] then if not rsef.targetlist[chainid] then
rstg.targetlist[chainid]={} rsef.targetlist[chainid]={}
end end
table.insert(rstg.targetlist[chainid],rsgf.Group_To_Table(selectgroup)) table.insert(rsef.targetlist[chainid],rsgf.Group_To_Table(selectgroup))
end end
targettotalgroup:Merge(selectgroup) targettotalgroup:Merge(selectgroup)
end end
...@@ -1890,7 +1908,7 @@ function rstg.TargetSelect(e,tp,eg,ep,ev,re,r,rp,valuetype,...) ...@@ -1890,7 +1908,7 @@ function rstg.TargetSelect(e,tp,eg,ep,ev,re,r,rp,valuetype,...)
--because player use 0 and 1 , some caculate like 0+1=1 ,cannot get PLAYER_ALL(3) ,so first treat base player as 1 and 2, inverse operation --because player use 0 and 1 , some caculate like 0+1=1 ,cannot get PLAYER_ALL(3) ,so first treat base player as 1 and 2, inverse operation
local playerlist={[0]=0,[1]=0,[2]=1,[3]=3} local playerlist={[0]=0,[1]=0,[2]=1,[3]=3}
infop=playerlist[infop] infop=playerlist[infop]
local playertargetcatelist={ CATEGORY_DRAW,CATEGORY_RECOVER,CATEGORY_DAMAGE,CATEGORY_DECKDES,CATEGORY_HANDES } -- local playertargetcatelist={ CATEGORY_DRAW,CATEGORY_RECOVER,CATEGORY_DAMAGE,CATEGORY_DECKDES } --CATEGORY_HANDES
if rsof.Table_List(playertargetcatelist,cate) then if rsof.Table_List(playertargetcatelist,cate) then
local spvalue=infoloc[tp] local spvalue=infoloc[tp]
local opvalue=infoloc[1-tp] local opvalue=infoloc[1-tp]
...@@ -2200,24 +2218,12 @@ function rscost.regflag(flagcode,resettbl) ...@@ -2200,24 +2218,12 @@ 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()
flagcode = flagcode or code if not flagcode then flagcode=code end
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
...@@ -2247,11 +2253,8 @@ function rscon.phase(p1,...) ...@@ -2247,11 +2253,8 @@ 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 phase_mp=function() local stringlist={"dp","sp","mp1","bp","bsp","dam","damndcal","dambdcal","dcal","ndcal","mp2","ep"}
return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2 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 }
end
local stringlist={"dp","sp","mp1","bp","bsp","dam","damndcal","dambdcal","dcal","ndcal","mp2","ep","mp"}
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,phase_mp }
local mainstringlist={} local mainstringlist={}
local turnplayerlist={} local turnplayerlist={}
local parlist2=rsof.String_Number_To_Table(parlist) local parlist2=rsof.String_Number_To_Table(parlist)
...@@ -2274,19 +2277,19 @@ function rscon.phase(p1,...) ...@@ -2274,19 +2277,19 @@ 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("mp1,mp2")(e) 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)
return rscon.phase("ndcal")(e) return rscon.phase("ndcal")
end end
--Condition: Battle Phase --Condition: Battle Phase
function rscon.phbp(e) function rscon.phbp(e)
return rscon.phase("bp")(e) return rscon.phase("bp")
end end
--Condition: Phase damage calculate,but not calculate --Condition: Phase damage calculate,but not calculate
function rscon.dambdcal(e) function rscon.dambdcal(e)
return rscon.phase("dambdcal")(e) return rscon.phase("dambdcal")
end end
--Condition in ADV or SP Summon Sucess --Condition in ADV or SP Summon Sucess
function rscon.sumtype(sumtbl,sumfilter,matchall) function rscon.sumtype(sumtbl,sumfilter,matchall)
...@@ -2464,9 +2467,6 @@ function rsop.disnegop(disorneg,waystring) ...@@ -2464,9 +2467,6 @@ function rsop.disnegop(disorneg,waystring)
if type(waystring)==nil then waystring="des" end if type(waystring)==nil then waystring="des" end
if not waystring then waystring="nil" end if not waystring then waystring="nil" end
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 relate=rsef.relationinfo[Duel.GetCurrentChain()]
if relate and not c:IsRelateToEffect(e) then return end
local ct=0 local ct=0
local rc=re:GetHandler() local rc=re:GetHandler()
if disorneg=="sum" then if disorneg=="sum" then
...@@ -2496,114 +2496,92 @@ function rsop.negsumop(waystring) ...@@ -2496,114 +2496,92 @@ function rsop.negsumop(waystring)
end end
end end
--Operation: Select Card --Operation: Select Card
function rsop.SelectCheck_Filter(filter,...)
local filterpar={...}
local filterpar2={}
if type(filter)=="table" then
for index,par in pairs(filter) do
if index>=2 then
table.insert(filterpar2,par)
end
end
filter=filter[1]
filterpar=rsof.Table_Mix(filterpar2,filterpar)
end
return filter or aux.TRUE,filterpar
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
len=len+1 table.insert(solveparlist,par)
--table.insert(solveparlist,par)
solveparlist[len]=par
end end
end end
solvefun=solvefun[1] solvefun=solvefun[1]
end end
return solvefun,solveparlist,len return solvefun,solveparlist
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 solvefun2,solvefunpar,len=rsop.SelectCheck_Solve(solvefun) local filter2,filterpar=rsop.SelectCheck_Filter(filter,...)
local solvefun2,solvefunpar=rsop.SelectCheck_Solve(solvefun)
if rsof.Check_Boolean(minct) then if rsof.Check_Boolean(minct) then
local g=Duel.GetMatchingGroup(sp,filter,tp,loc1,loc2,exceptg,...) local g=Duel.GetMatchingGroup(sp,filter2,tp,loc1,loc2,exceptg,...)
return rsgf.SelectSolve(g,selecthint,sp,filter,minct,maxct,exceptg,solvefun,...) 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,filter,tp,loc1,loc2,minct,maxct,exceptg,...) local g=Duel.SelectMatchingCard(sp,filter2,tp,loc1,loc2,minct,maxct,exceptg,table.unpack(filterpar))
if g:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) and not rsop.nohint then if g:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) then
Duel.HintSelection(g) Duel.HintSelection(g)
rsop.nohint=true
end end
--under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil" local res=not solvefun and {g,g:GetFirst()} or {solvefun2(g,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
local solveparlen=select("#",...)
for index=1,solveparlen do
len2=len2+1
solveparlist[len2]=({...})[index]
end
local res=not solvefun and {g,g:GetFirst()} or {solvefun2(g,table.unpack(solveparlist))}
rsop.solveprlen=nil
rsop.nohint=false rsop.nohint=false
return table.unpack(res) return table.unpack(res)
end end
end end
function rsop.GetFollowingSolvepar(solvepar,parlen)
solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.solveprlen=parlen
return solvepar
end
--Function:Select card and send to hand --Function:Select card and send to hand
function rsop.SelectToHand(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...) function rsop.SelectToHand(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
solvepar=rsop.GetFollowingSolvepar(solvepar,4) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.nohint=true
return rsop.SelectSolve("th",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoHand,table.unpack(solvepar)},...) return rsop.SelectSolve("th",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoHand,table.unpack(solvepar)},...)
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,solvepar,...) function rsop.SelectToGrave(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,reason,...)
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.SendtoGrave,reason},...)
return rsop.SelectSolve("tg",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoGrave,table.unpack(solvepar)},...)
end
--Function:Select card and release
function rsop.SelectRelease(sp,filter,tp,loc1,loc2,minct,maxct,exceptg,solvepar,...)
solvepar=rsop.GetFollowingSolvepar(solvepar,2)
rsop.nohint=true
return rsop.SelectSolve("tg",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Release,table.unpack(solvepar)},...)
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,...)
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.SendtoDeck,table.unpack(solvepar)},...) return rsop.SelectSolve("td",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.SendtoDeck,table.unpack(solvepar)},...)
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,...)
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.Destroy,table.unpack(solvepar)},...) return rsop.SelectSolve("des",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Destroy,table.unpack(solvepar)},...)
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,...)
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.Remove,table.unpack(solvepar)},...) return rsop.SelectSolve("rm",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,{rsop.Remove,table.unpack(solvepar)},...)
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,...)
solvepar=type(solvepar)=="table" and solvepar or {solvepar} solvepar=type(solvepar)=="table" and solvepar or {solvepar}
local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local parlen=select("#",...) local ex_par=not ... and {e,sp} or {...}
if parlen==0 then return rsop.SelectSolve("sp",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),table.unpack(ex_par) )
return rsop.SelectSolve("sp",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),e,sp)
else
return rsop.SelectSolve("sp",sp,filter,tp,loc1,loc2,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),...)
end
end end
function rsop.SelectSpecialSummon_Operation(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
local hintg=tg:Filter(Card.IsLocation,nil,LOCATION_SZONE+LOCATION_GRAVE+LOCATION_REMOVED)
if #hintg>0 then
Duel.HintSelection(tg)
end
return rssf.SpecialSummon(tg,table.unpack(sumfunvarlist)) return rssf.SpecialSummon(tg,table.unpack(sumfunvarlist))
end end
end end
...@@ -2649,26 +2627,20 @@ function rsop.eqop(e,eqc,eqtc,pos,opside) ...@@ -2649,26 +2627,20 @@ 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
function rsop.SendtoHand(corg,p,reason,hint,confirm) --if you don't neet confirm or hint, best use normal Duel.SendtoHand
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
reason= reason or REASON_EFFECT local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
local ishint,isconfirm=rsop.CheckOperationHint(g,hint,confirm) local confirmg=g:Clone()
confirmg:Sub(hintg)
if #hintg>0 and not nohint and not rsop.nohint then
Duel.HintSelection(g)
end
local ct=Duel.SendtoHand(g,p,reason) local ct=Duel.SendtoHand(g,p,reason)
if ct>0 and isconfirm then if ct>0 and confirmg and #confirmg>0 and not noconfirm 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
...@@ -2677,22 +2649,28 @@ function rsop.SendtoHand(corg,p,reason,hint,confirm) ...@@ -2677,22 +2649,28 @@ function rsop.SendtoHand(corg,p,reason,hint,confirm)
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,hint) function rsop.SendtoDeck(corg,p,seq,reason,nohint)
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
rsop.CheckOperationHint(g,hint) local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED)
if #hintg>0 and not nohint and not rsop.nohint then
Duel.HintSelection(g)
end
local ct=Duel.SendtoDeck(g,p,seq,reason) local ct=Duel.SendtoDeck(g,p,seq,reason)
local og=Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst() 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,hint) function rsop.SendtoGrave(corg,reason,nohint)
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
rsop.CheckOperationHint(g,hint) local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_REMOVED)
if #hintg>0 and not nohint and not rsop.nohint then
Duel.HintSelection(g)
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
...@@ -2700,45 +2678,32 @@ function rsop.SendtoGrave(corg,reason,hint) ...@@ -2700,45 +2678,32 @@ function rsop.SendtoGrave(corg,reason,hint)
local og=Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst() return ct,og,og:GetFirst()
end end
--Operation function:Release and hint --Operation function:Send to grave and hint
--if you don't neet hint, best use normal Duel.SendtoDeck
function rsop.Release(corg,reason,hint)
reason= reason or REASON_EFFECT
local g=rsgf.Mix2(corg)
if #g<=0 then return 0,nil end
rsop.CheckOperationHint(g,hint)
local f=function(c)
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
local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst()
end
--Operation function:destroy and hint
--if you don't neet hint, best use normal Duel.Destroy --if you don't neet hint, best use normal Duel.Destroy
function rsop.Destroy(corg,reason,desloc,hint) function rsop.Destroy(corg,reason,desloc,nohint)
reason= reason or REASON_EFFECT reason= reason or REASON_EFFECT
desloc= desloc or LOCATION_GRAVE desloc= desloc or LOCATION_GRAVE
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
rsop.CheckOperationHint(g,hint) local hintg=g:Filter(Card.IsOnField,nil)
if #hintg>0 and not nohint and not rsop.nohint then
Duel.HintSelection(g)
end
local ct=Duel.Destroy(g,reason,desloc) local ct=Duel.Destroy(g,reason,desloc)
local og=Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst() 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,hint) function rsop.Remove(corg,pos,reason,nohint)
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
rsop.CheckOperationHint(g,hint) local hintg=g:Filter(Card.IsLocation,nil,LOCATION_ONFIELD+LOCATION_GRAVE)
if #hintg>0 and not nohint and not rsop.nohint then
Duel.HintSelection(g)
end
local ct=Duel.Remove(g,pos,reason) local ct=Duel.Remove(g,pos,reason)
local og=Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
return ct,og,og:GetFirst() return ct,og,og:GetFirst()
...@@ -2749,7 +2714,7 @@ function rsop.SelectOption(p,...) ...@@ -2749,7 +2714,7 @@ function rsop.SelectOption(p,...)
local off=1 local off=1
local ops={} local ops={}
local opval={} local opval={}
for k,v in pairs(functionlist) do for k,v in ipairs(functionlist) do
if rsof.Check_Boolean(v) and k~=#functionlist then if rsof.Check_Boolean(v) and k~=#functionlist then
local selecthint=functionlist[k+1] local selecthint=functionlist[k+1]
if type(selecthint)=="table" then ops[off]=aux.Stringid(selecthint[1],selecthint[2]) if type(selecthint)=="table" then ops[off]=aux.Stringid(selecthint[1],selecthint[2])
...@@ -2989,7 +2954,7 @@ function rsgf.GetExceptGroup(exceptfun,b4,e,tp,eg,ep,ev,re,r,rp) ...@@ -2989,7 +2954,7 @@ function rsgf.GetExceptGroup(exceptfun,b4,e,tp,eg,ep,ev,re,r,rp)
exceptg:AddCard(c) exceptg:AddCard(c)
end end
elseif excepttype=="function" then elseif excepttype=="function" then
exceptg=rsgf.Mix2(exceptfun(e,tp,eg,ep,ev,re,r,rp)) exceptg=exceptfun(e,tp,eg,ep,ev,re,r,rp)
end end
local ct=not exceptg and 0 or #exceptg local ct=not exceptg and 0 or #exceptg
return exceptg,ct return exceptg,ct
...@@ -3093,94 +3058,60 @@ end ...@@ -3093,94 +3058,60 @@ end
function rsgf.SelectSolve(g,selecthint,sp,filter,minct,maxct,exceptg,solvefun,...) 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 solvefun2,solvefunpar,len=rsop.SelectCheck_Solve(solvefun) local filter2,filterpar=rsop.SelectCheck_Filter(filter,...)
local solvefun2,solvefunpar=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,filter,minct,maxct,exceptg,...) 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 if tg:IsExists(Card.IsLocation,1,nil,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED) then
Duel.HintSelection(tg) Duel.HintSelection(tg)
rsop.nohint=true
end end
end end
--under bitch function because of lua table's last element cannot be "nil" ,but last solve parameter will often be "nil" local res=not solvefun and {tg,tg:GetFirst()} or {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
local solveparlen=select("#",...)
for index=1,solveparlen do
len2=len2+1
solveparlist[len2]=({...})[index]
end
local res=not solvefun and {tg,tg:GetFirst()} or {solvefun2(tg,table.unpack(solveparlist))}
rsop.solveprlen=nil
rsop.nohint=false rsop.nohint=false
return table.unpack(res) 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=rsop.GetFollowingSolvepar(solvepar,4) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.nohint=true
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,solvepar,...) function rsgf.SelectToGrave(g,sp,filter,minct,maxct,exceptg,reason,...)
solvepar=rsop.GetFollowingSolvepar(solvepar,2) reason=type(reason)=="table" and reason[1] or reason
rsop.nohint=true 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)
rsop.nohint=true
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=rsop.GetFollowingSolvepar(solvepar,4) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.nohint=true
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=rsop.GetFollowingSolvepar(solvepar,2) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.nohint=true
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=rsop.GetFollowingSolvepar(solvepar,3) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
rsop.nohint=true
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=rsop.GetFollowingSolvepar(solvepar,8) solvepar=type(solvepar)=="table" and solvepar or {solvepar}
solvepar = type(solvepar)=="table" and solvepar or {solvepar}
local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT) local e=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT)
local parlen=select("#",...) local ex_par=not ... and {e,sp} or {...}
if parlen==0 then return rsgf.SelectSolve(g,"sp",sp,filter,minct,maxct,exceptg,{rssf.SpecialSummon,table.unpack(solvepar)},table.unpack(ex_par))
return rsgf.SelectSolve(g,"sp",sp,filter,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),e,sp)
else
return rsgf.SelectSolve(g,"sp",sp,filter,minct,maxct,exceptg,rsop.SelectSpecialSummon_Operation(solvepar),...)
end
end end
Group.SelectSpecialSummon=rsgf.SelectSpecialSummon Group.SelectSpecialSummon=rsgf.SelectSpecialSummon
...@@ -3219,22 +3150,13 @@ function rscf.DefineSet_Fun(prefix1,prefix2,seriesstring) ...@@ -3219,22 +3150,13 @@ function rscf.DefineSet_Fun(prefix1,prefix2,seriesstring)
end end
--Register qucik attribute buff in cards --Register qucik attribute buff in cards
function rscf.QuickBuff(reglist,...) function rscf.QuickBuff(reglist,...)
local bufflist={...}
local c1,c2=rsef.GetRegisterCard(reglist) local c1,c2=rsef.GetRegisterCard(reglist)
local reset,reset2 local bufflist={...}
if not rsof.Table_List(bufflist,"reset") then local reset=rsreset.est
table.insert(bufflist,"reset") local reset2=c1~=c2 and rsreset.est or rsreset.est_d
table.insert(bufflist,rsreset.est) if #bufflist&1==1 then
end reset=bufflist[#bufflist]
local _,ct=rsof.Table_List(bufflist,"reset") reset2=c1~=c2 and bufflist[#bufflist] or bufflist[#bufflist]|RESET_DISABLE
local resetval=bufflist[ct+1]
if resetval and type(resetval)~="string" then
reset=resetval
if c1==c2 then
reset2=type(resetval)=="table" and {resetval[1]|RESET_DISABLE,resetval[2] } or resetval|RESET_DISABLE
else
reset2=resetval
end
end end
local setlist={"atk","def","batk","bdef","atkf","deff"} local setlist={"atk","def","batk","bdef","atkf","deff"}
local uplist={"atk+","def+","lv+","rk+"} local uplist={"atk+","def+","lv+","rk+"}
...@@ -3243,29 +3165,19 @@ function rscf.QuickBuff(reglist,...) ...@@ -3243,29 +3165,19 @@ function rscf.QuickBuff(reglist,...)
local limitlist={"dis","dise","tri","atk","atkan","datk","ress","resns","td","th","cp","cost"} local limitlist={"dis","dise","tri","atk","atkan","datk","ress","resns","td","th","cp","cost"}
local matlimitlist={"fus","syn","xyz","link"} local matlimitlist={"fus","syn","xyz","link"}
local leavelist={"leave"} local leavelist={"leave"}
local splist={"mat","pc"} local phaselist={"ep","sp"}
--local phaselist={"ep","sp"} local funlist=rsof.Table_Mix(setlist,uplist,changelist,addlist,limitlist,matlimitlist,leavelist)
local funlist=rsof.Table_Mix(setlist,uplist,changelist,addlist,limitlist,matlimitlist,leavelist,splist)
local funlistatt=rsof.Table_Mix(setlist,uplist,changelist,addlist) local funlistatt=rsof.Table_Mix(setlist,uplist,changelist,addlist)
--local nulllist={} --local nulllist={}
--for i=1,#stringlist do --for i=1,#stringlist do
--table.insert(nulllist,"hape") --table.insert(nulllist,"hape")
--end --end
local effectlist={} local effectlist={}
for index,par in pairs(bufflist) do for index,value in pairs(bufflist) do
local vtype=type(par) if index&1==1 then
local parnext=bufflist[index+1] local vallist=type(bufflist[index+1])~=table and {bufflist[index+1]} or bufflist[index+1]
local vtypenext=type(parnext) local stringlist=rsof.String_Number_To_Table(value)
if vtype=="string" and par~="reset" then local _,effectvaluelist=rsof.Table_Suit(value,funlist,{},vallist)
local vallist
if not parnext or vtypenext=="string" then
vallist={}
end
if parnext and vtypenext~="string" then
vallist=vtypenext~="table" and {parnext} or parnext
end
local stringlist=rsof.String_Number_To_Table(par)
local _,effectvaluelist=rsof.Table_Suit(par,funlist,{},vallist)
for k,codestring in pairs(stringlist) do for k,codestring in pairs(stringlist) do
if rsof.Table_List(funlistatt,codestring) then if rsof.Table_List(funlistatt,codestring) then
e1=rsef.SV_ATTRIBUTE(reglist,codestring,effectvaluelist[k],nil,reset2) e1=rsef.SV_ATTRIBUTE(reglist,codestring,effectvaluelist[k],nil,reset2)
...@@ -3279,19 +3191,10 @@ function rscf.QuickBuff(reglist,...) ...@@ -3279,19 +3191,10 @@ function rscf.QuickBuff(reglist,...)
if rsof.Table_List(leavelist,codestring) then if rsof.Table_List(leavelist,codestring) then
e1=rsef.SV_REDIRECT(reglist,codestring,effectvaluelist[k],nil,rsreset.ered,"cd") e1=rsef.SV_REDIRECT(reglist,codestring,effectvaluelist[k],nil,rsreset.ered,"cd")
end end
if rsof.Table_List(splist,codestring) then
if codestring=="mat" then
c2:SetMaterial(effectvaluelist[k])
end
if codestring=="cp" then
c2:RegisterFlagEffect(rscode.Pre_Complete_Proc,rsreset.est,0,1)
end
else
table.insert(effectlist,e1) table.insert(effectlist,e1)
end end
end end
end end
end
return table.unpack(effectlist) return table.unpack(effectlist)
end end
--Card effect:Auxiliary.ExceptThisCard + Card.IsFaceup() --Card effect:Auxiliary.ExceptThisCard + Card.IsFaceup()
...@@ -3327,50 +3230,35 @@ function rscf.SetSummonCondition(cardtbl,isnsable,sumvalue,iseffectspsum,resettb ...@@ -3327,50 +3230,35 @@ function rscf.SetSummonCondition(cardtbl,isnsable,sumvalue,iseffectspsum,resettb
tc2:EnableReviveLimit() tc2:EnableReviveLimit()
end end
end end
sumvalue = sumvalue or aux.FALSE if not sumvalue then sumvalue=aux.FALSE end
local e1=rsef.SV(cardtbl,EFFECT_SPSUMMON_CONDITION,sumvalue,nil,nil,resettbl,"uc,cd,sr") local e1=rsef.SV(cardtbl,EFFECT_SPSUMMON_CONDITION,sumvalue,nil,nil,resettbl,"uc,cd")
return e1 return e1
end end
rssf.SetSummonCondition=rscf.SetSummonCondition rssf.SetSummonCondition=rscf.SetSummonCondition
--Check Built-in SetCode / Series Main Set --Check Built-in SetCode / Series Main Set
function rscf.CheckSetCardMainSet(c,settype,series1,...) function rscf.CheckSetCardMainSet(c,settype,series1,...)
local serieslist={series1,...} local stringlist=rsof.String_Number_To_Table({series1,...})
local seriesnormallist={}
local seriescustomlist={}
for _,series in pairs(serieslist) do
if type(series)=="number" then
table.insert(seriesnormallist,series)
else
table.insert(seriescustomlist,series)
end
end
local stringlist=rsof.String_Number_To_Table(seriescustomlist)
local codelist={} local codelist={}
local effectlist={} local effectlist={}
local addcodelist={} local addcodelist={}
if settype=="base" then if settype=="base" then
if #seriesnormallist>0 and c:IsSetCard(table.unpack(seriesnormallist)) then return true end
codelist={c:GetCode()} codelist={c:GetCode()}
effectlist={c:IsHasEffect(EFFECT_ADD_SETCODE)} effectlist={c:IsHasEffect(EFFECT_ADD_SETCODE)}
elseif settype=="fus" then elseif settype=="fus" then
if #seriesnormallist>0 and c:IsFusionSetCard(table.unpack(seriesnormallist)) then return true end
codelist={c:GetFusionCode()} codelist={c:GetFusionCode()}
effectlist={c:IsHasEffect(EFFECT_ADD_FUSION_SETCODE),c:IsHasEffect(EFFECT_ADD_SETCODE)} effectlist={c:IsHasEffect(EFFECT_ADD_FUSION_SETCODE),c:IsHasEffect(EFFECT_ADD_SETCODE)}
elseif settype=="link" then elseif settype=="link" then
if #seriesnormallist>0 and c:IsLinkSetCard(table.unpack(seriesnormallist)) then return true end
codelist={c:GetLinkCode()} codelist={c:GetLinkCode()}
effectlist={c:IsHasEffect(EFFECT_ADD_LINK_SETCODE),c:IsHasEffect(EFFECT_ADD_SETCODE)} effectlist={c:IsHasEffect(EFFECT_ADD_LINK_SETCODE),c:IsHasEffect(EFFECT_ADD_SETCODE)}
elseif settype=="org" then elseif settype=="org" then
if #seriesnormallist>0 and c:IsOriginalSetCard(table.unpack(seriesnormallist)) then return true end
codelist={c:GetOriginalCode()} codelist={c:GetOriginalCode()}
effectlist={} effectlist={}
elseif settype=="pre" then elseif settype=="pre" then
if #seriesnormallist>0 and c:IsPreviousSetCard(table.unpack(seriesnormallist)) then return true end
codelist={c:GetPreviousCodeOnField()} codelist={c:GetPreviousCodeOnField()}
effectlist=rscf.Previous_Set_Code_List effectlist=rscf.Previous_Set_Code_List
end end
for _,effect in pairs(effectlist) do for _,effect in pairs(effectlist) do
local string=rsval.valinfo[effect] local string=rsef.valinfo[effect]
if type(string)=="string" then if type(string)=="string" then
table.insert(addcodelist,string) table.insert(addcodelist,string)
end end
...@@ -3444,11 +3332,9 @@ function rscf.RecordSummonProcedure() ...@@ -3444,11 +3332,9 @@ function rscf.RecordSummonProcedure()
return e0 return e0
end end
end end
rssf.RecordSummonProcedure=rscf.RecordSummonProcedure rscf.RecordSummonProcedure()
--directly enable will cause bugs, but i am lazy to find what cards i have used this function
rssf.RecordSummonProcedure()
function rscf.RecordSummonProcedure_Operation(e,tp) function rscf.RecordSummonProcedure_Operation(e,tp)
local g=Duel.GetMatchingGroup(Card.IsType,0,0xff,0xff,nil,rscf.extype) local g=Duel.GetMatchingGroup(Card.IsType,0,0xff,0xff,nil,rscf.extype-TYPE_PENDULUM)
local f6=aux.AddSynchroProcedure local f6=aux.AddSynchroProcedure
local f7=aux.AddSynchroMixProcedure local f7=aux.AddSynchroMixProcedure
local f8=aux.AddXyzProcedure local f8=aux.AddXyzProcedure
...@@ -3460,8 +3346,8 @@ function rscf.RecordSummonProcedure_Operation(e,tp) ...@@ -3460,8 +3346,8 @@ function rscf.RecordSummonProcedure_Operation(e,tp)
aux.AddXyzProcedureLevelFree=rscf.GetBaseXyzProduce2 aux.AddXyzProcedureLevelFree=rscf.GetBaseXyzProduce2
aux.AddLinkProcedure=rscf.GetBaseLinkProduce1 aux.AddLinkProcedure=rscf.GetBaseLinkProduce1
for tc in aux.Next(g) do for tc in aux.Next(g) do
--Method ResetEffect/ReplaceEffect will cause issue at Raise Event --Method ResetEffect/ReplaceEffect is issue at Raise Event
tc:ReplaceEffect(80316585,0) tc:ResetEffect(tc:GetOriginalCode(),RESET_CARD)
local mt=getmetatable(tc) local mt=getmetatable(tc)
if mt.initial_effect then if mt.initial_effect then
mt.initial_effect(tc) mt.initial_effect(tc)
...@@ -4081,11 +3967,11 @@ function rscf.LinkCustomOperation(mg,c,e,tp,checkog) ...@@ -4081,11 +3967,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,checkog) rssf.LinkMaterialAction(mg,c,e,tp)
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,checkog) c.rs_link_material_action(mg,c,e,tp)
--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)
...@@ -4217,7 +4103,7 @@ function rscf.DarkTuner(f,...) ...@@ -4217,7 +4103,7 @@ function rscf.DarkTuner(f,...)
local typelist={target:IsHasEffect(EFFECT_ADD_TYPE)} local typelist={target:IsHasEffect(EFFECT_ADD_TYPE)}
local bool=false local bool=false
for _,e in pairs(typelist) do for _,e in pairs(typelist) do
if rsval.valinfo[e]=="TYPE_DARKTUNER" then if rsef.valinfo[e]=="TYPE_DARKTUNER" then
bool=true bool=true
break break
end end
...@@ -4226,7 +4112,7 @@ function rscf.DarkTuner(f,...) ...@@ -4226,7 +4112,7 @@ function rscf.DarkTuner(f,...)
end end
end end
--Card filter: face up + filter --Card filter: face up + filter
function rscf.fufilter(f,...) function rscf.FilterFaceUp(f,...)
local ext_params={...} local ext_params={...}
return function(target) return function(target)
return f(target,table.unpack(ext_params)) and target:IsFaceup() return f(target,table.unpack(ext_params)) and target:IsFaceup()
...@@ -4519,18 +4405,12 @@ function rsof.Table_Clone(table) ...@@ -4519,18 +4405,12 @@ function rsof.Table_Clone(table)
return t2 return t2
end end
--other function: Mix Table --other function: Mix Table
--error at "nil" value !!!!!!!!!
--error at no number key !!!!!!!!!
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
...@@ -4547,16 +4427,6 @@ function rsof.Table_To_Desc(hintlist) ...@@ -4547,16 +4427,6 @@ function rsof.Table_To_Desc(hintlist)
end end
return table.unpack(newlist) return table.unpack(newlist)
end end
--other function: Count for table value
function rsof.Table_Count(list,cval)
local ctlist={}
for index,value in pairs(list) do
if value==cval then
table.insert(ctlist,index)
end
end
return #ctlist,ctlist
end
--other function: check a value is true or false --other function: check a value is true or false
function rsof.Check_Boolean(value,booleanvaule) function rsof.Check_Boolean(value,booleanvaule)
if type(booleanvaule)=="nil" or booleanvaule==true then return if type(booleanvaule)=="nil" or booleanvaule==true then return
......
--Real Scl Version - Variable --Real Scl Version - Variable
local Version_Number=20200409 local Version_Number=20200218
local m=10199990 local m=10199990
local vm=10199991 local vm=10199991
rsv={} --"Base Function" rsv={} --"Base Function"
...@@ -21,18 +21,11 @@ rsreset={} --"Reset Function" ...@@ -21,18 +21,11 @@ rsreset={} --"Reset Function"
rshint={} --"Hint Function" rshint={} --"Hint Function"
rsloc={} --"Location Function" rsloc={} --"Location Function"
rsdv="Divide_Variable"
--Info Variable --Info Variable
rsval.valinfo ={} --"Value for inside series, inside type etc." rsef.valinfo ={} --"Value for inside series, inside type etc."
rscost.costinfo ={} --"Cost information, for record cost value" rscost.costinfo ={} --"Cost information, for record cost value"
rsop.opinfo={} --"Operation information, for record something" rsef.targetlist ={} --"Target group list, for rstg.GetTargetAttribute"
rsef.relationinfo={} --"Field,Pendulum,Continous leave field" rsef.attachinfo ={} --"Effect information for attach effects"
rstg.targetlist ={} --"Target group list, for rstg.GetTargetAttribute"
rsef.attacheffect ={} --"Effect information for attach effects"
rsef.attacheffectf ={}
rsef.solveeffect ={}
rsop.baseop={}
rscf.synchro_material_action={} --"Custom syn material's action" rscf.synchro_material_action={} --"Custom syn material's action"
rscf.xyz_material_action={} --"Custom xyz material's action" rscf.xyz_material_action={} --"Custom xyz material's action"
...@@ -58,17 +51,14 @@ rsreset.est_pend= rsreset.est + rsreset.pend ...@@ -58,17 +51,14 @@ rsreset.est_pend= rsreset.est + rsreset.pend
rsreset.ered = RESET_EVENT+RESETS_REDIRECT rsreset.ered = RESET_EVENT+RESETS_REDIRECT
--Code Variable --Code Variable
rscode.Extra_Effect_Activate = m+100 --"Attach Effect" rscode.Extra_Effect = m+100 --"Attach Effect"
rscode.Extra_Effect_BSolve = m+200 rscode.Extra_Effect_FORCE= m+200 --"Attach Effect,Force"
rscode.Extra_Effect_ASolve = m+800 rscode.Summon_Flag = m+300 --"Summon Flag for SummonBuff"
rscode.Phase_Leave_Flag = m+300 --"Summon Flag for SummonBuff"
rscode.Extra_Synchro_Material= m+400 --"Extra Synchro Material" rscode.Extra_Synchro_Material= m+400 --"Extra Synchro Material"
rscode.Extra_Xyz_Material = m+401 --"Extra Xyz Material" rscode.Extra_Xyz_Material = m+401 --"Extra Xyz Material"
rscode.Utility_Xyz_Material = m+500 --"Utility Xyz Material" rscode.Utility_Xyz_Material = m+500 --"Utility Xyz Material"
rscode.Previous_Set_Code = m+600 --"Previous Set Code" rscode.Previous_Set_Code = m+600 --"Previous Set Code"
rscode.Synchro_Material = m+700 --"Record synchro proceudre target" rscode.Synchro_Material = m+700 --"Record synchro proceudre target"
rscode.Pre_Complete_Proc = m+900 --"Previous c:CompleteProcedure"
--Hint Message Variable --Hint Message Variable
rshint.act=aux.Stringid(m,0) --"activate spell/trap" rshint.act=aux.Stringid(m,0) --"activate spell/trap"
...@@ -79,22 +69,19 @@ rshint.spproc=aux.Stringid(m,4) --"SS by self produce" ...@@ -79,22 +69,19 @@ rshint.spproc=aux.Stringid(m,4) --"SS by self produce"
rshint.negeffect=aux.Stringid(19502505,1) --"negate activation" rshint.negeffect=aux.Stringid(19502505,1) --"negate activation"
rshint.eq=aux.Stringid(68184115,0) --"cards will equip" rshint.eq=aux.Stringid(68184115,0) --"cards will equip"
rshint.te=aux.Stringid(24094258,3) --"add to extra deck" rshint.te=aux.Stringid(24094258,3) --"add to extra deck"
rshint.xyz=HINTMSG_XMATERIAL --"cards will become overlay cards" rshint.xyz=HINTMSG_XMATERIAL --"cards will be overlay cards"
rshint.diseffect=aux.Stringid(39185163,1) --"negate effect" rshint.diseffect=aux.Stringid(39185163,1) --"negate effect"
rshint.negsum=aux.Stringid(m+1,1) --"negate summon" rshint.negsum=aux.Stringid(m+1,1) --"negate summon"
rshint.negsp=aux.Stringid(74892653,0) --"negate special summon" rshint.negsp=aux.Stringid(74892653,0) --"negate special summon"
rshint.darktuner=aux.Stringid(m,14) --"treat as dark tuner" rshint.darktuner=aux.Stringid(m,14) --"treat as dark tuner"
rshint.darksynchro=aux.Stringid(m,15) --"treat as dark synchro" rshint.darksynchro=aux.Stringid(m,15) --"treat as dark synchro"
rshint.choose=aux.Stringid(23912837,1) --"choose 1 effect" rshint.choose=aux.Stringid(23912837,1) --"choose 1 effect"
rshint.epleave=aux.Stringid(m,3) --"end phase leave field"
rshint.finshcopy=aux.Stringid(43387895,1) --"reset copy effect"
--Property Variable --Property Variable
rsflag.flaglist = { EFFECT_FLAG_CARD_TARGET,EFFECT_FLAG_PLAYER_TARGET,EFFECT_FLAG_DELAY,EFFECT_FLAG_DAMAGE_STEP,EFFECT_FLAG_DAMAGE_CAL, rsflag.flaglist = { EFFECT_FLAG_CARD_TARGET,EFFECT_FLAG_PLAYER_TARGET,EFFECT_FLAG_DELAY,EFFECT_FLAG_DAMAGE_STEP,EFFECT_FLAG_DAMAGE_CAL,
EFFECT_FLAG_IGNORE_IMMUNE,EFFECT_FLAG_SET_AVAILABLE,EFFECT_FLAG_IGNORE_RANGE,EFFECT_FLAG_SINGLE_RANGE,EFFECT_FLAG_BOTH_SIDE, EFFECT_FLAG_IGNORE_IMMUNE,EFFECT_FLAG_SET_AVAILABLE,EFFECT_FLAG_IGNORE_RANGE,EFFECT_FLAG_SINGLE_RANGE,EFFECT_FLAG_BOTH_SIDE,
EFFECT_FLAG_UNCOPYABLE,EFFECT_FLAG_CANNOT_DISABLE,EFFECT_FLAG_CANNOT_NEGATE,EFFECT_FLAG_CLIENT_HINT,EFFECT_FLAG_LIMIT_ZONE, EFFECT_FLAG_UNCOPYABLE,EFFECT_FLAG_CANNOT_DISABLE,EFFECT_FLAG_CANNOT_NEGATE,EFFECT_FLAG_CLIENT_HINT,EFFECT_FLAG_LIMIT_ZONE,
EFFECT_FLAG_ABSOLUTE_TARGET,EFFECT_FLAG_SPSUM_PARAM, EFFECT_FLAG_ABSOLUTE_TARGET,EFFECT_FLAG_SPSUM_PARAM }
EFFECT_FLAG_EVENT_PLAYER }
rsflag.tg_d = EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY rsflag.tg_d = EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY
rsflag.dsp_d = EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY rsflag.dsp_d = EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY
rsflag.dsp_tg = EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET rsflag.dsp_tg = EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET
...@@ -116,34 +103,22 @@ rscate.neg_des = CATEGORY_NEGATE+CATEGORY_DESTROY ...@@ -116,34 +103,22 @@ rscate.neg_des = CATEGORY_NEGATE+CATEGORY_DESTROY
rscf.typelist = { TYPE_MONSTER,TYPE_NORMAL,TYPE_EFFECT,TYPE_DUAL,TYPE_UNION,TYPE_TOON,TYPE_TUNER,TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK,TYPE_TOKEN,TYPE_PENDULUM,TYPE_SPSUMMON,TYPE_FLIP,TYPE_SPIRIT, rscf.typelist = { TYPE_MONSTER,TYPE_NORMAL,TYPE_EFFECT,TYPE_DUAL,TYPE_UNION,TYPE_TOON,TYPE_TUNER,TYPE_RITUAL,TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK,TYPE_TOKEN,TYPE_PENDULUM,TYPE_SPSUMMON,TYPE_FLIP,TYPE_SPIRIT,
TYPE_SPELL,TYPE_EQUIP,TYPE_FIELD,TYPE_CONTINUOUS,TYPE_QUICKPLAY, TYPE_SPELL,TYPE_EQUIP,TYPE_FIELD,TYPE_CONTINUOUS,TYPE_QUICKPLAY,
TYPE_TRAP,TYPE_COUNTER,TYPE_TRAPMONSTER } TYPE_TRAP,TYPE_COUNTER,TYPE_TRAPMONSTER }
rscf.extype = TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK rscf.extype = TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_PENDULUM+TYPE_LINK
rscf.extype_r = rscf.extype + TYPE_RITUAL rscf.extype_r = rscf.extype + TYPE_RITUAL
rscf.extype_p = rscf.extype + TYPE_PENDULUM rscf.extype_np = rscf.extype - TYPE_PENDULUM
rscf.extype_rp = rscf.extype + TYPE_RITUAL + TYPE_PENDULUM
rscf.exlist = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK } rscf.exlist = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK }
rscf.exlist_r = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK,TYPE_RITUAL }
rscf.exlist_p = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK,TYPE_PENDULUM }
rscf.exlist_rp = { TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK,TYPE_PENDULUM,TYPE_RITUAL }
--Location Variable --Location Variable
rsloc.hd=LOCATION_HAND+LOCATION_DECK rsloc.hd=LOCATION_HAND+LOCATION_DECK
rsloc.ho=LOCATION_HAND+LOCATION_ONFIELD
rsloc.hg=LOCATION_HAND+LOCATION_GRAVE
rsloc.dg=LOCATION_DECK+LOCATION_GRAVE rsloc.dg=LOCATION_DECK+LOCATION_GRAVE
rsloc.gr=LOCATION_GRAVE+LOCATION_REMOVED rsloc.gr=LOCATION_GRAVE+LOCATION_REMOVED
rsloc.dgr=LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED
rsloc.hdg=LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE rsloc.hdg=LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE
rsloc.de=LOCATION_DECK+LOCATION_EXTRA rsloc.de=LOCATION_DECK+LOCATION_EXTRA
rsloc.mg=LOCATION_MZONE+LOCATION_GRAVE
rsloc.og=LOCATION_ONFIELD+LOCATION_GRAVE
rsloc.hmg=LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE
rsloc.hog=LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE
rsloc.all=0xff rsloc.all=0xff
--Escape Old Functions --Escape Old Functions
function rsof.Escape_Old_Functions() function rsof.Escape_Old_Functions()
rsof.DefineCard = rscf.DefineCard rsof.DefineCard = rscf.DefineCard
rscf.FilterFaceUp = rscf.fufilter
rsof.SendtoHand = rsop.SendtoHand rsof.SendtoHand = rsop.SendtoHand
rsof.SendtoDeck = rsop.SendtoDeck rsof.SendtoDeck = rsop.SendtoDeck
rsof.SendtoGrave = rsop.SendtoGrave rsof.SendtoGrave = rsop.SendtoGrave
...@@ -155,34 +130,6 @@ function rsof.Escape_Old_Functions() ...@@ -155,34 +130,6 @@ function rsof.Escape_Old_Functions()
rsof.SelectNumber= rsop.AnnounceNumber rsof.SelectNumber= rsop.AnnounceNumber
rsof.SelectNumber_List= rsop.AnnounceNumber_List rsof.SelectNumber_List= rsop.AnnounceNumber_List
rsof.IsSet = rscf.DefineSet rsof.IsSet = rscf.DefineSet
--some card use old SummonBuff's phase leave field parterment, must fix them in their luas
rssf.SummonBuff=function(attlist,isdis,isdistig,selfleave,phaseleave)
local bufflist={}
if attlist then
for index,par in pairs(attlist) do
if par then
if index==1 then att="atkf" end
if index==2 then att="deff" end
if index==3 then att="lv" end
table.insert(bufflist,att)
table.insert(bufflist,par)
end
end
end
if isdis then
table.insert(bufflist,"dis,dise")
table.insert(bufflist,true)
end
if isdistig then
table.insert(bufflist,"tri")
table.insert(bufflist,true)
end
if selfleave then
table.insert(bufflist,"leave")
table.insert(bufflist,selfleave)
end
return bufflist
end
end end
--Record Author --Record Author
local am=10199992 local am=10199992
local Version_Number=20200323 local Version_Number=20200310
#Scl #Scl
local rsdka = Dakyria local rsdka = Dakyria
local rsdio = Diablo local rsdio = Diablo
...@@ -13,8 +13,6 @@ local rssp = Stellar_Pearl ...@@ -13,8 +13,6 @@ 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 rsdh = Devil_Hunter
local rsds = Dark_Souls
local rsca = Corona
#Scl - Special Mode #Scl - Special Mode
local rssm = Special_Mode local rssm = Special_Mode
...@@ -27,18 +25,18 @@ local rssmf = Special_Mode_Fast_Duel ...@@ -27,18 +25,18 @@ local rssmf = Special_Mode_Fast_Duel
local rssmm = Special_Mode_Multiple_Duel local rssmm = Special_Mode_Multiple_Duel
local rssmu = Special_Mode_Universal_Duel local rssmu = Special_Mode_Universal_Duel
#Gale 1472676207 #Gale
local rsve = Voison local rsve = Voison
local rsneov= Neons local rsneov= Neons
local tfrsv = T.Fairies local tfrsv = T.Fairies
local rsss = Star_Spirit local rsss = Star_Spirit
#ChiJiang 626386490 #ChiJiang
local rsnm = Nightmare local rsnm = Nightmare
local rslf = Little_Fox local rslf = Little_Fox
local rccv = Thermonuclear local rccv = Thermonuclear
#XiaoMi 643865567 #XiaoMi
local rssg = Sex_Gun local rssg = Sex_Gun
local rsps = Pseudo_Soul local rsps = Pseudo_Soul
local rsdcc = Dragon_Chess_Corps local rsdcc = Dragon_Chess_Corps
...@@ -52,43 +50,29 @@ local rsvw = Virus_Wrom ...@@ -52,43 +50,29 @@ local rsvw = Virus_Wrom
local rsia = Indolent_Angel local rsia = Indolent_Angel
local rsso = Simulated_Organism local rsso = Simulated_Organism
#NianBao 583322404 #NianBao
local rslap = Lapin local rslap = Lapin
local rskh = Karehana
#XiaoDaoHeng 1614895649 #XiaoDaoHeng
local rslrd = Life_DeathRound_Dance local rslrd = Life_DeathRound_Dance
#Huang 1184387005 #Huang
local rsts = Trinity_Sword local rsts = Trinity_Sword
#Luoxing 1151483512 #Luoxing
local rsdt = Dark_Tale local rsdt = Dark_Tale
local rsod = Order local rsod = Order
#YunZeZhun 1587361112 #YunZeZhun
local rsphh = Phantom_Thieves_Of_Hearts local rsphh = Phantom_Thieves_Of_Hearts
local rsgc = Guard_City local rsgc = Guard_City
#ZhenDong #ZhenDong
local rsfv = Fgo/Assassin local rsfv = Fgo/Assassin
#JingJing 1772438857 #JingJing
local rsba = BlueAngel local rsba = BlueAngel
#Akashic 3204027606
local rszg = Zogu
local rsgs = Gran_Sphere
local rsoc = Oligocene_Civilization
local rsgol = Giant_of_Light
local rssb = Space_Beasts
#HeiBai 1172777968
local rstm = Toaru_Majutsu_no_Index
#2558566212
local rsgod = God
--Set Code --Set Code
#Scl #Scl
--local = 0x1330 --local = 0x1330
...@@ -135,9 +119,9 @@ local = 0xc334 ...@@ -135,9 +119,9 @@ local = 0xc334
local Oraclesmith = 0x3335 local Oraclesmith = 0x3335
local DevilHunter = 0x5335 local DevilHunter = 0x5335
local DevilSlayer = 0x6335 local DevilSlayer = 0x6335
local DMC = 0x9335 local = 0x9335
local Ashenone = 0xa335 local = 0xa335
local Cinderlord = 0xc335 local = 0xc335
--local = 0x1336 --local = 0x1336
local = 0x3336 local = 0x3336
......
...@@ -22,6 +22,7 @@ function c114707556.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -22,6 +22,7 @@ function c114707556.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_PZONE,LOCATION_PZONE)>0 end if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_PZONE,LOCATION_PZONE)>0 end
local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,LOCATION_PZONE) local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,LOCATION_PZONE)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end end
function c114707556.thfilter1(c) function c114707556.thfilter1(c)
return c:IsSetCard(0xc6) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() return c:IsSetCard(0xc6) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
......
...@@ -95,11 +95,11 @@ function cm.lvop(e,tp,eg,ep,ev,re,r,rp) ...@@ -95,11 +95,11 @@ function cm.lvop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
end end
end end
function cmcfilter(c) function cm.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x79) and c:IsType(TYPE_SYNCHRO) return c:IsFaceup() and c:IsSetCard(0x79) and c:IsType(TYPE_SYNCHRO)
end end
function cm.condition1(e,tp,eg,ep,ev,re,r,rp) function cm.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cmcfilter,tp,LOCATION_MZONE,0,1,nil) return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_MZONE,0,1,nil)
end end
function cm.desfilter(c) function cm.desfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGrave() return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToGrave()
...@@ -108,9 +108,9 @@ function cm.handes(e,tp,eg,ep,ev,re,r,rp) ...@@ -108,9 +108,9 @@ function cm.handes(e,tp,eg,ep,ev,re,r,rp)
local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) local id=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
if ep==tp or id==cm[0] or not re:IsActiveType(TYPE_MONSTER) then return end if ep==tp or id==cm[0] or not re:IsActiveType(TYPE_MONSTER) then return end
cm[0]=id cm[0]=id
if Duel.IsExistingMatchingCard(cm.desfilter,1-tp,LOCATION_HAND+LOCATION_SZONE,0,1,nil) and Duel.SelectYesNo(1-tp,aux.Stringid(m,3)) then if Duel.IsExistingMatchingCard(cm.desfilter,1-tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,nil) and Duel.SelectYesNo(1-tp,aux.Stringid(m,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(1-tp,cm.desfilter,1-tp,LOCATION_HAND+LOCATION_SZONE,0,1,1,nil) local g=Duel.SelectMatchingCard(1-tp,cm.desfilter,1-tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
Duel.SendtoGrave(g,REASON_EFFECT) Duel.SendtoGrave(g,REASON_EFFECT)
Duel.BreakEffect() Duel.BreakEffect()
else else
......
...@@ -19,6 +19,7 @@ function c117485040.initial_effect(c) ...@@ -19,6 +19,7 @@ function c117485040.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(LOCATION_SZONE) e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,117485040)
e3:SetCondition(c117485040.pencon) e3:SetCondition(c117485040.pencon)
e3:SetOperation(c117485040.penop) e3:SetOperation(c117485040.penop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
......
...@@ -107,7 +107,7 @@ function c118824150.sccost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -107,7 +107,7 @@ function c118824150.sccost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Remove(c,POS_FACEUP,REASON_COST) Duel.Remove(c,POS_FACEUP,REASON_COST)
end end
function c118824150.scfilter(c,e,tp) function c118824150.scfilter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,true)
end end
function c118824150.sctg(e,tp,eg,ep,ev,re,r,rp,chk) function c118824150.sctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c118824150.scfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c118824150.scfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
...@@ -117,5 +117,6 @@ end ...@@ -117,5 +117,6 @@ end
function c118824150.scop(e,tp,eg,ep,ev,re,r,rp) function c118824150.scop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not g or g:FilterCount(Card.IsRelateToEffect,nil,e)~=1 then return end if not g or g:FilterCount(Card.IsRelateToEffect,nil,e)~=1 then return end
Duel.SpecialSummon(g,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(g,SUMMON_TYPE_SYNCHRO,tp,tp,false,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end end
...@@ -20,7 +20,7 @@ function cm.negtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -20,7 +20,7 @@ function cm.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function cm.negop(e,tp,eg,ep,ev,re,r,rp) function cm.negop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.NegateActivation(ev) then return end if not Duel.NegateActivation(ev) then return end
if Duel.IsExistingMatchingCard(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,0))>0 then if Duel.IsExistingMatchingCard(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,0)) then
Duel.BreakEffect() Duel.BreakEffect()
rsop.SelectSolve(HINTMSG_POSCHANGE,tp,Card.IsCanTurnSet,tp,0,LOCATION_MZONE,1,1,nil,cm.solvefun) rsop.SelectSolve(HINTMSG_POSCHANGE,tp,Card.IsCanTurnSet,tp,0,LOCATION_MZONE,1,1,nil,cm.solvefun)
end end
...@@ -38,7 +38,7 @@ function cm.actval(e,re) ...@@ -38,7 +38,7 @@ function cm.actval(e,re)
return rc:IsLocation(LOCATION_GRAVE) return rc:IsLocation(LOCATION_GRAVE)
end end
function cm.atkval(e,c) function cm.atkval(e,c)
return Duel.GetMatchingGroupCount(cm.afilter,tp,rsloc.og,rsloc.og,nil)*100 return Duel.GetMatchingGroupCount(cm.afilter,tp,rsloc.og,rsloc.og,nil)*-100
end end
function cm.afilter(c) function cm.afilter(c)
return c:IsFacedown() or c:IsLocation(LOCATION_GRAVE) return c:IsFacedown() or c:IsLocation(LOCATION_GRAVE)
......
...@@ -23,7 +23,7 @@ function c30000005.initial_effect(c) ...@@ -23,7 +23,7 @@ function c30000005.initial_effect(c)
e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1) e2:SetCountLimit(99)
e2:SetTarget(c30000005.sptg) e2:SetTarget(c30000005.sptg)
e2:SetOperation(c30000005.spop) e2:SetOperation(c30000005.spop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
......
...@@ -43,7 +43,7 @@ function c30000007.op(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,7 +43,7 @@ function c30000007.op(e,tp,eg,ep,ev,re,r,rp)
while gc do while gc do
local e3=Effect.CreateEffect(e:GetHandler()) local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_TRIGGER) e3:SetCode(EFFECT_CANNOT_TO_GRAVE)
e3:SetReset(RESET_EVENT+RESETS_STANDARD) e3:SetReset(RESET_EVENT+RESETS_STANDARD)
gc:RegisterEffect(e3) gc:RegisterEffect(e3)
gc=sg:GetNext() gc=sg:GetNext()
......
...@@ -158,7 +158,7 @@ function c30000033.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -158,7 +158,7 @@ function c30000033.target(e,tp,eg,ep,ev,re,r,rp,chk)
end end
function c30000033.thfilter(c) function c30000033.thfilter(c)
return c:IsDefenseBelow(2200) and c:IsType(TYPE_MONSTER) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToHand() return c:IsDefenseBelow(8000) and c:IsType(TYPE_MONSTER) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToHand()
end end
function c30000033.operation(e,tp,eg,ep,ev,re,r,rp) function c30000033.operation(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -113,9 +113,9 @@ function c30000035.thfilter(c) ...@@ -113,9 +113,9 @@ function c30000035.thfilter(c)
return c:IsAbleToRemoveAsCost() and not c:IsCode(30000035) return c:IsAbleToRemoveAsCost() and not c:IsCode(30000035)
end end
function c30000035.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function c30000035.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c30000035.thfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,7,nil) end if chk==0 then return Duel.IsExistingMatchingCard(c30000035.thfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,5,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c30000035.thfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,7,7,nil) local g=Duel.SelectMatchingCard(tp,c30000035.thfilter,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_GRAVE,0,5,5,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST) Duel.Remove(g,POS_FACEUP,REASON_COST)
end end
function c30000035.thtg(e,tp,eg,ep,ev,re,r,rp,chk) function c30000035.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
......
--终焉邪魂 感染源核 --终焉邪魂 感染源核
function c30000042.initial_effect(c) function c30000042.initial_effect(c)
--link summon --link summon
aux.AddLinkProcedure(c,c30000042.mfilter,4) aux.AddLinkProcedure(c,c30000042.mfilter,3)
c:EnableReviveLimit() c:EnableReviveLimit()
--tohand --tohand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
......
...@@ -40,7 +40,7 @@ function c30000049.initial_effect(c) ...@@ -40,7 +40,7 @@ function c30000049.initial_effect(c)
end end
function c30000049.lcheck(g) function c30000049.lcheck(g)
return g:IsExists(Card.IsLinkSetCard,1,nil,0x920) and g:IsExists(Card.IsAttackAbove,2,nil,2400) return g:IsExists(Card.IsAttackAbove,2,nil,2400)
end end
function c30000049.spcon1(e,tp,eg,ep,ev,re,r,rp) function c30000049.spcon1(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -35,7 +35,7 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -35,7 +35,7 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end end
function cm.filter(c) function cm.filter(c)
return c:IsSetCard(0x9da0) and ((c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS)) and not c:IsForbidden() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) or ((c:IsType(TYPE_QUICKPLAY) or c:GetType()==TYPE_SPELL or c:GetType()==TYPE_TRAP) and c:CheckActivateEffect(false,true,false)~=nil ) return c:IsSetCard(0x9da0) and (((c:IsType(TYPE_FIELD) or c:IsType(TYPE_CONTINUOUS)) and not c:IsForbidden() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) or ((c:IsType(TYPE_QUICKPLAY) or c:GetType()==TYPE_SPELL or c:GetType()==TYPE_TRAP) and c:CheckActivateEffect(false,true,false)~=nil ))
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then if chkc then
......
...@@ -118,7 +118,7 @@ function c79029034.tgfilter(c) ...@@ -118,7 +118,7 @@ function c79029034.tgfilter(c)
return c:IsType(TYPE_MONSTER) return c:IsType(TYPE_MONSTER)
end end
function c79029034.tgcon(e) function c79029034.tgcon(e)
return Duel.IsExistingMatchingCard(c79029034.tgfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler()) return Duel.IsExistingMatchingCard(aux.TRUE,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler())
end end
function c79029034.discon(e,tp,eg,ep,ev,re,r,rp) function c79029034.discon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) return rp==1-tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
......
...@@ -129,13 +129,13 @@ function c79029093.sprop1(e,tp,eg,ep,ev,re,r,rp,c) ...@@ -129,13 +129,13 @@ function c79029093.sprop1(e,tp,eg,ep,ev,re,r,rp,c)
end end
end end
function c79029093.copycost(e,tp,eg,ep,ev,re,r,rp,chk) function c79029093.copycost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(79029093)==0 and Duel.IsCanRemoveCounter(tp,1,0,0x1099,79029010,REASON_COST) end if chk==0 then return e:GetHandler():GetFlagEffect(79029093)==0 and Duel.IsCanRemoveCounter(tp,1,0,0x1099,10,REASON_COST) end
e:GetHandler():RegisterFlagEffect(c79029093,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) e:GetHandler():RegisterFlagEffect(79029093,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
Duel.RemoveCounter(tp,1,0,0x1099,79029010,REASON_COST) Duel.RemoveCounter(tp,1,0,0x1099,10,REASON_COST)
end end
function c79029093.copycost1(e,tp,eg,ep,ev,re,r,rp,chk) function c79029093.copycost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(79029093)==0 and Duel.CheckLPCost(tp,6000) end if chk==0 then return e:GetHandler():GetFlagEffect(79029093)==0 and Duel.CheckLPCost(tp,6000) end
e:GetHandler():RegisterFlagEffect(c79029093,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) e:GetHandler():RegisterFlagEffect(79029093,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
Duel.PayLPCost(tp,6000) Duel.PayLPCost(tp,6000)
end end
function c79029093.copyfilter(c) function c79029093.copyfilter(c)
......
...@@ -11,7 +11,7 @@ function c79029133.initial_effect(c) ...@@ -11,7 +11,7 @@ function c79029133.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--Activate --Activate
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_HANDES) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_HANDES)
e2:SetCode(EVENT_DRAW) e2:SetCode(EVENT_DRAW)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
...@@ -63,13 +63,13 @@ function c79029133.adjustop(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,13 +63,13 @@ function c79029133.adjustop(e,tp,eg,ep,ev,re,r,rp)
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
local sg=Group.CreateGroup() local sg=Group.CreateGroup()
for p=1,1 do for p=1,1 do
local g=Duel.GetMatchingGroup(Card.IsFaceup,p,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(Card.IsFaceup,1-tp,LOCATION_MZONE,0,nil)
local race=1 local race=1
while bit.band(RACE_ALL,race)~=0 do while bit.band(RACE_ALL,race)~=0 do
local rg=g:Filter(Card.IsRace,nil,race) local rg=g:Filter(Card.IsRace,nil,race)
local rc=rg:GetCount() local rc=rg:GetCount()
if rc>1 then if rc>1 then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local dg=rg:Select(p,rc-1,rc-1,nil) local dg=rg:Select(p,rc-1,rc-1,nil)
sg:Merge(dg) sg:Merge(dg)
end end
......
...@@ -63,7 +63,7 @@ function c79029157.econ(e) ...@@ -63,7 +63,7 @@ function c79029157.econ(e)
ct=ct+1 ct=ct+1
end end
end end
return e:GetHandler():GetFlagEffect(c79029157+e:GetLabel())>=ct return e:GetHandler():GetFlagEffect(79029157+e:GetLabel())>=ct
end end
function c79029157.elimit(e,re,tp) function c79029157.elimit(e,re,tp)
return re:IsActiveType(TYPE_MONSTER) return re:IsActiveType(TYPE_MONSTER)
......
...@@ -57,8 +57,7 @@ end ...@@ -57,8 +57,7 @@ end
function c79029197.spop(e,tp,eg,ep,ev,re,r,rp) function c79029197.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(1-tp,aux.Stringid(1474910,0)) then if Duel.SelectYesNo(1-tp,aux.Stringid(1474910,0)) then
if Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) then if Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) then
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ht=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)
local ht=Duel.GetFieldGroupCount(p,LOCATION_HAND,0)
Duel.Draw(p,4-ht,REASON_EFFECT) Duel.Draw(p,4-ht,REASON_EFFECT)
local ht1=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0) local ht1=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
Duel.Draw(1-tp,4-ht1,REASON_EFFECT) Duel.Draw(1-tp,4-ht1,REASON_EFFECT)
......
...@@ -44,7 +44,7 @@ function c79029207.initial_effect(c) ...@@ -44,7 +44,7 @@ function c79029207.initial_effect(c)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e3:SetValue(aux.tgoval) e3:SetValue(aux.imval1)
e3:SetCondition(c79029207.ctcon) e3:SetCondition(c79029207.ctcon)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4=e3:Clone() local e4=e3:Clone()
...@@ -80,6 +80,7 @@ function c79029207.sprop(e,tp,eg,ep,ev,re,r,rp,c) ...@@ -80,6 +80,7 @@ function c79029207.sprop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g2=g:FilterSelect(tp,c79029207.sprfilter2,1,1,mc,tp,mc,c,mc:GetLink()) local g2=g:FilterSelect(tp,c79029207.sprfilter2,1,1,mc,tp,mc,c,mc:GetLink())
g1:Merge(g2) g1:Merge(g2)
e:GetHandler():SetMaterial(g1)
Duel.Overlay(e:GetHandler(),g1) Duel.Overlay(e:GetHandler(),g1)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_MZONE,POS_FACEUP,true) Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_MZONE,POS_FACEUP,true)
Debug.Message("说不定我会偷偷溜到其他地方去呢。") Debug.Message("说不定我会偷偷溜到其他地方去呢。")
......
...@@ -77,7 +77,7 @@ function c79029213.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -77,7 +77,7 @@ function c79029213.activate(e,tp,eg,ep,ev,re,r,rp)
tc:CompleteProcedure() tc:CompleteProcedure()
if tc:IsType(TYPE_PENDULUM) then if tc:IsType(TYPE_PENDULUM) then
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(20004,5)) e1:SetDescription(aux.Stringid(79029213,2))
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON) e1:SetCode(EFFECT_EXTRA_PENDULUM_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
...@@ -124,11 +124,11 @@ function c79029213.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -124,11 +124,11 @@ function c79029213.spop(e,tp,eg,ep,ev,re,r,rp)
local b1=not Duel.IsExistingMatchingCard(c79029213.bfil1,tp,LOCATION_SZONE,0,1,nil) local b1=not Duel.IsExistingMatchingCard(c79029213.bfil1,tp,LOCATION_SZONE,0,1,nil)
local b2=not Duel.IsExistingMatchingCard(c79029213.bfil2,tp,LOCATION_SZONE,0,1,nil) local b2=not Duel.IsExistingMatchingCard(c79029213.bfil2,tp,LOCATION_SZONE,0,1,nil)
if b1 and b2 then if b1 and b2 then
op=Duel.SelectOption(tp,aux.Stringid(20004,7),aux.Stringid(20004,6)) op=Duel.SelectOption(tp,aux.Stringid(79029213,1),aux.Stringid(79029213,0))
elseif b1 then elseif b1 then
op=Duel.SelectOption(tp,aux.Stringid(20004,7)) op=Duel.SelectOption(tp,aux.Stringid(79029213,1))
elseif b2 then elseif b2 then
op=Duel.SelectOption(tp,aux.Stringid(20004,6))+1 op=Duel.SelectOption(tp,aux.Stringid(79029213,0))+1
else else
return false return false
end end
......
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