name: Squeaknight
card_text: If this card is Special Summoned: You can activate this effect; treat this card as a Tuner this turn, also you can only Special Summon once from the Extra Deck for the rest of this turn. Once per turn, you can either: Target 1 face-up monster you control; equip this card to that target, OR: Unequip this card and Special Summon it. If the equipped monster would be destroyed by battle or card effect, destroy this card instead.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableExtraDeckSummonCountLimit()
  	aux.EnableUnionAttribute(c, aux.TRUE)
  	--tuner
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetTarget(s.tntg)
  	e1:SetOperation(s.tnop)
  	c:RegisterEffect(e1)
  end
  s.treat_itself_tuner = true
  function s.tntg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsType(TYPE_TUNER)
  	end
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetOperation(s.checkop)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(92345028)
  	e3:SetTargetRange(1, 0)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsLocation(LOCATION_EXTRA) and aux.ExtraDeckSummonCountLimit[sump] <= 0
  end
  function s.cfilter(c, tp)
  	return c:IsSummonPlayer(tp) and c:IsPreviousLocation(LOCATION_EXTRA)
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	if eg:IsExists(s.cfilter, 1, nil, tp) then
  		aux.ExtraDeckSummonCountLimit[tp] = aux.ExtraDeckSummonCountLimit[tp] - 1
  	end
  	if eg:IsExists(s.cfilter, 1, nil, 1 - tp) then
  		aux.ExtraDeckSummonCountLimit[1 - tp] = aux.ExtraDeckSummonCountLimit[1 - tp] - 1
  	end
  end
  
  
source_text: Squeaknight
  If this card is Special Summoned: You can activate this effect; treat this card as a Tuner this turn, also you can only Special Summon once from the Extra Deck for the rest of this turn. Once per turn, you can either: Target 1 face-up monster you control; equip this card to that target, OR: Unequip this card and Special Summon it. If the equipped monster would be destroyed by battle or card effect, destroy this card instead.
target_text: -- Squeaknight
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.EnableExtraDeckSummonCountLimit()
  	aux.EnableUnionAttribute(c, aux.TRUE)
  	--tuner
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetTarget(s.tntg)
  	e1:SetOperation(s.tnop)
  	c:RegisterEffect(e1)
  end
  s.treat_itself_tuner = true
  function s.tntg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return not e:GetHandler():IsType(TYPE_TUNER)
  	end
  end
  function s.tnop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() and c:IsRelateToEffect(e) then
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_ADD_TYPE)
  		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  		e1:SetValue(TYPE_TUNER)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_PHASE + PHASE_END)
  		c:RegisterEffect(e1)
  	end
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.splimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_FIELD)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetOperation(s.checkop)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e3:SetCode(92345028)
  	e3:SetTargetRange(1, 0)
  	e3:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e3, tp)
  end
  function s.splimit(e, c, sump, sumtype, sumpos, targetp, se)
  	return c:IsLocation(LOCATION_EXTRA) and aux.ExtraDeckSummonCountLimit[sump] <= 0
  end
  function s.cfilter(c, tp)
  	return c:IsSummonPlayer(tp) and c:IsPreviousLocation(LOCATION_EXTRA)
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	if eg:IsExists(s.cfilter, 1, nil, tp) then
  		aux.ExtraDeckSummonCountLimit[tp] = aux.ExtraDeckSummonCountLimit[tp] - 1
  	end
  	if eg:IsExists(s.cfilter, 1, nil, 1 - tp) then
  		aux.ExtraDeckSummonCountLimit[1 - tp] = aux.ExtraDeckSummonCountLimit[1 - tp] - 1
  	end
  end
  
  