name: Six
card_text: Each time a "Six Samurai" monster(s) is Normal or Special Summoned, place 1 Bushido Counter on this card (max. 2). You can send this card to the GY; draw 1 card for each Bushido Counter on this card.
external_ids: local SETCARD_ID_0 = 0x103d --Six
  local COUNTER_ID_0 = 0x3 --Bushido
  
lua: local SETCARD_ID_0 = 0x103d --Six
  local COUNTER_ID_0 = 0x3 --Bushido
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x3)
  	c:SetCounterLimit(0x3, 2)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--add counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--draw
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DRAW)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCost(s.drcost)
  	e4:SetTarget(s.drtg)
  	e4:SetOperation(s.drop)
  	c:RegisterEffect(e4)
  end
  s.counter_add_list = { 0x3 }
  function s.ctfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	if eg:IsExists(s.ctfilter, 1, nil) then
  		e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.drcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	local ct = e:GetHandler():GetCounter(COUNTER_ID_0)
  	e:SetLabel(ct)
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:GetCounter(COUNTER_ID_0) > 0 and Duel.IsPlayerCanDraw(tp, c:GetCounter(COUNTER_ID_0))
  	end
  	local ct = e:GetLabel()
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(ct)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, ct)
  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
  
  
source_text: Six
  Each time a "Six Samurai" monster(s) is Normal or Special Summoned, place 1 Bushido Counter on this card (max. 2). You can send this card to the GY; draw 1 card for each Bushido Counter on this card.
target_text: -- Six
  local SETCARD_ID_0 = 0x103d --Six
  local COUNTER_ID_0 = 0x3 --Bushido
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x3)
  	c:SetCounterLimit(0x3, 2)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--add counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--draw
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_DRAW)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_SZONE)
  	e4:SetCost(s.drcost)
  	e4:SetTarget(s.drtg)
  	e4:SetOperation(s.drop)
  	c:RegisterEffect(e4)
  end
  s.counter_add_list = { 0x3 }
  function s.ctfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	if eg:IsExists(s.ctfilter, 1, nil) then
  		e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.drcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	local ct = e:GetHandler():GetCounter(COUNTER_ID_0)
  	e:SetLabel(ct)
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.drtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:GetCounter(COUNTER_ID_0) > 0 and Duel.IsPlayerCanDraw(tp, c:GetCounter(COUNTER_ID_0))
  	end
  	local ct = e:GetLabel()
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(ct)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, ct)
  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
  
  