name: Prey
card_text: Special Summon this card as a Normal Monster (Insect/EARTH/Level 5/ATK 2100/DEF 100) to your Main Monster Zone in its same column (this card is also still a Trap), then you can destroy 1 monster your opponent controls in this card's column. You can banish this card from your GY; add 1 of your "Sanga of the Thunder", "Kazejin", or "Suijin" that is banished or in your Deck to your hand. You can only use each effect of "Prey of the Jirai Gumo" once per turn.
external_ids: local CARD_ID_0 = 62340868 --Kazejin
  local CARD_ID_1 = 25955164 --Sanga of the Thunder
  local CARD_ID_3 = 98434877 --Suijin
  
lua: local CARD_ID_0 = 62340868 --Kazejin
  local CARD_ID_1 = 25955164 --Sanga of the Thunder
  local CARD_ID_3 = 98434877 --Suijin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_0, CARD_ID_3)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetHintTiming(0, TIMING_END_PHASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local seq = e:GetHandler():GetSequence()
  	if chk == 0 then
  		return e:IsCostChecked()
  			and Duel.CheckLocation(tp, LOCATION_MZONE, seq)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id, 0, TYPES_NORMAL_TRAP_MONSTER, 2100, 100, 5, RACE_INSECT, ATTRIBUTE_EARTH)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.filter(c, tp)
  	return c:IsControler(1 - tp) and c:IsLocation(LOCATION_MZONE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local seq = c:GetSequence()
  	local zone = 1 << seq
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id, 0, TYPES_NORMAL_TRAP_MONSTER, 2100, 100, 5, RACE_INSECT, ATTRIBUTE_EARTH) then
  		return
  	end
  	c:AddMonsterAttribute(TYPE_NORMAL + TYPE_TRAP)
  	if Duel.SpecialSummon(c, 0, tp, tp, true, false, POS_FACEUP, zone) ~= 0 then
  		local g = c:GetColumnGroup():Filter(s.filter, nil, tp)
  		if #g > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			local tg = g:Clone()
  			if #tg > 1 then
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  				tg = g:Select(tp, 1, 1, nil)
  			end
  			Duel.HintSelection(tg)
  			Duel.Destroy(tg, REASON_EFFECT)
  		end
  	end
  end
  function s.thfilter(c)
  	return c:IsFaceupEx() and c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_3) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_REMOVED)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Prey
  Special Summon this card as a Normal Monster (Insect/EARTH/Level 5/ATK 2100/DEF 100) to your Main Monster Zone in its same column (this card is also still a Trap), then you can destroy 1 monster your opponent controls in this card's column. You can banish this card from your GY; add 1 of your "Sanga of the Thunder", "Kazejin", or "Suijin" that is banished or in your Deck to your hand. You can only use each effect of "Prey of the Jirai Gumo" once per turn.
target_text: -- Prey
  local CARD_ID_0 = 62340868 --Kazejin
  local CARD_ID_1 = 25955164 --Sanga of the Thunder
  local CARD_ID_3 = 98434877 --Suijin
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_0, CARD_ID_3)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON + CATEGORY_DESTROY)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCountLimit(1, id)
  	e1:SetHintTiming(0, TIMINGS_CHECK_MONSTER + TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--to hand
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e2:SetType(EFFECT_TYPE_QUICK_O)
  	e2:SetCode(EVENT_FREE_CHAIN)
  	e2:SetRange(LOCATION_GRAVE)
  	e2:SetHintTiming(0, TIMING_END_PHASE)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetCost(aux.bfgcost)
  	e2:SetTarget(s.thtg)
  	e2:SetOperation(s.thop)
  	c:RegisterEffect(e2)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	local seq = e:GetHandler():GetSequence()
  	if chk == 0 then
  		return e:IsCostChecked()
  			and Duel.CheckLocation(tp, LOCATION_MZONE, seq)
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id, 0, TYPES_NORMAL_TRAP_MONSTER, 2100, 100, 5, RACE_INSECT, ATTRIBUTE_EARTH)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.filter(c, tp)
  	return c:IsControler(1 - tp) and c:IsLocation(LOCATION_MZONE)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local seq = c:GetSequence()
  	local zone = 1 << seq
  	if not Duel.IsPlayerCanSpecialSummonMonster(tp, id, 0, TYPES_NORMAL_TRAP_MONSTER, 2100, 100, 5, RACE_INSECT, ATTRIBUTE_EARTH) then
  		return
  	end
  	c:AddMonsterAttribute(TYPE_NORMAL + TYPE_TRAP)
  	if Duel.SpecialSummon(c, 0, tp, tp, true, false, POS_FACEUP, zone) ~= 0 then
  		local g = c:GetColumnGroup():Filter(s.filter, nil, tp)
  		if #g > 0 and Duel.SelectYesNo(tp, aux.Stringid(id, 2)) then
  			Duel.BreakEffect()
  			local tg = g:Clone()
  			if #tg > 1 then
  				Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  				tg = g:Select(tp, 1, 1, nil)
  			end
  			Duel.HintSelection(tg)
  			Duel.Destroy(tg, REASON_EFFECT)
  		end
  	end
  end
  function s.thfilter(c)
  	return c:IsFaceupEx() and c:IsCode(CARD_ID_1, CARD_ID_0, CARD_ID_3) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK + LOCATION_REMOVED)
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_ATOHAND)
  	local g = Duel.SelectMatchingCard(tp, s.thfilter, tp, LOCATION_DECK + LOCATION_REMOVED, 0, 1, 1, nil)
  	if #g > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  