Commit 3c125543 authored by Nanahira's avatar Nanahira Committed by GitHub

Merge pull request #19 from mycard/develop-8888

Develop 8888
parents 700d4264 621bdcd9
......@@ -7,7 +7,7 @@ function c15310033.initial_effect(c)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,15310033+EFFECT_COUNT_CODE_DUEL)
e1:SetCountLimit(1,15310033+EFFECT_COUNT_CODE_OATH+EFFECT_COUNT_CODE_DUEL)
e1:SetCondition(c15310033.spcon)
c:RegisterEffect(e1)
end
......
......@@ -55,13 +55,14 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.dfilter,tp,0,LOCATION_MZONE,nil)
if tc:IsFaceup() and #g>0 then
if chk then Duel.BreakEffect() end
local atkd=tc:GetAttack()
local dg=Group.CreateGroup()
for sc in aux.Next(g) do
local patk=sc:GetAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-tc:GetAttack())
e1:SetValue(-atkd)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
sc:RegisterEffect(e1)
if patk~=0 and sc:IsAttack(0) then dg:AddCard(sc) end
......
......@@ -35,7 +35,7 @@ end
function c22398665.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsAttackAbove(1000) then
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsAttackAbove(1000) and not tc:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
......
......@@ -75,7 +75,7 @@ end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local rc=re:GetHandler()
return rc:IsAllTypes(TYPE_TRAP+TYPE_CONTINUOUS) and re:GetActivateLocation()==LOCATION_MZONE
and Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_REMOVED,0,1,nil)
and Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_REMOVED,0,1,nil) and rp==tp
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and aux.NegateAnyFilter(chkc) end
......
......@@ -80,7 +80,7 @@ function c31111109.rstop(e,tp,eg,ep,ev,re,r,rp)
atke:SetReset(RESET_EVENT+RESETS_STANDARD)
end
c:ResetEffect(cid,RESET_COPY)
c:ResetEffect(RESET_DISABLE,RESET_EVENT)
c:ResetEffect(RESET_DISABLE,RESET_EVENT+RESETS_STANDARD)
if atke then
atke:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE)
end
......
......@@ -65,28 +65,16 @@ end
function s.filter(c)
return c:IsCanOverlay() and c:IsFaceup()
end
function s.fselect(sg,tp)
local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
return mg:CheckSubGroup(s.matfilter,1,#mg,tp,sg)
end
function s.matfilter(sg,tp,g)
if sg:Filter(Card.IsSetCard,nil,0x1be):GetCount()==0 then return false end
return Duel.IsExistingMatchingCard(s.xyzfilter1,tp,LOCATION_EXTRA,0,1,nil,sg)
end
function s.xyzfilter1(c,mg)
return c:IsXyzSummonable(mg,#mg,#mg)
end
function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return mg:CheckSubGroup(s.fselect,1,mg:GetCount(),tp) end
if chk==0 then return Duel.IsExistingMatchingCard(s.xyzfilter2,tp,LOCATION_EXTRA,0,1,nil,mg) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.xyzfilter2(c,mg)
return mg:CheckSubGroup(s.gselect,1,#mg,c)
return c:IsType(TYPE_XYZ) and mg:CheckSubGroup(s.gselect,1,#mg,c)
end
function s.gselect(sg,c)
if sg:Filter(Card.IsSetCard,nil,0x1be):GetCount()==0 then return false end
return c:IsXyzSummonable(sg,#sg,#sg)
return sg:IsExists(Card.IsSetCard,1,nil,0x1be) and c:IsXyzSummonable(sg,#sg,#sg)
end
function s.xyzop(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil)
......
......@@ -20,7 +20,7 @@ function c39354437.initial_effect(c)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,39354438+EFFECT_COUNT_CODE_SINGLE)
e3:SetCountLimit(1,39354438)
e3:SetCondition(c39354437.spcon1)
e3:SetTarget(c39354437.sptg)
e3:SetOperation(c39354437.spop)
......
......@@ -42,8 +42,8 @@ end
function s.filter(c,tp)
local r=LOCATION_REASON_TOFIELD
if not c:IsControler(c:GetOwner()) then r=LOCATION_REASON_CONTROL end
return (c:IsType(TYPE_MONSTER) or c:IsLocation(LOCATION_MZONE)) and c:IsFaceupEx()
and Duel.GetLocationCount(c:GetOwner(),LOCATION_SZONE,tp,r)>0
return (c:IsLocation(LOCATION_MZONE) or c:IsType(TYPE_MONSTER) and not c:IsForbidden() and c:CheckUniqueOnField(c:GetOwner()))
and c:IsFaceupEx() and Duel.GetLocationCount(c:GetOwner(),LOCATION_SZONE,tp,r)>0
end
function s.mvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and s.filter(chkc,tp) end
......
......@@ -34,7 +34,11 @@ end
function c70491413.activate(e,tp,eg,ep,ev,re,r,rp)
local cl=Duel.GetCurrentChain()
if cl>=2 then
Duel.SortDecktop(tp,tp,cl)
Duel.ConfirmDecktop(tp,cl)
local g=Duel.GetDecktopGroup(tp,cl)
if g:GetCount()>0 then
Duel.SortDecktop(tp,tp,g:GetCount())
end
end
if cl>=3 then
Duel.BreakEffect()
......
......@@ -7,7 +7,7 @@ function c75366958.initial_effect(c)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,75366958+EFFECT_COUNT_CODE_DUEL)
e1:SetCountLimit(1,75366958+EFFECT_COUNT_CODE_OATH+EFFECT_COUNT_CODE_DUEL)
e1:SetCondition(c75366958.spcon)
e1:SetOperation(c75366958.spop)
c:RegisterEffect(e1)
......
......@@ -17,10 +17,8 @@ function s.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_TREAT_AS_2_XMATERIAL)
e2:SetValue(id)
e2:SetRange(0xff)
e2:SetTarget(s.sxyzfilter)
e2:SetCode(id)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id+o)
c:RegisterEffect(e2)
--material effect
......@@ -35,9 +33,134 @@ function s.initial_effect(c)
e3:SetTarget(s.xyztg)
e3:SetOperation(s.xyzop)
c:RegisterEffect(e3)
if not s.global_check then
s.global_check=true
Drake_shark_AddXyzProcedure=aux.AddXyzProcedure
function aux.AddXyzProcedure(card_c,function_f,int_lv,int_ct,function_alterf,int_dese,int_maxc,function_op)
if card_c:IsAttribute(ATTRIBUTE_WATER) and int_ct>=3 then
if function_alterf then
Drake_shark_XyzLevelFreeOperationAlter=Auxiliary.XyzLevelFreeOperationAlter
function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minc,maxc,alterf,alterdesc,alterop)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
if og:GetCount()==minc and og:IsExists(s.xfilter,1,nil) then
local ttc=og:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if mg:GetCount()==minc and mg:IsExists(s.xfilter,1,nil) then
local ttc=mg:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
else
local sg=Group.CreateGroup()
local tc=mg:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=mg:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end
end
aux.AddXyzProcedureLevelFree(card_c,s.f(function_f,int_lv,card_c),s.gf(int_ct,card_c:GetOwner()),int_ct-1,int_ct,function_alterf,int_dese,function_op)
Auxiliary.XyzLevelFreeOperationAlter=Drake_shark_XyzLevelFreeOperationAlter
else
Drake_shark_XyzLevelFreeOperation=Auxiliary.XyzLevelFreeOperation
function Auxiliary.XyzLevelFreeOperation(f,gf,minct,maxct)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
if og:GetCount()==minct and og:IsExists(s.xfilter,1,nil) then
local ttc=og:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
if mg:GetCount()==minct and mg:IsExists(s.xfilter,1,nil) then
local ttc=mg:Filter(s.xfilter,nil):GetFirst()
local tte=ttc:IsHasEffect(id,tp)
tte:UseCountLimit(tp)
end
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
else
local sg=Group.CreateGroup()
local tc=mg:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=mg:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end
end
aux.AddXyzProcedureLevelFree(card_c,s.f(function_f,int_lv,card_c),s.gf(int_ct,card_c:GetOwner()),int_ct-1,int_ct)
Auxiliary.XyzLevelFreeOperation=Drake_shark_XyzLevelFreeOperation
end
else
if function_alterf then
Drake_shark_AddXyzProcedure(card_c,function_f,int_lv,int_ct,function_alterf,int_dese,int_maxc,function_op)
else
Drake_shark_AddXyzProcedure(card_c,function_f,int_lv,int_ct,nil,nil,int_maxc,nil)
end
end
end
end
end
function s.f(function_f,int_lv,card_c)
return function (c)
return c:IsXyzLevel(card_c,int_lv) and (not function_f or function_f(c))
end
end
function s.gf(int_ct,int_tp)
return function (g)
return g:GetCount()==int_ct or g:GetCount()==int_ct-1 and g:IsExists(s.xfilter,1,nil,int_tp)
end
end
function s.sxyzfilter(e,c)
return c:IsAttribute(ATTRIBUTE_WATER)
function s.xfilter(c,tp)
return c:IsHasEffect(id,tp)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_DRAW)
......
......@@ -36,6 +36,7 @@ function s.initial_effect(c)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
s.material_type=TYPE_SYNCHRO
function s.mfilter1(c)
return c:IsLevelAbove(6) and c:IsFusionType(TYPE_FUSION)
end
......
......@@ -34,5 +34,5 @@ function c86466163.xyztg(e,c)
return c:IsLevelBelow(4) and c:IsSetCard(0x9c)
end
function c86466163.xyzlv(e,c,rc)
return 0x30050000+c:GetLevel()
return 0x30050000|aux.GetCappedXyzLevel(c)
end
......@@ -6,8 +6,8 @@ function c91110378.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_XYZ_LEVEL)
e1:SetValue(c91110378.xyz_level)
e1:SetCode(EFFECT_XYZ_MIN_COUNT)
e1:SetValue(3)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
......@@ -25,9 +25,6 @@ function c91110378.initial_effect(c)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
function c91110378.xyz_level(e,c,rc)
return 0x3000+c:GetLevel()
end
function c91110378.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x86) and c:IsSummonPlayer(tp)
end
......
......@@ -31,11 +31,15 @@ function c9190563.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c9190563.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c9190563.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetFirst()==e:GetHandler() then
e:GetHandler():ReleaseEffectRelation(e)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c9190563.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local c=e:GetHandler()
if tc:IsRelateToChain() or (tc==c and c:IsLocation(LOCATION_GRAVE) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetReasonEffect()==e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -90,7 +90,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectMatchingCard(tp,s.rfilter,tp,LOCATION_MZONE,0,1,1,aux.ExceptThisCard(e),tp,c)
if Duel.Release(g,REASON_EFFECT) and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,SUMMON_TYPE_RITUAL,tp,tp,true,true,POS_FACEUP)~=0 then
if Duel.Release(g,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,SUMMON_TYPE_RITUAL,tp,tp,true,true,POS_FACEUP)~=0 then
c:CompleteProcedure()
if Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil,tp)
and Duel.IsExistingMatchingCard(s.pfilter,tp,LOCATION_DECK,0,1,nil,tp)
......
......@@ -57,7 +57,7 @@ end
function c94415058.spcon(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if eg:GetCount()==1 and rp==1-tp and tc:IsReason(REASON_EFFECT)
and tc:IsPreviousControler(tp) and tc:IsPreviousLocation(LOCATION_MZONE)
and tc:IsPreviousControler(tp) and tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_FACEUP)
and tc:IsType(TYPE_PENDULUM) and tc:IsControler(tp) then
e:SetLabel(tc:GetCode())
return true
......
......@@ -83,7 +83,7 @@ function s.autg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function s.auop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetTargetsRelateToChain():GetFirst()
if tc:IsFaceup() then
if tc and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
......
......@@ -43,6 +43,8 @@ function s.actg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SelectTarget(tp,s.atkcheck,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,atk)
if race==RACE_REPTILE then
e:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DRAW)
else
e:SetCategory(CATEGORY_ATKCHANGE)
end
end
function s.acop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -3,6 +3,7 @@ MIN_ID =128 --0x80, by DataManager::GetDesc()
MAX_ID =268435455 --28 bits, by DataManager::GetDesc()
MAX_COUNTER =65535 --max number for adding/removing counters, by card::add_counter(), field::remove_counter()
MAX_PARAMETER =0xffff
MAX_XYZ_LEVEL =0x0fff
--Locations 区域
LOCATION_DECK =0x01 --卡组
LOCATION_HAND =0x02 --手牌
......@@ -604,7 +605,7 @@ EFFECT_LIMIT_SPECIAL_SUMMON_POSITION =368 --不能以特定表示形式特殊召
EFFECT_TUNER =369 --同调召唤时可以当作调整(百檎龙-苹果鳞虫)
EFFECT_KAISER_COLOSSEUM =370 --皇帝斗技场
EFFECT_REPLACE_DAMAGE =371 --伤害由特定行动代替
EFFECT_TREAT_AS_2_XMATERIAL =372 --需3只以上作素材的超量怪兽时可以作为2只数量
EFFECT_XYZ_MIN_COUNT =372 --只能用在X只以上的超量召唤
EFFECT_FLAG_EFFECT =0x20000000 --标记类效果,即RegisterFlagEffect()创建的效果
--下面是诱发效果的诱发事件、时点 (如果是TYPE_SINGLE则自己发生以下事件后触发,如果TYPE_FIELD则场上任何卡发生以下事件都触发)
......
......@@ -430,13 +430,6 @@ end
---@param maxct? integer
---@param alterop? function
function Auxiliary.AddXyzProcedure(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
if ct>=3 then
Auxiliary.AddXyzProcedureWith3MoreMaterial(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
else
Auxiliary.AddXyzProcedureNormal(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
end
end
function Auxiliary.AddXyzProcedureNormal(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
if not maxct then maxct=ct end
local e1=Effect.CreateEffect(c)
e1:SetDescription(1165)
......@@ -456,53 +449,6 @@ function Auxiliary.AddXyzProcedureNormal(c,f,lv,ct,alterf,alterdesc,maxct,altero
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
end
function Auxiliary.AddXyzProcedureWith3MoreMaterial(c,f,lv,ct,alterf,alterdesc,maxct,alterop)
local ff=function (fc)
return fc:IsXyzLevel(c,lv) and (not f or f(fc))
end
local gf=function (g)
local gct=g:GetCount()
local eg=g:Filter(Auxiliary.AddXyzProcedureWith3MoreMaterialGfFilter,nil,c:GetOwner(),c)
if #eg>0 then
gct=gct+eg:GetClassCount(Auxiliary.AddXyzProcedureWith3MoreMaterialGfValue,c:GetOwner(),c)
end
local tc=g:GetFirst()
while tc do
local te=tc:IsHasEffect(EFFECT_XYZ_LEVEL,c:GetOwner())
if te then
local evf=te:GetValue()
if evf then
local ev=evf(te,tc,c)
local lmct=(ev>>12)&0xf
if lmct>0 and lmct>g:GetCount() then
return false
end
end
end
tc=g:GetNext()
end
return gct>=ct
end
local minc=ct-2
local maxc=ct
local e1=Effect.CreateEffect(c)
e1:SetDescription(1165)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
if alterf then
e1:SetCondition(Auxiliary.XyzLevelFreeConditionAlter(ff,gf,minc,maxc,alterf,alterdesc,alterop))
e1:SetTarget(Auxiliary.XyzLevelFreeTargetAlter(ff,gf,minc,maxc,alterf,alterdesc,alterop))
e1:SetOperation(Auxiliary.XyzLevelFreeOperationAlterWith3MoreMaterial(ff,gf,minc,maxc,alterf,alterdesc,alterop))
else
e1:SetCondition(Auxiliary.XyzLevelFreeCondition(ff,gf,minc,maxc))
e1:SetTarget(Auxiliary.XyzLevelFreeTarget(ff,gf,minc,maxc))
e1:SetOperation(Auxiliary.XyzLevelFreeOperationWith3MoreMaterial(f,gf,minc,maxc))
end
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
end
--Xyz Summon(normal)
function Auxiliary.XyzCondition(f,lv,minct,maxct)
--og: use special material
......@@ -916,134 +862,6 @@ function Auxiliary.XyzLevelFreeOperationAlter(f,gf,minct,maxct,alterf,alterdesc,
end
end
end
--Xyz summon(with EFFECT_TREAT_AS_2_XMATERIAL)
function Auxiliary.AddXyzProcedureWith3MoreMaterialGfFilter(c,tp,xc)
local te=c:IsHasEffect(EFFECT_TREAT_AS_2_XMATERIAL,tp)
if te then
local etg=te:GetTarget()
return not etg or etg(te,xc)
end
return false
end
function Auxiliary.AddXyzProcedureWith3MoreMaterialGfValue(c,tp,xc)
local te=c:IsHasEffect(EFFECT_TREAT_AS_2_XMATERIAL,tp)
if te then
local etg=te:GetTarget()
if not etg or etg(te,xc) then
return te:GetValue()
end
end
end
function Auxiliary.XyzLevelFreeOperationAlterWith3MoreMaterial(f,gf,minc,maxc,alterf,alterdesc,alterop)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
Auxiliary.Solve2XMaterial(tp,og,maxc,minc)
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
Auxiliary.Solve2XMaterial(tp,mg,maxc,minc)
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
else
local sg=Group.CreateGroup()
local tc=mg:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=mg:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end
end
function Auxiliary.XyzLevelFreeOperationWith3MoreMaterial(f,gf,minct,maxct)
return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
if og and not min then
Auxiliary.Solve2XMaterial(tp,og,maxct,minct)
local sg=Group.CreateGroup()
local tc=og:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=og:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
c:SetMaterial(og)
Duel.Overlay(c,og)
else
local mg=e:GetLabelObject()
Auxiliary.Solve2XMaterial(tp,mg,maxct,minct)
if e:GetLabel()==1 then
local mg2=mg:GetFirst():GetOverlayGroup()
if mg2:GetCount()~=0 then
Duel.Overlay(c,mg2)
end
else
local sg=Group.CreateGroup()
local tc=mg:GetFirst()
while tc do
local sg1=tc:GetOverlayGroup()
sg:Merge(sg1)
tc=mg:GetNext()
end
Duel.SendtoGrave(sg,REASON_RULE)
end
c:SetMaterial(mg)
Duel.Overlay(c,mg)
mg:DeleteGroup()
end
end
end
function Auxiliary.Solve2XMaterialEffectFilter(c,tp)
local te=c:IsHasEffect(EFFECT_TREAT_AS_2_XMATERIAL,tp)
return te:GetValue()
end
function Auxiliary.Solve2XMaterialGroupCheck(g,tp)
return g:GetClassCount(Auxiliary.Solve2XMaterialEffectFilter,tp)==g:GetCount()
end
function Auxiliary.Solve2XMaterial(tp,g,maxct,minct)
if g:GetCount()<maxct and g:GetCount()>=minct and maxct==minct+2 then
local et=maxct-g:GetCount()
local exg=g:Filter(Card.IsHasEffect,nil,EFFECT_TREAT_AS_2_XMATERIAL,tp)
local ext=exg:GetClassCount(Auxiliary.Solve2XMaterialEffectFilter,tp)
if (et==0 or et==ext) and #exg>0 then
for ttc in Auxiliary.Next(exg) do
local tte=ttc:IsHasEffect(EFFECT_TREAT_AS_2_XMATERIAL,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
elseif #exg>0 then
local st=et
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RESOLVECARD)
local reg=exg:SelectSubGroup(tp,Auxiliary.Solve2XMaterialGroupCheck,false,st,st,tp)
for ttc in Auxiliary.Next(reg) do
local tte=ttc:IsHasEffect(EFFECT_TREAT_AS_2_XMATERIAL,tp)
if tte then
Duel.Hint(HINT_CARD,0,ttc:GetCode())
tte:UseCountLimit(tp)
end
end
end
end
end
--Fusion Summon
......
......@@ -1476,6 +1476,15 @@ function Auxiliary.GetCappedLevel(c)
end
end
--
function Auxiliary.GetCappedXyzLevel(c)
local lv=c:GetLevel()
if lv>MAX_XYZ_LEVEL then
return MAX_XYZ_LEVEL
else
return lv
end
end
--
function Auxiliary.GetCappedAttack(c)
local x=c:GetAttack()
if x>MAX_PARAMETER then
......@@ -1627,26 +1636,25 @@ function Auxiliary.RegisterMergedDelayedEvent_ToSingleCard(c,code,events)
g:KeepAlive()
local mt=getmetatable(c)
local seed=0
if type(events) == "table" then
if type(events) == "table" then
for _, event in ipairs(events) do
seed = seed + event
end
else
seed = seed + event
end
else
seed = events
end
while(mt[seed]==true)
do
seed = seed + 1
end
mt[seed]=true
while(mt[seed]==true) do
seed = seed + 1
end
mt[seed]=true
local event_code_single = (code ~ (seed << 16)) | EVENT_CUSTOM
if type(events) == "table" then
if type(events) == "table" then
for _, event in ipairs(events) do
Auxiliary.RegisterMergedDelayedEvent_ToSingleCard_AddOperation(c,g,event,event_code_single)
end
else
end
else
Auxiliary.RegisterMergedDelayedEvent_ToSingleCard_AddOperation(c,g,events,event_code_single)
end
end
--listened to again
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
......@@ -1675,21 +1683,20 @@ end
function Auxiliary.ThisCardMovedToPublicResetCheck_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetOwner()
local g=e:GetLabelObject()
if c:IsFaceup() or c:IsPublic() then
if c:IsFaceup() or c:IsPublic() then
g:Clear()
end
end
end
end
function Auxiliary.MergedDelayEventCheck1_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local c=e:GetOwner()
g:Merge(eg)
if Duel.CheckEvent(EVENT_MOVE) then
_,meg=Duel.CheckEvent(EVENT_MOVE,true)
local c=e:GetOwner()
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g:Clear()
end
end
end
end
if Duel.GetCurrentChain()==0 and #g>0 and not Duel.CheckEvent(EVENT_CHAIN_END) then
local _eg=g:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
......@@ -1698,13 +1705,13 @@ function Auxiliary.MergedDelayEventCheck1_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
end
function Auxiliary.MergedDelayEventCheck2_ToSingleCard(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if Duel.CheckEvent(EVENT_MOVE) then
_,meg=Duel.CheckEvent(EVENT_MOVE,true)
if Duel.CheckEvent(EVENT_MOVE) then
local _,meg=Duel.CheckEvent(EVENT_MOVE,true)
local c=e:GetOwner()
if meg:IsContains(c) and (c:IsFaceup() or c:IsPublic()) then
g:Clear()
end
end
end
end
if #g>0 then
local _eg=g:Clone()
Duel.RaiseEvent(_eg,e:GetLabel(),re,r,rp,ep,ev)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment