name: Armityle
card_text: "Uria, Lord of Searing Flames" + "Hamon, Lord of Striking Thunder" + "Raviel, Lord of Phantasms"
  This card's name becomes "Armityle the Chaos Phantasm" while on the field. Once per turn, during your Main Phase: You can give control of this card to your opponent. Once per turn, during the End Phase, if this card's control was changed this turn: Banish all cards you control, then the owner of this card can Special Summon 1 "Armityle the Chaos Phantasm" from their Extra Deck, ignoring its Summoning conditions.
external_ids: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 43378048 --Armityle the Chaos Phantasm
  
lua: local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 43378048 --Armityle the Chaos Phantasm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_2, CARD_ID_1, CARD_ID_0, true, true)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_3)
  	--control
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_CONTROL)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.cttg)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CONTROL_CHANGED)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetOperation(s.regop)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_PHASE + PHASE_END)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCondition(s.rmcon)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.GetControl(c, 1 - tp)
  	end
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  end
  function s.spfilter(c, e, p)
  	return c:IsCode(CARD_ID_3) and c:IsCanBeSpecialSummoned(e, 0, p, true, false) and Duel.GetLocationCountFromEx(p, p, nil, c) > 0
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local p = e:GetHandler():GetOwner()
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, nil)
  	if
  		#g > 0
  		and Duel.Remove(g, POS_FACEUP, REASON_EFFECT) ~= 0
  		and g:IsExists(Card.IsLocation, 1, nil, LOCATION_REMOVED)
  		and Duel.IsExistingMatchingCard(s.spfilter, p, LOCATION_EXTRA, 0, 1, nil, e, p)
  		and Duel.SelectYesNo(p, aux.Stringid(id, 2))
  	then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(p, s.spfilter, p, LOCATION_EXTRA, 0, 1, 1, nil, e, p)
  		Duel.SpecialSummon(sg, 0, p, p, true, false, POS_FACEUP)
  	end
  end
  
  
source_text: Armityle
  "Uria, Lord of Searing Flames" + "Hamon, Lord of Striking Thunder" + "Raviel, Lord of Phantasms"
  This card's name becomes "Armityle the Chaos Phantasm" while on the field. Once per turn, during your Main Phase: You can give control of this card to your opponent. Once per turn, during the End Phase, if this card's control was changed this turn: Banish all cards you control, then the owner of this card can Special Summon 1 "Armityle the Chaos Phantasm" from their Extra Deck, ignoring its Summoning conditions.
target_text: -- Armityle
  local CARD_ID_0 = 69890967 --Raviel, Lord of Phantasms
  local CARD_ID_1 = 32491822 --Hamon, Lord of Striking Thunder
  local CARD_ID_2 = 6007213 --Uria, Lord of Searing Flames
  local CARD_ID_3 = 43378048 --Armityle the Chaos Phantasm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode3(c, CARD_ID_2, CARD_ID_1, CARD_ID_0, true, true)
  	--change name
  	aux.EnableChangeCode(c, CARD_ID_3)
  	--control
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_CONTROL)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.cttg)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	--remove
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_CONTROL_CHANGED)
  	e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e3:SetOperation(s.regop)
  	c:RegisterEffect(e3)
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 1))
  	e4:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e4:SetCode(EVENT_PHASE + PHASE_END)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1)
  	e4:SetCondition(s.rmcon)
  	e4:SetTarget(s.rmtg)
  	e4:SetOperation(s.rmop)
  	c:RegisterEffect(e4)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		Duel.GetControl(c, 1 - tp)
  	end
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.rmcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetFlagEffect(id) > 0
  end
  function s.rmtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  end
  function s.spfilter(c, e, p)
  	return c:IsCode(CARD_ID_3) and c:IsCanBeSpecialSummoned(e, 0, p, true, false) and Duel.GetLocationCountFromEx(p, p, nil, c) > 0
  end
  function s.rmop(e, tp, eg, ep, ev, re, r, rp)
  	local p = e:GetHandler():GetOwner()
  	local g = Duel.GetMatchingGroup(Card.IsAbleToRemove, tp, LOCATION_ONFIELD, 0, nil)
  	if
  		#g > 0
  		and Duel.Remove(g, POS_FACEUP, REASON_EFFECT) ~= 0
  		and g:IsExists(Card.IsLocation, 1, nil, LOCATION_REMOVED)
  		and Duel.IsExistingMatchingCard(s.spfilter, p, LOCATION_EXTRA, 0, 1, nil, e, p)
  		and Duel.SelectYesNo(p, aux.Stringid(id, 2))
  	then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, p, HINTMSG_SPSUMMON)
  		local sg = Duel.SelectMatchingCard(p, s.spfilter, p, LOCATION_EXTRA, 0, 1, 1, nil, e, p)
  		Duel.SpecialSummon(sg, 0, p, p, true, false, POS_FACEUP)
  	end
  end
  
  