name: フォーチュン・インハーリット
card_text: 自分フィールド上に表側表示で存在する「フォーチュンレディ」と名のついたモンスターが破壊されたターンに発動する事ができる。
  次の自分のスタンバイフェイズ時に手札から「フォーチュンレディ」と名のついたモンスターを2体まで特殊召喚する事ができる。
external_ids: local CARD_ID_0 = 59822133 --青眼の精霊龍
  local SETCARD_ID_0 = 0x31 --フォーチュンレディ
  
lua: local CARD_ID_0 = 59822133 --青眼の精霊龍
  local SETCARD_ID_0 = 0x31 --フォーチュンレディ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		s[0] = false
  		s[1] = false
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DESTROYED)
  		ge1:SetOperation(s.checkop1)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = Effect.CreateEffect(c)
  		ge2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge2:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  		ge2:SetOperation(s.clear)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.checkop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	while tc do
  		if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_FACEUP) and tc:IsPreviousSetCard(SETCARD_ID_0) then
  			s[tc:GetPreviousControler()] = true
  		end
  		tc = eg:GetNext()
  	end
  end
  function s.clear(e, tp, eg, ep, ev, re, r, rp)
  	s[0] = false
  	s[1] = false
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return s[tp]
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetCountLimit(1)
  	e1:SetLabel(Duel.GetTurnCount())
  	if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() < PHASE_STANDBY then
  		e1:SetCondition(s.spcon1)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  	elseif Duel.GetTurnPlayer() == tp then
  		e1:SetCondition(s.spcon2)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  	else
  		e1:SetCondition(s.spcon2)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  	end
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.spcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() == e:GetLabel() and Duel.GetTurnPlayer() == tp
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() ~= e:GetLabel() and Duel.GetTurnPlayer() == tp
  end
  function s.filter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft <= 0 then
  		return
  	end
  	if ft > 2 then
  		ft = 2
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, ft, nil, e, tp)
  	Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: フォーチュン・インハーリット
  自分フィールド上に表側表示で存在する「フォーチュンレディ」と名のついたモンスターが破壊されたターンに発動する事ができる。
  次の自分のスタンバイフェイズ時に手札から「フォーチュンレディ」と名のついたモンスターを2体まで特殊召喚する事ができる。
target_text: -- フォーチュン・インハーリット
  local CARD_ID_0 = 59822133 --青眼の精霊龍
  local SETCARD_ID_0 = 0x31 --フォーチュンレディ
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetCondition(s.condition)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		s[0] = false
  		s[1] = false
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DESTROYED)
  		ge1:SetOperation(s.checkop1)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = Effect.CreateEffect(c)
  		ge2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge2:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  		ge2:SetOperation(s.clear)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.checkop1(e, tp, eg, ep, ev, re, r, rp)
  	local tc = eg:GetFirst()
  	while tc do
  		if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_FACEUP) and tc:IsPreviousSetCard(SETCARD_ID_0) then
  			s[tc:GetPreviousControler()] = true
  		end
  		tc = eg:GetNext()
  	end
  end
  function s.clear(e, tp, eg, ep, ev, re, r, rp)
  	s[0] = false
  	s[1] = false
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return s[tp]
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_PHASE + PHASE_STANDBY)
  	e1:SetCountLimit(1)
  	e1:SetLabel(Duel.GetTurnCount())
  	if Duel.GetTurnPlayer() == tp and Duel.GetCurrentPhase() < PHASE_STANDBY then
  		e1:SetCondition(s.spcon1)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  	elseif Duel.GetTurnPlayer() == tp then
  		e1:SetCondition(s.spcon2)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  	else
  		e1:SetCondition(s.spcon2)
  		e1:SetReset(RESET_PHASE + PHASE_END + RESET_SELF_TURN, 1)
  	end
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.spcon1(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() == e:GetLabel() and Duel.GetTurnPlayer() == tp
  end
  function s.spcon2(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnCount() ~= e:GetLabel() and Duel.GetTurnPlayer() == tp
  end
  function s.filter(c, e, tp)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_HAND, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_HAND)
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp)
  	local ft = Duel.GetLocationCount(tp, LOCATION_MZONE)
  	if ft <= 0 then
  		return
  	end
  	if ft > 2 then
  		ft = 2
  	end
  	if Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) then
  		ft = 1
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_HAND, 0, 1, ft, nil, e, tp)
  	Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  