name: Solitary
card_text: Equip only to a monster you control. If the equipped monster battles an opponent's monster, the equipped monster's original ATK/DEF is doubled during damage calculation only. If you control a monster other than the equipped monster, send this card to the GY. You can only control 1 "Solitary Sword of Poison".
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE)
  	c:SetUniqueOnField(1, 0, id)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Equip limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EFFECT_EQUIP_LIMIT)
  	e2:SetValue(s.eqlimit)
  	c:RegisterEffect(e2)
  	--self destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCode(EFFECT_SELF_TOGRAVE)
  	e3:SetCondition(s.sdcon)
  	c:RegisterEffect(e3)
  	--double atk/def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_SET_BASE_ATTACK)
  	e4:SetCondition(s.adcon)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	local e5 = e4:Clone()
  	e5:SetCode(EFFECT_SET_BASE_DEFENSE)
  	e5:SetValue(s.defval)
  	c:RegisterEffect(e5)
  end
  function s.eqlimit(e, c)
  	return c:IsControler(e:GetHandlerPlayer())
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.sdcon(e)
  	local tc = e:GetHandler():GetEquipTarget()
  	return tc and Duel.IsExistingMatchingCard(nil, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, tc)
  end
  function s.adcon(e)
  	if Duel.GetCurrentPhase() ~= PHASE_DAMAGE_CAL then
  		return false
  	end
  	local eqc = e:GetHandler():GetEquipTarget()
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	return d and (a == eqc or d == eqc)
  end
  function s.atkval(e, c)
  	return c:GetBaseAttack() * 2
  end
  function s.defval(e, c)
  	return c:GetBaseDefense() * 2
  end
  
  
source_text: Solitary
  Equip only to a monster you control. If the equipped monster battles an opponent's monster, the equipped monster's original ATK/DEF is doubled during damage calculation only. If you control a monster other than the equipped monster, send this card to the GY. You can only control 1 "Solitary Sword of Poison".
target_text: -- Solitary
  local s, id, o = GetID()
  function s.initial_effect(c)
  	Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE)
  	c:SetUniqueOnField(1, 0, id)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--Equip limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EFFECT_EQUIP_LIMIT)
  	e2:SetValue(s.eqlimit)
  	c:RegisterEffect(e2)
  	--self destroy
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_SZONE)
  	e3:SetCode(EFFECT_SELF_TOGRAVE)
  	e3:SetCondition(s.sdcon)
  	c:RegisterEffect(e3)
  	--double atk/def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_SET_BASE_ATTACK)
  	e4:SetCondition(s.adcon)
  	e4:SetValue(s.atkval)
  	c:RegisterEffect(e4)
  	local e5 = e4:Clone()
  	e5:SetCode(EFFECT_SET_BASE_DEFENSE)
  	e5:SetValue(s.defval)
  	c:RegisterEffect(e5)
  end
  function s.eqlimit(e, c)
  	return c:IsControler(e:GetHandlerPlayer())
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup()
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, Card.IsFaceup, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_EQUIP, e:GetHandler(), 1, 0, 0)
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.sdcon(e)
  	local tc = e:GetHandler():GetEquipTarget()
  	return tc and Duel.IsExistingMatchingCard(nil, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, tc)
  end
  function s.adcon(e)
  	if Duel.GetCurrentPhase() ~= PHASE_DAMAGE_CAL then
  		return false
  	end
  	local eqc = e:GetHandler():GetEquipTarget()
  	local a = Duel.GetAttacker()
  	local d = Duel.GetAttackTarget()
  	return d and (a == eqc or d == eqc)
  end
  function s.atkval(e, c)
  	return c:GetBaseAttack() * 2
  end
  function s.defval(e, c)
  	return c:GetBaseDefense() * 2
  end
  
  