name: Pyrotech
card_text: You can Tribute Summon this card with 1 Tribute. If Summoned this way, during each End Phase: You take 1000 damage. If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with 1 tribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetCondition(s.otcon)
  	e1:SetOperation(s.otop)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e1)
  	--pierce
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e2)
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	return c:IsLevelAbove(7) and minc <= 1 and Duel.CheckTribute(c, 1)
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = Duel.SelectTribute(tp, c, 1, 1)
  	c:SetMaterial(g)
  	Duel.Release(g, REASON_SUMMON + REASON_MATERIAL)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	e1:SetReset(RESET_EVENT + 0xc6e0000)
  	c:RegisterEffect(e1)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, tp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  		Duel.Damage(p, d, REASON_EFFECT)
  	end
  end
  
  
source_text: Pyrotech
  You can Tribute Summon this card with 1 Tribute. If Summoned this way, during each End Phase: You take 1000 damage. If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent.
target_text: -- Pyrotech
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--summon with 1 tribute
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_SUMMON_PROC)
  	e1:SetCondition(s.otcon)
  	e1:SetOperation(s.otop)
  	e1:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e1)
  	--pierce
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_SINGLE)
  	e2:SetCode(EFFECT_PIERCE)
  	c:RegisterEffect(e2)
  end
  function s.otcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	return c:IsLevelAbove(7) and minc <= 1 and Duel.CheckTribute(c, 1)
  end
  function s.otop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = Duel.SelectTribute(tp, c, 1, 1)
  	c:SetMaterial(g)
  	Duel.Release(g, REASON_SUMMON + REASON_MATERIAL)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 1))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCountLimit(1)
  	e1:SetCode(EVENT_PHASE + PHASE_END)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	e1:SetReset(RESET_EVENT + 0xc6e0000)
  	c:RegisterEffect(e1)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetTargetPlayer(tp)
  	Duel.SetTargetParam(1000)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, tp, 1000)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and c:IsFaceup() then
  		local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  		Duel.Damage(p, d, REASON_EFFECT)
  	end
  end
  
  