name: Amanokujaki
card_text: You cannot activate the effects of other Special Summoned monsters with the same Attribute as this card. Once per turn, during the Main Phase of this card's owner (Quick Effect): You can give control of this card to your opponent, then you (the activating player) can make this card become any Attribute until the end of the next turn.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--actlimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(1, 1)
  	e1:SetValue(s.actlimit)
  	c:RegisterEffect(e1)
  	--control
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_CONTROL)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.ctcon)
  	e2:SetTarget(s.cttg)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  end
  function s.actlimit(e, re, tp)
  	local rc = re:GetHandler()
  	local c = e:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER)
  		and rc:IsSummonType(SUMMON_TYPE_SPECIAL)
  		and re:GetActivateLocation() == LOCATION_MZONE
  		and rc:IsAttribute(c:GetAttribute())
  		and rc ~= c
  		and tp == c:GetControler()
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	local p = e:GetHandler():GetOwner()
  	return p == Duel.GetTurnPlayer() and (Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.GetControl(c, 1 - tp) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATTRIBUTE)
  		local aat = Duel.AnnounceAttribute(tp, 1, ATTRIBUTE_ALL & ~e:GetHandler():GetAttribute())
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(aat)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END, 2)
  		c:RegisterEffect(e1)
  	end
  end
  
  
source_text: Amanokujaki
  You cannot activate the effects of other Special Summoned monsters with the same Attribute as this card. Once per turn, during the Main Phase of this card's owner (Quick Effect): You can give control of this card to your opponent, then you (the activating player) can make this card become any Attribute until the end of the next turn.
target_text: -- Amanokujaki
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--actlimit
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(1, 1)
  	e1:SetValue(s.actlimit)
  	c:RegisterEffect(e1)
  	--control
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_CONTROL)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1)
  	e2:SetCondition(s.ctcon)
  	e2:SetTarget(s.cttg)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  end
  function s.actlimit(e, re, tp)
  	local rc = re:GetHandler()
  	local c = e:GetHandler()
  	return re:IsActiveType(TYPE_MONSTER)
  		and rc:IsSummonType(SUMMON_TYPE_SPECIAL)
  		and re:GetActivateLocation() == LOCATION_MZONE
  		and rc:IsAttribute(c:GetAttribute())
  		and rc ~= c
  		and tp == c:GetControler()
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	local p = e:GetHandler():GetOwner()
  	return p == Duel.GetTurnPlayer() and (Duel.GetCurrentPhase() == PHASE_MAIN1 or Duel.GetCurrentPhase() == PHASE_MAIN2)
  end
  function s.cttg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsControlerCanBeChanged()
  	end
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, e:GetHandler(), 1, 0, 0)
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.GetControl(c, 1 - tp) > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 0)) then
  		Duel.BreakEffect()
  		Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATTRIBUTE)
  		local aat = Duel.AnnounceAttribute(tp, 1, ATTRIBUTE_ALL & ~e:GetHandler():GetAttribute())
  		local e1 = Effect.CreateEffect(c)
  		e1:SetType(EFFECT_TYPE_SINGLE)
  		e1:SetCode(EFFECT_CHANGE_ATTRIBUTE)
  		e1:SetValue(aat)
  		e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE + RESET_PHASE + PHASE_END, 2)
  		c:RegisterEffect(e1)
  	end
  end
  
  