Commit 459443d5 authored by 未闻皂名's avatar 未闻皂名

2024/7/23 新增:燃烧羽翼,统一转移攻击对象的写法

parent c0a9b2ae
Pipeline #28614 passed with stages
in 7 minutes and 32 seconds
No preview for this file type
......@@ -388,7 +388,7 @@ function RushDuel.RevealDeckTopAndCanSelectGroup(player, count, desc, hint, filt
Duel.ConfirmDecktop(player, count)
local g = Duel.GetDecktopGroup(player, count)
if g:GetCount() > 0 then
local mg = g:Filter(filter,nil)
local mg = g:Filter(filter, nil)
if mg:CheckSubGroup(check, min, max, ...) then
::cancel::
if Duel.SelectYesNo(player, desc) then
......@@ -448,6 +448,14 @@ function RushDuel.CanSetCard(player, desc, card, effect, break_effect)
end
return false
end
-- 操作: 改变攻击对象
function RushDuel.ChangeAttackTarget(card, player, target)
local g = card:GetAttackableTarget()
Duel.Hint(HINT_SELECTMSG, player, HINTMSG_ATTACKTARGET)
local sg = g:Select(player, 1, 1, nil)
local tc = g:GetFirst()
return tc and (tc == target or Duel.ChangeAttackTarget(tc))
end
-- 可选操作: 抽卡
function RushDuel.CanDraw(desc, player, count, break_effect)
......
......@@ -196,6 +196,12 @@ function RushDuel.IsCanDoubleTribute(card, target)
return false
end
-- 条件: 可以改变攻击对象
function RushDuel.IsCanChangeAttackTarget(card)
local g = card:GetAttackableTarget()
return g:GetCount() > 1
end
-- 条件: 玩家是否能够使用特定种族进行攻击
function RushDuel.IsPlayerCanUseRaceAttack(player, race)
if Duel.IsPlayerAffectedByEffect(player, EFFECT_PLAYER_CANNOT_ATTACK) then
......
......@@ -16,18 +16,8 @@ function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():IsControler(1-tp)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local ag=Duel.GetAttacker():GetAttackableTarget()
return ag:GetCount()>1
end
if chk==0 then return RD.IsCanChangeAttackTarget(Duel.GetAttacker()) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ag=Duel.GetAttacker():GetAttackableTarget()
local at=Duel.GetAttackTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACKTARGET)
local g=ag:Select(tp,1,1,nil)
local tc=g:GetFirst()
if tc and tc~=at then
Duel.ChangeAttackTarget(tc)
end
RD.ChangeAttackTarget(Duel.GetAttacker(),tp,Duel.GetAttackTarget())
end
\ No newline at end of file
......@@ -24,18 +24,10 @@ function cm.condition(e,tp,eg,ep,ev,re,r,rp)
and Duel.GetAttacker():IsControler(1-tp)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local ag=Duel.GetAttacker():GetAttackableTarget()
return ag:GetCount()>1
end
if chk==0 then return RD.IsCanChangeAttackTarget(Duel.GetAttacker()) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local ag=Duel.GetAttacker():GetAttackableTarget()
local at=Duel.GetAttackTarget()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACKTARGET)
local g=ag:Select(tp,1,1,nil)
local tc=g:GetFirst()
if tc and (tc==at or Duel.ChangeAttackTarget(tc)) then
if RD.ChangeAttackTarget(Duel.GetAttacker(),tp,Duel.GetAttackTarget()) then
local mg=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
if mg:CheckSubGroup(cm.check,2,2) then
RD.CanSelectAndDoAction(aux.Stringid(m,1),HINTMSG_DESTROY,nil,tp,0,LOCATION_MZONE,1,1,nil,function(sg)
......
local m=120264061
local cm=_G["c"..m]
cm.name="燃烧羽翼"
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(cm.condition)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
--Activate
function cm.filter(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
return tc:IsControler(1-tp) and tc:IsLevelAbove(5) and Duel.GetAttackTarget()~=nil
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_MZONE,0,1,nil) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
RD.SelectAndDoAction(aux.Stringid(m,1),cm.filter,tp,LOCATION_MZONE,0,1,1,nil,function(g)
RD.AttachAtkDef(e,g:GetFirst(),1000,0,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
local tc=Duel.GetAttacker()
if RD.IsCanChangeAttackTarget(tc) and Duel.SelectYesNo(tp,aux.Stringid(m,2)) then
RD.ChangeAttackTarget(tc,tp,Duel.GetAttackTarget())
end
end)
end
\ No newline at end of file
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