name: Worm
card_text: This card cannot be Special Summoned. Negate the effects of Effect Monsters destroyed by battle with this card. If this card destroys an opponent's monster by battle, it can attack once again in a row.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--Disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_BATTLED)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--chain attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DESTROYING)
  	e3:SetCondition(s.atcon)
  	e3:SetOperation(s.atop)
  	c:RegisterEffect(e3)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttackTarget()
  	local c = e:GetHandler()
  	if c == tc then
  		tc = Duel.GetAttacker()
  	end
  	if tc and tc:IsType(TYPE_EFFECT) and tc:IsStatus(STATUS_BATTLE_DESTROYED) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + 0x17a0000)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetReset(RESET_EVENT + 0x17a0000)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.atcon(e, tp, eg, ep, ev, re, r, rp)
  	return aux.bdocon(e, tp, eg, ep, ev, re, r, rp) and e:GetHandler():IsChainAttackable()
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.ChainAttack()
  end
  
  
source_text: Worm
  This card cannot be Special Summoned. Negate the effects of Effect Monsters destroyed by battle with this card. If this card destroys an opponent's monster by battle, it can attack once again in a row.
target_text: -- Worm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--Disable
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_BATTLED)
  	e2:SetOperation(s.disop)
  	c:RegisterEffect(e2)
  	--chain attack
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetCode(EVENT_BATTLE_DESTROYING)
  	e3:SetCondition(s.atcon)
  	e3:SetOperation(s.atop)
  	c:RegisterEffect(e3)
  end
  function s.disop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetAttackTarget()
  	local c = e:GetHandler()
  	if c == tc then
  		tc = Duel.GetAttacker()
  	end
  	if tc and tc:IsType(TYPE_EFFECT) and tc:IsStatus(STATUS_BATTLE_DESTROYED) then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_DISABLE)
  		e1:SetReset(RESET_EVENT + 0x17a0000)
  		tc:RegisterEffect(e1)
  		local e2 = Effect.CreateEffect(e:GetHandler())
  		e2:SetType(EFFECT_TYPE_SINGLE)
  		e2:SetCode(EFFECT_DISABLE_EFFECT)
  		e2:SetReset(RESET_EVENT + 0x17a0000)
  		tc:RegisterEffect(e2)
  	end
  end
  function s.atcon(e, tp, eg, ep, ev, re, r, rp)
  	return aux.bdocon(e, tp, eg, ep, ev, re, r, rp) and e:GetHandler():IsChainAttackable()
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.ChainAttack()
  end
  
  