Skip to content

Duel.ChangeAttackTarget ​

Signature ​

lua
Duel.ChangeAttackTarget(Card|nil target) -> bool

Description ​

Changes the current attack target to target, or to a direct attack when target is nil, and returns whether the change succeeded. The current attacker must exist, be able to attack, and not have its attack canceled. A card target must be one of the current legal attack targets; direct attack requires that the attacker is not forbidden from attacking directly.

Parameters ​

  • target Card|nil

Returns ​

  • bool

Source ​

  • D:\Programs\GitHub\ygopro-core\libduel.cpp:4920

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 27 indexed script(s).
  • Search this function in the Script Explorer with Duel.ChangeAttackTarget.
CardIDScriptDetected Calls
X-Saber Gottoms8252010Scripts/c8252010.lua1
Galactikuriboh46261704Scripts/c46261704.lua1
Apple Magician Girl56132807Scripts/c56132807.lua1
Mermail Abysstrite59170782Scripts/c59170782.lua1
Ultimate Divine-Beast32247099Scripts/c32247099.lua1
Chocolate Magician Girl7198399Scripts/c7198399.lua1
Subterror Nemesis Defender68823957Scripts/c68823957.lua1
Blackwing Tamer - Obsidian Hawk Joe81983656Scripts/c81983656.lua1
Puppet Rook77590412Scripts/c77590412.lua1
Lemon Magician Girl34318086Scripts/c34318086.lua1
Krystal Avatar20960340Scripts/c20960340.lua1
Clear Kuriboh46613515Scripts/c46613515.lua1
Shift59560625Scripts/c59560625.lua1
White Night Dragon79473793Scripts/c79473793.lua1
Roulette Spider36708764Scripts/c36708764.lua1
Card Blocker42256406Scripts/c42256406.lua1
Dark Angel28593329Scripts/c28593329.lua1
Neo-Spacian Twinkle Moss13857930Scripts/c13857930.lua1
Neo-Spacian Glow Moss17732278Scripts/c17732278.lua1
Staunch Defender92854392Scripts/c92854392.lua1
Ghost Gardna59965151Scripts/c59965151.lua1
Jam Defender21558682Scripts/c21558682.lua1
Crystal Beast Amber Mammoth69937550Scripts/c69937550.lua1
Doble Passe79997591Scripts/c79997591.lua1
...and 3 more

Script Examples ​

X-Saber Gottoms (8252010) ​

Source: Scripts/c8252010.lua

lua
		and a:IsAttackable() and a:IsRelateToBattle() and not a:IsImmuneToEffect(e) then
		Duel.BreakEffect()
		Duel.ChangeAttackTarget(c)
	end
end

Galactikuriboh (46261704) ​

Source: Scripts/c46261704.lua

lua
			Duel.BreakEffect()
			local mg=Duel.GetMatchingGroup(c46261704.mfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
			if Duel.ChangeAttackTarget(tc) and mg:GetCount()>0
				and c:IsRelateToChain() and c:IsLocation(LOCATION_GRAVE) and aux.NecroValleyFilter()(c)
				and c:IsCanOverlay() and Duel.SelectYesNo(tp,aux.Stringid(46261704,2)) then

Apple Magician Girl (56132807) ​

Source: Scripts/c56132807.lua

lua
		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)