Awakening
You can Special Summon this card (from your hand or Deck) by sending 1 face-up Spellcaster monster and 1 face-up Level 4 or lower FIRE monster you control to the GY. You can only use each of the following effects of "Awakening of the Possessed - Greater Inari Fire" once per turn.
● When this card is Special Summoned by its effect: You can inflict damage to your opponent equal to the original ATK of 1 monster they control (your choice).
● If this card is sent from the field to the GY: You can add 1 "Spiritual Fire Art" card or 1 "Possessed" Spell/Trap from your Deck to your hand.
local SETCARD_ID_0 = 0xc0 --Possessed

local SETCARD_ID_0 = 0xc0 --Possessed
local s, id, o = GetID()
function s.initial_effect(c)
	--spsummon proc
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_SPSUMMON_PROC)
	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
	e1:SetRange(LOCATION_HAND + LOCATION_DECK)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	e1:SetValue(SUMMON_VALUE_SELF)
	c:RegisterEffect(e1)
	--damage
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_DAMAGE)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetCountLimit(1, id)
	e2:SetCondition(s.condition)
	e2:SetTarget(s.dmtg)
	e2:SetOperation(s.dmop)
	c:RegisterEffect(e2)
	--search
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 1))
	e3:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetProperty(EFFECT_FLAG_DELAY)
	e3:SetCode(EVENT_TO_GRAVE)
	e3:SetCountLimit(1, id + 1)
	e3:SetCondition(s.thcon)
	e3:SetTarget(s.thtg)
	e3:SetOperation(s.thop)
	c:RegisterEffect(e3)
end
function s.spfilter(c)
	return c:IsFaceup() and c:IsAbleToGraveAsCost()
end
function s.spfilter2(c)
	return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsLevelBelow(4)
end
function s.fselect(g, tp)
	return aux.mzctcheck(g, tp) and aux.gffcheck(g, Card.IsRace, RACE_SPELLCASTER, s.spfilter2, nil)
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_MZONE, 0, nil)
	return g:CheckSubGroup(s.fselect, 2, 2, tp)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_MZONE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local sg = g:SelectSubGroup(tp, s.fselect, true, 2, 2, tp)
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local g = e:GetLabelObject()
	Duel.SendtoGrave(g, REASON_SPSUMMON)
	g:DeleteGroup()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():GetSummonType() == SUMMON_TYPE_SPECIAL + SUMMON_VALUE_SELF
end
function s.dmfilter(c)
	return c:IsFaceup() and c:GetBaseAttack() > 0
end
function s.dmtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.dmfilter, tp, 0, LOCATION_MZONE, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
end
function s.dmop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPPO)
	local g = Duel.SelectMatchingCard(tp, s.dmfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
	local tc = g:GetFirst()
	if tc then
		Duel.HintSelection(g)
		Duel.Damage(1 - tp, tc:GetBaseAttack(), REASON_EFFECT)
	end
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function s.thfilter(c)
	return ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP)) or c:IsSetCard(0x614c)) 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


Awakening
You can Special Summon this card (from your hand or Deck) by sending 1 face-up Spellcaster monster and 1 face-up Level 4 or lower FIRE monster you control to the GY. You can only use each of the following effects of "Awakening of the Possessed - Greater Inari Fire" once per turn.
● When this card is Special Summoned by its effect: You can inflict damage to your opponent equal to the original ATK of 1 monster they control (your choice).
● If this card is sent from the field to the GY: You can add 1 "Spiritual Fire Art" card or 1 "Possessed" Spell/Trap from your Deck to your hand.
-- Awakening
local SETCARD_ID_0 = 0xc0 --Possessed
local s, id, o = GetID()
function s.initial_effect(c)
	--spsummon proc
	local e1 = Effect.CreateEffect(c)
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetCode(EFFECT_SPSUMMON_PROC)
	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
	e1:SetRange(LOCATION_HAND + LOCATION_DECK)
	e1:SetCondition(s.spcon)
	e1:SetTarget(s.sptg)
	e1:SetOperation(s.spop)
	e1:SetValue(SUMMON_VALUE_SELF)
	c:RegisterEffect(e1)
	--damage
	local e2 = Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(id, 0))
	e2:SetCategory(CATEGORY_DAMAGE)
	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
	e2:SetCountLimit(1, id)
	e2:SetCondition(s.condition)
	e2:SetTarget(s.dmtg)
	e2:SetOperation(s.dmop)
	c:RegisterEffect(e2)
	--search
	local e3 = Effect.CreateEffect(c)
	e3:SetDescription(aux.Stringid(id, 1))
	e3:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
	e3:SetProperty(EFFECT_FLAG_DELAY)
	e3:SetCode(EVENT_TO_GRAVE)
	e3:SetCountLimit(1, id + 1)
	e3:SetCondition(s.thcon)
	e3:SetTarget(s.thtg)
	e3:SetOperation(s.thop)
	c:RegisterEffect(e3)
end
function s.spfilter(c)
	return c:IsFaceup() and c:IsAbleToGraveAsCost()
end
function s.spfilter2(c)
	return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsLevelBelow(4)
end
function s.fselect(g, tp)
	return aux.mzctcheck(g, tp) and aux.gffcheck(g, Card.IsRace, RACE_SPELLCASTER, s.spfilter2, nil)
end
function s.spcon(e, c)
	if c == nil then
		return true
	end
	local tp = c:GetControler()
	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_MZONE, 0, nil)
	return g:CheckSubGroup(s.fselect, 2, 2, tp)
end
function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
	local g = Duel.GetMatchingGroup(s.spfilter, tp, LOCATION_MZONE, 0, nil)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
	local sg = g:SelectSubGroup(tp, s.fselect, true, 2, 2, tp)
	if sg then
		sg:KeepAlive()
		e:SetLabelObject(sg)
		return true
	else
		return false
	end
end
function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
	local g = e:GetLabelObject()
	Duel.SendtoGrave(g, REASON_SPSUMMON)
	g:DeleteGroup()
end
function s.condition(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():GetSummonType() == SUMMON_TYPE_SPECIAL + SUMMON_VALUE_SELF
end
function s.dmfilter(c)
	return c:IsFaceup() and c:GetBaseAttack() > 0
end
function s.dmtg(e, tp, eg, ep, ev, re, r, rp, chk)
	if chk == 0 then
		return Duel.IsExistingMatchingCard(s.dmfilter, tp, 0, LOCATION_MZONE, 1, nil)
	end
	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
end
function s.dmop(e, tp, eg, ep, ev, re, r, rp)
	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_OPPO)
	local g = Duel.SelectMatchingCard(tp, s.dmfilter, tp, 0, LOCATION_MZONE, 1, 1, nil)
	local tc = g:GetFirst()
	if tc then
		Duel.HintSelection(g)
		Duel.Damage(1 - tp, tc:GetBaseAttack(), REASON_EFFECT)
	end
end
function s.thcon(e, tp, eg, ep, ev, re, r, rp)
	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function s.thfilter(c)
	return ((c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP)) or c:IsSetCard(0x614c)) 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

