Battle
2 Warrior monsters, including a "Six Samurai" monster
If this card is Link Summoned: You can discard 1 card; add 1 card from your Deck to your hand that has an effect that places a Bushido Counter(s). You can only use this effect of "Battle Shogun of the Six Samurai" once per turn. Each time a "Six Samurai" monster(s) is Normal or Special Summoned to a zone(s) this card points to, place 1 Bushido Counter on this card. Gains 100 ATK for each Bushido Counter on your field.
local SETCARD_ID_0 = 0x103d --Six
local COUNTER_ID_0 = 0x3 --Bushido

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)
	--link summon
	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_WARRIOR), 2, 2, s.lcheck)
	c:EnableReviveLimit()
	--to hand
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.thcon)
	e1:SetCost(s.thcost)
	e1:SetTarget(s.thtg)
	e1:SetOperation(s.thop)
	c:RegisterEffect(e1)
	--counter
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
	e2:SetCode(EVENT_SUMMON_SUCCESS)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.ctcon)
	e2:SetOperation(s.ctop)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
	c:RegisterEffect(e3)
	--atkup
	local e4 = Effect.CreateEffect(c)
	e4:SetType(EFFECT_TYPE_SINGLE)
	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e4:SetCode(EFFECT_UPDATE_ATTACK)
	e4:SetRange(LOCATION_MZONE)
	e4:SetValue(s.atkval)
	c:RegisterEffect(e4)
end
s.counter_add_list = { 0x3 }
function s.lcheck(g, lc)
	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x103d)
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
end
function s.thfilter(c)
	return aux.IsCounterAdded(c, 0x3) and c:IsAbleToHand()
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
	if g:GetCount() > 0 then
		Duel.SendtoHand(g, nil, REASON_EFFECT)
		Duel.ConfirmCards(1 - tp, g)
	end
end
function s.cfilter(c, ec)
	if c:IsLocation(LOCATION_MZONE) then
		return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and ec:GetLinkedGroup():IsContains(c)
	else
		return c:IsPreviousSetCard(SETCARD_ID_0) and c:IsPreviousPosition(POS_FACEUP) and bit.extract(ec:GetLinkedZone(c:GetPreviousControler()), c:GetPreviousSequence()) ~= 0
	end
end
function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.cfilter, 1, nil, e:GetHandler())
end
function s.ctop(e, tp, eg, ep, ev, re, r, rp)
	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
end
function s.atkval(e, c)
	return Duel.GetCounter(c:GetControler(), 1, 0, COUNTER_ID_0) * 100
end


Battle
2 Warrior monsters, including a "Six Samurai" monster
If this card is Link Summoned: You can discard 1 card; add 1 card from your Deck to your hand that has an effect that places a Bushido Counter(s). You can only use this effect of "Battle Shogun of the Six Samurai" once per turn. Each time a "Six Samurai" monster(s) is Normal or Special Summoned to a zone(s) this card points to, place 1 Bushido Counter on this card. Gains 100 ATK for each Bushido Counter on your field.
-- Battle
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)
	--link summon
	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkRace, RACE_WARRIOR), 2, 2, s.lcheck)
	c:EnableReviveLimit()
	--to hand
	local e1 = Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(id, 0))
	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e1:SetProperty(EFFECT_FLAG_DELAY)
	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
	e1:SetCountLimit(1, id)
	e1:SetCondition(s.thcon)
	e1:SetCost(s.thcost)
	e1:SetTarget(s.thtg)
	e1:SetOperation(s.thop)
	c:RegisterEffect(e1)
	--counter
	local e2 = Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
	e2:SetCode(EVENT_SUMMON_SUCCESS)
	e2:SetRange(LOCATION_MZONE)
	e2:SetCondition(s.ctcon)
	e2:SetOperation(s.ctop)
	c:RegisterEffect(e2)
	local e3 = e2:Clone()
	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
	c:RegisterEffect(e3)
	--atkup
	local e4 = Effect.CreateEffect(c)
	e4:SetType(EFFECT_TYPE_SINGLE)
	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
	e4:SetCode(EFFECT_UPDATE_ATTACK)
	e4:SetRange(LOCATION_MZONE)
	e4:SetValue(s.atkval)
	c:RegisterEffect(e4)
end
s.counter_add_list = { 0x3 }
function s.lcheck(g, lc)
	return g:IsExists(Card.IsLinkSetCard, 1, nil, 0x103d)
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK)
end
function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(Card.IsDiscardable, tp, LOCATION_HAND, 0, 1, nil)
	end
	Duel.DiscardHand(tp, Card.IsDiscardable, 1, 1, REASON_COST + REASON_DISCARD)
end
function s.thfilter(c)
	return aux.IsCounterAdded(c, 0x3) and c:IsAbleToHand()
end
function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
end
function s.thop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
	if g:GetCount() > 0 then
		Duel.SendtoHand(g, nil, REASON_EFFECT)
		Duel.ConfirmCards(1 - tp, g)
	end
end
function s.cfilter(c, ec)
	if c:IsLocation(LOCATION_MZONE) then
		return c:IsSetCard(SETCARD_ID_0) and c:IsFaceup() and ec:GetLinkedGroup():IsContains(c)
	else
		return c:IsPreviousSetCard(SETCARD_ID_0) and c:IsPreviousPosition(POS_FACEUP) and bit.extract(ec:GetLinkedZone(c:GetPreviousControler()), c:GetPreviousSequence()) ~= 0
	end
end
function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
	return eg:IsExists(s.cfilter, 1, nil, e:GetHandler())
end
function s.ctop(e, tp, eg, ep, ev, re, r, rp)
	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
end
function s.atkval(e, c)
	return Duel.GetCounter(c:GetControler(), 1, 0, COUNTER_ID_0) * 100
end

