name: Adularia
card_text: If you control a face-up card in your Spell & Trap Zone, you can Special Summon this card (from your hand). You can only Special Summon "Adularia of the June Moon" once per turn this way. Gains 600 ATK/DEF for each face-up Spell/Trap on the field. You can send 2 face-up cards from your Spell & Trap Zone to the GY; send 1 Level 4 or lower monster from your Deck to the GY. You can only use this effect of "Adularia of the June Moon" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--to grave
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_TOGRAVE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCost(s.tgcost)
  	e4:SetTarget(s.tgtg)
  	e4:SetOperation(s.tgop)
  	c:RegisterEffect(e4)
  end
  function s.spcfilter(c)
  	return c:IsFaceup() and c:GetSequence() < 5
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spcfilter, tp, LOCATION_SZONE, 0, 1, nil)
  end
  function s.atkfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsFaceup()
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(s.atkfilter, c:GetControler(), LOCATION_ONFIELD, LOCATION_ONFIELD, nil) * 600
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsAbleToGraveAsCost() and c:GetSequence() < 5
  end
  function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_SZONE, 0, 2, 2, nil)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.tgfilter(c)
  	return c:IsLevelBelow(4) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  
source_text: Adularia
  If you control a face-up card in your Spell & Trap Zone, you can Special Summon this card (from your hand). You can only Special Summon "Adularia of the June Moon" once per turn this way. Gains 600 ATK/DEF for each face-up Spell/Trap on the field. You can send 2 face-up cards from your Spell & Trap Zone to the GY; send 1 Level 4 or lower monster from your Deck to the GY. You can only use this effect of "Adularia of the June Moon" once per turn.
target_text: -- Adularia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--atkup
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e2:SetValue(s.atkval)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--to grave
  	local e4 = Effect.CreateEffect(c)
  	e4:SetCategory(CATEGORY_TOGRAVE)
  	e4:SetType(EFFECT_TYPE_IGNITION)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCountLimit(1, id)
  	e4:SetCost(s.tgcost)
  	e4:SetTarget(s.tgtg)
  	e4:SetOperation(s.tgop)
  	c:RegisterEffect(e4)
  end
  function s.spcfilter(c)
  	return c:IsFaceup() and c:GetSequence() < 5
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.spcfilter, tp, LOCATION_SZONE, 0, 1, nil)
  end
  function s.atkfilter(c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsFaceup()
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(s.atkfilter, c:GetControler(), LOCATION_ONFIELD, LOCATION_ONFIELD, nil) * 600
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsAbleToGraveAsCost() and c:GetSequence() < 5
  end
  function s.tgcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_SZONE, 0, 2, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_SZONE, 0, 2, 2, nil)
  	Duel.SendtoGrave(g, REASON_COST)
  end
  function s.tgfilter(c)
  	return c:IsLevelBelow(4) and c:IsAbleToGrave()
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.tgfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoGrave(g, REASON_EFFECT)
  	end
  end
  
  