name: Crystal
card_text: 1 Tuner + 1+ non-Tuner Synchro Monsters
  Once per turn, when another monster's effect is activated (Quick Effect): You can negate the activation, and if you do, destroy that monster, and if you do that, this card gains ATK equal to the destroyed monster's original ATK until the end of this turn. If this card battles an opponent's Level 5 or higher monster, during damage calculation: This card gains ATK equal to the current ATK of the opponent's monster it is battling during that damage calculation only.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(Card.IsSynchroType, TYPE_SYNCHRO), 1)
  	c:EnableReviveLimit()
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetCondition(s.atkcon)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  s.material_type = TYPE_SYNCHRO
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rc ~= c and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) and Duel.Destroy(rc, REASON_EFFECT) ~= 0 and rc:GetBaseAttack() >= 0 and c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		e1:SetValue(rc:GetBaseAttack())
  		c:RegisterEffect(e1)
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsLevelAbove(5) and bc:IsControler(1 - tp)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if c:IsRelateToBattle() and c:IsFaceup() and bc:IsRelateToBattle() and bc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_PHASE + PHASE_DAMAGE_CAL)
  		e1:SetValue(bc:GetAttack())
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Crystal
  1 Tuner + 1+ non-Tuner Synchro Monsters
  Once per turn, when another monster's effect is activated (Quick Effect): You can negate the activation, and if you do, destroy that monster, and if you do that, this card gains ATK equal to the destroyed monster's original ATK until the end of this turn. If this card battles an opponent's Level 5 or higher monster, during damage calculation: This card gains ATK equal to the current ATK of the opponent's monster it is battling during that damage calculation only.
target_text: -- Crystal
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--synchro summon
  	aux.AddSynchroProcedure(c, nil, aux.NonTuner(Card.IsSynchroType, TYPE_SYNCHRO), 1)
  	c:EnableReviveLimit()
  	--negate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_NEGATE + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_QUICK_O)
  	e1:SetCode(EVENT_CHAINING)
  	e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP + EFFECT_FLAG_DAMAGE_CAL)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.operation)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetCategory(CATEGORY_ATKCHANGE)
  	e2:SetType(EFFECT_TYPE_TRIGGER_F + EFFECT_TYPE_SINGLE)
  	e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
  	e2:SetCondition(s.atkcon)
  	e2:SetOperation(s.atkop)
  	c:RegisterEffect(e2)
  end
  s.material_type = TYPE_SYNCHRO
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER) and rc ~= c and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_NEGATE, eg, 1, 0, 0)
  	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
  		Duel.SetOperationInfo(0, CATEGORY_DESTROY, eg, 1, 0, 0)
  	end
  end
  function s.operation(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local rc = re:GetHandler()
  	if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) and Duel.Destroy(rc, REASON_EFFECT) ~= 0 and rc:GetBaseAttack() >= 0 and c:IsRelateToEffect(e) and c:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END)
  		e1:SetValue(rc:GetBaseAttack())
  		c:RegisterEffect(e1)
  	end
  end
  function s.atkcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return bc and bc:IsLevelAbove(5) and bc:IsControler(1 - tp)
  end
  function s.atkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if c:IsRelateToBattle() and c:IsFaceup() and bc:IsRelateToBattle() and bc:IsFaceup() then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetReset(RESET_PHASE + PHASE_DAMAGE_CAL)
  		e1:SetValue(bc:GetAttack())
  		c:RegisterEffect(e1)
  	end
  end
  
  