name: Link
card_text: 2 Cyberse monsters
  Once per turn, at the end of the Damage Step, if your monster this card points to attacked an opponent's Link Monster: You can activate this effect; the monster that attacked gains 1 additional attack on an opponent's Link Monster during this Battle Phase for each Link Monster you currently control, except this card. Your monsters (except that monster) cannot attack the turn you activate this effect.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_CYBERSE), 2, 2)
  	--extra attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if a:IsControler(1 - tp) then
  		return false
  	end
  	local lg = e:GetHandler():GetLinkedGroup()
  	local d = a:GetBattleTarget()
  	return lg:IsContains(a) and d and d:IsControler(1 - tp)
  end
  function s.oathfilter(c)
  	return c:GetAttackAnnouncedCount() > 0
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local a = Duel.GetAttacker()
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not Duel.IsExistingMatchingCard(s.oathfilter, tp, LOCATION_MZONE, 0, 1, a)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_OATH + EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.ftarget)
  	e1:SetLabel(a:GetFieldID())
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFieldID()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_MZONE, 0, e:GetHandler(), TYPE_LINK) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local gc = Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_MZONE, 0, aux.ExceptThisCard(e), TYPE_LINK)
  	if gc == 0 then
  		return
  	end
  	local a = Duel.GetAttacker()
  	if a:IsRelateToBattle() and a:IsFaceup() then
  		local e0 = Effect.CreateEffect(c)
  		e0:SetType(EFFECT_TYPE_SINGLE)
  		e0:SetCode(EFFECT_EXTRA_ATTACK_MONSTER)
  		e0:SetValue(gc)
  		e0:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		a:RegisterEffect(e0)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  		e1:SetValue(s.atklimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		a:RegisterEffect(e1)
  	end
  end
  function s.atklimit(e, c)
  	return not c:IsType(TYPE_LINK)
  end
  
  
source_text: Link
  2 Cyberse monsters
  Once per turn, at the end of the Damage Step, if your monster this card points to attacked an opponent's Link Monster: You can activate this effect; the monster that attacked gains 1 additional attack on an opponent's Link Monster during this Battle Phase for each Link Monster you currently control, except this card. Your monsters (except that monster) cannot attack the turn you activate this effect.
target_text: -- Link
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	c:EnableReviveLimit()
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_CYBERSE), 2, 2)
  	--extra attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_DAMAGE_STEP_END)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local a = Duel.GetAttacker()
  	if a:IsControler(1 - tp) then
  		return false
  	end
  	local lg = e:GetHandler():GetLinkedGroup()
  	local d = a:GetBattleTarget()
  	return lg:IsContains(a) and d and d:IsControler(1 - tp)
  end
  function s.oathfilter(c)
  	return c:GetAttackAnnouncedCount() > 0
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local a = Duel.GetAttacker()
  	local c = e:GetHandler()
  	if chk == 0 then
  		return not Duel.IsExistingMatchingCard(s.oathfilter, tp, LOCATION_MZONE, 0, 1, a)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ATTACK)
  	e1:SetProperty(EFFECT_FLAG_OATH + EFFECT_FLAG_IGNORE_IMMUNE)
  	e1:SetTargetRange(LOCATION_MZONE, 0)
  	e1:SetTarget(s.ftarget)
  	e1:SetLabel(a:GetFieldID())
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.ftarget(e, c)
  	return e:GetLabel() ~= c:GetFieldID()
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_MZONE, 0, e:GetHandler(), TYPE_LINK) > 0
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local gc = Duel.GetMatchingGroupCount(Card.IsType, tp, LOCATION_MZONE, 0, aux.ExceptThisCard(e), TYPE_LINK)
  	if gc == 0 then
  		return
  	end
  	local a = Duel.GetAttacker()
  	if a:IsRelateToBattle() and a:IsFaceup() then
  		local e0 = Effect.CreateEffect(c)
  		e0:SetType(EFFECT_TYPE_SINGLE)
  		e0:SetCode(EFFECT_EXTRA_ATTACK_MONSTER)
  		e0:SetValue(gc)
  		e0:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		a:RegisterEffect(e0)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
  		e1:SetValue(s.atklimit)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_BATTLE)
  		a:RegisterEffect(e1)
  	end
  end
  function s.atklimit(e, c)
  	return not c:IsType(TYPE_LINK)
  end
  
  