name: Overdoom
card_text: If a Plant-Type monster(s) is Special Summoned from the Graveyard to your side of the field: It gains 1000 ATK while this card is face-up on the field. Destroy this card during your 2nd End Phase after activation.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.acttg)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetCondition(s.atkcon)
  	e3:SetTarget(s.atktg)
  	e3:SetValue(1000)
  	c:RegisterEffect(e3)
  	local g = Group.CreateGroup()
  	g:KeepAlive()
  	e2:SetLabelObject(g)
  	e3:SetLabelObject(g)
  end
  function s.acttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetCondition(s.descon)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  	c:RegisterEffect(e1)
  	c:SetTurnCounter(0)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetTurnCounter()
  	ct = ct + 1
  	c:SetTurnCounter(ct)
  	if ct == 2 then
  		Duel.Destroy(c, REASON_EFFECT)
  	end
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:IsControler(tp) and c:IsPreviousLocation(LOCATION_GRAVE) and (not e or c:IsRelateToEffect(e))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.filter, 1, nil, nil, tp)
  	end
  	Duel.SetTargetCard(eg)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local atkg = e:GetLabelObject()
  	if c:GetFlagEffect(id) == 0 then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 1)
  		atkg:Clear()
  	end
  	local g = eg:Filter(s.filter, nil, e, tp)
  	local tc = g:GetFirst()
  	while tc do
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  		atkg:AddCard(tc)
  		tc = g:GetNext()
  	end
  end
  function s.atkcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.atktg(e, c)
  	return e:GetLabelObject():IsContains(c) and c:GetFlagEffect(id) ~= 0
  end
  
  
source_text: Overdoom
  If a Plant-Type monster(s) is Special Summoned from the Graveyard to your side of the field: It gains 1000 ATK while this card is face-up on the field. Destroy this card during your 2nd End Phase after activation.
target_text: -- Overdoom
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.acttg)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetRange(LOCATION_SZONE)
  	e2:SetTarget(s.target)
  	e2:SetOperation(s.operation)
  	c:RegisterEffect(e2)
  	--atk
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetCondition(s.atkcon)
  	e3:SetTarget(s.atktg)
  	e3:SetValue(1000)
  	c:RegisterEffect(e3)
  	local g = Group.CreateGroup()
  	g:KeepAlive()
  	e2:SetLabelObject(g)
  	e3:SetLabelObject(g)
  end
  function s.acttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local c = e:GetHandler()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetCountLimit(1)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetCondition(s.descon)
  	e1:SetOperation(s.desop)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END + RESET_SELF_TURN, 2)
  	c:RegisterEffect(e1)
  	c:SetTurnCounter(0)
  end
  function s.descon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() == tp
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local ct = c:GetTurnCounter()
  	ct = ct + 1
  	c:SetTurnCounter(ct)
  	if ct == 2 then
  		Duel.Destroy(c, REASON_EFFECT)
  	end
  end
  function s.filter(c, e, tp)
  	return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:IsControler(tp) and c:IsPreviousLocation(LOCATION_GRAVE) and (not e or c:IsRelateToEffect(e))
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return eg:IsExists(s.filter, 1, nil, nil, tp)
  	end
  	Duel.SetTargetCard(eg)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local atkg = e:GetLabelObject()
  	if c:GetFlagEffect(id) == 0 then
  		c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD + RESET_DISABLE, 0, 1)
  		atkg:Clear()
  	end
  	local g = eg:Filter(s.filter, nil, e, tp)
  	local tc = g:GetFirst()
  	while tc do
  		tc:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  		atkg:AddCard(tc)
  		tc = g:GetNext()
  	end
  end
  function s.atkcon(e)
  	return e:GetHandler():GetFlagEffect(id) ~= 0
  end
  function s.atktg(e, c)
  	return e:GetLabelObject():IsContains(c) and c:GetFlagEffect(id) ~= 0
  end
  
  