Commit c973c46d authored by Chen Bill's avatar Chen Bill Committed by GitHub

add EFFECT_XYZ_MIN_COUNT (#2832)

* add EFFECT_XYZ_MIN_COUNT

* update procedure

---------
Co-authored-by: mercury233's avatarmercury233 <me@mercury233.me>
parent 78cb60fb
......@@ -33,5 +33,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
......@@ -5,8 +5,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)
......@@ -24,9 +24,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 --手牌
......@@ -605,6 +606,7 @@ EFFECT_LIMIT_SPECIAL_SUMMON_POSITION =368 --不能以特定表示形式特殊召
EFFECT_TUNER =369 --同调召唤时可以当作调整(百檎龙-苹果鳞虫)
EFFECT_KAISER_COLOSSEUM =370 --皇帝斗技场
EFFECT_REPLACE_DAMAGE =371 --伤害由特定行动代替
EFFECT_XYZ_MIN_COUNT =372 --只能用在X只以上的超量召唤
EFFECT_FLAG_EFFECT =0x20000000 --标记类效果,即RegisterFlagEffect()创建的效果
--下面是诱发效果的诱发事件、时点 (如果是TYPE_SINGLE则自己发生以下事件后触发,如果TYPE_FIELD则场上任何卡发生以下事件都触发)
......
......@@ -418,6 +418,7 @@ end
--Xyz Summon
function Auxiliary.XyzAlterFilter(c,alterf,xyzc,e,tp,alterop)
return alterf(c,e,tp,xyzc) and c:IsCanBeXyzMaterial(xyzc) and Duel.GetLocationCountFromEx(tp,tp,c,xyzc)>0
and not c:IsHasEffect(EFFECT_XYZ_MIN_COUNT)
and Auxiliary.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and (not alterop or alterop(e,tp,0,c))
end
---Xyz monster, lv k*n
......@@ -649,7 +650,15 @@ function Auxiliary.XyzLevelFreeFilter(c,xyzc,f)
return (not c:IsOnField() or c:IsFaceup()) and c:IsCanBeXyzMaterial(xyzc) and (not f or f(c,xyzc))
end
function Auxiliary.XyzLevelFreeGoal(g,tp,xyzc,gf)
return (not gf or gf(g)) and Duel.GetLocationCountFromEx(tp,tp,g,xyzc)>0
if Duel.GetLocationCountFromEx(tp,tp,g,xyzc)<=0 then return false end
if gf and not gf(g) then return false end
local lg=g:Filter(Card.IsHasEffect,nil,EFFECT_XYZ_MIN_COUNT)
for c in Auxiliary.Next(lg) do
local le=c:IsHasEffect(EFFECT_XYZ_MIN_COUNT)
local ct=le:GetValue()
if #g<ct then return false end
end
return true
end
function Auxiliary.XyzLevelFreeCondition(f,gf,minct,maxct)
return function(e,c,og,min,max)
......
......@@ -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