Commit d844bbe3 authored by 未闻皂名's avatar 未闻皂名

2023/1/7 新增:猫猫新卡,修改双重解放和赋予的抗性的判断

parent dc0d96c8
Pipeline #19224 passed with stages
in 5 minutes and 23 seconds
No preview for this file type
-- Rush Duel 条件
RushDuel = RushDuel or {}
-- 内部方法: 检测效果范围是否覆盖
function RushDuel._private_check_effect_values(value, values, decode)
local attach, attachs = {decode(value)}, {}
local start = 2
local count = #attach
for i = start, count do
attach[i] = attach[i] or 0
attachs[i] = 0
end
for _, val in ipairs(values) do
local _attach = {decode(val)}
if _attach[1] then
-- 忽略判定
else
for i = start, count do
attachs[i] = attachs[i] | (_attach[i] or 0)
end
end
end
for i = start, count do
if (attachs[i] | attach[i]) ~= attachs[i] then
return true
end
end
return false
end
-- 内部方法:检测效果破坏抗性的控制权
function RushDuel._private_swap_effect_indes(value, swap)
if swap then
local check = value(nil)
return function()
return check[1], check[3], check[2]
end
else
return value
end
end
-- 条件: 卡片是否处于"极大模式"
function RushDuel.IsMaximumMode(card)
return card:IsLocation(LOCATION_MZONE) and card:IsSummonType(SUMMON_TYPE_MAXIMUM) and card:GetOverlayCount() > 0
......@@ -146,13 +108,7 @@ function RushDuel.IsCanAttachDoubleTribute(card, value)
return false
end
local values = RushDuel.GetEffectValues(card, EFFECT_DOUBLE_TRIBUTE)
return RushDuel._private_check_effect_values(value, values, function(val)
if val == 1 then
return {true, RACE_ALL, ATTRIBUTE_ALL}
else
return val(nil)
end
end)
return RushDuel.CheckValueDoubleTribute(values, value)
end
-- 条件: 可否赋予效果 - 战斗破坏抗性
function RushDuel.IsCanAttachBattleIndes(card, value)
......@@ -166,16 +122,9 @@ function RushDuel.IsCanAttachBattleIndes(card, value)
end
-- 条件: 可否赋予效果 - 效果破坏抗性
function RushDuel.IsCanAttachEffectIndes(card, player, value)
local swap = card:GetControler() ~= player
local check = RushDuel._private_swap_effect_indes(value, swap)
local swap = card:GetOwner() ~= player
local values = RushDuel.GetEffectValues(card, EFFECT_INDESTRUCTABLE_EFFECT)
return RushDuel._private_check_effect_values(check, values, function(val)
if val == 1 then
return {true, TYPE_MONSTER + TYPE_SPELL + TYPE_TRAP, TYPE_MONSTER + TYPE_SPELL + TYPE_TRAP}
else
return val(nil)
end
end)
return RushDuel.CheckValueEffectIndesType(swap, values, value)
end
-- 额外条件: 最后的操作是否包含某种卡
......
-- Rush Duel 效果值
RushDuel = RushDuel or {}
-- 效果值: 双重解放 属性/种族
function RushDuel.ValueDoubleTribute(attribute, race, ignore)
-- 内部方法: 双重解放的对象怪兽信息
function RushDuel._private_double_tribute_info(code, attribute, level, race, attack, defense)
local info = {}
info.code = code
info.attribute = attribute
info.level = level
info.race = race
info.attack = attack
info.defense = defense
return info
end
-- 内部方法: 判断双重解放的对象怪兽是否重合
function RushDuel._private_is_double_tribute_info_different(info1, info2)
if info1.code ~= info2.code then
return true
elseif info1.attribute ~= info2.attribute then
return true
elseif info1.level ~= info2.level then
return true
elseif info1.race ~= info2.race then
return true
elseif info1.attack ~= info2.attack then
return true
elseif info1.defense ~= info2.defense then
return true
end
return false
end
-- 效果值: 双重解放
function RushDuel.ValueDoubleTributeMix(ignore, code, attribute, level, race, attack, defense)
return function(e, c)
if e == nil then
return ignore or false, attribute or 0, race or 0
return ignore, RushDuel._private_double_tribute_info(code, attribute, level, race, attack, defense)
end
return (code == nil or c:IsCode(code)) and (attribute == nil or c:IsAttribute(attribute)) and (level == nil or c:IsLevel(level)) and (race == nil or c:IsRace(race)) and
(attack == nil or c:IsAttack(attack)) and (defense == nil or c:IsDefense(defense))
end
end
-- 效果值: 双重解放 全范围
function RushDuel.ValueDoubleTributeAll(ignore)
return function(e, c)
if e == nil then
return ignore, 1
end
return true
end
end
-- 效果值: 双重解放 卡名
function RushDuel.ValueDoubleTributeCode(code, ignore)
return RushDuel.ValueDoubleTributeMix(ignore, code, nil, nil, nil, nil, nil)
end
-- 效果值: 双重解放 属性/种族
function RushDuel.ValueDoubleTributeAttrRace(attribute, race, ignore)
return RushDuel.ValueDoubleTributeMix(ignore, nil, attribute, nil, race, nil, nil)
end
-- 效果值: 双重解放 等级/属性/种族
function RushDuel.ValueDoubleTributeLvAttrRace(level, attribute, race, ignore)
return RushDuel.ValueDoubleTributeMix(ignore, nil, attribute, level, race, nil, nil)
end
-- 效果值: 双重解放 攻击力/守备力
function RushDuel.ValueDoubleTributeAtkDef(attack, defense, ignore)
return RushDuel.ValueDoubleTributeMix(ignore, nil, nil, nil, nil, attack, defense)
end
-- 判断: 是否可以赋予双重解放
function RushDuel.CheckValueDoubleTribute(values, value)
local _, info = value(nil)
for _, val in ipairs(values) do
if val == 1 then
-- 全范围双重解放, 无法再赋予双重解放
return false
else
-- 已有抗性全部叠加
local ignore, attach_info = val(nil)
if not ignore then
if attach_info == 1 then
-- 全范围双重解放, 无法再赋予双重解放
return false
elseif info == 1 then
-- 全范围双重解放, 无需判断
elseif not RushDuel._private_is_double_tribute_info_different(info, attach_info) then
-- 已存在相同的双重解放效果
return false
end
end
end
return (attribute == nil or c:IsAttribute(attribute)) and (race == nil or c:IsRace(race))
end
return true
end
-- 效果值: 效果破坏抗性 抵抗类型
......@@ -17,7 +98,7 @@ function RushDuel.ValueEffectIndesType(self_type, opponent_type, ignore)
local o_type = opponent_type or 0
return function(e, re, rp)
if e == nil then
return ignore or false, s_type or 0, o_type or 0
return ignore or false, s_type, o_type
end
local tp = e:GetHandlerPlayer()
if e:GetLabel() ~= 0 then
......@@ -30,3 +111,28 @@ function RushDuel.ValueEffectIndesType(self_type, opponent_type, ignore)
end
end
end
-- 判断: 是否可以赋予效果破坏抗性
function RushDuel.CheckValueEffectIndesType(swap, values, value)
local attachs_s, attachs_o = 0, 0
for _, val in ipairs(values) do
if val == 1 then
-- 全破坏抗性, 无法再赋予其他抗性
return false
else
-- 已有抗性全部叠加
local ignore, s_type, o_type = val(nil)
if not ignore then
attachs_s = attachs_s | s_type
attachs_o = attachs_o | o_type
end
end
end
-- 判断抗性是否有变化
local _, s_type, o_type = value(nil)
if swap then
-- 控制权交换中
s_type, o_type = o_type, s_type
end
return (attachs_s | s_type) ~= attachs_s or (attachs_o | o_type) ~= attachs_o
end
......@@ -13,7 +13,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
cm.trival=RD.ValueDoubleTribute(nil,RACE_DRAGON)
cm.trival=RD.ValueDoubleTributeAttrRace(nil,RACE_DRAGON)
function cm.costfilter(c)
return c:IsRace(RACE_DRAGON) and c:IsAbleToDeckOrExtraAsCost()
end
......
......@@ -13,7 +13,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
cm.trival=RD.ValueDoubleTribute(nil,RACE_WINDBEAST)
cm.trival=RD.ValueDoubleTributeAttrRace(nil,RACE_WINDBEAST)
function cm.costfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and not c:IsPublic()
end
......
......@@ -13,7 +13,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_LIGHT,RACE_MACHINE)
cm.trival=RD.ValueDoubleTributeAttrRace(ATTRIBUTE_LIGHT,RACE_MACHINE)
function cm.costfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsAbleToDeckOrExtraAsCost()
end
......
......@@ -15,7 +15,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_FIRE,nil)
cm.trival=RD.ValueDoubleTributeAttrRace(ATTRIBUTE_FIRE,nil)
function cm.confilter(c)
return c:IsFaceup() and c:IsCode(list[1])
end
......
......@@ -11,7 +11,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Activate
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_ALL,RACE_ALL)
cm.trival=RD.ValueDoubleTributeAll()
function cm.filter(c)
return c:IsFaceup() and RD.IsCanAttachDoubleTribute(c,cm.trival)
end
......
......@@ -10,4 +10,4 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Double Tribute
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_FIRE,nil)
\ No newline at end of file
cm.trival=RD.ValueDoubleTributeAttrRace(ATTRIBUTE_FIRE,nil)
\ No newline at end of file
......@@ -13,7 +13,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_DARK,RACE_GALAXY)
cm.trival=RD.ValueDoubleTributeAttrRace(ATTRIBUTE_DARK,RACE_GALAXY)
function cm.costfilter(c)
return c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_GALAXY) and c:IsAbleToDeckOrExtraAsCost()
end
......
......@@ -14,7 +14,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Discard Deck
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_WIND,RACE_PSYCHO)
cm.trival=RD.ValueDoubleTributeAttrRace(ATTRIBUTE_WIND,RACE_PSYCHO)
function cm.exfilter(c)
return c:IsRace(RACE_PSYCHO) and c:IsLocation(LOCATION_GRAVE)
end
......
......@@ -30,7 +30,7 @@ function cm.condition(e)
end
function cm.indval(e,re,rp)
if e==nil then
return true,0,0
return true,TYPE_MONSTER,0
end
local tp=e:GetHandlerPlayer()
local tc=re:GetHandler()
......
......@@ -18,7 +18,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e2)
end
--Activate
cm.trival=RD.ValueDoubleTribute(ATTRIBUTE_ALL,RACE_ALL)
cm.trival=RD.ValueDoubleTributeAll()
function cm.target(c,e,tp,chk)
return c:IsControler(tp) and c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAttackBelow(1400)
end
\ No newline at end of file
......@@ -13,12 +13,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Extra Tribute
function cm.trival(e,c)
if e==nil then
return true,0,RACE_DRAGON
end
return c:IsLevel(7) and c:IsRace(RACE_DRAGON)
end
cm.trival=RD.ValueDoubleTributeLvAttrRace(7,nil,RACE_DRAGON)
function cm.costfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeckOrExtraAsCost()
end
......
local m=120235010
local cm=_G["c"..m]
cm.name="极奏之马赫音盗贼"
function cm.initial_effect(c)
--Atk Up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(cm.atkval)
c:RegisterEffect(e1)
end
--Atk Up
function cm.filter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL)
end
function cm.atkval(e,c)
local ct1=c:GetEquipCount()
local ct2=Duel.GetMatchingGroupCount(cm.filter,c:GetControler(),0,LOCATION_MZONE,nil)
return (ct1+ct2)*500
end
\ No newline at end of file
local m=120235014
local list={120235061}
local cm=_G["c"..m]
cm.name="紫眼星猫"
function cm.initial_effect(c)
RD.AddCodeList(c,list)
--Set
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_GRAVE_ACTION)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
--Set
function cm.setfilter(c)
return c:IsCode(list[1]) and c:IsSSetable()
end
function cm.atkfilter(c)
return c:IsFaceup() and c:IsLevelAbove(7) and RD.IsDefense(c,200) and RD.IsCanAttachExtraAttack(c,1)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(cm.setfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
if RD.SelectAndSet(aux.NecroValleyFilter(cm.setfilter),tp,LOCATION_GRAVE,0,1,1,nil,e)~=0 then
RD.CanSelectAndDoAction(aux.Stringid(m,1),aux.Stringid(m,2),cm.atkfilter,tp,LOCATION_MZONE,0,1,1,nil,function(g)
RD.AttachExtraAttack(e,g:GetFirst(),1,aux.Stringid(m,3),RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
end)
end
end
\ No newline at end of file
local m=120235015
local cm=_G["c"..m]
cm.name="绿眼星猫"
function cm.initial_effect(c)
--Draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
--Draw
cm.trival=RD.ValueDoubleTributeAtkDef(nil,200)
function cm.costfilter(c)
return c:IsRace(RACE_BEAST+RACE_WARRIOR) and c:IsAbleToGraveAsCost()
end
cm.cost=RD.CostSendHandToGrave(cm.costfilter,1,1,nil,nil,function(g)
return g:GetFirst():GetType()
end)
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
RD.TargetDraw(tp,1)
end
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if RD.Draw()~=0 and (e:GetLabel()&(TYPE_NORMAL))~=0 and c:IsFaceup() and c:IsRelateToEffect(e) then
RD.AttachDoubleTribute(e,c,cm.trival,aux.Stringid(m,1),RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
end
end
\ No newline at end of file
local m=120235017
local cm=_G["c"..m]
cm.name="暗眼破星猫"
function cm.initial_effect(c)
--Pierce
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(cm.condition)
e1:SetCost(cm.cost)
e1:SetOperation(cm.operation)
c:RegisterEffect(e1)
end
--Pierce
function cm.desfilter(c)
return c:IsFaceup() and c:IsLevel(7,8)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsAbleToEnterBP() and RD.IsCanAttachPierce(e:GetHandler())
end
cm.cost=RD.CostSendDeckTopToGrave(2)
function cm.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
RD.AttachPierce(e,c,aux.Stringid(m,1),RESET_EVENT+RESETS_STANDARD+RESET_DISABLE+RESET_PHASE+PHASE_END)
if RD.IsSpecialSummonTurn(c) and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) then
RD.CanSelectAndDoAction(aux.Stringid(m,2),HINTMSG_DESTROY,cm.desfilter,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
Duel.Destroy(sg,REASON_EFFECT)
end)
end
end
end
\ No newline at end of file
local m=120235049
local cm=_G["c"..m]
cm.name="喵双重超速"
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_SPSUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
--Activate
function cm.spfilter(c,e,tp)
return c:IsRace(RACE_BEAST+RACE_WARRIOR) and RD.IsDefense(c,200) and RD.IsCanBeSpecialSummoned(c,e,tp,POS_FACEUP_DEFENSE)
end
cm.cost=RD.CostSendHandToDeckBottom(Card.IsAbleToDeckAsCost,1,1,false)
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMZoneCount(tp)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
RD.SelectAndSpecialSummon(aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_GRAVE,0,1,2,nil,e,POS_FACEUP_DEFENSE)
if Duel.GetFlagEffect(tp,m)~=0 then return end
RD.CreateHintEffect(e,aux.Stringid(m,1),tp,1,0,RESET_PHASE+PHASE_END)
RD.CreateAttackLimitEffect(e,cm.atktg,tp,LOCATION_MZONE,0,RESET_PHASE+PHASE_END)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
end
function cm.atktg(e,c)
return not RD.IsDefense(c,200)
end
\ No newline at end of file
local m=120235061
local cm=_G["c"..m]
cm.name="野性防护罩 -野良镜力-"
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(cm.condition)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
--Activate
function cm.exfilter(c)
return c:IsFaceup() and c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WARRIOR) and RD.IsDefense(c,200)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():IsControler(1-tp)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
if tc and tc:IsRelateToBattle() and tc:IsFaceup() then
RD.AttachAtkDef(e,tc,-200,0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
if Duel.GetMatchingGroupCount(cm.exfilter,tp,LOCATION_MZONE,0,nil)==3 then
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(m,1)) then
Duel.Destroy(g,REASON_EFFECT)
end
end
end
end
\ No newline at end of file
......@@ -16,12 +16,7 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--To Hand
function cm.trival(e,c)
if e==nil then
return true,0,0
end
return c:IsCode(list[1])
end
cm.trival=RD.ValueDoubleTributeCode(list[1])
function cm.thfilter(c)
return c:IsLevel(8) and c:IsRace(RACE_GALAXY) and c:IsAbleToHand()
end
......
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