name: Myutant
card_text: Fusion Summon 1 "Myutant" Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from your hand or field. If your opponent has activated a card or effect this turn, you can use up to 1 monster each from your Deck and GY as Fusion Material. You can only activate 1 "Myutant Fusion" per turn.
external_ids: local SETCARD_ID_0 = 0x157 --Myutant
  
lua: local SETCARD_ID_0 = 0x157 --Myutant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = s.pre_select_mat_location,
  		mat_operation_code_map = {
  			{ [LOCATION_REMOVED] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_BANISH },
  		},
  		additional_fcheck = s.fcheck,
  	})
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON + CATEGORY_GRAVE_ACTION)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_CHAIN, aux.FALSE)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.pre_select_mat_location(tc, tp)
  	local location = LOCATION_HAND | LOCATION_MZONE
  	if Duel.GetCustomActivityCount(id, 1 - tp, ACTIVITY_CHAIN) ~= 0 then
  		location = location | LOCATION_DECK | LOCATION_GRAVE
  	end
  	return location
  end
  
  function s.fcheck(tp, mg, fc, mg_all)
  	--- At most include 1 monster from Deck
  	if mg:FilterCount(function(c)
  		return c:IsLocation(LOCATION_DECK)
  	end, nil) > 1 then
  		return false
  	end
  	--- At most include 1 monster from Grave
  	if mg:FilterCount(function(c)
  		return c:IsLocation(LOCATION_GRAVE)
  	end, nil) > 1 then
  		return false
  	end
  	return true
  end
  
  
source_text: Myutant
  Fusion Summon 1 "Myutant" Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from your hand or field. If your opponent has activated a card or effect this turn, you can use up to 1 monster each from your Deck and GY as Fusion Material. You can only activate 1 "Myutant Fusion" per turn.
target_text: -- Myutant
  local SETCARD_ID_0 = 0x157 --Myutant
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = FusionSpell.CreateSummonEffect(c, {
  		fusfilter = s.fusfilter,
  		pre_select_mat_location = s.pre_select_mat_location,
  		mat_operation_code_map = {
  			{ [LOCATION_REMOVED] = FusionSpell.FUSION_OPERATION_GRAVE },
  			{ [0xff] = FusionSpell.FUSION_OPERATION_BANISH },
  		},
  		additional_fcheck = s.fcheck,
  	})
  	e1:SetCategory(CATEGORY_REMOVE + CATEGORY_SPECIAL_SUMMON + CATEGORY_FUSION_SUMMON + CATEGORY_GRAVE_ACTION)
  	e1:SetCountLimit(1, id + EFFECT_COUNT_CODE_OATH)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_CHAIN, aux.FALSE)
  end
  
  function s.fusfilter(c)
  	return c:IsSetCard(SETCARD_ID_0)
  end
  
  function s.pre_select_mat_location(tc, tp)
  	local location = LOCATION_HAND | LOCATION_MZONE
  	if Duel.GetCustomActivityCount(id, 1 - tp, ACTIVITY_CHAIN) ~= 0 then
  		location = location | LOCATION_DECK | LOCATION_GRAVE
  	end
  	return location
  end
  
  function s.fcheck(tp, mg, fc, mg_all)
  	--- At most include 1 monster from Deck
  	if mg:FilterCount(function(c)
  		return c:IsLocation(LOCATION_DECK)
  	end, nil) > 1 then
  		return false
  	end
  	--- At most include 1 monster from Grave
  	if mg:FilterCount(function(c)
  		return c:IsLocation(LOCATION_GRAVE)
  	end, nil) > 1 then
  		return false
  	end
  	return true
  end
  
  