Commit b4f2969f authored by DailyShana's avatar DailyShana

update change attack target

parent 99a62414
......@@ -33,8 +33,11 @@ function c11508758.ctlop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tc,REASON_EFFECT)
end
else
if tc:IsAttackPos() then
Duel.ChangeAttacker(tc)
if tc:IsAttackable() and not tc:IsImmuneToEffect(e) then
local ats=tc:GetAttackableTarget()
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11508758,1))
local g=ats:Select(tp,1,1,nil)
Duel.CalculateDamage(tc,g:GetFirst())
end
end
end
......
......@@ -23,28 +23,34 @@ end
function c21558682.atkcon(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer() and Duel.GetAttackTarget()~=nil
end
function c21558682.filter(c)
return c:IsFaceup() and c:IsCode(31709826)
function c21558682.filter(c,atg)
return c:IsFaceup() and c:IsCode(31709826) and atg:IsContains(c)
end
function c21558682.atktg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c21558682.filter(chkc) end
if chkc then
local atg=Duel.GetAttacker():GetAttackableTarget()
local at=Duel.GetAttackTarget()
return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc~=at and c21558682.filter(chkc,atg)
end
if chk==0 then return true end
e:SetProperty(0)
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and tp~=Duel.GetTurnPlayer() then
local at=Duel.GetAttackTarget()
if at and Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,at) and Duel.SelectYesNo(tp,aux.Stringid(21558682,1)) then
local atg=Duel.GetAttacker():GetAttackableTarget()
if at and Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,at,atg) and Duel.SelectYesNo(tp,aux.Stringid(21558682,1)) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,at)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,at,atg)
end
end
end
function c21558682.atktg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c21558682.filter(chkc) end
local atg=Duel.GetAttacker():GetAttackableTarget()
local at=Duel.GetAttackTarget()
if chk==0 then return Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,at) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc~=at and c21558682.filter(chkc,atg) end
if chk==0 then return Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,at,atg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,at)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,at,atg)
end
function c21558682.atkop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
......
......@@ -26,12 +26,12 @@ function c37053871.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
if Duel.CheckEvent(EVENT_BE_BATTLE_TARGET) and Duel.GetAttackTarget():IsControler(tp)
and Duel.GetAttackTarget() and Duel.SelectYesNo(tp,aux.Stringid(37053871,0)) then
and not Duel.GetAttacker():IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) and Duel.SelectYesNo(tp,aux.Stringid(37053871,0)) then
e:SetLabel(1)
end
end
function c37053871.atktg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if chk==0 then return not Duel.GetAttacker():IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) end
e:SetLabel(1)
end
function c37053871.atkop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -22,10 +22,13 @@ function c42256406.initial_effect(c)
e4:SetCode(EVENT_BE_BATTLE_TARGET)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c42256406.cbcon)
e4:SetTarget(c42256406.cbtg)
e4:SetOperation(c42256406.cbop)
c:RegisterEffect(e4)
--def
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(42256406,2))
e5:SetCategory(CATEGORY_DEFCHANGE)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_BE_BATTLE_TARGET)
e5:SetCost(c42256406.defcost)
......@@ -47,6 +50,9 @@ function c42256406.cbcon(e,tp,eg,ep,ev,re,r,rp)
local bt=eg:GetFirst()
return r~=REASON_REPLACE and c~=bt and bt:IsFaceup() and bt:GetControler()==c:GetControler()
end
function c42256406.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end
end
function c42256406.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then
......
--トゥーン・ディフェンス
function c43509019.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetTarget(c43509019.cbtg)
e1:SetOperation(c43509019.cbop)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c43509019.target)
c:RegisterEffect(e1)
--change battle target
local e2=Effect.CreateEffect(c)
......@@ -12,25 +12,30 @@ function c43509019.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetLabel(1)
e2:SetCondition(c43509019.cbcon)
e2:SetTarget(c43509019.cbtg)
e2:SetOperation(c43509019.cbop)
c:RegisterEffect(e2)
end
function c43509019.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
function c43509019.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local bt=Duel.GetAttackTarget()
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and bt and bt:IsFaceup() and bt:IsLevelBelow(4) and bt:IsType(TYPE_TOON)
and bt:GetControler()==e:GetHandlerPlayer() and Duel.SelectYesNo(tp,94) then
e:SetLabel(1)
else e:SetLabel(0) end
local res,teg,tep,tev,tre,tr,trp=Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE)
if res and c43509019.cbcon(e,tp,teg,tep,tev,tre,tr,trp)
and c43509019.cbtg(e,tp,teg,tep,tev,tre,tr,trp,0)
and Duel.SelectYesNo(tp,94) then
e:SetOperation(c43509019.cbop)
else
e:SetOperation(nil)
end
end
function c43509019.cbcon(e,tp,eg,ep,ev,re,r,rp)
local bt=Duel.GetAttackTarget()
return bt and bt:IsFaceup() and bt:IsLevelBelow(4) and bt:IsType(TYPE_TOON) and bt:GetControler()==e:GetHandlerPlayer()
end
function c43509019.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.GetAttacker():IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) end
end
function c43509019.cbop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==1 then
Duel.ChangeAttackTarget(nil)
end
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.ChangeAttackTarget(nil)
end
......@@ -32,8 +32,10 @@ function c54912977.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c54912977.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.ChangeAttackTarget(tc)
local a=Duel.GetAttacker()
if tc and tc:IsRelateToEffect(e)
and a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
end
function c54912977.spfilter(c,e,tp)
......
......@@ -35,9 +35,8 @@ function c56132807.spop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c56132807.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then
local a=Duel.GetAttacker()
if a and a:IsAttackable() and a:IsFaceup() and not a:IsImmuneToEffect(e) and not a:IsStatus(STATUS_ATTACK_CANCELED) then
if a and not a:IsImmuneToEffect(e) and Duel.ChangeAttackTarget(g:GetFirst()) then
Duel.BreakEffect()
Duel.ChangeAttackTarget(g:GetFirst())
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -7,6 +7,7 @@ function c59965151.initial_effect(c)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c59965151.cbcon)
e1:SetTarget(c59965151.cbtg)
e1:SetOperation(c59965151.cbop)
c:RegisterEffect(e1)
--atkdown
......@@ -25,6 +26,9 @@ function c59965151.cbcon(e,tp,eg,ep,ev,re,r,rp)
local bt=eg:GetFirst()
return c~=bt and bt:IsFaceup() and bt:GetControler()==c:GetControler()
end
function c59965151.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end
end
function c59965151.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then
......
......@@ -14,8 +14,9 @@ function c69937550.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c69937550.cbcondition)
e2:SetOperation(c69937550.cboperation)
e2:SetCondition(c69937550.cbcon)
e2:SetTarget(c69937550.cbtg)
e2:SetOperation(c69937550.cbop)
c:RegisterEffect(e2)
end
function c69937550.repcon(e)
......@@ -33,12 +34,15 @@ function c69937550.repop(e,tp,eg,ep,ev,re,r,rp)
c:RegisterEffect(e1)
Duel.RaiseEvent(c,EVENT_CUSTOM+47408488,e,0,tp,0,0)
end
function c69937550.cbcondition(e,tp,eg,ep,ev,re,r,rp)
function c69937550.cbcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bt=eg:GetFirst()
return r~=REASON_REPLACE and c~=bt and bt:IsFaceup() and bt:IsSetCard(0x1034) and bt:GetControler()==c:GetControler()
end
function c69937550.cboperation(e,tp,eg,ep,ev,re,r,rp)
function c69937550.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end
end
function c69937550.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then
Duel.ChangeAttackTarget(c)
......
......@@ -55,9 +55,8 @@ function c7198399.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
local a=Duel.GetAttacker()
if a and a:IsAttackable() and a:IsFaceup() and not a:IsImmuneToEffect(e) and not a:IsStatus(STATUS_ATTACK_CANCELED) then
if a and not a:IsImmuneToEffect(e) and Duel.ChangeAttackTarget(tc) then
Duel.BreakEffect()
Duel.ChangeAttackTarget(tc)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -20,6 +20,7 @@ function c79473793.initial_effect(c)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(c79473793.cbcon)
e2:SetCost(c79473793.cbcost)
e2:SetTarget(c79473793.cbtg)
e2:SetOperation(c79473793.cbop)
c:RegisterEffect(e2)
end
......@@ -56,6 +57,9 @@ function c79473793.cbcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c79473793.cfilter,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c79473793.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end
end
function c79473793.cbop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then
......
......@@ -6,6 +6,7 @@ function c79997591.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c79997591.cbcon)
e1:SetTarget(c79997591.cbtg)
e1:SetOperation(c79997591.cbop)
c:RegisterEffect(e1)
end
......@@ -13,6 +14,9 @@ function c79997591.cbcon(e,tp,eg,ep,ev,re,r,rp)
local bt=Duel.GetAttackTarget()
return bt and bt:IsPosition(POS_FACEUP_ATTACK) and bt:IsControler(tp)
end
function c79997591.cbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.GetAttacker():IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) end
end
function c79997591.cbop(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttacker()
local bt=Duel.GetAttackTarget()
......
......@@ -57,14 +57,15 @@ end
function c81983656.cbcon(e,tp,eg,ep,ev,re,r,rp)
return r~=REASON_REPLACE
end
function c81983656.cbfilter(c)
return c:IsFaceup() and c:IsSetCard(0x33)
function c81983656.cbfilter(c,at)
return c:IsFaceup() and c:IsSetCard(0x33) and at:IsContains(c)
end
function c81983656.cbtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c81983656.cbfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c81983656.cbfilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
local at=Duel.GetAttacker():GetAttackableTarget()
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c81983656.cbfilter(chkc,at) end
if chk==0 then return Duel.IsExistingTarget(c81983656.cbfilter,tp,LOCATION_MZONE,0,1,e:GetHandler(),at) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c81983656.cbfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SelectTarget(tp,c81983656.cbfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),at)
end
function c81983656.cbop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -14,11 +14,15 @@ end
function c8687195.condition(e,tp,eg,ep,ev,re,r,rp)
return r~=REASON_REPLACE and Duel.GetAttackTarget()==e:GetHandler() and Duel.GetAttacker():IsControler(1-tp)
end
function c8687195.filter(c,at)
return at:IsContains(c)
end
function c8687195.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return true end
local at=Duel.GetAttacker():GetAttackableTarget()
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and at:IsContains(chkc) end
if chk==0 then return Duel.IsExistingTarget(c8687195.filter,tp,LOCATION_MZONE,0,1,e:GetHandler(),at) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
Duel.SelectTarget(tp,c8687195.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),at)
end
function c8687195.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
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