name: Gatling
card_text: "Barrel Dragon" + "Blowback Dragon"
  Once per turn: You can toss a coin 3 times and destroy as many monsters on the field as possible, but not more than the number of heads.
external_ids: local CARD_ID_0 = 81480460 --Barrel Dragon
  local CARD_ID_1 = 25551951 --Blowback Dragon
  
lua: local CARD_ID_0 = 81480460 --Barrel Dragon
  local CARD_ID_1 = 25551951 --Blowback Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_0, CARD_ID_1, true, true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 3)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	local c1, c2, c3 = Duel.TossCoin(tp, 3)
  	local ct = c1 + c2 + c3
  	if ct == 0 then
  		return
  	end
  	if ct > g:GetCount() then
  		ct = g:GetCount()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = g:Select(tp, ct, ct, nil)
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  
source_text: Gatling
  "Barrel Dragon" + "Blowback Dragon"
  Once per turn: You can toss a coin 3 times and destroy as many monsters on the field as possible, but not more than the number of heads.
target_text: -- Gatling
  local CARD_ID_0 = 81480460 --Barrel Dragon
  local CARD_ID_1 = 25551951 --Blowback Dragon
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcCode2(c, CARD_ID_0, CARD_ID_1, true, true)
  	--destroy
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_COIN)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetTarget(s.destg)
  	e1:SetOperation(s.desop)
  	c:RegisterEffect(e1)
  end
  function s.destg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_COIN, nil, 0, tp, 3)
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetMatchingGroup(aux.TRUE, tp, LOCATION_MZONE, LOCATION_MZONE, nil)
  	if g:GetCount() == 0 then
  		return
  	end
  	local c1, c2, c3 = Duel.TossCoin(tp, 3)
  	local ct = c1 + c2 + c3
  	if ct == 0 then
  		return
  	end
  	if ct > g:GetCount() then
  		ct = g:GetCount()
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local dg = g:Select(tp, ct, ct, nil)
  	Duel.HintSelection(dg)
  	Duel.Destroy(dg, REASON_EFFECT)
  end
  
  