name: Brotherhood
card_text: When this card is Special Summoned by the effect of a "Fire Fist" monster: You can add 1 "Fire Fist" monster from your Deck to your hand. You can only use this effect of "Brotherhood of the Fire Fist - Rooster" once per turn. Once per turn: You can send 1 face-up "Fire Formation" Spell/Trap you control to the GY; Set 1 "Fire Formation" Spell/Trap directly from your Deck.
external_ids: local CARD_ID_0 = 46241344 --Brotherhood of the Fire Fist - Eagle
  local SETCARD_ID_0 = 0x79 --Fire
  local SETCARD_ID_1 = 0x7c --Fire
  
lua: local CARD_ID_0 = 46241344 --Brotherhood of the Fire Fist - Eagle
  local SETCARD_ID_0 = 0x79 --Fire
  local SETCARD_ID_1 = 0x7c --Fire
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--set
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.setcost)
  	e2:SetTarget(s.settg)
  	e2:SetOperation(s.setop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetSpecialSummonInfo(SUMMON_INFO_TYPE) & TYPE_MONSTER ~= 0 and c:IsSpecialSummonSetCard(SETCARD_ID_1)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToGraveAsCost()
  end
  function s.setcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ft = Duel.GetLocationCount(tp, LOCATION_SZONE)
  	if Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK, 0, 1, nil) then
  		ft = ft + 1
  	end
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) or (Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and ft > 0)
  	end
  	if
  		Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) and (not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) or ft <= 0 or not Duel.SelectYesNo(tp, aux.Stringid(46241344, 0)))
  	then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
  		Duel.SendtoGrave(g, REASON_COST)
  	end
  end
  function s.filter(c, chk)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSSetable(chk)
  end
  function s.filter2(c)
  	return s.filter(c, false) and c:IsType(TYPE_FIELD)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, true)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, false)
  	if g:GetCount() > 0 then
  		Duel.SSet(tp, g:GetFirst())
  	end
  end
  
  
source_text: Brotherhood
  When this card is Special Summoned by the effect of a "Fire Fist" monster: You can add 1 "Fire Fist" monster from your Deck to your hand. You can only use this effect of "Brotherhood of the Fire Fist - Rooster" once per turn. Once per turn: You can send 1 face-up "Fire Formation" Spell/Trap you control to the GY; Set 1 "Fire Formation" Spell/Trap directly from your Deck.
target_text: -- Brotherhood
  local CARD_ID_0 = 46241344 --Brotherhood of the Fire Fist - Eagle
  local SETCARD_ID_0 = 0x79 --Fire
  local SETCARD_ID_1 = 0x7c --Fire
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_TRIGGER_O + EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  	--set
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCost(s.setcost)
  	e2:SetTarget(s.settg)
  	e2:SetOperation(s.setop)
  	c:RegisterEffect(e2)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:GetSpecialSummonInfo(SUMMON_INFO_TYPE) & TYPE_MONSTER ~= 0 and c:IsSpecialSummonSetCard(SETCARD_ID_1)
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsAbleToGraveAsCost()
  end
  function s.setcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ft = Duel.GetLocationCount(tp, LOCATION_SZONE)
  	if Duel.IsExistingMatchingCard(s.filter2, tp, LOCATION_DECK, 0, 1, nil) then
  		ft = ft + 1
  	end
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) or (Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) and ft > 0)
  	end
  	if
  		Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_ONFIELD, 0, 1, nil) and (not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0) or ft <= 0 or not Duel.SelectYesNo(tp, aux.Stringid(46241344, 0)))
  	then
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOGRAVE)
  		local g = Duel.SelectMatchingCard(tp, s.cfilter, tp, LOCATION_ONFIELD, 0, 1, 1, nil)
  		Duel.SendtoGrave(g, REASON_COST)
  	end
  end
  function s.filter(c, chk)
  	return c:IsSetCard(SETCARD_ID_1) and c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSSetable(chk)
  end
  function s.filter2(c)
  	return s.filter(c, false) and c:IsType(TYPE_FIELD)
  end
  function s.settg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil, true)
  	end
  end
  function s.setop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SET)
  	local g = Duel.SelectMatchingCard(tp, s.filter, tp, LOCATION_DECK, 0, 1, 1, nil, false)
  	if g:GetCount() > 0 then
  		Duel.SSet(tp, g:GetFirst())
  	end
  end
  
  