name: Elemental
card_text: Each time this card inflicts Battle Damage to your opponent: It gains 100 ATK and loses 100 DEF. While you control another face-up "Elemental HERO" monster, your opponent cannot target this card for an attack, and this card can attack your opponent directly.
external_ids: local SETCARD_ID_0 = 0x3008 --Elemental
  
lua: local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--direct attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_DIRECT_ATTACK)
  	e1:SetCondition(s.atcon)
  	c:RegisterEffect(e1)
  	--atk/def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetCondition(s.adcon)
  	e2:SetOperation(s.adop)
  	c:RegisterEffect(e2)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.atcon)
  	e3:SetValue(aux.imval1)
  	c:RegisterEffect(e3)
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and c:GetDefense() >= 100 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(100)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		e2:SetValue(-100)
  		c:RegisterEffect(e2)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.atcon(e)
  	return Duel.IsExistingMatchingCard(s.filter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, e:GetHandler())
  end
  
  
source_text: Elemental
  Each time this card inflicts Battle Damage to your opponent: It gains 100 ATK and loses 100 DEF. While you control another face-up "Elemental HERO" monster, your opponent cannot target this card for an attack, and this card can attack your opponent directly.
target_text: -- Elemental
  local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--direct attack
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_DIRECT_ATTACK)
  	e1:SetCondition(s.atcon)
  	c:RegisterEffect(e1)
  	--atk/def
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_BATTLE_DAMAGE)
  	e2:SetCondition(s.adcon)
  	e2:SetOperation(s.adop)
  	c:RegisterEffect(e2)
  	--
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_SINGLE)
  	e3:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
  	e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCondition(s.atcon)
  	e3:SetValue(aux.imval1)
  	c:RegisterEffect(e3)
  end
  function s.adcon(e, tp, eg, ep, ev, re, r, rp)
  	return ep ~= tp
  end
  function s.adop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() and c:GetDefense() >= 100 then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_UPDATE_ATTACK)
  		e1:SetValue(100)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  		c:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_UPDATE_DEFENSE)
  		e2:SetValue(-100)
  		c:RegisterEffect(e2)
  	end
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.atcon(e)
  	return Duel.IsExistingMatchingCard(s.filter, e:GetHandlerPlayer(), LOCATION_MZONE, 0, 1, e:GetHandler())
  end
  
  