name: G
card_text: If this card is in your hand: You can discard 1 other Cyberse monster; reduce this card's Level by 2 until the end of this turn (even after it is Summoned/Set). You can Tribute this card; Special Summon 3 "G Golem Tokens" (Cyberse/EARTH/Level 1/ATK 0/DEF 0) in Defense Position, also you cannot Special Summon monsters for the rest of this turn, except Cyberse monsters. You can only use each effect of "G Golem Rock Hammer" once per turn.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 98875864 --G Golem Token
  local SETCARD_ID_0 = 0x186 --G
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 98875864 --G Golem Token
  local SETCARD_ID_0 = 0x186 --G
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--level down
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.lvcost)
  	e1:SetTarget(s.lvtg)
  	e1:SetOperation(s.lvop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.tkcost)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop)
  	c:RegisterEffect(e2)
  end
  function s.lvcfilter(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsDiscardable()
  end
  function s.lvcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.lvcfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.lvcfilter, 1, 1, REASON_DISCARD + REASON_COST, e:GetHandler())
  end
  function s.lvtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsLevelAbove(3)
  	end
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_LEVEL)
  		e1:SetValue(-2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  function s.tkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.tktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetMZoneCount(tp, e:GetHandler()) > 2
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 3, RACE_CYBERSE, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 3, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 3, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if
  		Duel.GetLocationCount(tp, LOCATION_MZONE) > 2
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  		and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 3, RACE_CYBERSE, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	then
  		local ct = 3
  		while ct > 0 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  			ct = ct - 1
  		end
  		Duel.SpecialSummonComplete()
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsRace(RACE_CYBERSE)
  end
  
  
source_text: G
  If this card is in your hand: You can discard 1 other Cyberse monster; reduce this card's Level by 2 until the end of this turn (even after it is Summoned/Set). You can Tribute this card; Special Summon 3 "G Golem Tokens" (Cyberse/EARTH/Level 1/ATK 0/DEF 0) in Defense Position, also you cannot Special Summon monsters for the rest of this turn, except Cyberse monsters. You can only use each effect of "G Golem Rock Hammer" once per turn.
target_text: -- G
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 98875864 --G Golem Token
  local SETCARD_ID_0 = 0x186 --G
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--level down
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.lvcost)
  	e1:SetTarget(s.lvtg)
  	e1:SetOperation(s.lvop)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(s.tkcost)
  	e2:SetTarget(s.tktg)
  	e2:SetOperation(s.tkop)
  	c:RegisterEffect(e2)
  end
  function s.lvcfilter(c)
  	return c:IsRace(RACE_CYBERSE) and c:IsDiscardable()
  end
  function s.lvcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.lvcfilter, tp, LOCATION_HAND, 0, 1, e:GetHandler())
  	end
  	Duel.DiscardHand(tp, s.lvcfilter, 1, 1, REASON_DISCARD + REASON_COST, e:GetHandler())
  end
  function s.lvtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsLevelAbove(3)
  	end
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_LEVEL)
  		e1:SetValue(-2)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  function s.tkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsReleasable()
  	end
  	Duel.Release(e:GetHandler(), REASON_COST)
  end
  function s.tktg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.GetMZoneCount(tp, e:GetHandler()) > 2
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 3, RACE_CYBERSE, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 3, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 3, 0, 0)
  end
  function s.tkop(e, tp, eg, ep, ev, re, r, rp)
  	if
  		Duel.GetLocationCount(tp, LOCATION_MZONE) > 2
  		and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  		and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, SETCARD_ID_0, TYPES_TOKEN_MONSTER, 0, 0, 3, RACE_CYBERSE, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE)
  	then
  		local ct = 3
  		while ct > 0 do
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  			ct = ct - 1
  		end
  		Duel.SpecialSummonComplete()
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  end
  function s.splimit(e, c)
  	return not c:IsRace(RACE_CYBERSE)
  end
  
  