Commit 621bdcd9 authored by wind2009's avatar wind2009

Merge branch 'develop' into develop-8888

parents 91faef45 5a640df5
......@@ -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)
......
......@@ -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
......
......@@ -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
......
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