name: Allure
card_text: Once per turn, if you control this card that was Special Summoned by the effect of "Allure Queen LV5": You can target 1 monster your opponent controls; equip that target to this card as an Equip Spell (max. 1). If this card would be destroyed by battle, destroy that equipped monster, instead.
external_ids: local CARD_ID_0 = 87257460 --Allure Queen LV3
  local CARD_ID_1 = 23756165 --Allure Queen LV5
  local CARD_ID_2 = 95937545 --Golden Allure Queen
  
lua: local CARD_ID_0 = 87257460 --Allure Queen LV3
  local CARD_ID_1 = 23756165 --Allure Queen LV5
  local CARD_ID_2 = 95937545 --Golden Allure Queen
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--flag effect id+1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCondition(s.eqcon1)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetCondition(s.eqcon2)
  	c:RegisterEffect(e3)
  end
  s.lvup = { CARD_ID_1 }
  s.lvdn = { CARD_ID_1, CARD_ID_0 }
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:GetSpecialSummonInfo(SUMMON_INFO_CODE) == CARD_ID_1 then
  		c:RegisterFlagEffect(id + 1, RESET_EVENT + RESETS_STANDARD, 0, 1)
  	end
  end
  function s.eqcon1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id + 1) > 0 and not aux.IsSelfEquip(c, FLAG_ID_ALLURE_QUEEN) and not aux.IsCanBeQuickEffect(c, tp, CARD_ID_2)
  end
  function s.eqcon2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id + 1) > 0 and not aux.IsSelfEquip(c, FLAG_ID_ALLURE_QUEEN) and aux.IsCanBeQuickEffect(c, tp, CARD_ID_2)
  end
  function s.filter(c)
  	return c:IsAbleToChangeControler()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		local atk = tc:GetTextAttack()
  		local def = tc:GetTextDefense()
  		if atk < 0 then
  			atk = 0
  		end
  		if def < 0 then
  			def = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		tc:RegisterFlagEffect(FLAG_ID_ALLURE_QUEEN, RESET_EVENT + RESETS_STANDARD, 0, 0, id)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_EQUIP)
  		e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE + EFFECT_FLAG_SET_AVAILABLE)
  		e2:SetCode(EFFECT_DESTROY_SUBSTITUTE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(s.repval)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.repval(e, re, r, rp)
  	return bit.band(r, REASON_BATTLE) ~= 0
  end
  
  
source_text: Allure
  Once per turn, if you control this card that was Special Summoned by the effect of "Allure Queen LV5": You can target 1 monster your opponent controls; equip that target to this card as an Equip Spell (max. 1). If this card would be destroyed by battle, destroy that equipped monster, instead.
target_text: -- Allure
  local CARD_ID_0 = 87257460 --Allure Queen LV3
  local CARD_ID_1 = 23756165 --Allure Queen LV5
  local CARD_ID_2 = 95937545 --Golden Allure Queen
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--flag effect id+1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetOperation(s.regop)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCondition(s.eqcon1)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetType(EFFECT_TYPE_QUICK_O)
  	e3:SetCode(EVENT_FREE_CHAIN)
  	e3:SetCondition(s.eqcon2)
  	c:RegisterEffect(e3)
  end
  s.lvup = { CARD_ID_1 }
  s.lvdn = { CARD_ID_1, CARD_ID_0 }
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:GetSpecialSummonInfo(SUMMON_INFO_CODE) == CARD_ID_1 then
  		c:RegisterFlagEffect(id + 1, RESET_EVENT + RESETS_STANDARD, 0, 1)
  	end
  end
  function s.eqcon1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id + 1) > 0 and not aux.IsSelfEquip(c, FLAG_ID_ALLURE_QUEEN) and not aux.IsCanBeQuickEffect(c, tp, CARD_ID_2)
  end
  function s.eqcon2(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetFlagEffect(id + 1) > 0 and not aux.IsSelfEquip(c, FLAG_ID_ALLURE_QUEEN) and aux.IsCanBeQuickEffect(c, tp, CARD_ID_2)
  end
  function s.filter(c)
  	return c:IsAbleToChangeControler()
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  end
  function s.eqlimit(e, c)
  	return e:GetOwner() == c
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		local atk = tc:GetTextAttack()
  		local def = tc:GetTextDefense()
  		if atk < 0 then
  			atk = 0
  		end
  		if def < 0 then
  			def = 0
  		end
  		if not Duel.Equip(tp, tc, c, false) then
  			return
  		end
  		--Add Equip limit
  		tc:RegisterFlagEffect(FLAG_ID_ALLURE_QUEEN, RESET_EVENT + RESETS_STANDARD, 0, 0, id)
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
  		e1:SetCode(EFFECT_EQUIP_LIMIT)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e1:SetValue(s.eqlimit)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(c)
  		e2:SetType(EFFECT_TYPE_EQUIP)
  		e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE + EFFECT_FLAG_OWNER_RELATE + EFFECT_FLAG_SET_AVAILABLE)
  		e2:SetCode(EFFECT_DESTROY_SUBSTITUTE)
  		e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  		e2:SetValue(s.repval)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.repval(e, re, r, rp)
  	return bit.band(r, REASON_BATTLE) ~= 0
  end
  
  