Commit f1e5fedd authored by salix5's avatar salix5

change attack target

parent 13bb48af
......@@ -12,7 +12,7 @@ function c37053871.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(37053871,1))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c37053871.atkcon)
e2:SetTarget(c37053871.atktg2)
......@@ -20,12 +20,16 @@ function c37053871.initial_effect(c)
c:RegisterEffect(e2)
end
function c37053871.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():IsControler(tp)
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
return a:IsControler(1-tp) and at and at:IsControler(tp)
end
function c37053871.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local a=Duel.GetAttacker
local at=Duel.GetAttackTarget()
e:SetLabel(0)
if Duel.CheckEvent(EVENT_BE_BATTLE_TARGET) and Duel.GetAttackTarget():IsControler(tp)
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and c37053871.atkcon(e,tp,eg,ep,ev,re,r,rp,chk)
and not Duel.GetAttacker():IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) and Duel.SelectYesNo(tp,aux.Stringid(37053871,0)) then
e:SetLabel(1)
end
......
......@@ -33,10 +33,13 @@ function c56132807.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
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 tc=g:GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local a=Duel.GetAttacker()
if a and not a:IsImmuneToEffect(e) and Duel.ChangeAttackTarget(g:GetFirst()) then
local ag=a:GetAttackableTarget()
if a:IsAttackable() and not a:IsImmuneToEffect(e) and ag:IsContains(tc) then
Duel.BreakEffect()
Duel.ChangeAttackTarget(tc)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -55,8 +55,10 @@ 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 not a:IsImmuneToEffect(e) and Duel.ChangeAttackTarget(tc) then
local ag=a:GetAttackableTarget()
if a:IsAttackable() and not a:IsImmuneToEffect(e) and ag:IsContains(tc) then
Duel.BreakEffect()
Duel.ChangeAttackTarget(tc)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
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