name: Dragonecro
card_text: 2 Zombie monsters
  Must first be Fusion Summoned. Monsters cannot be destroyed by battle with this card. At the end of the Damage Step, if this card battled a monster: Change that monster's ATK to 0, also, if that monster is still face-up on the field, Special Summon 1 "Dark Soul Token" (Zombie/DARK/Level ?/ATK ?/DEF 0) with the same Level/ATK as the original Level/ATK of that monster. You can only control 1 "Dragonecro Nethersoul Dragon".
external_ids: local CARD_ID_0 = 8198621 --Dark Soul Token
  
lua: local CARD_ID_0 = 8198621 --Dark Soul Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsRace, RACE_ZOMBIE), 2, true)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetRange(LOCATION_EXTRA)
  	e1:SetValue(aux.fuslimit)
  	c:RegisterEffect(e1)
  	--battle
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(aux.dsercon)
  	e2:SetTarget(s.attg)
  	e2:SetOperation(s.atop)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(0, LOCATION_MZONE)
  	e3:SetTarget(s.indestg)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return bc and bc:IsRelateToBattle()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if bc:IsRelateToBattle() and bc:IsFaceup() then
  		local lv = bc:GetOriginalLevel()
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		bc:RegisterEffect(e1)
  		if lv > 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, 0, 0, RACE_ZOMBIE, ATTRIBUTE_DARK) then
  			local token = Duel.CreateToken(tp, id + 1)
  			local atk = bc:GetBaseAttack()
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_SET_ATTACK)
  			e1:SetValue(atk)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD)
  			token:RegisterEffect(e1)
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_CHANGE_LEVEL)
  			e2:SetValue(lv)
  			token:RegisterEffect(e2)
  			Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  function s.indestg(e, c)
  	return c == e:GetHandler():GetBattleTarget()
  end
  
  
source_text: Dragonecro
  2 Zombie monsters
  Must first be Fusion Summoned. Monsters cannot be destroyed by battle with this card. At the end of the Damage Step, if this card battled a monster: Change that monster's ATK to 0, also, if that monster is still face-up on the field, Special Summon 1 "Dark Soul Token" (Zombie/DARK/Level ?/ATK ?/DEF 0) with the same Level/ATK as the original Level/ATK of that monster. You can only control 1 "Dragonecro Nethersoul Dragon".
target_text: -- Dragonecro
  local CARD_ID_0 = 8198621 --Dark Soul Token
  local s, id, o = GetID()
  function s.initial_effect(c)
  	c:SetUniqueOnField(1, 0, id)
  	--fusion material
  	c:EnableReviveLimit()
  	aux.AddFusionProcFunRep(c, aux.FilterBoolFunction(Card.IsRace, RACE_ZOMBIE), 2, true)
  	--spsummon condition
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE + EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetCode(EFFECT_SPSUMMON_CONDITION)
  	e1:SetRange(LOCATION_EXTRA)
  	e1:SetValue(aux.fuslimit)
  	c:RegisterEffect(e1)
  	--battle
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_ATKCHANGE + CATEGORY_SPECIAL_SUMMON + CATEGORY_TOKEN)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e2:SetCode(EVENT_DAMAGE_STEP_END)
  	e2:SetCondition(aux.dsercon)
  	e2:SetTarget(s.attg)
  	e2:SetOperation(s.atop)
  	c:RegisterEffect(e2)
  	--indes
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(0, LOCATION_MZONE)
  	e3:SetTarget(s.indestg)
  	e3:SetValue(1)
  	c:RegisterEffect(e3)
  end
  function s.attg(e, tp, eg, ep, ev, re, r, rp, chk)
  	local bc = e:GetHandler():GetBattleTarget()
  	if chk == 0 then
  		return bc and bc:IsRelateToBattle()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOKEN, nil, 1, 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, 0, 0)
  end
  function s.atop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local bc = c:GetBattleTarget()
  	if bc:IsRelateToBattle() and bc:IsFaceup() then
  		local lv = bc:GetOriginalLevel()
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_SET_ATTACK_FINAL)
  		e1:SetValue(0)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD)
  		bc:RegisterEffect(e1)
  		if lv > 0 and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsPlayerCanSpecialSummonMonster(tp, id + 1, 0, TYPES_TOKEN_MONSTER, -2, 0, 0, RACE_ZOMBIE, ATTRIBUTE_DARK) then
  			local token = Duel.CreateToken(tp, id + 1)
  			local atk = bc:GetBaseAttack()
  			local e1 = Effect.CreateEffect(c)
  			e1:SetType(EFFECT_TYPE_SINGLE)
  			e1:SetCode(EFFECT_SET_ATTACK)
  			e1:SetValue(atk)
  			e1:SetReset(RESET_EVENT + RESETS_STANDARD - RESET_TOFIELD)
  			token:RegisterEffect(e1)
  			local e2 = e1:Clone()
  			e2:SetCode(EFFECT_CHANGE_LEVEL)
  			e2:SetValue(lv)
  			token:RegisterEffect(e2)
  			Duel.SpecialSummon(token, 0, tp, tp, false, false, POS_FACEUP)
  		end
  	end
  end
  function s.indestg(e, c)
  	return c == e:GetHandler():GetBattleTarget()
  end
  
  