name: Naturia
card_text: All monsters your opponent controls lose 300 ATK/DEF for each "Naturia" monster you control. Once per turn: You can target 1 monster your opponent controls with 0 DEF; take control of that target until the End Phase.
external_ids: local SETCARD_ID_0 = 0x2a --Naturia
  
lua: local SETCARD_ID_0 = 0x2a --Naturia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(s.val)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  	--control
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_CONTROL)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.ctltg)
  	e3:SetOperation(s.ctlop)
  	c:RegisterEffect(e3)
  end
  function s.vfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.val(e, c)
  	return Duel.GetMatchingGroupCount(s.vfilter, e:GetOwnerPlayer(), LOCATION_MZONE, 0, nil) * -300
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsDefense(0) and c:IsControlerCanBeChanged()
  end
  function s.ctltg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, g, 1, 0, 0)
  end
  function s.ctlop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsDefense(0) then
  		Duel.GetControl(tc, tp, PHASE_END, 1)
  	end
  end
  
  
source_text: Naturia
  All monsters your opponent controls lose 300 ATK/DEF for each "Naturia" monster you control. Once per turn: You can target 1 monster your opponent controls with 0 DEF; take control of that target until the End Phase.
target_text: -- Naturia
  local SETCARD_ID_0 = 0x2a --Naturia
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--atk,def
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetTargetRange(0, LOCATION_MZONE)
  	e1:SetCode(EFFECT_UPDATE_ATTACK)
  	e1:SetValue(s.val)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e2)
  	--control
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetCategory(CATEGORY_CONTROL)
  	e3:SetType(EFFECT_TYPE_IGNITION)
  	e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetCountLimit(1)
  	e3:SetTarget(s.ctltg)
  	e3:SetOperation(s.ctlop)
  	c:RegisterEffect(e3)
  end
  function s.vfilter(c)
  	return c:IsFaceup() and c:IsSetCard(SETCARD_ID_0)
  end
  function s.val(e, c)
  	return Duel.GetMatchingGroupCount(s.vfilter, e:GetOwnerPlayer(), LOCATION_MZONE, 0, nil) * -300
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsDefense(0) and c:IsControlerCanBeChanged()
  end
  function s.ctltg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp) and s.filter(chkc)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_CONTROL)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_MZONE, 1, 1, nil)
  	Duel.SetOperationInfo(0, CATEGORY_CONTROL, g, 1, 0, 0)
  end
  function s.ctlop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsDefense(0) then
  		Duel.GetControl(tc, tp, PHASE_END, 1)
  	end
  end
  
  