name: Clay
card_text: When an "Elemental HERO Clayman" you control is targeted for an attack (even if it is face-down, but reveal it to your opponent in that case): Destroy the attacking monster and that "Elemental HERO Clayman", and inflict 800 damage to your opponent.
external_ids: local CARD_ID_0 = 84327329 --Elemental HERO Clayman
  local SETCARD_ID_0 = 0x3008 --Elemental
  
lua: local CARD_ID_0 = 84327329 --Elemental HERO Clayman
  local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local at = Duel.GetAttackTarget()
  	return at:IsControler(tp) and at:IsCode(CARD_ID_0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local a = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return a:IsOnField() and a:IsCanBeEffectTarget(e) and at:IsOnField() and at:IsCanBeEffectTarget(e)
  	end
  	if at:IsFacedown() then
  		Duel.ConfirmCards(1 - tp, at)
  	end
  	local g = Group.FromCards(a, at)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 800)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 2 then
  		Duel.Destroy(g, REASON_EFFECT)
  		Duel.Damage(1 - tp, 800, REASON_EFFECT)
  	end
  end
  
  
source_text: Clay
  When an "Elemental HERO Clayman" you control is targeted for an attack (even if it is face-down, but reveal it to your opponent in that case): Destroy the attacking monster and that "Elemental HERO Clayman", and inflict 800 damage to your opponent.
target_text: -- Clay
  local CARD_ID_0 = 84327329 --Elemental HERO Clayman
  local SETCARD_ID_0 = 0x3008 --Elemental
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddSetNameMonsterList(c, SETCARD_ID_0)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_BE_BATTLE_TARGET)
  	e1:SetCondition(s.condition)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	local at = Duel.GetAttackTarget()
  	return at:IsControler(tp) and at:IsCode(CARD_ID_0)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local a = Duel.GetAttacker()
  	local at = Duel.GetAttackTarget()
  	if chkc then
  		return false
  	end
  	if chk == 0 then
  		return a:IsOnField() and a:IsCanBeEffectTarget(e) and at:IsOnField() and at:IsCanBeEffectTarget(e)
  	end
  	if at:IsFacedown() then
  		Duel.ConfirmCards(1 - tp, at)
  	end
  	local g = Group.FromCards(a, at)
  	Duel.SetTargetCard(g)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, 2, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 800)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if g:GetCount() == 2 then
  		Duel.Destroy(g, REASON_EFFECT)
  		Duel.Damage(1 - tp, 800, REASON_EFFECT)
  	end
  end
  
  