name: D-Fusion
card_text: Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Material, and if you do, it cannot be destroyed by battle or card effects this turn. Only "Destiny HERO" monsters can be used as Fusion Material for a Fusion Summon using this card's effect.
external_ids: local SETCARD_ID_0 = 0xc008 --Destiny
  
lua: local SETCARD_ID_0 = 0xc008 --Destiny
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	FusionSpell.RegisterSummonEffect(c, {
  		matfilter = s.matfilter,
  		pre_select_mat_location = LOCATION_MZONE,
  		stage_x_operation = s.stage_x_operation,
  	})
  end
  
  function s.matfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.stage_x_operation(e, tc, tp, stage)
  	if stage == FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  		tc:RegisterEffect(e2)
  	end
  end
  
  
source_text: D-Fusion
  Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Material, and if you do, it cannot be destroyed by battle or card effects this turn. Only "Destiny HERO" monsters can be used as Fusion Material for a Fusion Summon using this card's effect.
target_text: -- D-Fusion
  local SETCARD_ID_0 = 0xc008 --Destiny
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	FusionSpell.RegisterSummonEffect(c, {
  		matfilter = s.matfilter,
  		pre_select_mat_location = LOCATION_MZONE,
  		stage_x_operation = s.stage_x_operation,
  	})
  end
  
  function s.matfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.stage_x_operation(e, tc, tp, stage)
  	if stage == FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE then
  		local e1 = Effect.CreateEffect(e:GetHandler())
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
  		e1:SetValue(1)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		tc:RegisterEffect(e1)
  		local e2 = e1:Clone()
  		e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  		tc:RegisterEffect(e2)
  	end
  end
  
  