name: Frodi,
card_text: You can only control 1 "Frodi, Generaider Boss of Swords". (Quick Effect): You can Tribute any number of "Generaider" monsters and/or Warrior monsters, then target that many monsters on the field; destroy them, then your opponent can draw cards equal to the number of monsters destroyed on their field. You can only use this effect of "Frodi, Generaider Boss of Swords" once per turn.
external_ids: local SETCARD_ID_0 = 0x134 --Generaider
  
lua: local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_WARRIOR)) and Duel.IsExistingTarget(nil, tp, LOCATION_MZONE, LOCATION_MZONE, 1, c)
  end
  function s.fselect(g, tp)
  	return Duel.IsExistingTarget(nil, tp, LOCATION_MZONE, LOCATION_MZONE, g:GetCount(), g) and Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, nil, tp)
  	end
  	local rg = Duel.GetReleaseGroup(tp):Filter(s.costfilter, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, s.fselect, false, 1, rg:GetCount(), tp)
  	aux.UseExtraReleaseCount(sg, tp)
  	local ct = Duel.Release(sg, REASON_COST)
  	e:SetLabel(ct)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return true
  	end
  	local ct = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, nil, tp, LOCATION_MZONE, LOCATION_MZONE, ct, ct, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if Duel.Destroy(tg, REASON_EFFECT) == 0 then
  		return
  	end
  	local ct = Duel.GetOperatedGroup():FilterCount(Card.IsPreviousControler, nil, 1 - tp)
  	if ct > 0 and Duel.IsPlayerCanDraw(1 - tp, ct) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 1)) then
  		Duel.BreakEffect()
  		Duel.Draw(1 - tp, ct, REASON_EFFECT)
  	end
  end
  
  
source_text: Frodi,
  You can only control 1 "Frodi, Generaider Boss of Swords". (Quick Effect): You can Tribute any number of "Generaider" monsters and/or Warrior monsters, then target that many monsters on the field; destroy them, then your opponent can draw cards equal to the number of monsters destroyed on their field. You can only use this effect of "Frodi, Generaider Boss of Swords" once per turn.
target_text: -- Frodi,
  local SETCARD_ID_0 = 0x134 --Generaider
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DRAW)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, id)
  	e1:SetCost(s.descost)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.costfilter(c, tp)
  	return (c:IsSetCard(SETCARD_ID_0) or c:IsRace(RACE_WARRIOR)) and Duel.IsExistingTarget(nil, tp, LOCATION_MZONE, LOCATION_MZONE, 1, c)
  end
  function s.fselect(g, tp)
  	return Duel.IsExistingTarget(nil, tp, LOCATION_MZONE, LOCATION_MZONE, g:GetCount(), g) and Duel.CheckReleaseGroup(tp, aux.IsInGroup, #g, nil, g)
  end
  function s.descost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.CheckReleaseGroup(tp, s.costfilter, 1, nil, tp)
  	end
  	local rg = Duel.GetReleaseGroup(tp):Filter(s.costfilter, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local sg = rg:SelectSubGroup(tp, s.fselect, false, 1, rg:GetCount(), tp)
  	aux.UseExtraReleaseCount(sg, tp)
  	local ct = Duel.Release(sg, REASON_COST)
  	e:SetLabel(ct)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE)
  	end
  	if chk == 0 then
  		return true
  	end
  	local ct = e:GetLabel()
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, nil, tp, LOCATION_MZONE, LOCATION_MZONE, ct, ct, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tg = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if Duel.Destroy(tg, REASON_EFFECT) == 0 then
  		return
  	end
  	local ct = Duel.GetOperatedGroup():FilterCount(Card.IsPreviousControler, nil, 1 - tp)
  	if ct > 0 and Duel.IsPlayerCanDraw(1 - tp, ct) and Duel.SelectYesNo(1 - tp, aux.Stringid(id, 1)) then
  		Duel.BreakEffect()
  		Duel.Draw(1 - tp, ct, REASON_EFFECT)
  	end
  end
  
  