name: Salamandra,
card_text: While this card is equipped to "Flame Swordsman" or a monster that mentions it, the equipped monster gains 700 ATK. You can only use each of the following effects of "Salamandra, the Flying Flame Dragon" once per turn. If this card is in your hand or GY: You can target 1 Warrior monster you control; equip this card to that monster you control as an Equip Spell. If this card is sent to the GY: You can add 1 "Salamandra" Spell/Trap from your Deck to your hand.
external_ids: local CARD_ID_0 = 45231177 --Flame Swordsman
  local SETCARD_ID_0 = 0x1ac --Salamandra
  
lua: local CARD_ID_0 = 45231177 --Flame Swordsman
  local SETCARD_ID_0 = 0x1ac --Salamandra
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_EQUIP)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetCondition(s.eqcon)
  	e1:SetValue(700)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_HAND + LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  	--search
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetTarget(s.thtg)
  	e3:SetOperation(s.thop)
  	c:RegisterEffect(e3)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local qc = e:GetHandler():GetEquipTarget()
  	return (qc:IsCode(CARD_ID_0) or aux.IsCodeListed(qc, CARD_ID_0))
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and e:GetHandler():CheckUniqueOnField(tp) and Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, c)
  	if c:IsLocation(LOCATION_GRAVE) then
  		Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, c, 0, 0, 0)
  	end
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	local tc = Duel.GetFirstTarget()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 or tc:IsFacedown() or tc:GetControler() ~= tp or not tc:IsRelateToEffect(e) or not c:CheckUniqueOnField(tp) then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  		return
  	end
  	if not Duel.Equip(tp, c, tc) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_EQUIP_LIMIT)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e1:SetValue(s.eqlimit)
  	e1:SetLabelObject(tc)
  	c:RegisterEffect(e1)
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) 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
  
  
source_text: Salamandra,
  While this card is equipped to "Flame Swordsman" or a monster that mentions it, the equipped monster gains 700 ATK. You can only use each of the following effects of "Salamandra, the Flying Flame Dragon" once per turn. If this card is in your hand or GY: You can target 1 Warrior monster you control; equip this card to that monster you control as an Equip Spell. If this card is sent to the GY: You can add 1 "Salamandra" Spell/Trap from your Deck to your hand.
target_text: -- Salamandra,
  local CARD_ID_0 = 45231177 --Flame Swordsman
  local SETCARD_ID_0 = 0x1ac --Salamandra
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_0)
  	--attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_EQUIP)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetCondition(s.eqcon)
  	e1:SetValue(700)
  	c:RegisterEffect(e1)
  	--equip
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_EQUIP)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_HAND + LOCATION_GRAVE)
  	e2:SetCountLimit(1, id)
  	e2:SetTarget(s.eqtg)
  	e2:SetOperation(s.eqop)
  	c:RegisterEffect(e2)
  	--search
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 1))
  	e3:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e3:SetProperty(EFFECT_FLAG_DELAY)
  	e3:SetCode(EVENT_TO_GRAVE)
  	e3:SetCountLimit(1, id + o)
  	e3:SetTarget(s.thtg)
  	e3:SetOperation(s.thop)
  	c:RegisterEffect(e3)
  end
  function s.eqcon(e, tp, eg, ep, ev, re, r, rp)
  	local qc = e:GetHandler():GetEquipTarget()
  	return (qc:IsCode(CARD_ID_0) or aux.IsCodeListed(qc, CARD_ID_0))
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local c = e:GetHandler()
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) and chkc ~= c
  	end
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and e:GetHandler():CheckUniqueOnField(tp) and Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, 0, 1, c)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, 0, 1, 1, c)
  	if c:IsLocation(LOCATION_GRAVE) then
  		Duel.SetOperationInfo(0, CATEGORY_LEAVE_GRAVE, c, 0, 0, 0)
  	end
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if not c:IsRelateToEffect(e) then
  		return
  	end
  	local tc = Duel.GetFirstTarget()
  	if Duel.GetLocationCount(tp, LOCATION_SZONE) <= 0 or tc:IsFacedown() or tc:GetControler() ~= tp or not tc:IsRelateToEffect(e) or not c:CheckUniqueOnField(tp) then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  		return
  	end
  	if not Duel.Equip(tp, c, tc) then
  		return
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_EQUIP_LIMIT)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e1:SetValue(s.eqlimit)
  	e1:SetLabelObject(tc)
  	c:RegisterEffect(e1)
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.thfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_SPELL + TYPE_TRAP) 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
  
  