name: Shark
card_text: 3 or more (max. 5) Level 3 monsters
  Once per turn: You can detach 1 Xyz Material from this card; place 1 Shark Counter on this card. If this card attacks or is attacked, it gains 1000 ATK for each Shark Counter on it, during the Damage Step only.
external_ids: local COUNTER_ID_0 = 0x2e --Shark
  
lua: local COUNTER_ID_0 = 0x2e --Shark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x2e)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 3, 3, nil, nil, 5)
  	c:EnableReviveLimit()
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.ctcost)
  	e1:SetTarget(s.cttg)
  	e1:SetOperation(s.ctop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  end
  function s.ctcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsCanAddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and (Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler())
  end
  function s.atkval(e, c)
  	return c:GetCounter(COUNTER_ID_0) * 1000
  end
  
  
source_text: Shark
  3 or more (max. 5) Level 3 monsters
  Once per turn: You can detach 1 Xyz Material from this card; place 1 Shark Counter on this card. If this card attacks or is attacked, it gains 1000 ATK for each Shark Counter on it, during the Damage Step only.
target_text: -- Shark
  local COUNTER_ID_0 = 0x2e --Shark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x2e)
  	--xyz summon
  	aux.AddXyzProcedure(c, nil, 3, 3, nil, nil, 5)
  	c:EnableReviveLimit()
  	--counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.ctcost)
  	e1:SetTarget(s.cttg)
  	e1:SetOperation(s.ctop)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetCondition(s.atkcon)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  end
  function s.ctcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():CheckRemoveOverlayCard(tp, 1, REASON_COST)
  	end
  	e:GetHandler():RemoveOverlayCard(tp, 1, 1, REASON_COST)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsCanAddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.atkcon(e)
  	local ph = Duel.GetCurrentPhase()
  	return (ph == PHASE_DAMAGE or ph == PHASE_DAMAGE_CAL) and (Duel.GetAttacker() == e:GetHandler() or Duel.GetAttackTarget() == e:GetHandler())
  end
  function s.atkval(e, c)
  	return c:GetCounter(COUNTER_ID_0) * 1000
  end
  
  