Elemental
2 "HERO" monsters with different Attributes
Must be Fusion Summoned. Monsters you control gain 200 ATK for each different Attribute you control. You can only use each of the following effects of "Elemental HERO Sunrise" once per turn.
��If this card is Special Summoned: You can add 1 "Miracle Fusion" from your Deck to your hand.
��When an attack is declared involving another "HERO" monster you control: You can target 1 card on the field; destroy it.
local CARD_ID_1 = 45906428 --Miracle Fusion
local SETCARD_ID_0 = 0x8 --HERO

local CARD_ID_1 = 45906428 --Miracle Fusion
local SETCARD_ID_0 = 0x8 --HERO
local s, id, o = GetID()
function s.initial_effect(c)
	--fusion material
	c:EnableReviveLimit()
	aux.AddFusionProcFunRep(c, s.ffilter, 2, true)
	--spsummon condition
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
	e1:SetValue(aux.fuslimit)
	c:RegisterEffect(e1)
	--search
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetCountLimit(1, id)
	e2:SetTarget(s.srtg)
	e2:SetOperation(s.srop)
	c:RegisterEffect(e2)
	--atk up
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_UPDATE_ATTACK)
	e3:SetRange(LOCATION_MZONE)
	e3:SetTargetRange(LOCATION_MZONE, 0)
	e3:SetValue(s.val)
	c:RegisterEffect(e3)
	--destroy
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 1))
	e4:SetCategory(CATEGORY_DESTROY)
	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e4:SetCode(EVENT_ATTACK_ANNOUNCE)
	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e4:SetRange(LOCATION_MZONE)
	e4:SetCountLimit(1, id + 1)
	e4:SetCondition(s.descon)
	e4:SetTarget(s.destg)
	e4:SetOperation(s.desop)
	c:RegisterEffect(e4)
end
s.material_setcode = 0x8
function s.ffilter(c, fc, sub, mg, sg)
	return c:IsFusionSetCard(SETCARD_ID_0) and (not sg or not sg:IsExists(Card.IsFusionAttribute, 1, c, c:GetFusionAttribute()))
end
function s.srfilter(c)
	return c:IsCode(CARD_ID_1) and c:IsAbleToHand()
end
function s.srtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.srfilter, tp, LOCATION_DECK, 0, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
end
function s.srop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectMatchingCard(tp, s.srfilter, 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.atkfilter(c)
	return c:IsFaceup() and c:GetAttribute() ~= 0
end
function s.val(e, c)
	local g = Duel.GetMatchingGroup(s.atkfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, nil)
	return aux.GetAttributeCount(g) * 200
end
function s.descon(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ac = Duel.GetAttacker()
	local tc = Duel.GetAttackTarget()
	if not ac:IsControler(tp) then
		ac, tc = tc, ac
	end
	return ac and ac:IsControler(tp) and ac:IsFaceup() and ac:IsSetCard(SETCARD_ID_0) and ac ~= c
end
function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsOnField()
	end
	if chk == 0 then
		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.Destroy(tc, REASON_EFFECT)
	end
end


Elemental
2 "HERO" monsters with different Attributes
Must be Fusion Summoned. Monsters you control gain 200 ATK for each different Attribute you control. You can only use each of the following effects of "Elemental HERO Sunrise" once per turn.
��If this card is Special Summoned: You can add 1 "Miracle Fusion" from your Deck to your hand.
��When an attack is declared involving another "HERO" monster you control: You can target 1 card on the field; destroy it.
-- Elemental
local CARD_ID_1 = 45906428 --Miracle Fusion
local SETCARD_ID_0 = 0x8 --HERO
local s, id, o = GetID()
function s.initial_effect(c)
	--fusion material
	c:EnableReviveLimit()
	aux.AddFusionProcFunRep(c, s.ffilter, 2, true)
	--spsummon condition
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_SINGLE)
	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
	e1:SetValue(aux.fuslimit)
	c:RegisterEffect(e1)
	--search
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_SEARCH + CATEGORY_TOHAND)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetProperty(EFFECT_FLAG_DELAY)
	e2:SetCountLimit(1, id)
	e2:SetTarget(s.srtg)
	e2:SetOperation(s.srop)
	c:RegisterEffect(e2)
	--atk up
	local e3 = Effect.CreateEffect(c)
	e3:SetType(EFFECT_TYPE_FIELD)
	e3:SetCode(EFFECT_UPDATE_ATTACK)
	e3:SetRange(LOCATION_MZONE)
	e3:SetTargetRange(LOCATION_MZONE, 0)
	e3:SetValue(s.val)
	c:RegisterEffect(e3)
	--destroy
	local e4 = Effect.CreateEffect(c)
	e4:SetDescription(aux.Stringid(id, 1))
	e4:SetCategory(CATEGORY_DESTROY)
	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
	e4:SetCode(EVENT_ATTACK_ANNOUNCE)
	e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
	e4:SetRange(LOCATION_MZONE)
	e4:SetCountLimit(1, id + 1)
	e4:SetCondition(s.descon)
	e4:SetTarget(s.destg)
	e4:SetOperation(s.desop)
	c:RegisterEffect(e4)
end
s.material_setcode = 0x8
function s.ffilter(c, fc, sub, mg, sg)
	return c:IsFusionSetCard(SETCARD_ID_0) and (not sg or not sg:IsExists(Card.IsFusionAttribute, 1, c, c:GetFusionAttribute()))
end
function s.srfilter(c)
	return c:IsCode(CARD_ID_1) and c:IsAbleToHand()
end
function s.srtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.srfilter, tp, LOCATION_DECK, 0, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
end
function s.srop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
	local g = Duel.SelectMatchingCard(tp, s.srfilter, 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.atkfilter(c)
	return c:IsFaceup() and c:GetAttribute() ~= 0
end
function s.val(e, c)
	local g = Duel.GetMatchingGroup(s.atkfilter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, nil)
	return aux.GetAttributeCount(g) * 200
end
function s.descon(e, tp, eg, ep, ev, re, r, rp)
	local c = e:GetHandler()
	local ac = Duel.GetAttacker()
	local tc = Duel.GetAttackTarget()
	if not ac:IsControler(tp) then
		ac, tc = tc, ac
	end
	return ac and ac:IsControler(tp) and ac:IsFaceup() and ac:IsSetCard(SETCARD_ID_0) and ac ~= c
end
function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
	if chkc then
		return chkc:IsOnField()
	end
	if chk == 0 then
		return Duel.IsExistingTarget(aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, nil)
	end
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
	local g = Duel.SelectTarget(tp, aux.TRUE, tp, LOCATION_ONFIELD, LOCATION_ONFIELD, 1, 1, nil)
	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 1, 0, 0)
end
function s.desop(e, tp, eg, ep, ev, re, r, rp)
	local tc = Duel.GetFirstTarget()
	if tc:IsRelateToEffect(e) then
		Duel.Destroy(tc, REASON_EFFECT)
	end
end

