name: Ojamagic
card_text: If this card is sent from the hand or field to the GY: Add 1 each of "Ojama Green", "Ojama Yellow", and "Ojama Black" from your Deck to your hand.
external_ids: local CARD_ID_0 = 79335209 --Ojama Black
  local CARD_ID_1 = 12482652 --Ojama Green
  local CARD_ID_2 = 42941100 --Ojama Yellow
  
lua: local CARD_ID_0 = 79335209 --Ojama Black
  local CARD_ID_1 = 12482652 --Ojama Green
  local CARD_ID_2 = 42941100 --Ojama Yellow
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_2, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD + LOCATION_HAND)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 3, tp, LOCATION_DECK)
  end
  function s.filter(c, code)
  	return c:IsCode(code) and c:IsAbleToHand()
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local t1 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_1)
  	if not t1 then
  		return
  	end
  	local t2 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_2)
  	if not t2 then
  		return
  	end
  	local t3 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_0)
  	if not t3 then
  		return
  	end
  	local g = Group.FromCards(t1, t2, t3)
  	Duel.SendtoHand(g, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, g)
  end
  
  
source_text: Ojamagic
  If this card is sent from the hand or field to the GY: Add 1 each of "Ojama Green", "Ojama Yellow", and "Ojama Black" from your Deck to your hand.
target_text: -- Ojamagic
  local CARD_ID_0 = 79335209 --Ojama Black
  local CARD_ID_1 = 12482652 --Ojama Green
  local CARD_ID_2 = 42941100 --Ojama Yellow
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1, CARD_ID_2, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_F)
  	e1:SetCode(EVENT_TO_GRAVE)
  	e1:SetCondition(s.thcon)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  end
  function s.thcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD + LOCATION_HAND)
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return true
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 3, tp, LOCATION_DECK)
  end
  function s.filter(c, code)
  	return c:IsCode(code) and c:IsAbleToHand()
  end
  function s.thop(e, tp, eg, ep, ev, re, r, rp)
  	local t1 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_1)
  	if not t1 then
  		return
  	end
  	local t2 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_2)
  	if not t2 then
  		return
  	end
  	local t3 = Duel.GetFirstMatchingCard(s.filter, tp, LOCATION_DECK, 0, nil, CARD_ID_0)
  	if not t3 then
  		return
  	end
  	local g = Group.FromCards(t1, t2, t3)
  	Duel.SendtoHand(g, nil, REASON_EFFECT)
  	Duel.ConfirmCards(1 - tp, g)
  end
  
  