游戏王残局简化版

Annotation For script/utility.txt
Login

Annotation For script/utility.txt

Origin for each line in script/utility.txt from check-in 748ed664c0:

748ed664c0 2023-06-29  顽雨沉风: Auxiliary={}
748ed664c0 2023-06-29  顽雨沉风: aux=Auxiliary
748ed664c0 2023-06-29  顽雨沉风: POS_FACEUP_DEFENCE=POS_FACEUP_DEFENSE
748ed664c0 2023-06-29  顽雨沉风: POS_FACEDOWN_DEFENCE=POS_FACEDOWN_DEFENSE
748ed664c0 2023-06-29  顽雨沉风: RACE_CYBERS=RACE_CYBERSE
748ed664c0 2023-06-29  顽雨沉风: 
748ed664c0 2023-06-29  顽雨沉风: function GetID()
748ed664c0 2023-06-29  顽雨沉风: 	local offset=self_code<100000000 and 1 or 100
748ed664c0 2023-06-29  顽雨沉风: 	return self_table,self_code,offset
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: 
748ed664c0 2023-06-29  顽雨沉风: --the lua version of the bit32 lib, which is deprecated in lua 5.3
748ed664c0 2023-06-29  顽雨沉风: bit={}
748ed664c0 2023-06-29  顽雨沉风: function bit.band(a,b)
748ed664c0 2023-06-29  顽雨沉风: 	return a&b
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.bor(a,b)
748ed664c0 2023-06-29  顽雨沉风: 	return a|b
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.bxor(a,b)
748ed664c0 2023-06-29  顽雨沉风: 	return a~b
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.lshift(a,b)
748ed664c0 2023-06-29  顽雨沉风: 	return a<<b
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.rshift(a,b)
748ed664c0 2023-06-29  顽雨沉风: 	return a>>b
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.bnot(a)
748ed664c0 2023-06-29  顽雨沉风: 	return ~a
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: local function fieldargs(f,width)
748ed664c0 2023-06-29  顽雨沉风: 	w=width or 1
748ed664c0 2023-06-29  顽雨沉风: 	assert(f>=0,"field cannot be negative")
748ed664c0 2023-06-29  顽雨沉风: 	assert(w>0,"width must be positive")
748ed664c0 2023-06-29  顽雨沉风: 	assert(f+w<=32,"trying to access non-existent bits")
748ed664c0 2023-06-29  顽雨沉风: 	return f,~(-1<<w)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.extract(r,field,width)
748ed664c0 2023-06-29  顽雨沉风: 	local f,m=fieldargs(field,width)
748ed664c0 2023-06-29  顽雨沉风: 	return (r>>f)&m
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function bit.replace(r,v,field,width)
748ed664c0 2023-06-29  顽雨沉风: 	local f,m=fieldargs(field,width)
748ed664c0 2023-06-29  顽雨沉风: 	return (r&~(m<<f))|((v&m)<< f)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: 
748ed664c0 2023-06-29  顽雨沉风: --the table of xyz number
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.xyz_number={}
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetXyzNumber(v)
748ed664c0 2023-06-29  顽雨沉风: 	local id
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GetValueType(v)=="Card" then id=v:GetCode() end
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GetValueType(v)=="number" then id=v end
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.xyz_number[id]
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: 
748ed664c0 2023-06-29  顽雨沉风: --the chain id of the results modified by EVENT_TOSS_DICE_NEGATE
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.idx_table=table.pack(1,2,3,4,5,6,7,8)
748ed664c0 2023-06-29  顽雨沉风: 
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.Stringid(code,id)
748ed664c0 2023-06-29  顽雨沉风: 	return code*16+id
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.Next(g)
748ed664c0 2023-06-29  顽雨沉风: 	local first=true
748ed664c0 2023-06-29  顽雨沉风: 	return	function()
748ed664c0 2023-06-29  顽雨沉风: 				if first then first=false return g:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 				else return g:GetNext() end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NULL()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TRUE()
748ed664c0 2023-06-29  顽雨沉风: 	return true
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FALSE()
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AND(...)
748ed664c0 2023-06-29  顽雨沉风: 	local function_list={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(...)
748ed664c0 2023-06-29  顽雨沉风: 				local res=false
748ed664c0 2023-06-29  顽雨沉风: 				for i,f in ipairs(function_list) do
748ed664c0 2023-06-29  顽雨沉风: 					res=f(...)
748ed664c0 2023-06-29  顽雨沉风: 					if not res then return res end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return res
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.OR(...)
748ed664c0 2023-06-29  顽雨沉风: 	local function_list={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(...)
748ed664c0 2023-06-29  顽雨沉风: 				local res=false
748ed664c0 2023-06-29  顽雨沉风: 				for i,f in ipairs(function_list) do
748ed664c0 2023-06-29  顽雨沉风: 					res=f(...)
748ed664c0 2023-06-29  顽雨沉风: 					if res then return res end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return res
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NOT(f)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(...)
748ed664c0 2023-06-29  顽雨沉风: 				return not f(...)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.BeginPuzzle(effect)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.GlobalEffect()
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_TURN_END)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCountLimit(1)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.PuzzleOp)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e1,0)
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Effect.GlobalEffect()
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCode(EFFECT_SKIP_DP)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetTargetRange(1,0)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e2,0)
748ed664c0 2023-06-29  顽雨沉风: 	local e3=Effect.GlobalEffect()
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetCode(EFFECT_SKIP_SP)
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetTargetRange(1,0)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e3,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PuzzleOp(e,tp)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetLP(0,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Duel.SelectOption with option condition
748ed664c0 2023-06-29  顽雨沉风: --Return value starts from 1, different from Duel.SelectOption
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SelectFromOptions(tp,...)
748ed664c0 2023-06-29  顽雨沉风: 	local options={...}
748ed664c0 2023-06-29  顽雨沉风: 	local ops={}
748ed664c0 2023-06-29  顽雨沉风: 	local opvals={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,#options do
748ed664c0 2023-06-29  顽雨沉风: 		if options[i][1] then
748ed664c0 2023-06-29  顽雨沉风: 			table.insert(ops,options[i][2])
748ed664c0 2023-06-29  顽雨沉风: 			table.insert(opvals,options[i][3] or i)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if #ops==0 then return nil end
748ed664c0 2023-06-29  顽雨沉风: 	local select=Duel.SelectOption(tp,table.unpack(ops))
748ed664c0 2023-06-29  顽雨沉风: 	return opvals[select+1]
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsDualState(effect)
748ed664c0 2023-06-29  顽雨沉风: 	local c=effect:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return not c:IsDisabled() and c:IsDualState()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsNotDualState(effect)
748ed664c0 2023-06-29  顽雨沉风: 	local c=effect:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsDisabled() or not c:IsDualState()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DualNormalCondition(effect)
748ed664c0 2023-06-29  顽雨沉风: 	local c=effect:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and not c:IsDualState()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableDualAttribute(c)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_DUAL_SUMMONABLE)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCode(EFFECT_ADD_TYPE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetRange(LOCATION_MZONE+LOCATION_GRAVE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCondition(aux.DualNormalCondition)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetValue(TYPE_NORMAL)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	local e3=e2:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetCode(EFFECT_REMOVE_TYPE)
748ed664c0 2023-06-29  顽雨沉风: 	e3:SetValue(TYPE_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e3)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --register effect of return to hand for Spirit monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableSpiritReturn(c,event1,...)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(event1)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.SpiritReturnReg)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	for i,event in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 		local e2=e1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetCode(event)
748ed664c0 2023-06-29  顽雨沉风: 		c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnReg(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1104)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCategory(CATEGORY_TOHAND)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_MZONE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCountLimit(1)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetReset(RESET_EVENT+0xd6e0000+RESET_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.SpiritReturnConditionForced)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.SpiritReturnTargetForced)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.SpiritReturnOperation)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	local e2=e1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCondition(Auxiliary.SpiritReturnConditionOptional)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetTarget(Auxiliary.SpiritReturnTargetOptional)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnConditionForced(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return not c:IsHasEffect(EFFECT_SPIRIT_DONOT_RETURN) and not c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnTargetForced(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return true end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnConditionOptional(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return not c:IsHasEffect(EFFECT_SPIRIT_DONOT_RETURN) and c:IsHasEffect(EFFECT_SPIRIT_MAYNOT_RETURN)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnTargetOptional(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return e:GetHandler():IsAbleToHand() end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SpiritReturnOperation(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsRelateToEffect(e) then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.SendtoHand(c,nil,REASON_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableNeosReturn(c,operation,set_category)
748ed664c0 2023-06-29  顽雨沉风: 	--return
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1193)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCategory(CATEGORY_TODECK)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_MZONE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCountLimit(1)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.NeosReturnConditionForced)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.NeosReturnTargetForced(set_category))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(operation)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	local e2=e1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCondition(Auxiliary.NeosReturnConditionOptional)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetTarget(Auxiliary.NeosReturnTargetOptional(set_category))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	return e1,e2
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NeosReturnConditionForced(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return not e:GetHandler():IsHasEffect(42015635)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NeosReturnTargetForced(set_category)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 				if chk==0 then return true end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: 				if set_category then set_category(e,tp,eg,ep,ev,re,r,rp) end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NeosReturnConditionOptional(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return e:GetHandler():IsHasEffect(42015635)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NeosReturnTargetOptional(set_category)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 				if chk==0 then return e:GetHandler():IsAbleToExtra() end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: 				if set_category then set_category(e,tp,eg,ep,ev,re,r,rp) end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsUnionState(effect)
748ed664c0 2023-06-29  顽雨沉风: 	local c=effect:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsHasEffect(EFFECT_UNION_STATUS) and c:GetEquipTarget()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --set EFFECT_EQUIP_LIMIT after equipping
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SetUnionState(c)
748ed664c0 2023-06-29  顽雨沉风: 	local eset={c:IsHasEffect(EFFECT_UNION_LIMIT)}
748ed664c0 2023-06-29  顽雨沉风: 	if #eset==0 then return end
748ed664c0 2023-06-29  顽雨沉风: 	local e0=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e0:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e0:SetCode(EFFECT_EQUIP_LIMIT)
748ed664c0 2023-06-29  顽雨沉风: 	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e0:SetValue(eset[1]:GetValue())
748ed664c0 2023-06-29  顽雨沉风: 	e0:SetReset(RESET_EVENT+RESETS_STANDARD)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e0)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_UNION_STATUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetReset(RESET_EVENT+RESETS_STANDARD)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	if c.old_union then
748ed664c0 2023-06-29  顽雨沉风: 		local e2=e1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetCode(EFFECT_OLDUNION_STATUS)
748ed664c0 2023-06-29  顽雨沉风: 		c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --uc: the union monster to be equipped, tc: the target monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CheckUnionEquip(uc,tc,exclude_modern_count)
748ed664c0 2023-06-29  顽雨沉风: 	local modern_count,old_count=tc:GetUnionCount()
748ed664c0 2023-06-29  顽雨沉风: 	if exclude_modern_count then modern_count=modern_count-exclude_modern_count end
748ed664c0 2023-06-29  顽雨沉风: 	if uc.old_union then return modern_count==0
748ed664c0 2023-06-29  顽雨沉风: 	else return old_count==0 end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --EFFECT_DESTROY_SUBSTITUTE filter for modern union monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UnionReplaceFilter(e,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return r&(REASON_BATTLE+REASON_EFFECT)~=0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --add effect to modern union monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableUnionAttribute(c,f)
748ed664c0 2023-06-29  顽雨沉风: 	--destroy sub
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_EQUIP)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_DESTROY_SUBSTITUTE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(aux.UnionReplaceFilter)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	--limit
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCode(EFFECT_UNION_LIMIT)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetValue(f)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableChangeCode(c,code,location,condition)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code)
748ed664c0 2023-06-29  顽雨沉风: 	local loc=c:GetOriginalType()&TYPE_MONSTER~=0 and LOCATION_MZONE or LOCATION_SZONE
748ed664c0 2023-06-29  顽雨沉风: 	loc=location or loc
748ed664c0 2023-06-29  顽雨沉风: 	if condition==nil then condition=Auxiliary.TRUE end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_CHANGE_CODE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(loc)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(condition)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(code)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TargetEqualFunction(f,value,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(effect,target)
748ed664c0 2023-06-29  顽雨沉风: 				return f(target,table.unpack(ext_params))==value
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TargetBoolFunction(f,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(effect,target)
748ed664c0 2023-06-29  顽雨沉风: 				return f(target,table.unpack(ext_params))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FilterEqualFunction(f,value,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(target)
748ed664c0 2023-06-29  顽雨沉风: 				return f(target,table.unpack(ext_params))==value
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FilterBoolFunction(f,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(target)
748ed664c0 2023-06-29  顽雨沉风: 				return f(target,table.unpack(ext_params))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.Tuner(f,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(target,syncard)
748ed664c0 2023-06-29  顽雨沉风: 				return target:IsTuner(syncard) and (not f or f(target,table.unpack(ext_params)))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NonTuner(f,...)
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(target,syncard)
748ed664c0 2023-06-29  顽雨沉风: 				return target:IsNotTuner(syncard) and (not f or f(target,table.unpack(ext_params)))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetValueType(v)
748ed664c0 2023-06-29  顽雨沉风: 	local t=type(v)
748ed664c0 2023-06-29  顽雨沉风: 	if t=="userdata" then
748ed664c0 2023-06-29  顽雨沉风: 		local mt=getmetatable(v)
748ed664c0 2023-06-29  顽雨沉风: 		if mt==Group then return "Group"
748ed664c0 2023-06-29  顽雨沉风: 		elseif mt==Effect then return "Effect"
748ed664c0 2023-06-29  顽雨沉风: 		else return "Card" end
748ed664c0 2023-06-29  顽雨沉风: 	else return t end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MustMaterialCheck(v,tp,code)
748ed664c0 2023-06-29  顽雨沉风: 	local g=Duel.GetMustMaterial(tp,code)
748ed664c0 2023-06-29  顽雨沉风: 	if not v then
748ed664c0 2023-06-29  顽雨沉风: 		if code==EFFECT_MUST_BE_XMATERIAL and Duel.IsPlayerAffectedByEffect(tp,67120578) then return false end
748ed664c0 2023-06-29  顽雨沉风: 		return #g==0
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.CheckMustMaterial(tp,v,code)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MustMaterialCounterFilter(c,g)
748ed664c0 2023-06-29  顽雨沉风: 	return not g:IsContains(c)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Synchro monster, 1 tuner + min to max monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddSynchroProcedure(c,f1,f2,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	if maxc==nil then maxc=99 end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1164)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.SynCondition(f1,f2,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.SynTarget(f1,f2,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.SynOperation(f1,f2,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_SYNCHRO)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynCondition(f1,f2,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,smat,mg,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if smat and smat:IsTuner(c) and (not f1 or f1(smat)) then
748ed664c0 2023-06-29  顽雨沉风: 					return Duel.CheckTunerMaterial(c,smat,f1,f2,minc,maxc,mg) end
748ed664c0 2023-06-29  顽雨沉风: 				return Duel.CheckSynchroMaterial(c,f1,f2,minc,maxc,smat,mg)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynTarget(f1,f2,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,smat,mg,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local g=nil
748ed664c0 2023-06-29  顽雨沉风: 				if smat and smat:IsTuner(c) and (not f1 or f1(smat)) then
748ed664c0 2023-06-29  顽雨沉风: 					g=Duel.SelectTunerMaterial(c:GetControler(),c,smat,f1,f2,minc,maxc,mg)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					g=Duel.SelectSynchroMaterial(c:GetControler(),c,f1,f2,minc,maxc,smat,mg)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if g then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynOperation(f1,f2,minct,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,smat,mg,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local g=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 				c:SetMaterial(g)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
748ed664c0 2023-06-29  顽雨沉风: 				g:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Synchro monster, 1 tuner + 1 monster
748ed664c0 2023-06-29  顽雨沉风: --backward compatibility
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddSynchroProcedure2(c,f1,f2)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddSynchroProcedure(c,f1,f2,1,1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Synchro monster, f1~f3 each 1 MONSTER + f4 min to max monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddSynchroMixProcedure(c,f1,f2,f3,f4,minc,maxc,gc)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1164)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.SynMixCondition(f1,f2,f3,f4,minc,maxc,gc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.SynMixTarget(f1,f2,f3,f4,minc,maxc,gc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.SynMixOperation(f1,f2,f3,f4,minc,maxc,gc))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_SYNCHRO)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMaterialFilter(c,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceupEx() and c:IsCanBeSynchroMaterial(syncard)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynLimitFilter(c,f,e,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	return f and not f(e,c,syncard)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetSynchroLevelFlowerCardian(c)
748ed664c0 2023-06-29  顽雨沉风: 	return 2
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetSynMaterials(tp,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	local mg=Duel.GetSynchroMaterial(tp):Filter(Auxiliary.SynMaterialFilter,nil,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	if mg:IsExists(Card.GetHandSynchro,1,nil) then
748ed664c0 2023-06-29  顽雨沉风: 		local mg2=Duel.GetMatchingGroup(Card.IsCanBeSynchroMaterial,tp,LOCATION_HAND,0,nil,syncard)
748ed664c0 2023-06-29  顽雨沉风: 		if mg2:GetCount()>0 then mg:Merge(mg2) end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return mg
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixCondition(f1,f2,f3,f4,minc,maxc,gc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,smat,mg1,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if smat and not smat:IsCanBeSynchroMaterial(c) then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg
748ed664c0 2023-06-29  顽雨沉风: 				local mgchk=false
748ed664c0 2023-06-29  顽雨沉风: 				if mg1 then
748ed664c0 2023-06-29  顽雨沉风: 					mg=mg1
748ed664c0 2023-06-29  顽雨沉风: 					mgchk=true
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Auxiliary.GetSynMaterials(tp,c)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if smat~=nil then mg:AddCard(smat) end
748ed664c0 2023-06-29  顽雨沉风: 				return mg:IsExists(Auxiliary.SynMixFilter1,1,nil,f1,f2,f3,f4,minc,maxc,c,mg,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixTarget(f1,f2,f3,f4,minc,maxc,gc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,smat,mg1,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				::SynMixTargetSelectStart::
748ed664c0 2023-06-29  顽雨沉风: 				local g=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 				local mg
748ed664c0 2023-06-29  顽雨沉风: 				local mgchk=false
748ed664c0 2023-06-29  顽雨沉风: 				if mg1 then
748ed664c0 2023-06-29  顽雨沉风: 					mg=mg1
748ed664c0 2023-06-29  顽雨沉风: 					mgchk=true
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Auxiliary.GetSynMaterials(tp,c)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if smat~=nil then mg:AddCard(smat) end
748ed664c0 2023-06-29  顽雨沉风: 				local c1
748ed664c0 2023-06-29  顽雨沉风: 				local c2
748ed664c0 2023-06-29  顽雨沉风: 				local c3
748ed664c0 2023-06-29  顽雨沉风: 				local cancel=Duel.IsSummonCancelable()
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				c1=mg:Filter(Auxiliary.SynMixFilter1,nil,f1,f2,f3,f4,minc,maxc,c,mg,smat,gc,mgchk):SelectUnselect(g,tp,false,cancel,1,1)
748ed664c0 2023-06-29  顽雨沉风: 				if not c1 then return false end
748ed664c0 2023-06-29  顽雨沉风: 				g:AddCard(c1)
748ed664c0 2023-06-29  顽雨沉风: 				if f2 then
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					c2=mg:Filter(Auxiliary.SynMixFilter2,g,f2,f3,f4,minc,maxc,c,mg,smat,c1,gc,mgchk):SelectUnselect(g,tp,false,cancel,1,1)
748ed664c0 2023-06-29  顽雨沉风: 					if not c2 then return false end
748ed664c0 2023-06-29  顽雨沉风: 					if g:IsContains(c2) then goto SynMixTargetSelectStart end
748ed664c0 2023-06-29  顽雨沉风: 					g:AddCard(c2)
748ed664c0 2023-06-29  顽雨沉风: 					if f3 then
748ed664c0 2023-06-29  顽雨沉风: 						Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 						c3=mg:Filter(Auxiliary.SynMixFilter3,g,f3,f4,minc,maxc,c,mg,smat,c1,c2,gc,mgchk):SelectUnselect(g,tp,false,cancel,1,1)
748ed664c0 2023-06-29  顽雨沉风: 						if not c3 then return false end
748ed664c0 2023-06-29  顽雨沉风: 						if g:IsContains(c3) then goto SynMixTargetSelectStart end
748ed664c0 2023-06-29  顽雨沉风: 						g:AddCard(c3)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local g4=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 				for i=0,maxc-1 do
748ed664c0 2023-06-29  顽雨沉风: 					local mg2=mg:Clone()
748ed664c0 2023-06-29  顽雨沉风: 					if f4 then
748ed664c0 2023-06-29  顽雨沉风: 						mg2=mg2:Filter(f4,g,c,c1,c2,c3)
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						mg2:Sub(g)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					local cg=mg2:Filter(Auxiliary.SynMixCheckRecursive,g4,tp,g4,mg2,i,minc,maxc,c,g,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 					if cg:GetCount()==0 then break end
748ed664c0 2023-06-29  顽雨沉风: 					local finish=Auxiliary.SynMixCheckGoal(tp,g4,minc,i,c,g,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local c4=cg:SelectUnselect(g+g4,tp,finish,cancel,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 					if not c4 then
748ed664c0 2023-06-29  顽雨沉风: 						if finish then break
748ed664c0 2023-06-29  顽雨沉风: 						else return false end
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					if g:IsContains(c4) or g4:IsContains(c4) then goto SynMixTargetSelectStart end
748ed664c0 2023-06-29  顽雨沉风: 					g4:AddCard(c4)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				g:Merge(g4)
748ed664c0 2023-06-29  顽雨沉风: 				if g:GetCount()>0 then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixOperation(f1,f2,f3,f4,minct,maxc,gc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,smat,mg,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local g=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 				c:SetMaterial(g)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
748ed664c0 2023-06-29  顽雨沉风: 				g:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixFilter1(c,f1,f2,f3,f4,minc,maxc,syncard,mg,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	return (not f1 or f1(c,syncard)) and mg:IsExists(Auxiliary.SynMixFilter2,1,c,f2,f3,f4,minc,maxc,syncard,mg,smat,c,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixFilter2(c,f2,f3,f4,minc,maxc,syncard,mg,smat,c1,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	if f2 then
748ed664c0 2023-06-29  顽雨沉风: 		return f2(c,syncard,c1)
748ed664c0 2023-06-29  顽雨沉风: 			and (mg:IsExists(Auxiliary.SynMixFilter3,1,Group.FromCards(c1,c),f3,f4,minc,maxc,syncard,mg,smat,c1,c,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 				or minc==0 and Auxiliary.SynMixFilter4(c,nil,1,1,syncard,mg,smat,c1,nil,nil,gc,mgchk))
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return mg:IsExists(Auxiliary.SynMixFilter4,1,c1,f4,minc,maxc,syncard,mg,smat,c1,nil,nil,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixFilter3(c,f3,f4,minc,maxc,syncard,mg,smat,c1,c2,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	if f3 then
748ed664c0 2023-06-29  顽雨沉风: 		return f3(c,syncard,c1,c2)
748ed664c0 2023-06-29  顽雨沉风: 			and (mg:IsExists(Auxiliary.SynMixFilter4,1,Group.FromCards(c1,c2,c),f4,minc,maxc,syncard,mg,smat,c1,c2,c,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 				or minc==0 and Auxiliary.SynMixFilter4(c,nil,1,1,syncard,mg,smat,c1,c2,nil,gc,mgchk))
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return mg:IsExists(Auxiliary.SynMixFilter4,1,Group.FromCards(c1,c2),f4,minc,maxc,syncard,mg,smat,c1,c2,nil,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixFilter4(c,f4,minc,maxc,syncard,mg1,smat,c1,c2,c3,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	if f4 and not f4(c,syncard,c1,c2,c3) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.FromCards(c1,c)
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c1)
748ed664c0 2023-06-29  顽雨沉风: 	if c2 then sg:AddCard(c2) end
748ed664c0 2023-06-29  顽雨沉风: 	if c3 then sg:AddCard(c3) end
748ed664c0 2023-06-29  顽雨沉风: 	local mg=mg1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	if f4 then
748ed664c0 2023-06-29  顽雨沉风: 		mg=mg:Filter(f4,sg,syncard,c1,c2,c3)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		mg:Sub(sg)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.SynMixCheck(mg,sg,minc-1,maxc-1,syncard,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixCheck(mg,sg1,minc,maxc,syncard,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	local tp=syncard:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	if minc<=0 and Auxiliary.SynMixCheckGoal(tp,sg1,0,0,syncard,sg,smat,gc,mgchk) then return true end
748ed664c0 2023-06-29  顽雨沉风: 	if maxc==0 then return false end
748ed664c0 2023-06-29  顽雨沉风: 	return mg:IsExists(Auxiliary.SynMixCheckRecursive,1,nil,tp,sg,mg,0,minc,maxc,syncard,sg1,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixCheckRecursive(c,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	ct=ct+1
748ed664c0 2023-06-29  顽雨沉风: 	local res=Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 		or (ct<maxc and mg:IsExists(Auxiliary.SynMixCheckRecursive,1,sg,tp,sg,mg,ct,minc,maxc,syncard,sg1,smat,gc,mgchk))
748ed664c0 2023-06-29  顽雨沉风: 	sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	ct=ct-1
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: -- the material is in hand and don't has extra synchro material effect itself
748ed664c0 2023-06-29  顽雨沉风: -- that mean some other tuner added it as material
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixHandFilter(c,tp,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	if not c:IsLocation(LOCATION_HAND) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local le={c:IsHasEffect(EFFECT_EXTRA_SYNCHRO_MATERIAL,tp)}
748ed664c0 2023-06-29  顽雨沉风: 	for _,te in pairs(le) do
748ed664c0 2023-06-29  顽雨沉风: 		local tf=te:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 		if Auxiliary.GetValueType(tf)=="function" then
748ed664c0 2023-06-29  顽雨沉风: 			if tf(te,syncard) then return false end
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			if tf~=0 then return false end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return true
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SynMixCheckGoal(tp,sg,minc,ct,syncard,sg1,smat,gc,mgchk)
748ed664c0 2023-06-29  顽雨沉风: 	if ct<minc then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local g=sg:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	g:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 	if Duel.GetLocationCountFromEx(tp,tp,g,syncard)<=0 then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if gc and not gc(g) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if smat and not g:IsContains(smat) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.MustMaterialCheck(g,tp,EFFECT_MUST_BE_SMATERIAL) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not g:CheckWithSumEqual(Card.GetSynchroLevel,syncard:GetLevel(),g:GetCount(),g:GetCount(),syncard)
748ed664c0 2023-06-29  顽雨沉风: 		and (not g:IsExists(Card.IsHasEffect,1,nil,89818984)
748ed664c0 2023-06-29  顽雨沉风: 		or not g:CheckWithSumEqual(Auxiliary.GetSynchroLevelFlowerCardian,syncard:GetLevel(),g:GetCount(),g:GetCount(),syncard))
748ed664c0 2023-06-29  顽雨沉风: 		then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local hg=g:Filter(Auxiliary.SynMixHandFilter,nil,tp,syncard)
748ed664c0 2023-06-29  顽雨沉风: 	local hct=hg:GetCount()
748ed664c0 2023-06-29  顽雨沉风: 	if hct>0 and not mgchk then
748ed664c0 2023-06-29  顽雨沉风: 		local found=false
748ed664c0 2023-06-29  顽雨沉风: 		for c in aux.Next(g) do
748ed664c0 2023-06-29  顽雨沉风: 			local he,hf,hmin,hmax=c:GetHandSynchro()
748ed664c0 2023-06-29  顽雨沉风: 			if he then
748ed664c0 2023-06-29  顽雨沉风: 				found=true
748ed664c0 2023-06-29  顽雨沉风: 				if hf and hg:IsExists(Auxiliary.SynLimitFilter,1,c,hf,he,syncard) then return false end
748ed664c0 2023-06-29  顽雨沉风: 				if (hmin and hct<hmin) or (hmax and hct>hmax) then return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		if not found then return false end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	for c in aux.Next(g) do
748ed664c0 2023-06-29  顽雨沉风: 		local le,lf,lloc,lmin,lmax=c:GetTunerLimit()
748ed664c0 2023-06-29  顽雨沉风: 		if le then
748ed664c0 2023-06-29  顽雨沉风: 			local lct=g:GetCount()-1
748ed664c0 2023-06-29  顽雨沉风: 			if lloc then
748ed664c0 2023-06-29  顽雨沉风: 				local llct=g:FilterCount(Card.IsLocation,c,lloc)
748ed664c0 2023-06-29  顽雨沉风: 				if llct~=lct then return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 			if lf and g:IsExists(Auxiliary.SynLimitFilter,1,c,lf,le,syncard) then return false end
748ed664c0 2023-06-29  顽雨沉风: 			if (lmin and lct<lmin) or (lmax and lct>lmax) then return false end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return true
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Checking Tune Magician
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TuneMagicianFilter(c,e)
748ed664c0 2023-06-29  顽雨沉风: 	local f=e:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 	return f(e,c)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TuneMagicianCheckX(c,sg,ecode)
748ed664c0 2023-06-29  顽雨沉风: 	local eset={c:IsHasEffect(ecode)}
748ed664c0 2023-06-29  顽雨沉风: 	for _,te in pairs(eset) do
748ed664c0 2023-06-29  顽雨沉风: 		if sg:IsExists(Auxiliary.TuneMagicianFilter,1,c,te) then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.TuneMagicianCheckAdditionalX(ecode)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(g)
748ed664c0 2023-06-29  顽雨沉风: 				return not g:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,g,ecode)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return alterf(c) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0
748ed664c0 2023-06-29  顽雨沉风: 		and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not alterop or alterop(e,tp,0,c))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Xyz monster, lv k*n
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1165)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	if not maxct then maxct=ct end
748ed664c0 2023-06-29  顽雨沉风: 	if alterf then
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCondition(Auxiliary.XyzConditionAlter(f,lv,ct,maxct,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetTarget(Auxiliary.XyzTargetAlter(f,lv,ct,maxct,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.XyzOperationAlter(f,lv,ct,maxct,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCondition(Auxiliary.XyzCondition(f,lv,ct,maxct))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetTarget(Auxiliary.XyzTarget(f,lv,ct,maxct))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.XyzOperation(f,lv,ct,maxct))
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_XYZ)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Xyz Summon(normal)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzCondition(f,lv,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	--og: use special material
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzTarget(f,lv,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local g=Duel.SelectXyzMaterial(tp,c,f,lv,minc,maxc,og)
748ed664c0 2023-06-29  顽雨沉风: 				if g then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzOperation(f,lv,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					local tc=og:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 					while tc do
748ed664c0 2023-06-29  顽雨沉风: 						local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 						tc=og:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(og)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,og)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					local mg=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					local tc=mg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 					while tc do
748ed664c0 2023-06-29  顽雨沉风: 						local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 						tc=mg:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(mg)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,mg)
748ed664c0 2023-06-29  顽雨沉风: 					mg:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Xyz summon(alterf)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzConditionAlter(f,lv,minc,maxc,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if (not min or min<=1) and mg:IsExists(Auxiliary.XyzAlterFilter,1,nil,alterf,c,e,tp,alterop) then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzTargetAlter(f,lv,minc,maxc,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
748ed664c0 2023-06-29  顽雨沉风: 				local b1=Duel.CheckXyzMaterial(c,f,lv,minc,maxc,og)
748ed664c0 2023-06-29  顽雨沉风: 				local b2=(not min or min<=1) and #altg>0
748ed664c0 2023-06-29  顽雨沉风: 				local g=nil
748ed664c0 2023-06-29  顽雨沉风: 				local cancel=Duel.IsSummonCancelable()
748ed664c0 2023-06-29  顽雨沉风: 				if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabel(1)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local tc=altg:SelectUnselect(nil,tp,false,cancel,1,1)
748ed664c0 2023-06-29  顽雨沉风: 					if tc then
748ed664c0 2023-06-29  顽雨沉风: 						g=Group.FromCards(tc)
748ed664c0 2023-06-29  顽雨沉风: 						if alterop then alterop(e,tp,1,tc) end
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabel(0)
748ed664c0 2023-06-29  顽雨沉风: 					g=Duel.SelectXyzMaterial(tp,c,f,lv,minc,maxc,og)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if g then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzOperationAlter(f,lv,minc,maxc,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					local tc=og:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 					while tc do
748ed664c0 2023-06-29  顽雨沉风: 						local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 						tc=og:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(og)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,og)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					local mg=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 					if e:GetLabel()==1 then
748ed664c0 2023-06-29  顽雨沉风: 						local mg2=mg:GetFirst():GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						if mg2:GetCount()~=0 then
748ed664c0 2023-06-29  顽雨沉风: 							Duel.Overlay(c,mg2)
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 						local tc=mg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 						while tc do
748ed664c0 2023-06-29  顽雨沉风: 							local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 							sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 							tc=mg:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 						Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(mg)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,mg)
748ed664c0 2023-06-29  顽雨沉风: 					mg:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddXyzProcedureLevelFree(c,f,gf,minc,maxc,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1165)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	if alterf then
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCondition(Auxiliary.XyzLevelFreeConditionAlter(f,gf,minc,maxc,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetTarget(Auxiliary.XyzLevelFreeTargetAlter(f,gf,minc,maxc,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop))
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCondition(Auxiliary.XyzLevelFreeCondition(f,gf,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetTarget(Auxiliary.XyzLevelFreeTarget(f,gf,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.XyzLevelFreeOperation(f,gf,minc,maxc))
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_XYZ)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Xyz Summon(level free)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeFilter(c,xyzc,f)
748ed664c0 2023-06-29  顽雨沉风: 	return (not c:IsOnField() or c:IsFaceup()) and c:IsCanBeXyzMaterial(xyzc) and (not f or f(c,xyzc))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeGoal(g,tp,xyzc,gf)
748ed664c0 2023-06-29  顽雨沉风: 	return (not gf or gf(g)) and Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minct
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxct
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					minc=math.max(minc,min)
748ed664c0 2023-06-29  顽雨沉风: 					maxc=math.min(maxc,max)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if maxc<minc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetMatchingGroup(Auxiliary.XyzLevelFreeFilter,tp,LOCATION_MZONE,0,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(sg)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
748ed664c0 2023-06-29  顽雨沉风: 				local res=mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 				return res
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeTarget(f,gf,minct,maxct)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minct
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxct
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetMatchingGroup(Auxiliary.XyzLevelFreeFilter,tp,LOCATION_MZONE,0,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(sg)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				local cancel=Duel.IsSummonCancelable()
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
748ed664c0 2023-06-29  顽雨沉风: 				local g=mg:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,cancel,minc,maxc,tp,c,gf)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 				if g and g:GetCount()>0 then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					local tc=og:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 					while tc do
748ed664c0 2023-06-29  顽雨沉风: 						local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 						tc=og:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(og)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,og)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					local mg=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 					if e:GetLabel()==1 then
748ed664c0 2023-06-29  顽雨沉风: 						local mg2=mg:GetFirst():GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						if mg2:GetCount()~=0 then
748ed664c0 2023-06-29  顽雨沉风: 							Duel.Overlay(c,mg2)
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 						local tc=mg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 						while tc do
748ed664c0 2023-06-29  顽雨沉风: 							local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 							sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 							tc=mg:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 						Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(mg)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,mg)
748ed664c0 2023-06-29  顽雨沉风: 					mg:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Xyz summon(level free&alterf)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeConditionAlter(f,gf,minct,maxct,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
748ed664c0 2023-06-29  顽雨沉风: 				if (not min or min<=1) and altg:GetCount()>0 then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minct
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxct
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				mg=mg:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				if sg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(sg)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
748ed664c0 2023-06-29  顽雨沉风: 				local res=mg:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 				return res
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeTargetAlter(f,gf,minct,maxct,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minct
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxct
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				local altg=mg:Filter(Auxiliary.XyzAlterFilter,nil,alterf,c,e,tp,alterop)
748ed664c0 2023-06-29  顽雨沉风: 				local mg2=mg:Filter(Auxiliary.XyzLevelFreeFilter,nil,c,f)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(sg)
748ed664c0 2023-06-29  顽雨沉风: 				local b1=mg2:CheckSubGroup(Auxiliary.XyzLevelFreeGoal,minc,maxc,tp,c,gf)
748ed664c0 2023-06-29  顽雨沉风: 				local b2=(not min or min<=1) and #altg>0
748ed664c0 2023-06-29  顽雨沉风: 				local g=nil
748ed664c0 2023-06-29  顽雨沉风: 				local cancel=Duel.IsSummonCancelable()
748ed664c0 2023-06-29  顽雨沉风: 				if b2 and (not b1 or Duel.SelectYesNo(tp,alterdesc)) then
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabel(1)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local tc=altg:SelectUnselect(nil,tp,false,cancel,1,1)
748ed664c0 2023-06-29  顽雨沉风: 					if tc then
748ed664c0 2023-06-29  顽雨沉风: 						g=Group.FromCards(tc)
748ed664c0 2023-06-29  顽雨沉风: 						if alterop then alterop(e,tp,1,tc) end
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabel(0)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SetSelectedCard(sg)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					Auxiliary.GCheckAdditional=Auxiliary.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
748ed664c0 2023-06-29  顽雨沉风: 					g=mg2:SelectSubGroup(tp,Auxiliary.XyzLevelFreeGoal,cancel,minc,maxc,tp,c,gf)
748ed664c0 2023-06-29  顽雨沉风: 					Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if g and g:GetCount()>0 then
748ed664c0 2023-06-29  顽雨沉风: 					g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minct,maxct,alterf,alterdesc,alterop)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if og and not min then
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					local tc=og:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 					while tc do
748ed664c0 2023-06-29  顽雨沉风: 						local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 						tc=og:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(og)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,og)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					local mg=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 					if e:GetLabel()==1 then
748ed664c0 2023-06-29  顽雨沉风: 						local mg2=mg:GetFirst():GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 						if mg2:GetCount()~=0 then
748ed664c0 2023-06-29  顽雨沉风: 							Duel.Overlay(c,mg2)
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 						local tc=mg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 						while tc do
748ed664c0 2023-06-29  顽雨沉风: 							local sg1=tc:GetOverlayGroup()
748ed664c0 2023-06-29  顽雨沉风: 							sg:Merge(sg1)
748ed664c0 2023-06-29  顽雨沉风: 							tc=mg:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 						Duel.SendtoGrave(sg,REASON_RULE)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					c:SetMaterial(mg)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Overlay(c,mg)
748ed664c0 2023-06-29  顽雨沉风: 					mg:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --material: names in material list
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, mixed materials
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcMix(c,sub,insf,...)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	local val={...}
748ed664c0 2023-06-29  顽雨沉风: 	local fun={}
748ed664c0 2023-06-29  顽雨沉风: 	local mat={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,#val do
748ed664c0 2023-06-29  顽雨沉风: 		if type(val[i])=='function' then
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub,mg,sg) return val[i](c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) end
748ed664c0 2023-06-29  顽雨沉风: 		elseif type(val[i])=='table' then
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 					for _,fcode in ipairs(val[i]) do
748ed664c0 2023-06-29  顽雨沉风: 						if type(fcode)=='function' then
748ed664c0 2023-06-29  顽雨沉风: 							if fcode(c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) then return true end
748ed664c0 2023-06-29  顽雨沉风: 						else
748ed664c0 2023-06-29  顽雨沉风: 							if c:IsFusionCode(fcode) or (sub and c:CheckFusionSubstitute(fc)) then return true end
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					return false
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 			for _,fcode in ipairs(val[i]) do
748ed664c0 2023-06-29  顽雨沉风: 				if type(fcode)~='function' then mat[fcode]=true end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end
748ed664c0 2023-06-29  顽雨沉风: 			mat[val[i]]=true
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 	if mt.material==nil then
748ed664c0 2023-06-29  顽雨沉风: 		mt.material=mat
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if mt.material_count==nil then
748ed664c0 2023-06-29  顽雨沉风: 		mt.material_count={#fun,#fun}
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	for index,_ in pairs(mat) do
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.AddCodeList(c,index)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_FUSION_MATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.FConditionMix(insf,sub,table.unpack(fun)))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.FOperationMix(insf,sub,table.unpack(fun)))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FConditionMix(insf,sub,...)
748ed664c0 2023-06-29  顽雨沉风: 	--g:Material group(nil for Instant Fusion)
748ed664c0 2023-06-29  顽雨沉风: 	--gc:Material already used
748ed664c0 2023-06-29  顽雨沉风: 	--chkf: check field, default:PLAYER_NONE
748ed664c0 2023-06-29  顽雨沉风: 	--chkf&0x100: Not fusion summon
748ed664c0 2023-06-29  顽雨沉风: 	--chkf&0x200: Concat fusion
748ed664c0 2023-06-29  顽雨沉风: 	local funs={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,g,gc,chkfnf)
748ed664c0 2023-06-29  顽雨沉风: 				if g==nil then return insf and Auxiliary.MustMaterialCheck(nil,e:GetHandlerPlayer(),EFFECT_MUST_BE_FMATERIAL) end
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local notfusion=chkfnf&0x100>0
748ed664c0 2023-06-29  顽雨沉风: 				local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 				local sub=(sub or notfusion) and not concat_fusion
748ed664c0 2023-06-29  顽雨沉风: 				local mg=g:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				if gc then
748ed664c0 2023-06-29  顽雨沉风: 					if not mg:IsContains(gc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SetSelectedCard(Group.FromCards(gc))
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return mg:CheckSubGroup(Auxiliary.FCheckMixGoal,#funs,#funs,tp,c,sub,chkfnf,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FOperationMix(insf,sub,...)
748ed664c0 2023-06-29  顽雨沉风: 	local funs={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local notfusion=chkfnf&0x100>0
748ed664c0 2023-06-29  顽雨沉风: 				local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 				local sub=(sub or notfusion) and not concat_fusion
748ed664c0 2023-06-29  顽雨沉风: 				local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				if gc then Duel.SetSelectedCard(Group.FromCards(gc)) end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				local sg=mg:SelectSubGroup(tp,Auxiliary.FCheckMixGoal,false,#funs,#funs,tp,c,sub,chkfnf,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetFusionMaterial(sg)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FConditionFilterMix(c,fc,sub,concat_fusion,...)
748ed664c0 2023-06-29  顽雨沉风: 	local fusion_type=concat_fusion and SUMMON_TYPE_SPECIAL or SUMMON_TYPE_FUSION
748ed664c0 2023-06-29  顽雨沉风: 	if not c:IsCanBeFusionMaterial(fc,fusion_type) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	for i,f in ipairs({...}) do
748ed664c0 2023-06-29  顽雨沉风: 		if f(c,fc,sub) then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMix(c,mg,sg,fc,sub,fun1,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 	if fun2 then
748ed664c0 2023-06-29  顽雨沉风: 		sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		local res=false
748ed664c0 2023-06-29  顽雨沉风: 		if fun1(c,fc,false,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 			res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,sub,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 		elseif sub and fun1(c,fc,true,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 			res=mg:IsExists(Auxiliary.FCheckMix,1,sg,mg,sg,fc,false,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return res
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return fun1(c,fc,sub,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --if sg1 is subset of sg2 then not Auxiliary.FCheckAdditional(tp,sg1,fc) -> not Auxiliary.FCheckAdditional(tp,sg2,fc)
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.FCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.FGoalCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixGoal(sg,tp,fc,sub,chkfnf,...)
748ed664c0 2023-06-29  顽雨沉风: 	local chkf=chkfnf&0xff
748ed664c0 2023-06-29  顽雨沉风: 	local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 	if not concat_fusion and sg:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,sg,EFFECT_TUNE_MAGICIAN_F) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.MustMaterialCheck(sg,tp,EFFECT_MUST_BE_FMATERIAL) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local g=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	return sg:IsExists(Auxiliary.FCheckMix,1,nil,sg,g,fc,sub,...) and (chkf==PLAYER_NONE or Duel.GetLocationCountFromEx(tp,tp,sg,fc)>0)
748ed664c0 2023-06-29  顽雨沉风: 		and (not Auxiliary.FCheckAdditional or Auxiliary.FCheckAdditional(tp,sg,fc))
748ed664c0 2023-06-29  顽雨沉风: 		and (not Auxiliary.FGoalCheckAdditional or Auxiliary.FGoalCheckAdditional(tp,sg,fc))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, mixed material * minc to maxc + material + ...
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcMixRep(c,sub,insf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	local val={fun1,...}
748ed664c0 2023-06-29  顽雨沉风: 	local fun={}
748ed664c0 2023-06-29  顽雨沉风: 	local mat={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,#val do
748ed664c0 2023-06-29  顽雨沉风: 		if type(val[i])=='function' then
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub,mg,sg) return val[i](c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) end
748ed664c0 2023-06-29  顽雨沉风: 		elseif type(val[i])=='table' then
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 					for _,fcode in ipairs(val[i]) do
748ed664c0 2023-06-29  顽雨沉风: 						if type(fcode)=='function' then
748ed664c0 2023-06-29  顽雨沉风: 							if fcode(c,fc,sub,mg,sg) and not c:IsHasEffect(6205579) then return true end
748ed664c0 2023-06-29  顽雨沉风: 						else
748ed664c0 2023-06-29  顽雨沉风: 							if c:IsFusionCode(fcode) or (sub and c:CheckFusionSubstitute(fc)) then return true end
748ed664c0 2023-06-29  顽雨沉风: 						end
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					return false
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 			for _,fcode in ipairs(val[i]) do
748ed664c0 2023-06-29  顽雨沉风: 				if type(fcode)~='function' then mat[fcode]=true end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			fun[i]=function(c,fc,sub) return c:IsFusionCode(val[i]) or (sub and c:CheckFusionSubstitute(fc)) end
748ed664c0 2023-06-29  顽雨沉风: 			mat[val[i]]=true
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 	if mt.material==nil then
748ed664c0 2023-06-29  顽雨沉风: 		mt.material=mat
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if mt.material_count==nil then
748ed664c0 2023-06-29  顽雨沉风: 		mt.material_count={#fun+minc-1,#fun+maxc-1}
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	for index,_ in pairs(mat) do
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.AddCodeList(c,index)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_FUSION_MATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.FConditionMixRep(insf,sub,fun[1],minc,maxc,table.unpack(fun,2)))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.FOperationMixRep(insf,sub,fun[1],minc,maxc,table.unpack(fun,2)))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FConditionMixRep(insf,sub,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	local funs={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,g,gc,chkfnf)
748ed664c0 2023-06-29  顽雨沉风: 				if g==nil then return insf and Auxiliary.MustMaterialCheck(nil,e:GetHandlerPlayer(),EFFECT_MUST_BE_FMATERIAL) end
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local notfusion=chkfnf&0x100>0
748ed664c0 2023-06-29  顽雨沉风: 				local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 				local sub=(sub or notfusion) and not concat_fusion
748ed664c0 2023-06-29  顽雨沉风: 				local mg=g:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,fun1,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				if gc then
748ed664c0 2023-06-29  顽雨沉风: 					if not mg:IsContains(gc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 					local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 					return Auxiliary.FSelectMixRep(gc,tp,mg,sg,c,sub,chkfnf,fun1,minc,maxc,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 				return mg:IsExists(Auxiliary.FSelectMixRep,1,nil,tp,mg,sg,c,sub,chkfnf,fun1,minc,maxc,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FOperationMixRep(insf,sub,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	local funs={...}
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,gc,chkfnf)
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local notfusion=chkfnf&0x100>0
748ed664c0 2023-06-29  顽雨沉风: 				local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 				local sub=(sub or notfusion) and not concat_fusion
748ed664c0 2023-06-29  顽雨沉风: 				local mg=eg:Filter(Auxiliary.FConditionFilterMix,c,c,sub,concat_fusion,fun1,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 				local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 				if gc then sg:AddCard(gc) end
748ed664c0 2023-06-29  顽雨沉风: 				while sg:GetCount()<maxc+#funs do
748ed664c0 2023-06-29  顽雨沉风: 					local cg=mg:Filter(Auxiliary.FSelectMixRep,sg,tp,mg,sg,c,sub,chkfnf,fun1,minc,maxc,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 					if cg:GetCount()==0 then break end
748ed664c0 2023-06-29  顽雨沉风: 					local finish=Auxiliary.FCheckMixRepGoal(tp,sg,c,sub,chkfnf,fun1,minc,maxc,table.unpack(funs))
748ed664c0 2023-06-29  顽雨沉风: 					local cancel_group=sg:Clone()
748ed664c0 2023-06-29  顽雨沉风: 					if gc then cancel_group:RemoveCard(gc) end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local tc=cg:SelectUnselect(cancel_group,tp,finish,false,minc+#funs,maxc+#funs)
748ed664c0 2023-06-29  顽雨沉风: 					if not tc then break end
748ed664c0 2023-06-29  顽雨沉风: 					if sg:IsContains(tc) then
748ed664c0 2023-06-29  顽雨沉风: 						sg:RemoveCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						sg:AddCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetFusionMaterial(sg)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 	if fun2 then
748ed664c0 2023-06-29  顽雨沉风: 		return sg:IsExists(Auxiliary.FCheckMixRepFilter,1,g,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		local ct1=sg:FilterCount(fun1,g,fc,sub,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 		local ct2=sg:FilterCount(fun1,g,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 		return ct1==sg:GetCount()-g:GetCount() and ct1-ct2<=1
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepFilter(c,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 	if fun2(c,fc,sub,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 		g:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		local sub=sub and fun2(c,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 		local res=Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 		g:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return res
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepGoalCheck(tp,sg,fc,chkfnf)
748ed664c0 2023-06-29  顽雨沉风: 	local concat_fusion=chkfnf&0x200>0
748ed664c0 2023-06-29  顽雨沉风: 	if not concat_fusion and sg:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,sg,EFFECT_TUNE_MAGICIAN_F) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.MustMaterialCheck(sg,tp,EFFECT_MUST_BE_FMATERIAL) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.FGoalCheckAdditional and not Auxiliary.FGoalCheckAdditional(tp,sg,fc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	return true
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepGoal(tp,sg,fc,sub,chkfnf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	local chkf=chkfnf&0xff
748ed664c0 2023-06-29  顽雨沉风: 	if sg:GetCount()<minc+#{...} or sg:GetCount()>maxc+#{...} then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not (chkf==PLAYER_NONE or Duel.GetLocationCountFromEx(tp,tp,sg,fc)>0) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.FCheckAdditional and not Auxiliary.FCheckAdditional(tp,sg,fc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.FCheckMixRepGoalCheck(tp,sg,fc,chkfnf) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local g=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.FCheckMixRep(sg,g,fc,sub,chkf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepTemplate(c,cond,tp,mg,sg,g,fc,sub,chkfnf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	for i,f in ipairs({...}) do
748ed664c0 2023-06-29  顽雨沉风: 		if f(c,fc,sub,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 			g:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			local sub=sub and f(c,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 			local t={...}
748ed664c0 2023-06-29  顽雨沉风: 			table.remove(t,i)
748ed664c0 2023-06-29  顽雨沉风: 			local res=cond(tp,mg,sg,g,fc,sub,chkfnf,fun1,minc,maxc,table.unpack(t))
748ed664c0 2023-06-29  顽雨沉风: 			g:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			if res then return true end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if maxc>0 then
748ed664c0 2023-06-29  顽雨沉风: 		if fun1(c,fc,sub,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 			g:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			local sub=sub and fun1(c,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 			local res=cond(tp,mg,sg,g,fc,sub,chkfnf,fun1,minc-1,maxc-1,...)
748ed664c0 2023-06-29  顽雨沉风: 			g:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			if res then return true end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepSelectedCond(tp,mg,sg,g,...)
748ed664c0 2023-06-29  顽雨沉风: 	if g:GetCount()<sg:GetCount() then
748ed664c0 2023-06-29  顽雨沉风: 		return sg:IsExists(Auxiliary.FCheckMixRepSelected,1,g,tp,mg,sg,g,...)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,...)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckMixRepSelected(c,...)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.FCheckMixRepTemplate(c,Auxiliary.FCheckMixRepSelectedCond,...)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkfnf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	local chkf=chkfnf&0xff
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.FCheckAdditional and not Auxiliary.FCheckAdditional(tp,g,fc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if chkf==PLAYER_NONE or Duel.GetLocationCountFromEx(tp,tp,g,fc)>0 then
748ed664c0 2023-06-29  顽雨沉风: 		if minc<=0 and #{...}==0 and Auxiliary.FCheckMixRepGoalCheck(tp,g,fc,chkfnf) then return true end
748ed664c0 2023-06-29  顽雨沉风: 		return mg:IsExists(Auxiliary.FCheckSelectMixRepAll,1,g,tp,mg,sg,g,fc,sub,chkfnf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return mg:IsExists(Auxiliary.FCheckSelectMixRepM,1,g,tp,mg,sg,g,fc,sub,chkfnf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckSelectMixRepAll(c,tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,fun2,...)
748ed664c0 2023-06-29  顽雨沉风: 	if fun2 then
748ed664c0 2023-06-29  顽雨沉风: 		if fun2(c,fc,sub,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 			g:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			local sub=sub and fun2(c,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 			local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc,maxc,...)
748ed664c0 2023-06-29  顽雨沉风: 			g:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 			return res
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	elseif maxc>0 and fun1(c,fc,sub,mg,sg) then
748ed664c0 2023-06-29  顽雨沉风: 		g:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		local sub=sub and fun1(c,fc,false,mg,sg)
748ed664c0 2023-06-29  顽雨沉风: 		local res=Auxiliary.FCheckSelectMixRep(tp,mg,sg,g,fc,sub,chkf,fun1,minc-1,maxc-1)
748ed664c0 2023-06-29  顽雨沉风: 		g:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return res
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FCheckSelectMixRepM(c,tp,...)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
748ed664c0 2023-06-29  顽雨沉风: 		and Auxiliary.FCheckMixRepTemplate(c,Auxiliary.FCheckSelectMixRep,tp,...)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FSelectMixRep(c,tp,mg,sg,fc,sub,chkfnf,...)
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	local res=false
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.FCheckAdditional and not Auxiliary.FCheckAdditional(tp,sg,fc) then
748ed664c0 2023-06-29  顽雨沉风: 		res=false
748ed664c0 2023-06-29  顽雨沉风: 	elseif Auxiliary.FCheckMixRepGoal(tp,sg,fc,sub,chkfnf,...) then
748ed664c0 2023-06-29  顽雨沉风: 		res=true
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		local g=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 		res=sg:IsExists(Auxiliary.FCheckMixRepSelected,1,nil,tp,mg,sg,g,fc,sub,chkfnf,...)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + name
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCode2(c,code1,code2,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,sub,insf,code1,code2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + name + name
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCode3(c,code1,code2,code3,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,sub,insf,code1,code2,code3)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + name + name + name
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCode4(c,code1,code2,code3,code4,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,sub,insf,code1,code2,code3,code4)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name * n
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCodeRep(c,code1,cc,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	local code={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,cc do
748ed664c0 2023-06-29  顽雨沉风: 		code[i]=code1
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,sub,insf,table.unpack(code))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name * minc to maxc
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCodeRep2(c,code1,minc,maxc,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMixRep(c,sub,insf,code1,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + condition * n
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCodeFun(c,code1,f,cc,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	local fun={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,cc do
748ed664c0 2023-06-29  顽雨沉风: 		fun[i]=f
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,sub,insf,code1,table.unpack(fun))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, condition + condition
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcFun2(c,f1,f2,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,false,insf,f1,f2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, condition * n
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcFunRep(c,f,cc,insf)
748ed664c0 2023-06-29  顽雨沉风: 	local fun={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,cc do
748ed664c0 2023-06-29  顽雨沉风: 		fun[i]=f
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,false,insf,table.unpack(fun))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, condition * minc to maxc
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcFunRep2(c,f,minc,maxc,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMixRep(c,false,insf,f,minc,maxc)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, condition1 + condition2 * n
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcFunFun(c,f1,f2,cc,insf)
748ed664c0 2023-06-29  顽雨沉风: 	local fun={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,cc do
748ed664c0 2023-06-29  顽雨沉风: 		fun[i]=f2
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMix(c,false,insf,f1,table.unpack(fun))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, condition1 + condition2 * minc to maxc
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcFunFunRep(c,f1,f2,minc,maxc,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMixRep(c,false,insf,f2,minc,maxc,f1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + condition * minc to maxc
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCodeFunRep(c,code1,f,minc,maxc,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMixRep(c,sub,insf,f,minc,maxc,code1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, name + name + condition * minc to maxc
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcCode2FunRep(c,code1,code2,f,minc,maxc,sub,insf)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddFusionProcMixRep(c,sub,insf,f,minc,maxc,code1,code2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion monster, Shaddoll materials
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddFusionProcShaddoll(c,attr)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_FUSION_MATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.FShaddollCondition(attr))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.FShaddollOperation(attr))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollFilter(c,fc,attr)
748ed664c0 2023-06-29  顽雨沉风: 	return (Auxiliary.FShaddollFilter1(c) or Auxiliary.FShaddollFilter2(c,attr)) and c:IsCanBeFusionMaterial(fc) and not c:IsHasEffect(6205579)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollExFilter(c,fc,attr,fe)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and not c:IsImmuneToEffect(fe) and Auxiliary.FShaddollFilter(c,fc,attr)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollFilter1(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFusionSetCard(0x9d)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollFilter2(c,attr)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFusionAttribute(attr) or c:IsHasEffect(4904633)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollSpFilter1(c,fc,tp,mg,exg,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 	return mg:IsExists(Auxiliary.FShaddollSpFilter2,1,c,fc,tp,c,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 		or (exg and exg:IsExists(Auxiliary.FShaddollSpFilter2,1,c,fc,tp,c,attr,chkf))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollSpFilter2(c,fc,tp,mc,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.FromCards(c,mc)
748ed664c0 2023-06-29  顽雨沉风: 	if sg:IsExists(Auxiliary.TuneMagicianCheckX,1,nil,sg,EFFECT_TUNE_MAGICIAN_F) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.MustMaterialCheck(sg,tp,EFFECT_MUST_BE_FMATERIAL) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.FCheckAdditional and not Auxiliary.FCheckAdditional(tp,sg,fc)
748ed664c0 2023-06-29  顽雨沉风: 		or Auxiliary.FGoalCheckAdditional and not Auxiliary.FGoalCheckAdditional(tp,sg,fc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	return ((Auxiliary.FShaddollFilter1(c) and Auxiliary.FShaddollFilter2(mc,attr))
748ed664c0 2023-06-29  顽雨沉风: 		or (Auxiliary.FShaddollFilter2(c,attr) and Auxiliary.FShaddollFilter1(mc)))
748ed664c0 2023-06-29  顽雨沉风: 		and (chkf==PLAYER_NONE or Duel.GetLocationCountFromEx(tp,tp,sg,fc)>0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollCondition(attr)
748ed664c0 2023-06-29  顽雨沉风: 	return 	function(e,g,gc,chkf)
748ed664c0 2023-06-29  顽雨沉风: 				if g==nil then return Auxiliary.MustMaterialCheck(nil,e:GetHandlerPlayer(),EFFECT_MUST_BE_FMATERIAL) end
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=g:Filter(Auxiliary.FShaddollFilter,nil,c,attr)
748ed664c0 2023-06-29  顽雨沉风: 				local tp=e:GetHandlerPlayer()
748ed664c0 2023-06-29  顽雨沉风: 				local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				local exg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if fc and fc:IsHasEffect(81788994) and fc:IsCanRemoveCounter(tp,0x16,3,REASON_EFFECT) then
748ed664c0 2023-06-29  顽雨沉风: 					local fe=fc:IsHasEffect(81788994)
748ed664c0 2023-06-29  顽雨沉风: 					exg=Duel.GetMatchingGroup(Auxiliary.FShaddollExFilter,tp,0,LOCATION_MZONE,mg,c,attr,fe)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if gc then
748ed664c0 2023-06-29  顽雨沉风: 					if not mg:IsContains(gc) then return false end
748ed664c0 2023-06-29  顽雨沉风: 					return Auxiliary.FShaddollSpFilter1(gc,c,tp,mg,exg,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return mg:IsExists(Auxiliary.FShaddollSpFilter1,1,nil,c,tp,mg,exg,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.FShaddollOperation(attr)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
748ed664c0 2023-06-29  顽雨沉风: 				local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=eg:Filter(Auxiliary.FShaddollFilter,nil,c,attr)
748ed664c0 2023-06-29  顽雨沉风: 				local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
748ed664c0 2023-06-29  顽雨沉风: 				local exg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if fc and fc:IsHasEffect(81788994) and fc:IsCanRemoveCounter(tp,0x16,3,REASON_EFFECT) then
748ed664c0 2023-06-29  顽雨沉风: 					local fe=fc:IsHasEffect(81788994)
748ed664c0 2023-06-29  顽雨沉风: 					exg=Duel.GetMatchingGroup(Auxiliary.FShaddollExFilter,tp,0,LOCATION_MZONE,mg,c,attr,fe)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local g=nil
748ed664c0 2023-06-29  顽雨沉风: 				if gc then
748ed664c0 2023-06-29  顽雨沉风: 					g=Group.FromCards(gc)
748ed664c0 2023-06-29  顽雨沉风: 					mg:RemoveCard(gc)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					g=mg:FilterSelect(tp,Auxiliary.FShaddollSpFilter1,1,1,nil,c,tp,mg,exg,attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 					mg:Sub(g)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if exg and exg:IsExists(Auxiliary.FShaddollSpFilter2,1,nil,c,tp,g:GetFirst(),attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 					and (mg:GetCount()==0 or (exg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(81788994,0)))) then
748ed664c0 2023-06-29  顽雨沉风: 					fc:RemoveCounter(tp,0x16,3,REASON_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local sg=exg:FilterSelect(tp,Auxiliary.FShaddollSpFilter2,1,1,nil,c,tp,g:GetFirst(),attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 					g:Merge(sg)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 					local sg=mg:FilterSelect(tp,Auxiliary.FShaddollSpFilter2,1,1,nil,c,tp,g:GetFirst(),attr,chkf)
748ed664c0 2023-06-29  顽雨沉风: 					g:Merge(sg)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetFusionMaterial(g)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddContactFusionProcedure(c,filter,self_location,opponent_location,mat_operation,...)
748ed664c0 2023-06-29  顽雨沉风: 	local self_location=self_location or 0
748ed664c0 2023-06-29  顽雨沉风: 	local opponent_location=opponent_location or 0
748ed664c0 2023-06-29  顽雨沉风: 	local operation_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCondition(Auxiliary.ContactFusionCondition(filter,self_location,opponent_location))
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetOperation(Auxiliary.ContactFusionOperation(filter,self_location,opponent_location,mat_operation,operation_params))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	return e2
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ContactFusionMaterialFilter(c,fc,filter)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsCanBeFusionMaterial(fc,SUMMON_TYPE_SPECIAL) and (not filter or filter(c,fc))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ContactFusionCondition(filter,self_location,opponent_location)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=Duel.GetMatchingGroup(Auxiliary.ContactFusionMaterialFilter,tp,self_location,opponent_location,c,c,filter)
748ed664c0 2023-06-29  顽雨沉风: 				return c:CheckFusionMaterial(mg,nil,tp|0x200)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ContactFusionOperation(filter,self_location,opponent_location,mat_operation,operation_params)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c)
748ed664c0 2023-06-29  顽雨沉风: 				local mg=Duel.GetMatchingGroup(Auxiliary.ContactFusionMaterialFilter,tp,self_location,opponent_location,c,c,filter)
748ed664c0 2023-06-29  顽雨沉风: 				local g=Duel.SelectFusionMaterial(tp,c,mg,nil,tp|0x200)
748ed664c0 2023-06-29  顽雨沉风: 				c:SetMaterial(g)
748ed664c0 2023-06-29  顽雨沉风: 				mat_operation(g,table.unpack(operation_params))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcUltimate(c,filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	summon_location=summon_location or LOCATION_HAND
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_ACTIVATE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_FREE_CHAIN)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,extra_target))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,extra_operation))
748ed664c0 2023-06-29  顽雨沉风: 	if not pause then
748ed664c0 2023-06-29  顽雨沉风: 		c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualCheckGreater(g,c,lv)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetSelectedCard(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:CheckWithSumGreater(Card.GetRitualLevel,lv,c)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualCheckEqual(g,c,lv)
748ed664c0 2023-06-29  顽雨沉风: 	return g:CheckWithSumEqual(Card.GetRitualLevel,lv,#g,#g,c)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.RCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualCheck(g,tp,c,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary["RitualCheck"..greater_or_equal](g,c,lv) and Duel.GetMZoneCount(tp,g,tp)>0 and (not c.mat_group_check or c.mat_group_check(g,tp))
748ed664c0 2023-06-29  顽雨沉风: 		and (not Auxiliary.RCheckAdditional or Auxiliary.RCheckAdditional(tp,g,c))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualCheckAdditionalLevel(c,rc)
748ed664c0 2023-06-29  顽雨沉风: 	local raw_level=c:GetRitualLevel(rc)
748ed664c0 2023-06-29  顽雨沉风: 	local lv1=raw_level&0xffff
748ed664c0 2023-06-29  顽雨沉风: 	local lv2=raw_level>>16
748ed664c0 2023-06-29  顽雨沉风: 	if lv2>0 then
748ed664c0 2023-06-29  顽雨沉风: 		return math.min(lv1,lv2)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return lv1
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.RGCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualCheckAdditional(c,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 	if greater_or_equal=="Equal" then
748ed664c0 2023-06-29  顽雨沉风: 		return	function(g)
748ed664c0 2023-06-29  顽雨沉风: 					return (not Auxiliary.RGCheckAdditional or Auxiliary.RGCheckAdditional(g)) and g:GetSum(Auxiliary.RitualCheckAdditionalLevel,c)<=lv
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return	function(g,ec)
748ed664c0 2023-06-29  顽雨沉风: 					if ec then
748ed664c0 2023-06-29  顽雨沉风: 						return (not Auxiliary.RGCheckAdditional or Auxiliary.RGCheckAdditional(g,ec)) and g:GetSum(Auxiliary.RitualCheckAdditionalLevel,c)-Auxiliary.RitualCheckAdditionalLevel(ec,c)<=lv
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						return not Auxiliary.RGCheckAdditional or Auxiliary.RGCheckAdditional(g)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp,chk)) or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local mg=m1:Filter(Card.IsCanBeRitualMaterial,c,c)
748ed664c0 2023-06-29  顽雨沉风: 	if m2 then
748ed664c0 2023-06-29  顽雨沉风: 		mg:Merge(m2)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if c.mat_filter then
748ed664c0 2023-06-29  顽雨沉风: 		mg=mg:Filter(c.mat_filter,c,tp)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		mg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local lv=level_function(c)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.GCheckAdditional=Auxiliary.RitualCheckAdditional(c,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 	local res=mg:CheckSubGroup(Auxiliary.RitualCheck,1,lv,tp,c,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualExtraFilter(c,f)
748ed664c0 2023-06-29  顽雨沉风: 	return c:GetLevel()>0 and f(c) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualUltimateTarget(filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 				if chk==0 then
748ed664c0 2023-06-29  顽雨沉风: 					local mg=Duel.GetRitualMaterial(tp)
748ed664c0 2023-06-29  顽雨沉风: 					if mat_filter then mg=mg:Filter(mat_filter,nil,e,tp,true) end
748ed664c0 2023-06-29  顽雨沉风: 					local exg=nil
748ed664c0 2023-06-29  顽雨沉风: 					if grave_filter then
748ed664c0 2023-06-29  顽雨沉风: 						exg=Duel.GetMatchingGroup(Auxiliary.RitualExtraFilter,tp,LOCATION_GRAVE,0,nil,grave_filter)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					return Duel.IsExistingMatchingCard(Auxiliary.RitualUltimateFilter,tp,summon_location,0,1,nil,filter,e,tp,mg,exg,level_function,greater_or_equal,true)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,summon_location)
748ed664c0 2023-06-29  顽雨沉风: 				if grave_filter then
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if extra_target then
748ed664c0 2023-06-29  顽雨沉风: 					extra_target(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RitualUltimateOperation(filter,level_function,greater_or_equal,summon_location,grave_filter,mat_filter,extra_operation)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 				::RitualUltimateSelectStart::
748ed664c0 2023-06-29  顽雨沉风: 				local mg=Duel.GetRitualMaterial(tp)
748ed664c0 2023-06-29  顽雨沉风: 				if mat_filter then mg=mg:Filter(mat_filter,nil,e,tp) end
748ed664c0 2023-06-29  顽雨沉风: 				local exg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if grave_filter then
748ed664c0 2023-06-29  顽雨沉风: 					exg=Duel.GetMatchingGroup(Auxiliary.RitualExtraFilter,tp,LOCATION_GRAVE,0,nil,grave_filter)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
748ed664c0 2023-06-29  顽雨沉风: 				local tg=Duel.SelectMatchingCard(tp,Auxiliary.NecroValleyFilter(Auxiliary.RitualUltimateFilter),tp,summon_location,0,1,1,nil,filter,e,tp,mg,exg,level_function,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 				local tc=tg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 				local mat
748ed664c0 2023-06-29  顽雨沉风: 				if tc then
748ed664c0 2023-06-29  顽雨沉风: 					mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
748ed664c0 2023-06-29  顽雨沉风: 					if exg then
748ed664c0 2023-06-29  顽雨沉风: 						mg:Merge(exg)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					if tc.mat_filter then
748ed664c0 2023-06-29  顽雨沉风: 						mg=mg:Filter(tc.mat_filter,tc,tp)
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						mg:RemoveCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
748ed664c0 2023-06-29  顽雨沉风: 					local lv=level_function(tc)
748ed664c0 2023-06-29  顽雨沉风: 					Auxiliary.GCheckAdditional=Auxiliary.RitualCheckAdditional(tc,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 					mat=mg:SelectSubGroup(tp,Auxiliary.RitualCheck,true,1,lv,tp,tc,lv,greater_or_equal)
748ed664c0 2023-06-29  顽雨沉风: 					Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 					if not mat then goto RitualUltimateSelectStart end
748ed664c0 2023-06-29  顽雨沉风: 					tc:SetMaterial(mat)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.ReleaseRitualMaterial(mat)
748ed664c0 2023-06-29  顽雨沉风: 					Duel.BreakEffect()
748ed664c0 2023-06-29  顽雨沉风: 					Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP)
748ed664c0 2023-06-29  顽雨沉风: 					tc:CompleteProcedure()
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if extra_operation then
748ed664c0 2023-06-29  顽雨沉风: 					extra_operation(e,tp,eg,ep,ev,re,r,rp,tc,mat)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Ritual Summon, geq fixed lv
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcGreater(c,filter,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Greater",summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcGreaterCode(c,code1,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcGreater(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Ritual Summon, equal to fixed lv
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcEqual(c,filter,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetOriginalLevel,"Equal",summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcEqualCode(c,code1,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcEqual(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Ritual Summon, equal to monster lv
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcEqual2(c,filter,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetLevel,"Equal",summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcEqual2Code(c,code1,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcEqual2Code2(c,code1,code2,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1,code2)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcEqual2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1,code2),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Ritual Summon, geq monster lv
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcGreater2(c,filter,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcUltimate(c,filter,Card.GetLevel,"Greater",summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcGreater2Code(c,code1,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcGreater2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddRitualProcGreater2Code2(c,code1,code2,summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.AddCodeList(c,code1,code2)
748ed664c0 2023-06-29  顽雨沉风: 	return Auxiliary.AddRitualProcGreater2(c,Auxiliary.FilterBoolFunction(Card.IsCode,code1,code2),summon_location,grave_filter,mat_filter,pause,extra_operation,extra_target)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --add procedure to Pendulum monster, also allows registeration of activation effect
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnablePendulumAttribute(c,reg)
748ed664c0 2023-06-29  顽雨沉风: 	if not Auxiliary.PendulumChecklist then
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.PendulumChecklist=0
748ed664c0 2023-06-29  顽雨沉风: 		local ge1=Effect.GlobalEffect()
748ed664c0 2023-06-29  顽雨沉风: 		ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 		ge1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
748ed664c0 2023-06-29  顽雨沉风: 		ge1:SetOperation(Auxiliary.PendulumReset)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RegisterEffect(ge1,0)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1163)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC_G)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_PZONE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.PendCondition())
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.PendOperation())
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_PENDULUM)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	--register by default
748ed664c0 2023-06-29  顽雨沉风: 	if reg==nil or reg then
748ed664c0 2023-06-29  顽雨沉风: 		local e2=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetDescription(1160)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetType(EFFECT_TYPE_ACTIVATE)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetCode(EVENT_FREE_CHAIN)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetRange(LOCATION_HAND)
748ed664c0 2023-06-29  顽雨沉风: 		c:RegisterEffect(e2)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PendulumReset(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.PendulumChecklist=0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PConditionExtraFilterSpecific(c,e,tp,lscale,rscale,te)
748ed664c0 2023-06-29  顽雨沉风: 	if not te then return true end
748ed664c0 2023-06-29  顽雨沉风: 	local f=te:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 	return not f or f(te,c,e,tp,lscale,rscale)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PConditionExtraFilter(c,e,tp,lscale,rscale,eset)
748ed664c0 2023-06-29  顽雨沉风: 	for _,te in ipairs(eset) do
748ed664c0 2023-06-29  顽雨沉风: 		if Auxiliary.PConditionExtraFilterSpecific(c,e,tp,lscale,rscale,te) then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PConditionFilter(c,e,tp,lscale,rscale,eset)
748ed664c0 2023-06-29  顽雨沉风: 	local lv=0
748ed664c0 2023-06-29  顽雨沉风: 	if c.pendulum_level then
748ed664c0 2023-06-29  顽雨沉风: 		lv=c.pendulum_level
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		lv=c:GetLevel()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local bool=Auxiliary.PendulumSummonableBool(c)
748ed664c0 2023-06-29  顽雨沉风: 	return (c:IsLocation(LOCATION_HAND) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM)))
748ed664c0 2023-06-29  顽雨沉风: 		and lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
748ed664c0 2023-06-29  顽雨沉风: 		and not c:IsForbidden()
748ed664c0 2023-06-29  顽雨沉风: 		and (Auxiliary.PendulumChecklist&(0x1<<tp)==0 or Auxiliary.PConditionExtraFilter(c,e,tp,lscale,rscale,eset))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PendCondition()
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
748ed664c0 2023-06-29  顽雨沉风: 				if Auxiliary.PendulumChecklist&(0x1<<tp)~=0 and #eset==0 then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
748ed664c0 2023-06-29  顽雨沉风: 				if rpz==nil or c==rpz then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local lscale=c:GetLeftScale()
748ed664c0 2023-06-29  顽雨沉风: 				local rscale=rpz:GetRightScale()
748ed664c0 2023-06-29  顽雨沉风: 				if lscale>rscale then lscale,rscale=rscale,lscale end
748ed664c0 2023-06-29  顽雨沉风: 				local loc=0
748ed664c0 2023-06-29  顽雨沉风: 				if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_HAND end
748ed664c0 2023-06-29  顽雨沉风: 				if Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)>0 then loc=loc+LOCATION_EXTRA end
748ed664c0 2023-06-29  顽雨沉风: 				if loc==0 then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local g=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					g=og:Filter(Card.IsLocation,nil,loc)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					g=Duel.GetFieldGroup(tp,loc,0)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				return g:IsExists(Auxiliary.PConditionFilter,1,nil,e,tp,lscale,rscale,eset)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PendOperationCheck(ft1,ft2,ft)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(g)
748ed664c0 2023-06-29  顽雨沉风: 				local exg=g:Filter(Card.IsLocation,nil,LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 				local mg=g-exg
748ed664c0 2023-06-29  顽雨沉风: 				return #g<=ft and #exg<=ft2 and #mg<=ft1
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PendOperation()
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
748ed664c0 2023-06-29  顽雨沉风: 				local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
748ed664c0 2023-06-29  顽雨沉风: 				local lscale=c:GetLeftScale()
748ed664c0 2023-06-29  顽雨沉风: 				local rscale=rpz:GetRightScale()
748ed664c0 2023-06-29  顽雨沉风: 				if lscale>rscale then lscale,rscale=rscale,lscale end
748ed664c0 2023-06-29  顽雨沉风: 				local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
748ed664c0 2023-06-29  顽雨沉风: 				local tg=nil
748ed664c0 2023-06-29  顽雨沉风: 				local loc=0
748ed664c0 2023-06-29  顽雨沉风: 				local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE)
748ed664c0 2023-06-29  顽雨沉风: 				local ft2=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)
748ed664c0 2023-06-29  顽雨沉风: 				local ft=Duel.GetUsableMZoneCount(tp)
748ed664c0 2023-06-29  顽雨沉风: 				local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp]
748ed664c0 2023-06-29  顽雨沉风: 				if ect and ect<ft2 then ft2=ect end
748ed664c0 2023-06-29  顽雨沉风: 				if Duel.IsPlayerAffectedByEffect(tp,59822133) then
748ed664c0 2023-06-29  顽雨沉风: 					if ft1>0 then ft1=1 end
748ed664c0 2023-06-29  顽雨沉风: 					if ft2>0 then ft2=1 end
748ed664c0 2023-06-29  顽雨沉风: 					ft=1
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if ft1>0 then loc=loc|LOCATION_HAND end
748ed664c0 2023-06-29  顽雨沉风: 				if ft2>0 then loc=loc|LOCATION_EXTRA end
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					tg=og:Filter(Card.IsLocation,nil,loc):Filter(Auxiliary.PConditionFilter,nil,e,tp,lscale,rscale,eset)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					tg=Duel.GetMatchingGroup(Auxiliary.PConditionFilter,tp,loc,0,nil,e,tp,lscale,rscale,eset)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local ce=nil
748ed664c0 2023-06-29  顽雨沉风: 				local b1=Auxiliary.PendulumChecklist&(0x1<<tp)==0
748ed664c0 2023-06-29  顽雨沉风: 				local b2=#eset>0
748ed664c0 2023-06-29  顽雨沉风: 				if b1 and b2 then
748ed664c0 2023-06-29  顽雨沉风: 					local options={1163}
748ed664c0 2023-06-29  顽雨沉风: 					for _,te in ipairs(eset) do
748ed664c0 2023-06-29  顽雨沉风: 						table.insert(options,te:GetDescription())
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					local op=Duel.SelectOption(tp,table.unpack(options))
748ed664c0 2023-06-29  顽雨沉风: 					if op>0 then
748ed664c0 2023-06-29  顽雨沉风: 						ce=eset[op]
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				elseif b2 and not b1 then
748ed664c0 2023-06-29  顽雨沉风: 					local options={}
748ed664c0 2023-06-29  顽雨沉风: 					for _,te in ipairs(eset) do
748ed664c0 2023-06-29  顽雨沉风: 						table.insert(options,te:GetDescription())
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 					local op=Duel.SelectOption(tp,table.unpack(options))
748ed664c0 2023-06-29  顽雨沉风: 					ce=eset[op+1]
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if ce then
748ed664c0 2023-06-29  顽雨沉风: 					tg=tg:Filter(Auxiliary.PConditionExtraFilterSpecific,nil,e,tp,lscale,rscale,ce)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=Auxiliary.PendOperationCheck(ft1,ft2,ft)
748ed664c0 2023-06-29  顽雨沉风: 				local g=tg:SelectSubGroup(tp,aux.TRUE,true,1,math.min(#tg,ft))
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: 				if not g then return end
748ed664c0 2023-06-29  顽雨沉风: 				if ce then
748ed664c0 2023-06-29  顽雨沉风: 					Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
748ed664c0 2023-06-29  顽雨沉风: 					ce:UseCountLimit(tp)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					Auxiliary.PendulumChecklist=Auxiliary.PendulumChecklist|(0x1<<tp)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				sg:Merge(g)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.HintSelection(Group.FromCards(c))
748ed664c0 2023-06-29  顽雨沉风: 				Duel.HintSelection(Group.FromCards(rpz))
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --enable revive limit for monsters that are also pendulum sumonable from certain locations (Odd-Eyes Revolution Dragon)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableReviveLimitPendulumSummonable(c, loc)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	c:EnableReviveLimit()
748ed664c0 2023-06-29  顽雨沉风: 	local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 	if loc==nil then loc=0xff end
748ed664c0 2023-06-29  顽雨沉风: 	mt.psummonable_location=loc
748ed664c0 2023-06-29  顽雨沉风: 	--complete procedure on pendulum summon success
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.PSSCompleteProcedure)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PendulumSummonableBool(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c.psummonable_location~=nil and c:GetLocation()&c.psummonable_location>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PSSCompleteProcedure(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsSummonType(SUMMON_TYPE_PENDULUM) then
748ed664c0 2023-06-29  顽雨沉风: 		c:CompleteProcedure()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Link Summon
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddLinkProcedure(c,f,min,max,gf)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetDescription(1166)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_SPSUMMON_PROC)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_EXTRA)
748ed664c0 2023-06-29  顽雨沉风: 	if max==nil then max=c:GetLink() end
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.LinkCondition(f,min,max,gf))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.LinkTarget(f,min,max,gf))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.LinkOperation(f,min,max,gf))
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetValue(SUMMON_TYPE_LINK)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LConditionFilter(c,f,lc,e)
748ed664c0 2023-06-29  顽雨沉风: 	return (c:IsFaceup() or not c:IsOnField() or e:IsHasProperty(EFFECT_FLAG_SET_AVAILABLE))
748ed664c0 2023-06-29  顽雨沉风: 		and c:IsCanBeLinkMaterial(lc) and (not f or f(c))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LExtraFilter(c,f,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsOnField() and c:IsFacedown() then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if not c:IsCanBeLinkMaterial(lc) or f and not f(c) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
748ed664c0 2023-06-29  顽雨沉风: 	for _,te in pairs(le) do
748ed664c0 2023-06-29  顽雨沉风: 		local tf=te:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 		local related,valid=tf(te,lc,nil,c,tp)
748ed664c0 2023-06-29  顽雨沉风: 		if related then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetLinkCount(c)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsType(TYPE_LINK) and c:GetLink()>1 then
748ed664c0 2023-06-29  顽雨沉风: 		return 1+0x10000*c:GetLink()
748ed664c0 2023-06-29  顽雨沉风: 	else return 1 end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetLinkMaterials(tp,f,lc,e)
748ed664c0 2023-06-29  顽雨沉风: 	local mg=Duel.GetMatchingGroup(Auxiliary.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,lc,e)
748ed664c0 2023-06-29  顽雨沉风: 	local mg2=Duel.GetMatchingGroup(Auxiliary.LExtraFilter,tp,LOCATION_HAND+LOCATION_SZONE,LOCATION_ONFIELD,nil,f,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 	if mg2:GetCount()>0 then mg:Merge(mg2) end
748ed664c0 2023-06-29  顽雨沉风: 	return mg
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LCheckOtherMaterial(c,mg,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 	local le={c:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
748ed664c0 2023-06-29  顽雨沉风: 	local res1=false
748ed664c0 2023-06-29  顽雨沉风: 	local res2=true
748ed664c0 2023-06-29  顽雨沉风: 	for _,te in pairs(le) do
748ed664c0 2023-06-29  顽雨沉风: 		local f=te:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 		local related,valid=f(te,lc,mg,c,tp)
748ed664c0 2023-06-29  顽雨沉风: 		if related then res2=false end
748ed664c0 2023-06-29  顽雨沉风: 		if related and valid then res1=true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return res1 or res2
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LUncompatibilityFilter(c,sg,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 	local mg=sg:Filter(aux.TRUE,c)
748ed664c0 2023-06-29  顽雨沉风: 	return not Auxiliary.LCheckOtherMaterial(c,mg,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LCheckGoal(sg,tp,lc,gf,lmat)
748ed664c0 2023-06-29  顽雨沉风: 	return sg:CheckWithSumEqual(Auxiliary.GetLinkCount,lc:GetLink(),#sg,#sg)
748ed664c0 2023-06-29  顽雨沉风: 		and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg,lc,tp))
748ed664c0 2023-06-29  顽雨沉风: 		and not sg:IsExists(Auxiliary.LUncompatibilityFilter,1,nil,sg,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 		and (not lmat or sg:IsContains(lmat))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LExtraMaterialCount(mg,lc,tp)
748ed664c0 2023-06-29  顽雨沉风: 	for tc in aux.Next(mg) do
748ed664c0 2023-06-29  顽雨沉风: 		local le={tc:IsHasEffect(EFFECT_EXTRA_LINK_MATERIAL,tp)}
748ed664c0 2023-06-29  顽雨沉风: 		for _,te in pairs(le) do
748ed664c0 2023-06-29  顽雨沉风: 			local sg=mg:Filter(aux.TRUE,tc)
748ed664c0 2023-06-29  顽雨沉风: 			local f=te:GetValue()
748ed664c0 2023-06-29  顽雨沉风: 			local related,valid=f(te,lc,sg,tc,tp)
748ed664c0 2023-06-29  顽雨沉风: 			if related and valid then
748ed664c0 2023-06-29  顽雨沉风: 				te:UseCountLimit(tp)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LinkCondition(f,minc,maxc,gf)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,c,og,lmat,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				if c==nil then return true end
748ed664c0 2023-06-29  顽雨沉风: 				if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local tp=c:GetControler()
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og:Filter(Auxiliary.LConditionFilter,nil,f,c,e)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Auxiliary.GetLinkMaterials(tp,f,c,e)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if lmat~=nil then
748ed664c0 2023-06-29  顽雨沉风: 					if not Auxiliary.LConditionFilter(lmat,f,c,e) then return false end
748ed664c0 2023-06-29  顽雨沉风: 					mg:AddCard(lmat)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local fg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_LMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				if fg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(fg)
748ed664c0 2023-06-29  顽雨沉风: 				return mg:CheckSubGroup(Auxiliary.LCheckGoal,minc,maxc,tp,c,gf,lmat)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LinkTarget(f,minc,maxc,gf)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,lmat,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local minc=minc
748ed664c0 2023-06-29  顽雨沉风: 				local maxc=maxc
748ed664c0 2023-06-29  顽雨沉风: 				if min then
748ed664c0 2023-06-29  顽雨沉风: 					if min>minc then minc=min end
748ed664c0 2023-06-29  顽雨沉风: 					if max<maxc then maxc=max end
748ed664c0 2023-06-29  顽雨沉风: 					if minc>maxc then return false end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local mg=nil
748ed664c0 2023-06-29  顽雨沉风: 				if og then
748ed664c0 2023-06-29  顽雨沉风: 					mg=og:Filter(Auxiliary.LConditionFilter,nil,f,c,e)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					mg=Auxiliary.GetLinkMaterials(tp,f,c,e)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				if lmat~=nil then
748ed664c0 2023-06-29  顽雨沉风: 					if not Auxiliary.LConditionFilter(lmat,f,c,e) then return false end
748ed664c0 2023-06-29  顽雨沉风: 					mg:AddCard(lmat)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				local fg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_LMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SetSelectedCard(fg)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 				local cancel=Duel.IsSummonCancelable()
748ed664c0 2023-06-29  顽雨沉风: 				local sg=mg:SelectSubGroup(tp,Auxiliary.LCheckGoal,cancel,minc,maxc,tp,c,gf,lmat)
748ed664c0 2023-06-29  顽雨沉风: 				if sg then
748ed664c0 2023-06-29  顽雨沉风: 					sg:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 					e:SetLabelObject(sg)
748ed664c0 2023-06-29  顽雨沉风: 					return true
748ed664c0 2023-06-29  顽雨沉风: 				else return false end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LinkOperation(f,minc,maxc,gf)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,tp,eg,ep,ev,re,r,rp,c,og,lmat,min,max)
748ed664c0 2023-06-29  顽雨沉风: 				local g=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 				c:SetMaterial(g)
748ed664c0 2023-06-29  顽雨沉风: 				Auxiliary.LExtraMaterialCount(g,c,tp)
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK)
748ed664c0 2023-06-29  顽雨沉风: 				g:DeleteGroup()
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.EnableExtraDeckSummonCountLimit()
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.ExtraDeckSummonCountLimit~=nil then return end
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.ExtraDeckSummonCountLimit={}
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.ExtraDeckSummonCountLimit[0]=1
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.ExtraDeckSummonCountLimit[1]=1
748ed664c0 2023-06-29  顽雨沉风: 	local ge1=Effect.GlobalEffect()
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetOperation(Auxiliary.ExtraDeckSummonCountLimitReset)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(ge1,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ExtraDeckSummonCountLimitReset()
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.ExtraDeckSummonCountLimit[0]=1
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.ExtraDeckSummonCountLimit[1]=1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Fusion Monster is unnecessary to use this
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddMaterialCodeList(c,...)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	local mat={}
748ed664c0 2023-06-29  顽雨沉风: 	for _,code in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 		mat[code]=true
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if c.material==nil then
748ed664c0 2023-06-29  顽雨沉风: 		local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 		mt.material=mat
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	for index,_ in pairs(mat) do
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.AddCodeList(c,index)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsMaterialListCode(c,code)
748ed664c0 2023-06-29  顽雨沉风: 	return c.material and c.material[code]
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsMaterialListSetCard(c,setcode)
748ed664c0 2023-06-29  顽雨沉风: 	if not c.material_setcode then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if type(c.material_setcode)=='table' then
748ed664c0 2023-06-29  顽雨沉风: 		for i,scode in ipairs(c.material_setcode) do
748ed664c0 2023-06-29  顽雨沉风: 			if setcode&0xfff==scode&0xfff and setcode&scode==setcode then return true end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return setcode&0xfff==c.material_setcode&0xfff and setcode&c.material_setcode==setcode
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsMaterialListType(c,type)
748ed664c0 2023-06-29  顽雨沉风: 	return c.material_type and type&c.material_type==type
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetMaterialListCount(c)
748ed664c0 2023-06-29  顽雨沉风: 	if not c.material_count then return 0,0 end
748ed664c0 2023-06-29  顽雨沉风: 	return c.material_count[1],c.material_count[2]
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddCodeList(c,...)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	if c.card_code_list==nil then
748ed664c0 2023-06-29  顽雨沉风: 		local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 		mt.card_code_list={}
748ed664c0 2023-06-29  顽雨沉风: 		for _,code in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 			mt.card_code_list[code]=true
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		for _,code in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 			c.card_code_list[code]=true
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsCodeListed(c,code)
748ed664c0 2023-06-29  顽雨沉风: 	return c.card_code_list and c.card_code_list[code]
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddSetNameMonsterList(c,...)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_COPYING_EFFECT) then return end
748ed664c0 2023-06-29  顽雨沉风: 	if c.setcode_monster_list==nil then
748ed664c0 2023-06-29  顽雨沉风: 		local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 		mt.setcode_monster_list={}
748ed664c0 2023-06-29  顽雨沉风: 		for i,scode in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 			mt.setcode_monster_list[i]=scode
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		for i,scode in ipairs{...} do
748ed664c0 2023-06-29  顽雨沉风: 			c.setcode_monster_list[i]=scode
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsSetNameMonsterListed(c,setcode)
748ed664c0 2023-06-29  顽雨沉风: 	if not c.setcode_monster_list then return false end
748ed664c0 2023-06-29  顽雨沉风: 	for i,scode in ipairs(c.setcode_monster_list) do
748ed664c0 2023-06-29  顽雨沉风: 		if setcode&0xfff==scode&0xfff and setcode&scode==setcode then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsCounterAdded(c,counter)
748ed664c0 2023-06-29  顽雨沉风: 	if not c.counter_add_list then return false end
748ed664c0 2023-06-29  顽雨沉风: 	for i,ccounter in ipairs(c.counter_add_list) do
748ed664c0 2023-06-29  顽雨沉风: 		if counter==ccounter then return true end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsTypeInText(c,type)
748ed664c0 2023-06-29  顽雨沉风: 	return c.has_text_type and type&c.has_text_type==type
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetAttributeCount(g)
748ed664c0 2023-06-29  顽雨沉风: 	if #g==0 then return 0 end
748ed664c0 2023-06-29  顽雨沉风: 	local att=0
748ed664c0 2023-06-29  顽雨沉风: 	for tc in Auxiliary.Next(g) do
748ed664c0 2023-06-29  顽雨沉风: 		att=att|tc:GetAttribute()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local ct=0
748ed664c0 2023-06-29  顽雨沉风: 	while att~=0 do
748ed664c0 2023-06-29  顽雨沉风: 		if att&0x1~=0 then ct=ct+1 end
748ed664c0 2023-06-29  顽雨沉风: 		att=att>>1
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return ct
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsInGroup(c,g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:IsContains(c)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --return the column of card c (from the viewpoint of p)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetColumn(c,p)
748ed664c0 2023-06-29  顽雨沉风: 	local seq=c:GetSequence()
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsLocation(LOCATION_MZONE) then
748ed664c0 2023-06-29  顽雨沉风: 		if seq==5 then
748ed664c0 2023-06-29  顽雨沉风: 			seq=1
748ed664c0 2023-06-29  顽雨沉风: 		elseif seq==6 then
748ed664c0 2023-06-29  顽雨沉风: 			seq=3
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	elseif c:IsLocation(LOCATION_SZONE) then
748ed664c0 2023-06-29  顽雨沉风: 		if seq>4 then
748ed664c0 2023-06-29  顽雨沉风: 			return nil
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return nil
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsControler(p or 0) then
748ed664c0 2023-06-29  顽雨沉风: 		return seq
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return 4-seq
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --return the column of monster zone seq (from the viewpoint of controller)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MZoneSequence(seq)
748ed664c0 2023-06-29  顽雨沉风: 	if seq==5 then return 1 end
748ed664c0 2023-06-29  顽雨沉风: 	if seq==6 then return 3 end
748ed664c0 2023-06-29  顽雨沉风: 	return seq
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --return the column of spell/trap zone seq (from the viewpoint of controller)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SZoneSequence(seq)
748ed664c0 2023-06-29  顽雨沉风: 	if seq>4 then return nil end
748ed664c0 2023-06-29  顽雨沉风: 	return seq
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --generate the value function of EFFECT_CHANGE_BATTLE_DAMAGE on monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ChangeBattleDamage(player,value)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(e,damp)
748ed664c0 2023-06-29  顽雨沉风: 				if player==0 then
748ed664c0 2023-06-29  顽雨沉风: 					if e:GetOwnerPlayer()==damp then
748ed664c0 2023-06-29  顽雨沉风: 						return value
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						return -1
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				elseif player==1 then
748ed664c0 2023-06-29  顽雨沉风: 					if e:GetOwnerPlayer()==1-damp then
748ed664c0 2023-06-29  顽雨沉风: 						return value
748ed664c0 2023-06-29  顽雨沉风: 					else
748ed664c0 2023-06-29  顽雨沉风: 						return -1
748ed664c0 2023-06-29  顽雨沉风: 					end
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for "negate the effects of a face-up monster" (無限泡影/Infinite Impermanence)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NegateMonsterFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and not c:IsDisabled() and (c:IsType(TYPE_EFFECT) or c:GetOriginalType()&TYPE_EFFECT~=0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for "negate the effects of an Effect Monster" (エフェクト・ヴェーラー/Effect Veiler)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NegateEffectMonsterFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and not c:IsDisabled() and c:IsType(TYPE_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for "negate the effects of a face-up card"
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NegateAnyFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsType(TYPE_TRAPMONSTER) then
748ed664c0 2023-06-29  顽雨沉风: 		return c:IsFaceup()
748ed664c0 2023-06-29  顽雨沉风: 	elseif c:IsType(TYPE_SPELL+TYPE_TRAP) then
748ed664c0 2023-06-29  顽雨沉风: 		return c:IsFaceup() and not c:IsDisabled()
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return aux.NegateMonsterFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --alias for compatibility
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.disfilter1=Auxiliary.NegateAnyFilter
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_BATTLE_DESTROYING
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bdcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsRelateToBattle()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_BATTLE_DESTROYING + opponent monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bdocon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsRelateToBattle() and c:IsStatus(STATUS_OPPO_BATTLE)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_BATTLE_DESTROYING + to_grave
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bdgcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	local bc=c:GetBattleTarget()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_BATTLE_DESTROYING + opponent monster + to_grave
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bdogcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	local bc=c:GetBattleTarget()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsRelateToBattle() and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_DAMAGE_STEP_END + this monster is releate to battle
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dsercon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsRelateToBattle() or c:IsStatus(STATUS_BATTLE_DESTROYED)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_TO_GRAVE + destroyed by opponent
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dogcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsPreviousControler(tp) and c:IsReason(REASON_DESTROY) and rp==1-tp
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of EVENT_TO_GRAVE + destroyed by opponent + from field
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dogfcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
748ed664c0 2023-06-29  顽雨沉风: 		and c:IsReason(REASON_DESTROY) and rp==1-tp
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of "except the turn this card was sent to the Graveyard"
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.exccon(e)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.GetTurnCount()~=e:GetHandler():GetTurnID() or e:GetHandler():IsReason(REASON_RETURN)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of checking battle phase availability
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bpcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.IsAbleToEnterBP() or (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of free chain effects changing ATK/DEF
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dscon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --flag effect for spell counter
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.chainreg(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	if e:GetHandler():GetFlagEffect(1)==0 then
748ed664c0 2023-06-29  顽雨沉风: 		e:GetHandler():RegisterFlagEffect(1,RESET_EVENT+RESETS_STANDARD-RESET_TURN_SET+RESET_CHAIN,0,1)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --default filter for EFFECT_CANNOT_BE_BATTLE_TARGET
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.imval1(e,c)
748ed664c0 2023-06-29  顽雨沉风: 	return not c:IsImmuneToEffect(e)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for EFFECT_INDESTRUCTABLE_EFFECT + self
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.indsval(e,re,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return rp==e:GetHandlerPlayer()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for EFFECT_INDESTRUCTABLE_EFFECT + opponent
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.indoval(e,re,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return rp==1-e:GetHandlerPlayer()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for EFFECT_CANNOT_BE_EFFECT_TARGET + self
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.tgsval(e,re,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return rp==e:GetHandlerPlayer()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for EFFECT_CANNOT_BE_EFFECT_TARGET + opponent
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.tgoval(e,re,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return rp==1-e:GetHandlerPlayer()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for non-zero ATK
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.nzatk(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and c:GetAttack()>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for non-zero DEF
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.nzdef(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsFaceup() and c:GetDefense()>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --flag effect for summon/sp_summon turn
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.sumreg(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local tc=eg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 	local code=e:GetLabel()
748ed664c0 2023-06-29  顽雨沉风: 	while tc do
748ed664c0 2023-06-29  顽雨沉风: 		if tc:GetOriginalCode()==code then
748ed664c0 2023-06-29  顽雨沉风: 			tc:RegisterFlagEffect(code,RESET_EVENT+0x1ec0000+RESET_PHASE+PHASE_END,0,1)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		tc=eg:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --for EVENT_BE_MATERIAL effect releated to the summoned monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CreateMaterialReasonCardRelation(c,te)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_BE_MATERIAL)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.MaterialReasonCardReg)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetLabelObject(te)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MaterialReasonCardReg(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	local te=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 	c:GetReasonCard():CreateEffectRelation(te)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for fusion monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.fuslimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_FUSION==SUMMON_TYPE_FUSION
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for ritual monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ritlimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_RITUAL==SUMMON_TYPE_RITUAL
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for synchro monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.synlimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_SYNCHRO==SUMMON_TYPE_SYNCHRO
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for xyz monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.xyzlimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_XYZ==SUMMON_TYPE_XYZ
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for pendulum monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.penlimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_PENDULUM==SUMMON_TYPE_PENDULUM
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for link monster
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.linklimit(e,se,sp,st)
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --effects inflicting damage to tp
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.damcon1(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_DAMAGE)
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER)
748ed664c0 2023-06-29  顽雨沉风: 	local rd=e1 and not e2
748ed664c0 2023-06-29  顽雨沉风: 	local rr=not e1 and e2
748ed664c0 2023-06-29  顽雨沉风: 	local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE)
748ed664c0 2023-06-29  顽雨沉风: 	if ex and (cp==tp or cp==PLAYER_ALL) and not rd and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_EFFECT_DAMAGE) then
748ed664c0 2023-06-29  顽雨沉风: 		return true
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
748ed664c0 2023-06-29  顽雨沉风: 	return ex and (cp==tp or cp==PLAYER_ALL) and rr and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_NO_EFFECT_DAMAGE)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for the immune effect of qli monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.qlifilter(e,te)
748ed664c0 2023-06-29  顽雨沉风: 	if te:IsActiveType(TYPE_MONSTER) and te:IsActivated() then
748ed664c0 2023-06-29  顽雨沉风: 		local lv=e:GetHandler():GetLevel()
748ed664c0 2023-06-29  顽雨沉风: 		local ec=te:GetOwner()
748ed664c0 2023-06-29  顽雨沉风: 		if ec:IsType(TYPE_LINK) then
748ed664c0 2023-06-29  顽雨沉风: 			return false
748ed664c0 2023-06-29  顽雨沉风: 		elseif ec:IsType(TYPE_XYZ) then
748ed664c0 2023-06-29  顽雨沉风: 			return ec:GetOriginalRank()<lv
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			return ec:GetOriginalLevel()<lv
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return false
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for gladiator beast monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.gbspcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local st=e:GetHandler():GetSummonType()
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_VALUE_GLADIATOR>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --sp_summon condition for evolsaur monsters
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.evospcon(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local st=e:GetHandler():GetSummonType()
748ed664c0 2023-06-29  顽雨沉风: 	return st&SUMMON_VALUE_EVOLTILE>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --filter for necro_valley test
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NecroValleyFilter(f)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(target,...)
748ed664c0 2023-06-29  顽雨沉风: 				return (not f or f(target,...)) and not target:IsHasEffect(EFFECT_NECRO_VALLEY)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Necrovalley test for effect with not certain target or not certain action
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.NecroValleyNegateCheck(v)
748ed664c0 2023-06-29  顽雨沉风: 	if not Duel.IsChainDisablable(0) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local g=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GetValueType(v)=="Card" then g:AddCard(v) end
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GetValueType(v)=="Group" then g:Merge(v) end
748ed664c0 2023-06-29  顽雨沉风: 	if g:IsExists(Card.IsHasEffect,1,nil,EFFECT_NECRO_VALLEY) then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.NegateEffect(0)
748ed664c0 2023-06-29  顽雨沉风: 		return true
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Ursarctic common summon from hand effect
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddUrsarcticSpSummonEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_QUICK_O)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_FREE_CHAIN)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_HAND)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.UrsarcticSpSummonCondition)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCost(Auxiliary.UrsarcticSpSummonCost)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.UrsarcticSpSummonTarget)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.UrsarcticSpSummonOperation)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticSpSummonCondition(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticReleaseFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsLevelAbove(7) and c:IsLocation(LOCATION_HAND)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticExCostFilter(c,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsAbleToRemoveAsCost() and (c:IsHasEffect(16471775,tp) or c:IsHasEffect(89264428,tp))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticSpSummonCost(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	local g1=Duel.GetReleaseGroup(tp,true):Filter(Auxiliary.UrsarcticReleaseFilter,e:GetHandler())
748ed664c0 2023-06-29  顽雨沉风: 	local g2=Duel.GetMatchingGroup(Auxiliary.UrsarcticExCostFilter,tp,LOCATION_GRAVE,0,nil,tp)
748ed664c0 2023-06-29  顽雨沉风: 	g1:Merge(g2)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return g1:GetCount()>0 end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
748ed664c0 2023-06-29  顽雨沉风: 	local tc=g1:Select(tp,1,1,nil):GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 	local te=tc:IsHasEffect(16471775,tp) or tc:IsHasEffect(89264428,tp)
748ed664c0 2023-06-29  顽雨沉风: 	if te then
748ed664c0 2023-06-29  顽雨沉风: 		te:UseCountLimit(tp)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Remove(tc,POS_FACEUP,REASON_EFFECT+REASON_REPLACE)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Release(tc,REASON_COST)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticSpSummonTarget(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
748ed664c0 2023-06-29  顽雨沉风: 		and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticSpSummonOperation(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsRelateToEffect(e) then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTargetRange(1,0)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.UrsarcticSpSummonLimit)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetReset(RESET_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e1,tp)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UrsarcticSpSummonLimit(e,c)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsLevel(0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Drytron common summon effect
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddDrytronSpSummonEffect(c,func)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_IGNITION)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCost(Auxiliary.DrytronSpSummonCost)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.DrytronSpSummonTarget)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetOperation(Auxiliary.DrytronSpSummonOperation(func))
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.AddCustomActivityCounter(97148796,ACTIVITY_SPSUMMON,Auxiliary.DrytronCounterFilter)
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronCounterFilter(c)
748ed664c0 2023-06-29  顽雨沉风: 	return not c:IsSummonableCard()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronCostFilter(c,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return (c:IsSetCard(0x154) or c:IsType(TYPE_RITUAL)) and c:IsType(TYPE_MONSTER) and Duel.GetMZoneCount(tp,c)>0
748ed664c0 2023-06-29  顽雨沉风: 		and (c:IsControler(tp) or c:IsFaceup())
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronExtraCostFilter(c,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsAbleToRemove() and c:IsHasEffect(89771220,tp)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronSpSummonCost(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	e:SetLabel(100)
748ed664c0 2023-06-29  顽雨沉风: 	local g1=Duel.GetReleaseGroup(tp,true):Filter(Auxiliary.DrytronCostFilter,e:GetHandler(),tp)
748ed664c0 2023-06-29  顽雨沉风: 	local g2=Duel.GetMatchingGroup(Auxiliary.DrytronExtraCostFilter,tp,LOCATION_GRAVE,0,nil,tp)
748ed664c0 2023-06-29  顽雨沉风: 	g1:Merge(g2)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return #g1>0 and Duel.GetCustomActivityCount(97148796,tp,ACTIVITY_SPSUMMON)==0 end
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(e:GetHandler())
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTargetRange(1,0)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetTarget(Auxiliary.DrytronSpSummonLimit)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetReset(RESET_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e1,tp)
748ed664c0 2023-06-29  顽雨沉风: 	--cant special summon summonable card check
748ed664c0 2023-06-29  顽雨沉风: 	local e2=Effect.CreateEffect(e:GetHandler())
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetType(EFFECT_TYPE_FIELD)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetCode(97148796)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetTargetRange(1,0)
748ed664c0 2023-06-29  顽雨沉风: 	e2:SetReset(RESET_PHASE+PHASE_END)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(e2,tp)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
748ed664c0 2023-06-29  顽雨沉风: 	local rg=g1:Select(tp,1,1,nil)
748ed664c0 2023-06-29  顽雨沉风: 	local tc=rg:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 	local te=tc:IsHasEffect(89771220,tp)
748ed664c0 2023-06-29  顽雨沉风: 	if te then
748ed664c0 2023-06-29  顽雨沉风: 		te:UseCountLimit(tp)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Remove(tc,POS_FACEUP,REASON_EFFECT+REASON_REPLACE)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.UseExtraReleaseCount(rg,tp)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Release(tc,REASON_COST)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronSpSummonLimit(e,c,sump,sumtype,sumpos,targetp,se)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsSummonableCard()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronSpSummonTarget(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	local res=e:GetLabel()==100 or Duel.GetLocationCount(tp,LOCATION_MZONE)>0
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then
748ed664c0 2023-06-29  顽雨沉风: 		e:SetLabel(0)
748ed664c0 2023-06-29  顽雨沉风: 		return res and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	e:SetLabel(0)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.DrytronSpSummonOperation(func)
748ed664c0 2023-06-29  顽雨沉风: 	return function(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 		local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 		if not c:IsRelateToEffect(e) then return end
748ed664c0 2023-06-29  顽雨沉风: 		if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then func(e,tp) end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --additional destroy effect for the Labrynth field
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.LabrynthDestroyOp(e,tp,res)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	local chk=not c:IsStatus(STATUS_ACT_FROM_HAND) and c:IsSetCard(0x117e) and c:GetType()==TYPE_TRAP and e:IsHasType(EFFECT_TYPE_ACTIVATE)
748ed664c0 2023-06-29  顽雨沉风: 	local exc=nil
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsStatus(STATUS_LEAVE_CONFIRMED) then exc=c end
748ed664c0 2023-06-29  顽雨沉风: 	local te=Duel.IsPlayerAffectedByEffect(tp,33407125)
748ed664c0 2023-06-29  顽雨沉风: 	if chk and te
748ed664c0 2023-06-29  顽雨沉风: 		and Duel.IsExistingMatchingCard(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,exc)
748ed664c0 2023-06-29  顽雨沉风: 		and Duel.SelectYesNo(tp,aux.Stringid(33407125,0)) then
748ed664c0 2023-06-29  顽雨沉风: 		if res>0 then Duel.BreakEffect() end
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Hint(HINT_CARD,0,33407125)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
748ed664c0 2023-06-29  顽雨沉风: 		local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,exc)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.HintSelection(dg)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.Destroy(dg,REASON_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: 		te:UseCountLimit(tp)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --shortcut for Gizmek cards
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AtkEqualsDef(c)
748ed664c0 2023-06-29  顽雨沉风: 	if not c:IsType(TYPE_MONSTER) or c:IsType(TYPE_LINK) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if c:GetAttack()~=c:GetDefense() then return false end
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsLocation(LOCATION_MZONE) or c:GetTextAttack()>=0 and c:GetTextDefense()>=0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --shortcut for self-banish costs
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different names
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dncheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetCode)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different levels
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dlvcheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetLevel)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different ranks
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.drkcheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetRank)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different links
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dlkcheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetLink)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different attributes
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.dabcheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetAttribute)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for cards with different races
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.drccheck(g)
748ed664c0 2023-06-29  顽雨沉风: 	return g:GetClassCount(Card.GetRace)==#g
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for group with 2 cards, each card match f with a1/a2 as argument
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.gfcheck(g,f,a1,a2)
748ed664c0 2023-06-29  顽雨沉风: 	if #g~=2 then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local c1=g:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 	local c2=g:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 	return f(c1,a1) and f(c2,a2) or f(c2,a1) and f(c1,a2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --check for group with 2 cards, each card match f1 with a1, f2 with a2 as argument
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.gffcheck(g,f1,a1,f2,a2)
748ed664c0 2023-06-29  顽雨沉风: 	if #g~=2 then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local c1=g:GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 	local c2=g:GetNext()
748ed664c0 2023-06-29  顽雨沉风: 	return f1(c1,a1) and f2(c2,a2) or f1(c2,a1) and f2(c1,a2)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.mzctcheck(g,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.GetMZoneCount(tp,g)>0
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.mzctcheckrel(g,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.GetMZoneCount(tp,g)>0 and Duel.CheckReleaseGroup(tp,Auxiliary.IsInGroup,#g,nil,g)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --used for "except this card"
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ExceptThisCard(e)
748ed664c0 2023-06-29  顽雨沉风: 	local c=e:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	if c:IsRelateToChain() then return c else return nil end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --used for multi-linked zone(zone linked by two or more link monsters)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetMultiLinkedZone(tp)
748ed664c0 2023-06-29  顽雨沉风: 	local f=function(c)
748ed664c0 2023-06-29  顽雨沉风: 		return c:IsFaceup() and c:IsType(TYPE_LINK)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local lg=Duel.GetMatchingGroup(f,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
748ed664c0 2023-06-29  顽雨沉风: 	local multi_linked_zone=0
748ed664c0 2023-06-29  顽雨沉风: 	local single_linked_zone=0
748ed664c0 2023-06-29  顽雨沉风: 	for tc in aux.Next(lg) do
748ed664c0 2023-06-29  顽雨沉风: 		local zone=tc:GetLinkedZone(tp)&0x7f
748ed664c0 2023-06-29  顽雨沉风: 		multi_linked_zone=single_linked_zone&zone|multi_linked_zone
748ed664c0 2023-06-29  顽雨沉风: 		single_linked_zone=single_linked_zone~zone
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return multi_linked_zone
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.SubGroupCaptured=nil
748ed664c0 2023-06-29  顽雨沉风: Auxiliary.GCheckAdditional=nil
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then
748ed664c0 2023-06-29  顽雨沉风: 		sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return false
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local res=(#sg>=min and #sg<=max and f(sg,table.unpack(ext_params)))
748ed664c0 2023-06-29  顽雨沉风: 		or (#sg<max and g:IsExists(Auxiliary.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
748ed664c0 2023-06-29  顽雨沉风: 	sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CheckGroupRecursiveCapture(c,sg,g,f,min,max,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then
748ed664c0 2023-06-29  顽雨沉风: 		sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return false
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local res=#sg>=min and #sg<=max and f(sg,table.unpack(ext_params))
748ed664c0 2023-06-29  顽雨沉风: 	if res then
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.SubGroupCaptured:Clear()
748ed664c0 2023-06-29  顽雨沉风: 		Auxiliary.SubGroupCaptured:Merge(sg)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		res=#sg<max and g:IsExists(Auxiliary.CheckGroupRecursiveCapture,1,sg,sg,g,f,min,max,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Group.CheckSubGroup(g,f,min,max,...)
748ed664c0 2023-06-29  顽雨沉风: 	local min=min or 1
748ed664c0 2023-06-29  顽雨沉风: 	local max=max or #g
748ed664c0 2023-06-29  顽雨沉风: 	if min>max then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Duel.GrabSelectedCard()
748ed664c0 2023-06-29  顽雨沉风: 	if #sg>max or #(g+sg)<min then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if #sg==max and (not f(sg,...) or Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if #sg>=min and #sg<=max and f(sg,...) and (not Auxiliary.GCheckAdditional or Auxiliary.GCheckAdditional(sg,nil,g,f,min,max,ext_params)) then return true end
748ed664c0 2023-06-29  顽雨沉风: 	local eg=g:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	for c in aux.Next(g-sg) do
748ed664c0 2023-06-29  顽雨沉风: 		if Auxiliary.CheckGroupRecursive(c,sg,eg,f,min,max,ext_params) then return true end
748ed664c0 2023-06-29  顽雨沉风: 		eg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Group.SelectSubGroup(g,tp,f,cancelable,min,max,...)
748ed664c0 2023-06-29  顽雨沉风: 	Auxiliary.SubGroupCaptured=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	local min=min or 1
748ed664c0 2023-06-29  顽雨沉风: 	local max=max or #g
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	local fg=Duel.GrabSelectedCard()
748ed664c0 2023-06-29  顽雨沉风: 	if #fg>max or min>max or #(g+fg)<min then return nil end
748ed664c0 2023-06-29  顽雨沉风: 	for tc in aux.Next(fg) do
748ed664c0 2023-06-29  顽雨沉风: 		fg:SelectUnselect(sg,tp,false,false,min,max)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	sg:Merge(fg)
748ed664c0 2023-06-29  顽雨沉风: 	local finish=(#sg>=min and #sg<=max and f(sg,...))
748ed664c0 2023-06-29  顽雨沉风: 	while #sg<max do
748ed664c0 2023-06-29  顽雨沉风: 		local cg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 		local eg=g:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		for c in aux.Next(g-sg) do
748ed664c0 2023-06-29  顽雨沉风: 			if not cg:IsContains(c) then
748ed664c0 2023-06-29  顽雨沉风: 				if Auxiliary.CheckGroupRecursiveCapture(c,sg,eg,f,min,max,ext_params) then
748ed664c0 2023-06-29  顽雨沉风: 					cg:Merge(Auxiliary.SubGroupCaptured)
748ed664c0 2023-06-29  顽雨沉风: 				else
748ed664c0 2023-06-29  顽雨沉风: 					eg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		cg:Sub(sg)
748ed664c0 2023-06-29  顽雨沉风: 		finish=(#sg>=min and #sg<=max and f(sg,...))
748ed664c0 2023-06-29  顽雨沉风: 		if #cg==0 then break end
748ed664c0 2023-06-29  顽雨沉风: 		local cancel=not finish and cancelable
748ed664c0 2023-06-29  顽雨沉风: 		local tc=cg:SelectUnselect(sg,tp,finish,cancel,min,max)
748ed664c0 2023-06-29  顽雨沉风: 		if not tc then break end
748ed664c0 2023-06-29  顽雨沉风: 		if not fg:IsContains(tc) then
748ed664c0 2023-06-29  顽雨沉风: 			if not sg:IsContains(tc) then
748ed664c0 2023-06-29  顽雨沉风: 				sg:AddCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 				if #sg==max then finish=true end
748ed664c0 2023-06-29  顽雨沉风: 			else
748ed664c0 2023-06-29  顽雨沉风: 				sg:RemoveCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: 		elseif cancelable then
748ed664c0 2023-06-29  顽雨沉风: 			return nil
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if finish then
748ed664c0 2023-06-29  顽雨沉风: 		return sg
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return nil
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CreateChecks(f,list)
748ed664c0 2023-06-29  顽雨沉风: 	local checks={}
748ed664c0 2023-06-29  顽雨沉风: 	for i=1,#list do
748ed664c0 2023-06-29  顽雨沉风: 		checks[i]=function(c) return f(c,list[i]) end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return checks
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.CheckGroupRecursiveEach(c,sg,g,f,checks,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 	if not checks[1+#sg](c) then
748ed664c0 2023-06-29  顽雨沉风: 		return false
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	sg:AddCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	if Auxiliary.GCheckAdditional and not Auxiliary.GCheckAdditional(sg,c,g,f,min,max,ext_params) then
748ed664c0 2023-06-29  顽雨沉风: 		sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 		return false
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	local res
748ed664c0 2023-06-29  顽雨沉风: 	if #sg==#checks then
748ed664c0 2023-06-29  顽雨沉风: 		res=f(sg,table.unpack(ext_params))
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		res=g:IsExists(Auxiliary.CheckGroupRecursiveEach,1,sg,sg,g,f,checks,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	sg:RemoveCard(c)
748ed664c0 2023-06-29  顽雨沉风: 	return res
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Group.CheckSubGroupEach(g,checks,f,...)
748ed664c0 2023-06-29  顽雨沉风: 	if f==nil then f=Auxiliary.TRUE end
748ed664c0 2023-06-29  顽雨沉风: 	if #g<#checks then return false end
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	return g:IsExists(Auxiliary.CheckGroupRecursiveEach,1,sg,sg,g,f,checks,ext_params)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Group.SelectSubGroupEach(g,tp,checks,cancelable,f,...)
748ed664c0 2023-06-29  顽雨沉风: 	if cancelable==nil then cancelable=false end
748ed664c0 2023-06-29  顽雨沉风: 	if f==nil then f=Auxiliary.TRUE end
748ed664c0 2023-06-29  顽雨沉风: 	local ct=#checks
748ed664c0 2023-06-29  顽雨沉风: 	local ext_params={...}
748ed664c0 2023-06-29  顽雨沉风: 	local sg=Group.CreateGroup()
748ed664c0 2023-06-29  顽雨沉风: 	local finish=false
748ed664c0 2023-06-29  顽雨沉风: 	while #sg<ct do
748ed664c0 2023-06-29  顽雨沉风: 		local cg=g:Filter(Auxiliary.CheckGroupRecursiveEach,sg,sg,g,f,checks,ext_params)
748ed664c0 2023-06-29  顽雨沉风: 		if #cg==0 then break end
748ed664c0 2023-06-29  顽雨沉风: 		local tc=cg:SelectUnselect(sg,tp,false,cancelable,ct,ct)
748ed664c0 2023-06-29  顽雨沉风: 		if not tc then break end
748ed664c0 2023-06-29  顽雨沉风: 		if not sg:IsContains(tc) then
748ed664c0 2023-06-29  顽雨沉风: 			sg:AddCard(tc)
748ed664c0 2023-06-29  顽雨沉风: 			if #sg==ct then finish=true end
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			sg:Clear()
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if finish then
748ed664c0 2023-06-29  顽雨沉风: 		return sg
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return nil
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of "negate activation and banish"
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.nbcon(tp,re)
748ed664c0 2023-06-29  顽雨沉风: 	local rc=re:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return Duel.IsPlayerCanRemove(tp)
748ed664c0 2023-06-29  顽雨沉风: 		and (not rc:IsRelateToEffect(re) or rc:IsAbleToRemove())
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.nbtg(e,tp,eg,ep,ev,re,r,rp,chk)
748ed664c0 2023-06-29  顽雨沉风: 	if chk==0 then return aux.nbcon(tp,re) end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
748ed664c0 2023-06-29  顽雨沉风: 	if re:GetHandler():IsRelateToEffect(re) then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if re:GetActivateLocation()==LOCATION_GRAVE then
748ed664c0 2023-06-29  顽雨沉风: 		e:SetCategory(e:GetCategory()|CATEGORY_GRAVE_ACTION)
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		e:SetCategory(e:GetCategory()&~CATEGORY_GRAVE_ACTION)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --condition of "negate activation and return to deck"
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ndcon(tp,re)
748ed664c0 2023-06-29  顽雨沉风: 	local rc=re:GetHandler()
748ed664c0 2023-06-29  顽雨沉风: 	return re:IsHasType(EFFECT_TYPE_ACTIVATE) or not rc:IsRelateToEffect(re) or rc:IsAbleToDeck()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --send to deck of contact fusion
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.tdcfop(c)
748ed664c0 2023-06-29  顽雨沉风: 	return	function(g)
748ed664c0 2023-06-29  顽雨沉风: 				local cg=g:Filter(Card.IsFacedown,nil)
748ed664c0 2023-06-29  顽雨沉风: 				if cg:GetCount()>0 then
748ed664c0 2023-06-29  顽雨沉风: 					Duel.ConfirmCards(1-c:GetControler(),cg)
748ed664c0 2023-06-29  顽雨沉风: 				end
748ed664c0 2023-06-29  顽雨沉风: 				Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
748ed664c0 2023-06-29  顽雨沉风: 			end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --return the global index of the zone in (p,loc,seq)
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.SequenceToGlobal(p,loc,seq)
748ed664c0 2023-06-29  顽雨沉风: 	if p~=0 and p~=1 then
748ed664c0 2023-06-29  顽雨沉风: 		return 0
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if loc==LOCATION_MZONE then
748ed664c0 2023-06-29  顽雨沉风: 		if seq<=6 then
748ed664c0 2023-06-29  顽雨沉风: 			return 0x0001<<(16*p+seq)
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			return 0
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	elseif loc == LOCATION_SZONE then
748ed664c0 2023-06-29  顽雨沉风: 		if seq<=4 then
748ed664c0 2023-06-29  顽雨沉风: 			return 0x0100<<(16*p+seq)
748ed664c0 2023-06-29  顽雨沉风: 		else
748ed664c0 2023-06-29  顽雨沉风: 			return 0
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return 0
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --use the count limit of Lair of Darkness if the tributes are not selected by Duel.SelectReleaseGroup
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.UseExtraReleaseCount(g,tp)
748ed664c0 2023-06-29  顽雨沉风: 	local eg=g:Filter(Auxiliary.ExtraReleaseFilter,nil,tp)
748ed664c0 2023-06-29  顽雨沉风: 	for ec in Auxiliary.Next(eg) do
748ed664c0 2023-06-29  顽雨沉风: 		local te=ec:IsHasEffect(EFFECT_EXTRA_RELEASE_NONSUM,tp)
748ed664c0 2023-06-29  顽雨沉风: 		if te then te:UseCountLimit(tp) end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ExtraReleaseFilter(c,tp)
748ed664c0 2023-06-29  顽雨沉风: 	return c:IsControler(1-tp) and c:IsHasEffect(EFFECT_EXTRA_RELEASE_NONSUM,tp)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.IsSpecialSummonedByEffect(e)
748ed664c0 2023-06-29  顽雨沉风: 	return not ((e:GetCode()==EFFECT_SPSUMMON_PROC or e:GetCode()==EFFECT_SPSUMMON_PROC_G) and e:GetProperty()&(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)==(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE))
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetCappedLevel(c)
748ed664c0 2023-06-29  顽雨沉风: 	local lv=c:GetLevel()
748ed664c0 2023-06-29  顽雨沉风: 	if lv>MAX_PARAMETER then
748ed664c0 2023-06-29  顽雨沉风: 		return MAX_PARAMETER
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return lv
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.GetCappedAttack(c)
748ed664c0 2023-06-29  顽雨沉风: 	local x=c:GetAttack()
748ed664c0 2023-06-29  顽雨沉风: 	if x>MAX_PARAMETER then
748ed664c0 2023-06-29  顽雨沉风: 		return MAX_PARAMETER
748ed664c0 2023-06-29  顽雨沉风: 	else
748ed664c0 2023-06-29  顽雨沉风: 		return x
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --when this card is sent to grave, record the reason effect
748ed664c0 2023-06-29  顽雨沉风: --to check whether the reason effect do something simultaneously
748ed664c0 2023-06-29  顽雨沉风: --so the "while this card is in your GY" condition isn't met
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.AddThisCardInGraveAlreadyCheck(c)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCode(EVENT_TO_GRAVE)
748ed664c0 2023-06-29  顽雨沉风: 	e1:SetCondition(Auxiliary.ThisCardInGraveAlreadyCheckReg)
748ed664c0 2023-06-29  顽雨沉风: 	c:RegisterEffect(e1)
748ed664c0 2023-06-29  顽雨沉风: 	return e1
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ThisCardInGraveAlreadyCheckReg(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	--condition of continous effect will be checked before other effects
748ed664c0 2023-06-29  顽雨沉风: 	if re==nil then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if e:GetLabelObject()~=nil then return false end
748ed664c0 2023-06-29  顽雨沉风: 	if (r&REASON_EFFECT)>0 then
748ed664c0 2023-06-29  顽雨沉风: 		e:SetLabelObject(re)
748ed664c0 2023-06-29  顽雨沉风: 		local e1=Effect.CreateEffect(e:GetHandler())
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCode(EVENT_CHAIN_END)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.ThisCardInGraveAlreadyReset1)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetLabelObject(e)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RegisterEffect(e1,tp)
748ed664c0 2023-06-29  顽雨沉风: 		local e2=e1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetCode(EVENT_BREAK_EFFECT)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetOperation(Auxiliary.ThisCardInGraveAlreadyReset2)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetReset(RESET_CHAIN)
748ed664c0 2023-06-29  顽雨沉风: 		e2:SetLabelObject(e1)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RegisterEffect(e2,tp)
748ed664c0 2023-06-29  顽雨沉风: 	elseif (r&REASON_MATERIAL)>0 or not re:IsActivated() and (r&REASON_COST)>0 then
748ed664c0 2023-06-29  顽雨沉风: 		e:SetLabelObject(re)
748ed664c0 2023-06-29  顽雨沉风: 		local reset_event=EVENT_SPSUMMON
748ed664c0 2023-06-29  顽雨沉风: 		if re:GetCode()~=EFFECT_SPSUMMON_PROC then reset_event=EVENT_SUMMON end
748ed664c0 2023-06-29  顽雨沉风: 		local e1=Effect.CreateEffect(e:GetHandler())
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetCode(reset_event)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetOperation(Auxiliary.ThisCardInGraveAlreadyReset1)
748ed664c0 2023-06-29  顽雨沉风: 		e1:SetLabelObject(e)
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RegisterEffect(e1,tp)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return false
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ThisCardInGraveAlreadyReset1(e)
748ed664c0 2023-06-29  顽雨沉风: 	--this will run after EVENT_SPSUMMON_SUCCESS
748ed664c0 2023-06-29  顽雨沉风: 	e:GetLabelObject():SetLabelObject(nil)
748ed664c0 2023-06-29  顽雨沉风: 	e:Reset()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.ThisCardInGraveAlreadyReset2(e)
748ed664c0 2023-06-29  顽雨沉风: 	local e1=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 	e1:GetLabelObject():SetLabelObject(nil)
748ed664c0 2023-06-29  顽雨沉风: 	e1:Reset()
748ed664c0 2023-06-29  顽雨沉风: 	e:Reset()
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Player p place g on the top of Deck in any order
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PlaceCardsOnDeckTop(p,g,reason)
748ed664c0 2023-06-29  顽雨沉风: 	if reason==nil then reason=REASON_EFFECT end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SendtoDeck(g,nil,SEQ_DECKTOP,reason)
748ed664c0 2023-06-29  顽雨沉风: 	local rg=Duel.GetOperatedGroup()
748ed664c0 2023-06-29  顽雨沉风: 	local og=rg:Filter(Card.IsLocation,nil,LOCATION_DECK)
748ed664c0 2023-06-29  顽雨沉风: 	local ct1=og:FilterCount(Card.IsControler,nil,p)
748ed664c0 2023-06-29  顽雨沉风: 	local ct2=og:FilterCount(Card.IsControler,nil,1-p)
748ed664c0 2023-06-29  顽雨沉风: 	if ct1>1 then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.SortDecktop(p,p,ct1)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if ct2>1 then
748ed664c0 2023-06-29  顽雨沉风: 		Duel.SortDecktop(p,1-p,ct2)
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return #rg
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --Player p place g on the bottom of Deck in any order
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.PlaceCardsOnDeckBottom(p,g,reason)
748ed664c0 2023-06-29  顽雨沉风: 	if reason==nil then reason=REASON_EFFECT end
748ed664c0 2023-06-29  顽雨沉风: 	Duel.SendtoDeck(g,nil,SEQ_DECKTOP,reason)
748ed664c0 2023-06-29  顽雨沉风: 	local rg=Duel.GetOperatedGroup()
748ed664c0 2023-06-29  顽雨沉风: 	local og=rg:Filter(Card.IsLocation,nil,LOCATION_DECK)
748ed664c0 2023-06-29  顽雨沉风: 	local ct1=og:FilterCount(Card.IsControler,nil,p)
748ed664c0 2023-06-29  顽雨沉风: 	local ct2=og:FilterCount(Card.IsControler,nil,1-p)
748ed664c0 2023-06-29  顽雨沉风: 	if ct1>0 then
748ed664c0 2023-06-29  顽雨沉风: 		if ct1>1 then
748ed664c0 2023-06-29  顽雨沉风: 			Duel.SortDecktop(p,p,ct1)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		for i=1,ct1 do
748ed664c0 2023-06-29  顽雨沉风: 			local tc=Duel.GetDecktopGroup(p,1):GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 			Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	if ct2>0 then
748ed664c0 2023-06-29  顽雨沉风: 		if ct2>1 then
748ed664c0 2023-06-29  顽雨沉风: 			Duel.SortDecktop(p,1-p,ct2)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 		for i=1,ct2 do
748ed664c0 2023-06-29  顽雨沉风: 			local tc=Duel.GetDecktopGroup(1-p,1):GetFirst()
748ed664c0 2023-06-29  顽雨沉风: 			Duel.MoveSequence(tc,SEQ_DECKBOTTOM)
748ed664c0 2023-06-29  顽雨沉风: 		end
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: 	return #rg
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: --The event is triggered multiple times in a chain
748ed664c0 2023-06-29  顽雨沉风: --but only 1 event with EVENT_CUSTOM+code will be triggered at EVENT_CHAIN_END, or immediately if not in chain
748ed664c0 2023-06-29  顽雨沉风: --NOTE: re,r,rp,ep,ev of that custom event ARE NOT releated to the real event that trigger this custom event
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.RegisterMergedDelayedEvent(c,code,event,g)
748ed664c0 2023-06-29  顽雨沉风: 	local mt=getmetatable(c)
748ed664c0 2023-06-29  顽雨沉风: 	if mt[event]==true then return end
748ed664c0 2023-06-29  顽雨沉风: 	mt[event]=true
748ed664c0 2023-06-29  顽雨沉风: 	if not g then g=Group.CreateGroup() end
748ed664c0 2023-06-29  顽雨沉风: 	g:KeepAlive()
748ed664c0 2023-06-29  顽雨沉风: 	local ge1=Effect.CreateEffect(c)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetCode(event)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetLabel(code)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetLabelObject(g)
748ed664c0 2023-06-29  顽雨沉风: 	ge1:SetOperation(Auxiliary.MergedDelayEventCheck1)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(ge1,0)
748ed664c0 2023-06-29  顽雨沉风: 	local ge2=ge1:Clone()
748ed664c0 2023-06-29  顽雨沉风: 	ge2:SetCode(EVENT_CHAIN_END)
748ed664c0 2023-06-29  顽雨沉风: 	ge2:SetOperation(Auxiliary.MergedDelayEventCheck2)
748ed664c0 2023-06-29  顽雨沉风: 	Duel.RegisterEffect(ge2,0)
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MergedDelayEventCheck1(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local g=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 	g:Merge(eg)
748ed664c0 2023-06-29  顽雨沉风: 	if Duel.GetCurrentChain()==0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
748ed664c0 2023-06-29  顽雨沉风: 		local _eg=g:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RaiseEvent(_eg,EVENT_CUSTOM+e:GetLabel(),re,r,rp,ep,ev)
748ed664c0 2023-06-29  顽雨沉风: 		g:Clear()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end
748ed664c0 2023-06-29  顽雨沉风: function Auxiliary.MergedDelayEventCheck2(e,tp,eg,ep,ev,re,r,rp)
748ed664c0 2023-06-29  顽雨沉风: 	local g=e:GetLabelObject()
748ed664c0 2023-06-29  顽雨沉风: 	if #g>0 then
748ed664c0 2023-06-29  顽雨沉风: 		local _eg=g:Clone()
748ed664c0 2023-06-29  顽雨沉风: 		Duel.RaiseEvent(_eg,EVENT_CUSTOM+e:GetLabel(),re,r,rp,ep,ev)
748ed664c0 2023-06-29  顽雨沉风: 		g:Clear()
748ed664c0 2023-06-29  顽雨沉风: 	end
748ed664c0 2023-06-29  顽雨沉风: end