name: ダメージ・トランスレーション
card_text: このターン自分が受ける効果ダメージは半分になる。
  このターンのエンドフェイズ時、受けた効果ダメージの回数と同じ数だけ自分フィールド上に「ゴースト・トークン」(悪魔族・闇・星1・攻/守0)を守備表示で特殊召喚する。
external_ids: local CARD_ID_0 = 59822133 --青眼の精霊龍
  local CARD_ID_1 = 35268888 --ゴースト・トークン
  
lua: local CARD_ID_0 = 59822133 --青眼の精霊龍
  local CARD_ID_1 = 35268888 --ゴースト・トークン
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		s[0] = 0
  		s[1] = 0
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DAMAGE)
  		ge1:SetOperation(s.checkop)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = Effect.CreateEffect(c)
  		ge2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge2:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  		ge2:SetOperation(s.clear)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	if bit.band(r, REASON_EFFECT) ~= 0 then
  		s[ep] = s[ep] + 1
  	end
  end
  function s.clear(e, tp, eg, ep, ev, re, r, rp)
  	s[0] = 0
  	s[1] = 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CHANGE_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(s.val)
  	e1:SetReset(RESET_PHASE + PHASE_END, 1)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.tokentg)
  	e2:SetOperation(s.tokenop)
  	e2:SetReset(RESET_PHASE + PHASE_END, 1)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.val(e, re, dam, r, rp, rc)
  	if bit.band(r, REASON_EFFECT) ~= 0 then
  		return math.floor(dam / 2)
  	else
  		return dam
  	end
  end
  function s.tokentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = s[tp]
  	if chk == 0 then
  		return ct > 0
  			and (ct == 1 or not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) >= ct
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, ct, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, ct, 0, 0)
  end
  function s.tokenop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = s[tp]
  	if
  		(ct > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  		or Duel.GetLocationCount(tp, LOCATION_MZONE) < ct
  		or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK, POS_FACEUP_DEFENSE)
  	then
  		return
  	end
  	for i = 1, ct do
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  
source_text: ダメージ・トランスレーション
  このターン自分が受ける効果ダメージは半分になる。
  このターンのエンドフェイズ時、受けた効果ダメージの回数と同じ数だけ自分フィールド上に「ゴースト・トークン」(悪魔族・闇・星1・攻/守0)を守備表示で特殊召喚する。
target_text: -- ダメージ・トランスレーション
  local CARD_ID_0 = 59822133 --青眼の精霊龍
  local CARD_ID_1 = 35268888 --ゴースト・トークン
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	if not s.global_check then
  		s.global_check = true
  		s[0] = 0
  		s[1] = 0
  		local ge1 = Effect.CreateEffect(c)
  		ge1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge1:SetCode(EVENT_DAMAGE)
  		ge1:SetOperation(s.checkop)
  		Duel.RegisterEffect(ge1, 0)
  		local ge2 = Effect.CreateEffect(c)
  		ge2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  		ge2:SetCode(EVENT_PHASE_START + PHASE_DRAW)
  		ge2:SetOperation(s.clear)
  		Duel.RegisterEffect(ge2, 0)
  	end
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	if bit.band(r, REASON_EFFECT) ~= 0 then
  		s[ep] = s[ep] + 1
  	end
  end
  function s.clear(e, tp, eg, ep, ev, re, r, rp)
  	s[0] = 0
  	s[1] = 0
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CHANGE_DAMAGE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetTargetRange(1, 0)
  	e1:SetValue(s.val)
  	e1:SetReset(RESET_PHASE + PHASE_END, 1)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_PHASE + PHASE_END)
  	e2:SetCountLimit(1)
  	e2:SetTarget(s.tokentg)
  	e2:SetOperation(s.tokenop)
  	e2:SetReset(RESET_PHASE + PHASE_END, 1)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.val(e, re, dam, r, rp, rc)
  	if bit.band(r, REASON_EFFECT) ~= 0 then
  		return math.floor(dam / 2)
  	else
  		return dam
  	end
  end
  function s.tokentg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local ct = s[tp]
  	if chk == 0 then
  		return ct > 0
  			and (ct == 1 or not Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) >= ct
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK, POS_FACEUP_DEFENSE)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, ct, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, ct, 0, 0)
  end
  function s.tokenop(e, tp, eg, ep, ev, re, r, rp)
  	local ct = s[tp]
  	if
  		(ct > 1 and Duel.IsPlayerAffectedByEffect(tp, CARD_ID_0))
  		or Duel.GetLocationCount(tp, LOCATION_MZONE) < ct
  		or not Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, 0, 0, 1, RACE_FIEND, ATTRIBUTE_DARK, POS_FACEUP_DEFENSE)
  	then
  		return
  	end
  	for i = 1, ct do
  		local token = Duel.CreateToken(tp, id + 1)
  		Duel.SpecialSummonStep(token, 0, tp, tp, false, false, POS_FACEUP_DEFENSE)
  	end
  	Duel.SpecialSummonComplete()
  end
  
  