Lineage
Activate only during a turn in which you destroyed a Defense Position monster your opponent controlled. Select 1 Level 8 monster you control. During this turn, the selected monster can attack twice.
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
	if not s.global_check then
		s.global_check = true
		local ge1 = Effect.CreateEffect(c)
		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
		ge1:SetCode(EVENT_DESTROYED)
		ge1:SetOperation(s.checkop)
		Duel.RegisterEffect(ge1, 0)
	end
end
function s.checkop(e, tp, eg, ep, ev, re, r, rp)
	local tc = eg:GetFirst()
	local p1 = false
	local p2 = false
	while tc do
		if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_DEFENSE) then
			if tc:GetReasonPlayer() == 0 and tc:GetPreviousControler() == 1 then
				p1 = true
			end
			if tc:GetReasonPlayer() == 1 and tc:GetPreviousControler() == 0 then
				p2 = true
			end
		end
		tc = eg:GetNext()
	end
	if p1 then
		Duel.RegisterFlagEffect(0, id, RESET_PHASE + PHASE_END, 0, 1)
	end
	if p2 then
		Duel.RegisterFlagEffect(1, id, RESET_PHASE + PHASE_END, 0, 1)
	end
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetFlagEffect(tp, id) ~= 0 and Duel.GetTurnPlayer() == tp and aux.bpcon(e, tp, eg, ep, ev, re, r, rp)
end
function s.filter(c)
	return c:IsFaceup() and c:IsLevelAbove(8) and c:GetEffectCount(EFFECT_EXTRA_ATTACK) == 0
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_EXTRA_ATTACK)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		e1:SetValue(1)
		tc:RegisterEffect(e1)
	end
end


Lineage
Activate only during a turn in which you destroyed a Defense Position monster your opponent controlled. Select 1 Level 8 monster you control. During this turn, the selected monster can attack twice.
-- Lineage
local s, id, o = GetID()
function s.initial_effect(c)
	--Activate
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_ACTIVATE)
	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e1:SetCode(EVENT_FREE_CHAIN)
	e1:SetCondition(s.condition)
	e1:SetTarget(s.target)
	e1:SetOperation(s.activate)
	c:RegisterEffect(e1)
	if not s.global_check then
		s.global_check = true
		local ge1 = Effect.CreateEffect(c)
		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
		ge1:SetCode(EVENT_DESTROYED)
		ge1:SetOperation(s.checkop)
		Duel.RegisterEffect(ge1, 0)
	end
end
function s.checkop(e, tp, eg, ep, ev, re, r, rp)
	local tc = eg:GetFirst()
	local p1 = false
	local p2 = false
	while tc do
		if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_DEFENSE) then
			if tc:GetReasonPlayer() == 0 and tc:GetPreviousControler() == 1 then
				p1 = true
			end
			if tc:GetReasonPlayer() == 1 and tc:GetPreviousControler() == 0 then
				p2 = true
			end
		end
		tc = eg:GetNext()
	end
	if p1 then
		Duel.RegisterFlagEffect(0, id, RESET_PHASE + PHASE_END, 0, 1)
	end
	if p2 then
		Duel.RegisterFlagEffect(1, id, RESET_PHASE + PHASE_END, 0, 1)
	end
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return Duel.GetFlagEffect(tp, id) ~= 0 and Duel.GetTurnPlayer() == tp and aux.bpcon(e, tp, eg, ep, ev, re, r, rp)
end
function s.filter(c)
	return c:IsFaceup() and c:IsLevelAbove(8) and c:GetEffectCount(EFFECT_EXTRA_ATTACK) == 0
end
function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc)
	end
	if chk == 0 then
		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_FACEUP)
	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, nil)
end
function s.activate(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		local e1 = Effect.CreateEffect(e:GetHandler())
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_EXTRA_ATTACK)
		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
		e1:SetValue(1)
		tc:RegisterEffect(e1)
	end
end

