name: Chthonian
card_text: When this card is destroyed by an opponent's attacking monster and sent to the Graveyard, the Battle Damage you took from this battle is also inflicted to your opponent.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.damcon)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return ev == 1 and e:GetHandler():IsLocation(LOCATION_GRAVE)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local damage = Duel.GetBattleDamage(tp)
  	if chk == 0 then
  		return damage > 0
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(damage)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, e:GetLabel())
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  
source_text: Chthonian
  When this card is destroyed by an opponent's attacking monster and sent to the Graveyard, the Battle Damage you took from this battle is also inflicted to your opponent.
target_text: -- Chthonian
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--damage
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_BATTLE_DESTROYED)
  	e1:SetCondition(s.damcon)
  	e1:SetTarget(s.damtg)
  	e1:SetOperation(s.damop)
  	c:RegisterEffect(e1)
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	return ev == 1 and e:GetHandler():IsLocation(LOCATION_GRAVE)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local damage = Duel.GetBattleDamage(tp)
  	if chk == 0 then
  		return damage > 0
  	end
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(damage)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, e:GetLabel())
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p, d = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER, CHAININFO_TARGET_PARAM)
  	Duel.Damage(p, d, REASON_EFFECT)
  end
  
  