name: Spright
card_text: If you control a Level/Rank 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Pixies" once per turn this way. During damage calculation, if another Level/Rank/Link 2 monster you control battles an opponent's monster (Quick Effect): You can send this card from your hand or field to the GY; that monster you control gains ATK/DEF equal to the opponent's monster's ATK, until the end of this turn. You can only use this effect of "Spright Pixies" once per turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_HAND + LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.atkcon)
  	e2:SetCost(s.atkcost)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return (c:IsLevel(2) or c:IsRank(2)) and c:IsFaceup()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local a, d = Duel.GetBattleMonster(tp)
  	return a and d and (a:IsLevel(2) or a:IsRank(2) or a:IsLink(2)) and a ~= e:GetHandler()
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local a, d = Duel.GetBattleMonster(tp)
  	if not a:IsRelateToBattle() or not d:IsRelateToBattle() then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(d:GetAttack())
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	a:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	a:RegisterEffect(e2)
  end
  
  
source_text: Spright
  If you control a Level/Rank 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Pixies" once per turn this way. During damage calculation, if another Level/Rank/Link 2 monster you control battles an opponent's monster (Quick Effect): You can send this card from your hand or field to the GY; that monster you control gains ATK/DEF equal to the opponent's monster's ATK, until the end of this turn. You can only use this effect of "Spright Pixies" once per turn.
target_text: -- Spright
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	e1:SetCondition(s.spcon)
  	c:RegisterEffect(e1)
  	--atk up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_DEFCHANGE)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetRange(LOCATION_HAND + LOCATION_MZONE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCondition(s.atkcon)
  	e2:SetCost(s.atkcost)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  function s.filter(c)
  	return (c:IsLevel(2) or c:IsRank(2)) and c:IsFaceup()
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	return Duel.GetLocationCount(c:GetControler(), LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.filter, c:GetControler(), LOCATION_MZONE, 0, 1, nil)
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local a, d = Duel.GetBattleMonster(tp)
  	return a and d and (a:IsLevel(2) or a:IsRank(2) or a:IsLink(2)) and a ~= e:GetHandler()
  end
  function s.atkcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToGraveAsCost()
  	end
  	Duel.SendtoGrave(e:GetHandler(), REASON_COST)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local a, d = Duel.GetBattleMonster(tp)
  	if not a:IsRelateToBattle() or not d:IsRelateToBattle() then
  		return
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(d:GetAttack())
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  	a:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	a:RegisterEffect(e2)
  end
  
  