name: Yang
card_text: If a "Yang Zing" monster you control battles an opponent's monster, during damage calculation: Your battling monster's ATK/DEF become double its original ATK/DEF during that damage calculation only, but destroy it at the end of the Damage Step.
external_ids: local SETCARD_ID_0 = 0x9e --Yang
  
lua: local SETCARD_ID_0 = 0x9e --Yang
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at or tc:IsFacedown() or at:IsFacedown() then
  		return false
  	end
  	if tc:IsControler(1 - tp) then
  		tc = at
  	end
  	e:SetLabelObject(tc)
  	return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsSetCard(SETCARD_ID_0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if tc:IsRelateToBattle() and not tc:IsImmuneToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(tc:GetBaseAttack() * 2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e2:SetValue(tc:GetBaseDefense() * 2)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e2)
  		local fid = c:GetFieldID()
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1, fid)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  		e3:SetCode(EVENT_DAMAGE_STEP_END)
  		e3:SetCountLimit(1)
  		e3:SetLabel(fid)
  		e3:SetLabelObject(tc)
  		e3:SetCondition(s.descon)
  		e3:SetOperation(s.desop)
  		e3:SetReset(RESET_PHASE + PHASE_DAMAGE)
  		Duel.RegisterEffect(e3, tp)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if tc:GetFlagEffectLabel(id) == e:GetLabel() then
  		return true
  	else
  		e:Reset()
  		return false
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	Duel.Destroy(tc, REASON_EFFECT)
  end
  
  
source_text: Yang
  If a "Yang Zing" monster you control battles an opponent's monster, during damage calculation: Your battling monster's ATK/DEF become double its original ATK/DEF during that damage calculation only, but destroy it at the end of the Damage Step.
target_text: -- Yang
  local SETCARD_ID_0 = 0x9e --Yang
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at or tc:IsFacedown() or at:IsFacedown() then
  		return false
  	end
  	if tc:IsControler(1 - tp) then
  		tc = at
  	end
  	e:SetLabelObject(tc)
  	return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsSetCard(SETCARD_ID_0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	if tc:IsRelateToBattle() and not tc:IsImmuneToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(tc:GetBaseAttack() * 2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
  		e2:SetValue(tc:GetBaseDefense() * 2)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e2)
  		local fid = c:GetFieldID()
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1, fid)
  		local e3 = Effect.CreateEffect(c)
  		e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
  		e3:SetCode(EVENT_DAMAGE_STEP_END)
  		e3:SetCountLimit(1)
  		e3:SetLabel(fid)
  		e3:SetLabelObject(tc)
  		e3:SetCondition(s.descon)
  		e3:SetOperation(s.desop)
  		e3:SetReset(RESET_PHASE + PHASE_DAMAGE)
  		Duel.RegisterEffect(e3, tp)
  	end
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	if tc:GetFlagEffectLabel(id) == e:GetLabel() then
  		return true
  	else
  		e:Reset()
  		return false
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetLabelObject()
  	Duel.Destroy(tc, REASON_EFFECT)
  end
  
  