name: Armory
card_text: 1 Tuner + 1+ non-Tuner monsters
  Once per turn, you can either: Target 1 monster on the field; equip this card to that target, OR: Unequip this card and Special Summon it in Attack Position. While equipped by this effect, that target gains 1000 ATK. If that target destroys a monster by battle and sends it to the GY: Inflict damage to your opponent equal to the destroyed monster's original ATK.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc ~= e:GetHandler()
  	end
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x7e0000 + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	if not tc:IsRelateToEffect(e) or tc:IsFacedown() then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  		return
  	end
  	if not Duel.Equip(tp, c, tc, false) then
  		return
  	end
  	--unequip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e1)
  	--Atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetValue(1000)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_BATTLE_DESTROYED)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCondition(s.damcon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e3)
  	--eqlimit
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_EQUIP_LIMIT)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e4:SetValue(s.eqlimit)
  	e4:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e4:SetLabelObject(tc)
  	c:RegisterEffect(e4)
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, true, false, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x7e0000 + RESET_PHASE + PHASE_END, 0, 1)
  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, true, false, POS_FACEUP_ATTACK)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local eqc = e:GetHandler():GetEquipTarget()
  	local des = eg:GetFirst()
  	return des:IsLocation(LOCATION_GRAVE) and des:GetReasonCard() == eqc and des:IsType(TYPE_MONSTER)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	eg:GetFirst():CreateEffectRelation(e)
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local des = eg:GetFirst()
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	if des:IsRelateToEffect(e) then
  		local dam = des:GetAttack()
  		if dam < 0 then
  			dam = 0
  		end
  		Duel.Damage(p, dam, REASON_EFFECT)
  	end
  end
  
  
source_text: Armory
  1 Tuner + 1+ non-Tuner monsters
  Once per turn, you can either: Target 1 monster on the field; equip this card to that target, OR: Unequip this card and Special Summon it in Attack Position. While equipped by this effect, that target gains 1000 ATK. If that target destroys a monster by battle and sends it to the GY: Inflict damage to your opponent equal to the destroyed monster's original ATK.
target_text: -- Armory
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(nil), 1)
  	c:EnableReviveLimit()
  	--equip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTarget(s.eqtg)
  	e1:SetOperation(s.eqop)
  	c:RegisterEffect(e1)
  end
  function s.eqtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc ~= e:GetHandler()
  	end
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.GetLocationCount(tp, LOCATION_SZONE) > 0 and Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, e:GetHandler())
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	local g = Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, LOCATION_MZONE, 1, 1, e:GetHandler())
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, g, 1, 0, 0)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x7e0000 + RESET_PHASE + PHASE_END, 0, 1)
  end
  function s.eqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	if not c:IsRelateToEffect(e) or c:IsFacedown() then
  		return
  	end
  	if not tc:IsRelateToEffect(e) or tc:IsFacedown() then
  		Duel.SendtoGrave(c, REASON_EFFECT)
  		return
  	end
  	if not Duel.Equip(tp, c, tc, false) then
  		return
  	end
  	--unequip
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_SZONE)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e1)
  	--Atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_EQUIP)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetValue(1000)
  	e2:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e2)
  	--damage
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 2))
  	e3:SetCategory(CATEGORY_DAMAGE)
  	e3:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e3:SetCode(EVENT_BATTLE_DESTROYED)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCondition(s.damcon)
  	e3:SetTarget(s.damtg)
  	e3:SetOperation(s.damop)
  	e3:SetReset(RESET_EVENT + RESETS_STANDARD)
  	c:RegisterEffect(e3)
  	--eqlimit
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE)
  	e4:SetCode(EFFECT_EQUIP_LIMIT)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e4:SetValue(s.eqlimit)
  	e4:SetReset(RESET_EVENT + RESETS_STANDARD)
  	e4:SetLabelObject(tc)
  	c:RegisterEffect(e4)
  end
  function s.eqlimit(e, c)
  	return c == e:GetLabelObject()
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():GetFlagEffect(id) == 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, true, false, POS_FACEUP_ATTACK)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  	e:GetHandler():RegisterFlagEffect(id, RESET_EVENT + 0x7e0000 + RESET_PHASE + PHASE_END, 0, 1)
  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, true, false, POS_FACEUP_ATTACK)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local eqc = e:GetHandler():GetEquipTarget()
  	local des = eg:GetFirst()
  	return des:IsLocation(LOCATION_GRAVE) and des:GetReasonCard() == eqc and des:IsType(TYPE_MONSTER)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	eg:GetFirst():CreateEffectRelation(e)
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local des = eg:GetFirst()
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	if des:IsRelateToEffect(e) then
  		local dam = des:GetAttack()
  		if dam < 0 then
  			dam = 0
  		end
  		Duel.Damage(p, dam, REASON_EFFECT)
  	end
  end
  
  