name: 氷結界の軍師
card_text: 1:1ターンに1度、手札から「氷結界」モンスター1体を墓地へ送って発動できる。
  自分は1枚ドローする。
external_ids: local CARD_ID_0 = 18319762 --氷結界の照魔師
  local SETCARD_ID_0 = 0x2f --氷結界
  
lua: local CARD_ID_0 = 18319762 --氷結界の照魔師
  local SETCARD_ID_0 = 0x2f --氷結界
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--draw
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c, e, tp)
  	if c:IsLocation(LOCATION_HAND) then
  		return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  	else
  		return e:GetHandler():IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove() and c:IsHasEffect(CARD_ID_0, tp)
  	end
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	local te = tc:IsHasEffect(CARD_ID_0, tp)
  	if te then
  		te:UseCountLimit(tp)
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT + REASON_REPLACE)
  	else
  		Duel.SendtoGrave(tc, REASON_COST)
  	end
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.operation(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: 氷結界の軍師
  1:1ターンに1度、手札から「氷結界」モンスター1体を墓地へ送って発動できる。
  自分は1枚ドローする。
target_text: -- 氷結界の軍師
  local CARD_ID_0 = 18319762 --氷結界の照魔師
  local SETCARD_ID_0 = 0x2f --氷結界
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--draw
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetCategory(CATEGORY_DRAW)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c, e, tp)
  	if c:IsLocation(LOCATION_HAND) then
  		return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  	else
  		return e:GetHandler():IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove() and c:IsHasEffect(CARD_ID_0, tp)
  	end
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, nil, e, tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_HAND + LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	local tc = g:GetFirst()
  	local te = tc:IsHasEffect(CARD_ID_0, tp)
  	if te then
  		te:UseCountLimit(tp)
  		Duel.Remove(tc, POS_FACEUP, REASON_EFFECT + REASON_REPLACE)
  	else
  		Duel.SendtoGrave(tc, REASON_COST)
  	end
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsPlayerCanDraw(tp, 1)
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1)
  	Duel.SetOperationInfo(0, CATEGORY_DRAW, nil, 0, tp, 1)
  end
  function s.operation(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
  
  