name: D.D.
card_text: Cannot declare an attack unless you banish 1 card from your GY. If exactly 3 of your cards are banished: You can Special Summon this card from your hand. You can only use this effect of "D.D. Assault Carrier" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--attack cost
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_ATTACK_COST)
  	e1:SetCost(s.atcost)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  	--sp summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.atcost(e, c, tp)
  	return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, nil)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetMatchingGroupCount(aux.TRUE, tp, LOCATION_REMOVED, 0, nil) == 3
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  
source_text: D.D.
  Cannot declare an attack unless you banish 1 card from your GY. If exactly 3 of your cards are banished: You can Special Summon this card from your hand. You can only use this effect of "D.D. Assault Carrier" once per turn.
target_text: -- D.D.
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--attack cost
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_ATTACK_COST)
  	e1:SetCost(s.atcost)
  	e1:SetOperation(s.atop)
  	c:RegisterEffect(e1)
  	--sp summon
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_HAND)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.spcon)
  	e2:SetTarget(s.sptg)
  	e2:SetOperation(s.spop)
  	c:RegisterEffect(e2)
  end
  function s.atcost(e, c, tp)
  	return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, nil)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_REMOVE)
  	local sg = Duel.SelectMatchingCard(tp, Card.IsAbleToRemoveAsCost, tp, LOCATION_GRAVE, 0, 1, 1, nil)
  	Duel.Remove(sg, POS_FACEUP, REASON_COST)
  end
  function s.spcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetMatchingGroupCount(aux.TRUE, tp, LOCATION_REMOVED, 0, nil) == 3
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP)
  end
  
  