Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Chain (of 2 or more Links) occurred in your Main Phase 1, this card can attack twice during the Battle Phase this turn.
--コンボマスター
--Combo Master
local s,id=GetID()
function s.initial_effect(c)
	--chain
	local e1=Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetRange(LOCATION_MZONE)
	e1:SetOperation(s.chop)
	c:RegisterEffect(e1)
	--atk
	local e2=Effect.CreateEffect(c)
	e2:SetType(EFFECT_TYPE_SINGLE)
	e2:SetCode(EFFECT_EXTRA_ATTACK)
	e2:SetCondition(s.atkcon)
	e2:SetValue(1)
	c:RegisterEffect(e2)
end
function s.chop(e,tp,eg,ep,ev,re,r,rp)
	if Duel.IsPhase(PHASE_MAIN1) and Duel.IsTurnPlayer(tp) and Duel.GetCurrentChain()>1
		and e:GetHandler():GetFlagEffect(id)==0 then
		e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
	end
end
function s.atkcon(e)
	return e:GetHandler():GetFlagEffect(id)~=0
end