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