name: Seed
card_text: Each time a Plant-Type monster(s) is Summoned, place 1 Plant Counter on this card (max. 5). You can send this card to the Graveyard to inflict 500 damage to your opponent for each Plant Counter on it.
external_ids: local COUNTER_ID_0 = 0x20 --Plant
  
lua: local COUNTER_ID_0 = 0x20 --Plant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x20)
  	c:SetCounterLimit(0x20, 5)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--add counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCondition(s.ctcon)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	local e4 = e2:Clone()
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e4)
  	--damage
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_DAMAGE)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_SZONE)
  	e5:SetCost(s.damcost)
  	e5:SetTarget(s.damtg)
  	e5:SetOperation(s.damop)
  	c:RegisterEffect(e5)
  end
  function s.ctfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_PLANT)
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.ctfilter, 1, nil)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  end
  function s.damcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	e:SetLabel(e:GetHandler():GetCounter(COUNTER_ID_0))
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetCounter(COUNTER_ID_0) > 0
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(e:GetLabel() * 500)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, e:GetLabel() * 500)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Seed
  Each time a Plant-Type monster(s) is Summoned, place 1 Plant Counter on this card (max. 5). You can send this card to the Graveyard to inflict 500 damage to your opponent for each Plant Counter on it.
target_text: -- Seed
  local COUNTER_ID_0 = 0x20 --Plant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableCounterPermit(0x20)
  	c:SetCounterLimit(0x20, 5)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--add counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetCondition(s.ctcon)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	local e4 = e2:Clone()
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e4)
  	--damage
  	local e5 = Effect.CreateEffect(c)
  	e5:SetDescription(aux.Stringid(id, 0))
  	e5:SetCategory(CATEGORY_DAMAGE)
  	e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetRange(LOCATION_SZONE)
  	e5:SetCost(s.damcost)
  	e5:SetTarget(s.damtg)
  	e5:SetOperation(s.damop)
  	c:RegisterEffect(e5)
  end
  function s.ctfilter(c)
  	return c:IsFaceup() and c:IsRace(RACE_PLANT)
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.ctfilter, 1, nil)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	e:GetHandler():AddCounter(COUNTER_ID_0, 1)
  end
  function s.damcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	e:SetLabel(e:GetHandler():GetCounter(COUNTER_ID_0))
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetCounter(COUNTER_ID_0) > 0
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(e:GetLabel() * 500)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, e:GetLabel() * 500)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  