name: Worm
card_text: Once per turn, you can remove from play 1 Reptile-Type "Worm" monster in your Graveyard to allow this card to attack twice during the same Battle Phase.
external_ids: local SETCARD_ID_0 = 0x3e --Worm
  
lua: local SETCARD_ID_0 = 0x3e --Worm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--multi atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.mtcon)
  	e1:SetCost(s.mtcost)
  	e1:SetTarget(s.mttg)
  	e1:SetOperation(s.mtop)
  	c:RegisterEffect(e1)
  end
  function s.mtcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsAbleToEnterBP()
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsRace(RACE_REPTILE) and c:IsAbleToRemoveAsCost()
  end
  function s.mtcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.mttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetEffectCount(EFFECT_EXTRA_ATTACK) == 0
  	end
  end
  function s.mtop(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_EXTRA_ATTACK)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Worm
  Once per turn, you can remove from play 1 Reptile-Type "Worm" monster in your Graveyard to allow this card to attack twice during the same Battle Phase.
target_text: -- Worm
  local SETCARD_ID_0 = 0x3e --Worm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--multi atk
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.mtcon)
  	e1:SetCost(s.mtcost)
  	e1:SetTarget(s.mttg)
  	e1:SetOperation(s.mtop)
  	c:RegisterEffect(e1)
  end
  function s.mtcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsAbleToEnterBP()
  end
  function s.costfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsRace(RACE_REPTILE) and c:IsAbleToRemoveAsCost()
  end
  function s.mtcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.costfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local g = Duel.SelectMatchingCard(tp, s.costfilter, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(g, POS_FACEUP, REASON_COST)
  end
  function s.mttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetEffectCount(EFFECT_EXTRA_ATTACK) == 0
  	end
  end
  function s.mtop(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_EXTRA_ATTACK)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  
  