name: Gravekeeper's
card_text: 2 "Gravekeeper's" monsters
  Gains ATK/DEF equal to the combined original Levels of the materials used for its Fusion Summon x 100. While "Necrovalley" is on the field, this card, and any card in your Field Zone, cannot be destroyed by card effects. During your Main Phase: You can activate this effect; during the End Phase of this turn, add 1 "Gravekeeper's" monster or 1 "Necrovalley" card from your Deck to your hand. You can only use this effect of "Gravekeeper's Supernaturalist" once per turn.
external_ids: local CARD_ID_0 = 47355498 --Necrovalley
  local SETCARD_ID_0 = 0x2e --Gravekeeper's
  
lua: local CARD_ID_0 = 47355498 --Necrovalley
  local SETCARD_ID_0 = 0x2e --Gravekeeper's
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true)
  	--atk/def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_MATERIAL_CHECK)
  	e1:SetValue(s.valcheck)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.atkcon)
  	e2:SetOperation(s.atkop)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_MZONE + LOCATION_FZONE, 0)
  	e3:SetCondition(s.indcon)
  	e3:SetTarget(s.indtg)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetOperation(s.regop)
  	c:RegisterEffect(e4)
  end
  function s.valcheck(e, c)
  	local lv = c:GetMaterial():GetSum(Card.GetOriginalLevel)
  	e:SetLabel(lv)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local val = e:GetLabelObject():GetLabel() * 100
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(val)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  end
  function s.indcon(e)
  	return Duel.IsEnvironment(CARD_ID_0)
  end
  function s.indtg(e, c)
  	return c == e:GetHandler() or c:IsLocation(LOCATION_FZONE)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.thcon)
  	e1:SetOperation(s.thop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.thfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0x91) and c:IsAbleToHand()
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Gravekeeper's
  2 "Gravekeeper's" monsters
  Gains ATK/DEF equal to the combined original Levels of the materials used for its Fusion Summon x 100. While "Necrovalley" is on the field, this card, and any card in your Field Zone, cannot be destroyed by card effects. During your Main Phase: You can activate this effect; during the End Phase of this turn, add 1 "Gravekeeper's" monster or 1 "Necrovalley" card from your Deck to your hand. You can only use this effect of "Gravekeeper's Supernaturalist" once per turn.
target_text: -- Gravekeeper's
  local CARD_ID_0 = 47355498 --Necrovalley
  local SETCARD_ID_0 = 0x2e --Gravekeeper's
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsFusionSetCard, SETCARD_ID_0), 2, true)
  	--atk/def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_MATERIAL_CHECK)
  	e1:SetValue(s.valcheck)
  	c:RegisterEffect(e1)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.atkcon)
  	e2:SetOperation(s.atkop)
  	e2:SetLabelObject(e1)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_MZONE + LOCATION_FZONE, 0)
  	e3:SetCondition(s.indcon)
  	e3:SetTarget(s.indtg)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  	--to hand
  	local e4 = Effect.CreateEffect(c)
  	e4:SetDescription(aux.Stringid(id, 0))
  	e4:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetOperation(s.regop)
  	c:RegisterEffect(e4)
  end
  function s.valcheck(e, c)
  	local lv = c:GetMaterial():GetSum(Card.GetOriginalLevel)
  	e:SetLabel(lv)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local val = e:GetLabelObject():GetLabel() * 100
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(val)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  end
  function s.indcon(e)
  	return Duel.IsEnvironment(CARD_ID_0)
  end
  function s.indtg(e, c)
  	return c == e:GetHandler() or c:IsLocation(LOCATION_FZONE)
  end
  function s.regop(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.thcon)
  	e1:SetOperation(s.thop)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.thfilter(c)
  	return (c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)) or c:IsSetCard(0x91) and c:IsAbleToHand()
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, id)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  