name: Double
card_text: When a monster's attack is negated: Target that monster; it can make a second attack during this Battle Phase, and if it does, its ATK is doubled during the Damage Step only.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_DISABLED)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc == eg:GetFirst()
  	end
  	if chk == 0 then
  		return eg:GetFirst():IsFaceup() and eg:GetFirst():IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(eg:GetFirst())
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetFlagEffect(id) == 0 then
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE, 0, 1)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EXTRA_ATTACK)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e2:SetCondition(s.atkcon)
  		e2:SetValue(s.atkval)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	if (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and Duel.GetAttacker() == e:GetHandler() then
  		e:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE + PHASE_BATTLE)
  		return true
  	end
  	return false
  end
  function s.atkval(e, c)
  	return e:GetHandler():GetAttack() * 2
  end
  
  
source_text: Double
  When a monster's attack is negated: Target that monster; it can make a second attack during this Battle Phase, and if it does, its ATK is doubled during the Damage Step only.
target_text: -- Double
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_ATKCHANGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_ATTACK_DISABLED)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc == eg:GetFirst()
  	end
  	if chk == 0 then
  		return eg:GetFirst():IsFaceup() and eg:GetFirst():IsCanBeEffectTarget(e)
  	end
  	Duel.SetTargetCard(eg:GetFirst())
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetFlagEffect(id) == 0 then
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE, 0, 1)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_EXTRA_ATTACK)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  		e2:SetRange(LOCATION_MZONE)
  		e2:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e2:SetCondition(s.atkcon)
  		e2:SetValue(s.atkval)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	if (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and Duel.GetAttacker() == e:GetHandler() then
  		e:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE + PHASE_BATTLE)
  		return true
  	end
  	return false
  end
  function s.atkval(e, c)
  	return e:GetHandler():GetAttack() * 2
  end
  
  