name: Storm
card_text: Once per turn, you can select and activate 1 of these effects:
  ● Move this card to an adjacent (horizontal) unoccupied Monster Card Zone.
  ● Return 1 Spell, Trap or Monster Card on your opponent's side of the field in the same column as this card to its owner's hand.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--move
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e1:SetCondition(s.seqcon)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.seqtg)
  	e1:SetOperation(s.seqop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	local seq = e:GetHandler():GetSequence()
  	if seq > 4 then
  		return false
  	end
  	return (seq > 0 and Duel.CheckLocation(tp, LOCATION_MZONE, seq - 1)) or (seq < 4 and Duel.CheckLocation(tp, LOCATION_MZONE, seq + 1))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local seq = e:GetHandler():GetSequence()
  	local flag = 0
  	if seq > 0 and Duel.CheckLocation(tp, LOCATION_MZONE, seq - 1) then
  		flag = flag | (1 << (seq - 1))
  	end
  	if seq < 4 and Duel.CheckLocation(tp, LOCATION_MZONE, seq + 1) then
  		flag = flag | (1 << (seq + 1))
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  	local s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, ~flag)
  	local nseq = math.log(s, 2)
  	e:SetLabel(nseq)
  	Duel.Hint(HINT_ZONE, tp, s)
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local seq = e:GetLabel()
  	if not c:IsRelateToEffect(e) or c:IsControler(1 - tp) or c:GetSequence() > 4 or not Duel.CheckLocation(tp, LOCATION_MZONE, seq) then
  		return
  	end
  	Duel.MoveSequence(c, seq)
  end
  function s.filter(c, g)
  	return g:IsContains(c) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local cg = e:GetHandler():GetColumnGroup()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and s.filter(chkc, cg)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_ONFIELD, 1, nil, cg)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_ONFIELD, 1, 1, nil, cg)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  
source_text: Storm
  Once per turn, you can select and activate 1 of these effects:
  ● Move this card to an adjacent (horizontal) unoccupied Monster Card Zone.
  ● Return 1 Spell, Trap or Monster Card on your opponent's side of the field in the same column as this card to its owner's hand.
target_text: -- Storm
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--move
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e1:SetCondition(s.seqcon)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.seqtg)
  	e1:SetOperation(s.seqop)
  	c:RegisterEffect(e1)
  	--
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, EFFECT_COUNT_CODE_SINGLE)
  	e2:SetCost(s.cost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.seqcon(e, tp, eg, ep, ev, re, r, rp)
  	local seq = e:GetHandler():GetSequence()
  	if seq > 4 then
  		return false
  	end
  	return (seq > 0 and Duel.CheckLocation(tp, LOCATION_MZONE, seq - 1)) or (seq < 4 and Duel.CheckLocation(tp, LOCATION_MZONE, seq + 1))
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.Hint(HINT_OPSELECTED, 1 - tp, e:GetDescription())
  end
  function s.seqtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	local seq = e:GetHandler():GetSequence()
  	local flag = 0
  	if seq > 0 and Duel.CheckLocation(tp, LOCATION_MZONE, seq - 1) then
  		flag = flag | (1 << (seq - 1))
  	end
  	if seq < 4 and Duel.CheckLocation(tp, LOCATION_MZONE, seq + 1) then
  		flag = flag | (1 << (seq + 1))
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_TOZONE)
  	local s = Duel.SelectDisableField(tp, 1, LOCATION_MZONE, 0, ~flag)
  	local nseq = math.log(s, 2)
  	e:SetLabel(nseq)
  	Duel.Hint(HINT_ZONE, tp, s)
  end
  function s.seqop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local seq = e:GetLabel()
  	if not c:IsRelateToEffect(e) or c:IsControler(1 - tp) or c:GetSequence() > 4 or not Duel.CheckLocation(tp, LOCATION_MZONE, seq) then
  		return
  	end
  	Duel.MoveSequence(c, seq)
  end
  function s.filter(c, g)
  	return g:IsContains(c) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	local cg = e:GetHandler():GetColumnGroup()
  	if chkc then
  		return chkc:IsOnField() and chkc:IsControler(1 - tp) and s.filter(chkc, cg)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(s.filter, tp, 0, LOCATION_ONFIELD, 1, nil, cg)
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RTOHAND)
  	local g = Duel.SelectTarget(tp, s.filter, tp, 0, LOCATION_ONFIELD, 1, 1, nil, cg)
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, g, 1, 0, 0)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local tc = Duel.GetFirstTarget()
  	if tc:IsRelateToEffect(e) then
  		Duel.SendtoHand(tc, nil, REASON_EFFECT)
  	end
  end
  
  