name: Exodius
card_text: Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by shuffling all monsters in your Graveyard into the Deck, and cannot be Special Summoned by other ways. When this card declares an attack: Send 1 monster from your hand or Deck to the Graveyard. This card gains 1000 ATK for each Normal Monster in your Graveyard. If this face-up card would leave the field, banish it instead. If there are 5 different "Forbidden One" cards in your Graveyard that were sent there by this card's effect, you win the Duel.
external_ids: local SETCARD_ID_0 = 0x40 --Forbidden
  
lua: local SETCARD_ID_0 = 0x40 --Forbidden
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--to grave
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_TOGRAVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e3:SetTarget(s.tgtg)
  	e3:SetOperation(s.tgop)
  	c:RegisterEffect(e3)
  	--atkup
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	--redirect
  	aux.AddBanishRedirect(c)
  end
  function s.cfilter(c)
  	return not c:IsAbleToDeckOrExtraAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER)
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and g:GetCount() > 0 and not g:IsExists(s.cfilter, 1, nil)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER)
  	Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_SPSUMMON)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
  end
  function s.filter(c, rc)
  	return c:IsRelateToCard(rc) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local c = e:GetHandler()
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then
  		tc:CreateRelation(c, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_GRAVE, 0, nil, c)
  		if c:GetOriginalCode() == id and c:IsFaceup() and g:IsContains(tc) and g:GetClassCount(Card.GetCode) == 5 then
  			local WIN_REASON_EXODIUS = 0x14
  			Duel.Win(tp, WIN_REASON_EXODIUS)
  		end
  	end
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(Card.IsType, c:GetControler(), LOCATION_GRAVE, 0, nil, TYPE_NORMAL) * 1000
  end
  
  
source_text: Exodius
  Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by shuffling all monsters in your Graveyard into the Deck, and cannot be Special Summoned by other ways. When this card declares an attack: Send 1 monster from your hand or Deck to the Graveyard. This card gains 1000 ATK for each Normal Monster in your Graveyard. If this face-up card would leave the field, banish it instead. If there are 5 different "Forbidden One" cards in your Graveyard that were sent there by this card's effect, you win the Duel.
target_text: -- Exodius
  local SETCARD_ID_0 = 0x40 --Forbidden
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:EnableReviveLimit()
  	--cannot special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	c:RegisterEffect(e1)
  	--special summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_SPSUMMON_PROC)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCondition(s.spcon)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  	--to grave
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_TOGRAVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_ATTACK_ANNOUNCE)
  	e3:SetTarget(s.tgtg)
  	e3:SetOperation(s.tgop)
  	c:RegisterEffect(e3)
  	--atkup
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e4:SetRange(LOCATION_MZONE)
  	e4:SetCode(EFFECT_UPDATE_ATTACK)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	--redirect
  	aux.AddBanishRedirect(c)
  end
  function s.cfilter(c)
  	return not c:IsAbleToDeckOrExtraAsCost()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	local g = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER)
  	return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and g:GetCount() > 0 and not g:IsExists(s.cfilter, 1, nil)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_GRAVE, 0, nil, TYPE_MONSTER)
  	Duel.SendtoDeck(g, nil, SEQ_DECKSHUFFLE, REASON_SPSUMMON)
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, nil, 1, tp, LOCATION_DECK)
  end
  function s.tgfilter(c)
  	return c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
  end
  function s.filter(c, rc)
  	return c:IsRelateToCard(rc) and c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  	local c = e:GetHandler()
  	local g = Duel.SelectMatchingCard(tp, s.tgfilter, tp, LOCATION_HAND + LOCATION_DECK, 0, 1, 1, nil)
  	local tc = g:GetFirst()
  	if tc and Duel.SendtoGrave(tc, REASON_EFFECT) ~= 0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then
  		tc:CreateRelation(c, RESET_EVENT + RESETS_STANDARD - RESET_TURN_SET)
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_GRAVE, 0, nil, c)
  		if c:GetOriginalCode() == id and c:IsFaceup() and g:IsContains(tc) and g:GetClassCount(Card.GetCode) == 5 then
  			local WIN_REASON_EXODIUS = 0x14
  			Duel.Win(tp, WIN_REASON_EXODIUS)
  		end
  	end
  end
  function s.atkval(e, c)
  	return Duel.GetMatchingGroupCount(Card.IsType, c:GetControler(), LOCATION_GRAVE, 0, nil, TYPE_NORMAL) * 1000
  end
  
  