name: Dark
card_text: If this card is being attacked by a LIGHT monster, its DEF is halved during damage calculation only.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--defdown
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.defcon)
  	e1:SetValue(s.defval)
  	c:RegisterEffect(e1)
  end
  function s.defcon(e)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and c == Duel.GetAttackTarget() and bc:IsAttribute(ATTRIBUTE_LIGHT)
  end
  function s.defval(e, c)
  	return math.ceil(e:GetHandler():GetDefense() / 2)
  end
  
  
source_text: Dark
  If this card is being attacked by a LIGHT monster, its DEF is halved during damage calculation only.
target_text: -- Dark
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--defdown
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.defcon)
  	e1:SetValue(s.defval)
  	c:RegisterEffect(e1)
  end
  function s.defcon(e)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and c == Duel.GetAttackTarget() and bc:IsAttribute(ATTRIBUTE_LIGHT)
  end
  function s.defval(e, c)
  	return math.ceil(e:GetHandler():GetDefense() / 2)
  end
  
  