name: Star
card_text: During damage calculation, if your Link Monster battles an opponent's monster: Your monster gains ATK equal to the total Levels/Ranks of the monsters it points to x 400, during that damage calculation only. You can only activate 1 "Star Power!!" per turn.
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_PRE_DAMAGE_CALCULATE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.lv_or_rk(c)
  	if c:IsType(TYPE_XYZ) then
  		return c:GetRank()
  	else
  		return c:GetLevel()
  	end
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at then
  		return false
  	end
  	if tc:IsControler(1 - tp) then
  		tc = at
  	end
  	e:SetLabelObject(tc)
  	local lg = tc:GetLinkedGroup()
  	return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsType(TYPE_LINK) and lg and lg:GetSum(s.lv_or_rk) > 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	local lg = tc:GetLinkedGroup()
  	if tc:IsControler(tp) and tc:IsRelateToBattle() and lg then
  		local atk = lg:GetSum(s.lv_or_rk)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(atk * 400)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e1)
  	end
  end
  
  
source_text: Star
  During damage calculation, if your Link Monster battles an opponent's monster: Your monster gains ATK equal to the total Levels/Ranks of the monsters it points to x 400, during that damage calculation only. You can only activate 1 "Star Power!!" per turn.
target_text: -- Star
  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_PRE_DAMAGE_CALCULATE)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.lv_or_rk(c)
  	if c:IsType(TYPE_XYZ) then
  		return c:GetRank()
  	else
  		return c:GetLevel()
  	end
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if not at then
  		return false
  	end
  	if tc:IsControler(1 - tp) then
  		tc = at
  	end
  	e:SetLabelObject(tc)
  	local lg = tc:GetLinkedGroup()
  	return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsType(TYPE_LINK) and lg and lg:GetSum(s.lv_or_rk) > 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = e:GetLabelObject()
  	local lg = tc:GetLinkedGroup()
  	if tc:IsControler(tp) and tc:IsRelateToBattle() and lg then
  		local atk = lg:GetSum(s.lv_or_rk)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(atk * 400)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_DAMAGE_CAL)
  		tc:RegisterEffect(e1)
  	end
  end
  
  