name: Seed
card_text: When this card you control is destroyed by a card effect and sent to your Graveyard: You can target 1 Level 4 or lower Plant-Type monster in your Graveyard, except "Seed of Flame"; Special Summon that target, and if you do, Special Summon 1 "Seed Token" (Plant-Type/EARTH/Level 1/ATK 0/DEF 0) to your opponent's side of the field in Defense Position. This Token cannot be Tributed for a Tribute Summon.
external_ids: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 38041941 --Seed Token
  
lua: local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 38041941 --Seed Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return bit.band(c:GetReason(), 0x41) == 0x41 and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsRace(RACE_PLANT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_PLANT, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsRace(RACE_PLANT) and Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  		if
  			Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_PLANT, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE, 1 - tp)
  		then
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP_DEFENSE)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UNRELEASABLE_SUM)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(1)
  			token:RegisterEffect(e1, true)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: Seed
  When this card you control is destroyed by a card effect and sent to your Graveyard: You can target 1 Level 4 or lower Plant-Type monster in your Graveyard, except "Seed of Flame"; Special Summon that target, and if you do, Special Summon 1 "Seed Token" (Plant-Type/EARTH/Level 1/ATK 0/DEF 0) to your opponent's side of the field in Defense Position. This Token cannot be Tributed for a Tribute Summon.
target_text: -- Seed
  local CARD_ID_0 = 59822133 --Blue-Eyes Spirit Dragon
  local CARD_ID_1 = 38041941 --Seed Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return bit.band(c:GetReason(), 0x41) == 0x41 and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
  end
  function s.spfilter(c, e, tp)
  	return c:IsLevelBelow(4) and c:IsRace(RACE_PLANT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc, e, tp)
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsExistingTarget(s.spfilter, tp, LOCATION_GRAVE, 0, 1, nil, e, tp)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_PLANT, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE, 1 - tp)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectTarget(tp, s.spfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil, e, tp)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, g, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, tp, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsRace(RACE_PLANT) and Duel.SpecialSummonStep(tc, 0, tp, tp, false, false, POS_FACEUP) then
  		if
  			Duel.GetLocationCount(1 - tp, LOCATION_MZONE) > 0
  			and not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_PLANT, ATTRIBUTE_EARTH, POS_FACEUP_DEFENSE, 1 - tp)
  		then
  			local token = Duel.CreateToken(tp, id + 1)
  			Duel.SpecialSummonStep(token, 0, tp, 1 - tp, false, false, POS_FACEUP_DEFENSE)
  			local e1 = Effect.CreateEffect(e:GetHandler())
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_UNRELEASABLE_SUM)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  			e1:SetValue(1)
  			token:RegisterEffect(e1, true)
  		end
  	end
  	Duel.SpecialSummonComplete()
  end
  
  