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