name: Core
card_text: Reveal 1 "Iron Core of Koa'ki Meiru" in your hand and discard 1 "Koa'ki Meiru" monster to activate this card. Draw 2 cards.
external_ids: local CARD_ID_0 = 36623431 --Iron Core of Koa'ki Meiru
  local SETCARD_ID_0 = 0x1d --Koa'ki
  
lua: local CARD_ID_0 = 36623431 --Iron Core of Koa'ki Meiru
  local SETCARD_ID_0 = 0x1d --Koa'ki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter1(c)
  	return c:IsCode(CARD_ID_0) and not c:IsPublic()
  end
  function s.cfilter2(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) and c:IsDiscardable()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter1, tp, LOCATION_HAND, 0, 1, nil) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g1 = Duel.SelectMatchingCard(tp, s.cfilter1, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g1)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local g2 = Duel.SelectMatchingCard(tp, s.cfilter2, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.SendtoGrave(g2, REASON_COST + REASON_DISCARD)
  	Duel.ShuffleHand(tp)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(2)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  
  
source_text: Core
  Reveal 1 "Iron Core of Koa'ki Meiru" in your hand and discard 1 "Koa'ki Meiru" monster to activate this card. Draw 2 cards.
target_text: -- Core
  local CARD_ID_0 = 36623431 --Iron Core of Koa'ki Meiru
  local SETCARD_ID_0 = 0x1d --Koa'ki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.cfilter1(c)
  	return c:IsCode(CARD_ID_0) and not c:IsPublic()
  end
  function s.cfilter2(c)
  	return c:IsType(TYPE_MONSTER) and c:IsSetCard(SETCARD_ID_0) and c:IsDiscardable()
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter1, tp, LOCATION_HAND, 0, 1, nil) and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONFIRM)
  	local g1 = Duel.SelectMatchingCard(tp, s.cfilter1, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.ConfirmCards(1 - tp, g1)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DISCARD)
  	local g2 = Duel.SelectMatchingCard(tp, s.cfilter2, tp, LOCATION_HAND, 0, 1, 1, nil)
  	Duel.SendtoGrave(g2, REASON_COST + REASON_DISCARD)
  	Duel.ShuffleHand(tp)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 2)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(2)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 2)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Draw(p, d, REASON_EFFECT)
  end
  
  