name: Signal
card_text: 1 Tuner + 1+ non-Tuner monsters
  Once per turn, during the Standby Phase: Place 1 Signal Counter on each face-up card in the Field Zone, also place 1 on this card. This card with a Signal Counter(s) cannot be destroyed by battle or your opponent's card effects. Once per turn: You can remove 4, 7, or 10 Signal Counters from anywhere on the field; apply this effect, depending on the number removed.
  ● 4: Inflict 800 damage to your opponent.
  ● 7: Draw 1 card.
  ● 10: Destroy 1 card on the field.
external_ids: local COUNTER_ID_0 = 0x104d --Signal
  
lua: local COUNTER_ID_0 = 0x104d --Signal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	c:EnableReviveLimit()
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	--Add counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_FIELD)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetOperation(s.ctop)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetCondition(s.incon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetValue(aux.indoval)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e4:SetCost(s.ctcost(4))
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  	--draw
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_DRAW)
  	e5:SetDescription(aux.Stringid(id, 2))
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e5:SetCost(s.ctcost(7))
  	e5:SetTarget(s.drtg)
  	e5:SetOperation(s.drop)
  	c:RegisterEffect(e5)
  	--destroy
  	local e6 = Effect.CreateEffect(c)
  	e6:SetCategory(CATEGORY_DESTROY)
  	e6:SetDescription(aux.Stringid(id, 3))
  	e6:SetType(EFFECT_TYPE_IGNITION)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e6:SetCost(s.ctcost(10))
  	e6:SetTarget(s.destg)
  	e6:SetOperation(s.desop)
  	c:RegisterEffect(e6)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetFieldGroup(tp, LOCATION_FZONE, LOCATION_FZONE)
  	if c:IsRelateToEffect(e) then
  		g:AddCard(c)
  	end
  	for tc in aux.Next(g) do
  		if tc:IsCanAddCounter(COUNTER_ID_0, 1) then
  			tc:AddCounter(COUNTER_ID_0, 1)
  		end
  	end
  end
  function s.incon(e)
  	return e:GetHandler():GetCounter(COUNTER_ID_0) > 0
  end
  function s.ctcost(ct)
  	return function(e, tp, eg, ep, ev, re, r, rp, chk)
  		if chk == 0 then
  			return Duel.IsCanRemoveCounter(tp, 1, 1, COUNTER_ID_0, ct, REASON_COST)
  		end
  		Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  		Duel.RemoveCounter(tp, 1, 1, COUNTER_ID_0, ct, REASON_COST)
  	end
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(800)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 800)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	if #g > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Signal
  1 Tuner + 1+ non-Tuner monsters
  Once per turn, during the Standby Phase: Place 1 Signal Counter on each face-up card in the Field Zone, also place 1 on this card. This card with a Signal Counter(s) cannot be destroyed by battle or your opponent's card effects. Once per turn: You can remove 4, 7, or 10 Signal Counters from anywhere on the field; apply this effect, depending on the number removed.
  ● 4: Inflict 800 damage to your opponent.
  ● 7: Draw 1 card.
  ● 10: Destroy 1 card on the field.
target_text: -- Signal
  local COUNTER_ID_0 = 0x104d --Signal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	c:EnableReviveLimit()
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	--Add counter
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_COUNTER)
  	e1:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_FIELD)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetOperation(s.ctop)
  	c:RegisterEffect(e1)
  	--indes
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e2:SetCondition(s.incon)
  	e2:SetValue(1)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetValue(aux.indoval)
  	c:RegisterEffect(e3)
  	--damage
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DAMAGE)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e4:SetCost(s.ctcost(4))
  	e4:SetTarget(s.damtg)
  	e4:SetOperation(s.damop)
  	c:RegisterEffect(e4)
  	--draw
  	local e5 = Effect.CreateEffect(c)
  	e5:SetCategory(CATEGORY_DRAW)
  	e5:SetDescription(aux.Stringid(id, 2))
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_MZONE)
  	e5:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e5:SetCost(s.ctcost(7))
  	e5:SetTarget(s.drtg)
  	e5:SetOperation(s.drop)
  	c:RegisterEffect(e5)
  	--destroy
  	local e6 = Effect.CreateEffect(c)
  	e6:SetCategory(CATEGORY_DESTROY)
  	e6:SetDescription(aux.Stringid(id, 3))
  	e6:SetType(EFFECT_TYPE_IGNITION)
  	e6:SetRange(LOCATION_MZONE)
  	e6:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e6:SetCost(s.ctcost(10))
  	e6:SetTarget(s.destg)
  	e6:SetOperation(s.desop)
  	c:RegisterEffect(e6)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local g = Duel.GetFieldGroup(tp, LOCATION_FZONE, LOCATION_FZONE)
  	if c:IsRelateToEffect(e) then
  		g:AddCard(c)
  	end
  	for tc in aux.Next(g) do
  		if tc:IsCanAddCounter(COUNTER_ID_0, 1) then
  			tc:AddCounter(COUNTER_ID_0, 1)
  		end
  	end
  end
  function s.incon(e)
  	return e:GetHandler():GetCounter(COUNTER_ID_0) > 0
  end
  function s.ctcost(ct)
  	return function(e, tp, eg, ep, ev, re, r, rp, chk)
  		if chk == 0 then
  			return Duel.IsCanRemoveCounter(tp, 1, 1, COUNTER_ID_0, ct, REASON_COST)
  		end
  		Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  		Duel.RemoveCounter(tp, 1, 1, COUNTER_ID_0, ct, REASON_COST)
  	end
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(800)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 800)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectMatchingCard(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
  	if #g > 0 then
  		Duel.HintSelection(g)
  		Duel.Destroy(g, REASON_EFFECT)
  	end
  end
  
  