name: Iron
card_text: 1 Tuner + 1 or more non-Tuner monsters
  You can remove from play all "Iron Chain" monsters from your Graveyard to have this card gain 200 ATK for each card removed, until the End Phase. When this card inflicts Battle Damage to your opponent, send the top 3 cards of your opponent's Deck to the Graveyard.
external_ids: local SETCARD_ID_0 = 0x25 --Iron
  
lua: local SETCARD_ID_0 = 0x25 --Iron
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_ATKCHANGE)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetHintTiming(TIMING_DAMAGE_STEP)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.attg)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  	--discard deck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DECKDES)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetCondition(s.ddcon)
  	e2:SetTarget(s.ddtg)
  	e2:SetOperation(s.ddop)
  	c:RegisterEffect(e2)
  end
  function s.rfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove()
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.rfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.rfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	local g = Duel.GetMatchingGroup(s.rfilter, tp, LOCATION_GRAVE, 0, nil)
  	local ct = Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  	if ct > 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(ct * 200)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  function s.ddcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp
  end
  function s.ddtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, 0, 0, 1 - tp, 3)
  end
  function s.ddop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  end
  
  
source_text: Iron
  1 Tuner + 1 or more non-Tuner monsters
  You can remove from play all "Iron Chain" monsters from your Graveyard to have this card gain 200 ATK for each card removed, until the End Phase. When this card inflicts Battle Damage to your opponent, send the top 3 cards of your opponent's Deck to the Graveyard.
target_text: -- Iron
  local SETCARD_ID_0 = 0x25 --Iron
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--atkup
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_ATKCHANGE)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetHintTiming(TIMING_DAMAGE_STEP)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.attg)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  	--discard deck
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_DECKDES)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetCondition(s.ddcon)
  	e2:SetTarget(s.ddtg)
  	e2:SetOperation(s.ddop)
  	c:RegisterEffect(e2)
  end
  function s.rfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToRemove()
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.rfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.rfilter, tp, LOCATION_GRAVE, 0, nil)
  	Duel.SetOperationInfo(0, CATEGORY_REMOVE, g, g:GetCount(), 0, 0)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	local g = Duel.GetMatchingGroup(s.rfilter, tp, LOCATION_GRAVE, 0, nil)
  	local ct = Duel.Remove(g, POS_FACEUP, REASON_EFFECT)
  	if ct > 0 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(ct * 200)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  end
  function s.ddcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp
  end
  function s.ddtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_DECKDES, 0, 0, 1 - tp, 3)
  end
  function s.ddop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.DiscardDeck(1 - tp, 3, REASON_EFFECT)
  end
  
  