name: Stoic
card_text: You can only control 1 "Stoic Challenge". Equip only to a face-up Xyz Monster that has Xyz Material. It gains 600 ATK for each Xyz Material attached to a monster you control, and any battle damage your opponent takes from battles involving it and their monster is doubled, but its effects cannot be activated. During your opponent's End Phase: Send this card to the Graveyard. When this card leaves the field, destroy the equipped monster.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--equip limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_EQUIP_LIMIT)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetValue(s.eqlimit)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_EQUIP)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetValue(s.atkval)
  	c:RegisterEffect(e3)
  	--damage change
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE)
  	e4:SetCondition(s.damcon)
  	e4:SetValue(aux.ChangeBattleDamage(1, DOUBLE_DAMAGE))
  	c:RegisterEffect(e4)
  	--
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_EQUIP)
  	e5:SetCode(EFFECT_CANNOT_TRIGGER)
  	c:RegisterEffect(e5)
  	--tograve
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_END)
  	e6:SetRange(LOCATION_SZONE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.tgcon)
  	e6:SetTarget(s.tgtg)
  	e6:SetOperation(s.tgop)
  	c:RegisterEffect(e6)
  	--destroy
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e7:SetCode(EVENT_LEAVE_FIELD)
  	e7:SetOperation(s.desop)
  	c:RegisterEffect(e7)
  end
  function s.eqlimit(e, c)
  	return c:GetOverlayCount() > 0
  end
  function s.filter(c)
  	return c:IsFaceup() and c:GetOverlayCount() > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 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() then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.atkval(e, c)
  	return Duel.GetOverlayCount(e:GetHandlerPlayer(), 1, 0) * 600
  end
  function s.damcon(e)
  	return e:GetHandler():GetEquipTarget():GetBattleTarget() ~= nil
  end
  function s.tgcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, e:GetHandler(), 1, 0, 0)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetFirstCardTarget()
  	if tc and tc:IsLocation(LOCATION_MZONE) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  
source_text: Stoic
  You can only control 1 "Stoic Challenge". Equip only to a face-up Xyz Monster that has Xyz Material. It gains 600 ATK for each Xyz Material attached to a monster you control, and any battle damage your opponent takes from battles involving it and their monster is doubled, but its effects cannot be activated. During your opponent's End Phase: Send this card to the Graveyard. When this card leaves the field, destroy the equipped monster.
target_text: -- Stoic
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_EQUIP)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET + EFFECT_FLAG_CONTINUOUS_TARGET)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--equip limit
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_EQUIP_LIMIT)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetValue(s.eqlimit)
  	c:RegisterEffect(e2)
  	--atkup
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_EQUIP)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetValue(s.atkval)
  	c:RegisterEffect(e3)
  	--damage change
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_EQUIP)
  	e4:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE)
  	e4:SetCondition(s.damcon)
  	e4:SetValue(aux.ChangeBattleDamage(1, DOUBLE_DAMAGE))
  	c:RegisterEffect(e4)
  	--
  	local e5 = Effect.CreateEffect(c)
  	e5:SetType(EFFECT_TYPE_EQUIP)
  	e5:SetCode(EFFECT_CANNOT_TRIGGER)
  	c:RegisterEffect(e5)
  	--tograve
  	local e6 = Effect.CreateEffect(c)
  	e6:SetDescription(aux.Stringid(id, 0))
  	e6:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e6:SetCode(EVENT_PHASE + PHASE_END)
  	e6:SetRange(LOCATION_SZONE)
  	e6:SetCountLimit(1)
  	e6:SetCondition(s.tgcon)
  	e6:SetTarget(s.tgtg)
  	e6:SetOperation(s.tgop)
  	c:RegisterEffect(e6)
  	--destroy
  	local e7 = Effect.CreateEffect(c)
  	e7:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e7:SetCode(EVENT_LEAVE_FIELD)
  	e7:SetOperation(s.desop)
  	c:RegisterEffect(e7)
  end
  function s.eqlimit(e, c)
  	return c:GetOverlayCount() > 0
  end
  function s.filter(c)
  	return c:IsFaceup() and c:GetOverlayCount() > 0
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_EQUIP)
  	Duel.SelectTarget(tp, s.filter, tp, LOCATION_MZONE, LOCATION_MZONE, 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() then
  		Duel.Equip(tp, e:GetHandler(), tc)
  	end
  end
  function s.atkval(e, c)
  	return Duel.GetOverlayCount(e:GetHandlerPlayer(), 1, 0) * 600
  end
  function s.damcon(e)
  	return e:GetHandler():GetEquipTarget():GetBattleTarget() ~= nil
  end
  function s.tgcon(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.GetTurnPlayer() ~= tp
  end
  function s.tgtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOGRAVE, e:GetHandler(), 1, 0, 0)
  end
  function s.tgop(e, tp, eg, ep, ev, re, r, rp)
  	if e:GetHandler():IsRelateToEffect(e) then
  		Duel.SendtoGrave(e:GetHandler(), REASON_EFFECT)
  	end
  end
  function s.desop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = e:GetHandler():GetFirstCardTarget()
  	if tc and tc:IsLocation(LOCATION_MZONE) then
  		Duel.Destroy(tc, REASON_EFFECT)
  	end
  end
  
  