name: Good
card_text: This card is used to Ritual Summon "Malacoda, Netherlord of the Burning Abyss". You must also Tribute monsters from your hand or field whose total Levels equal 6 or more. During your Main Phase, except the turn this card was sent to the Graveyard: You can banish this card from your Graveyard and send 1 "Burning Abyss" monster from your hand to the Graveyard; add 1 "Burning Abyss" card from your Deck to your hand. You can only use this effect of "Good & Evil in the Burning Abyss" once per turn.
external_ids: local CARD_ID_0 = 35330871 --Malacoda, Netherlord of the Burning Abyss
  local SETCARD_ID_0 = 0xb1 --Burning
  
lua: local CARD_ID_0 = 35330871 --Malacoda, Netherlord of the Burning Abyss
  local SETCARD_ID_0 = 0xb1 --Burning
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddRitualProcGreaterCode(c, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(aux.exccon)
  	e1:SetCost(s.thcost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_COST)
  	Duel.DiscardHand(tp, s.cfilter, 1, 1, REASON_COST, nil)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  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.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  
source_text: Good
  This card is used to Ritual Summon "Malacoda, Netherlord of the Burning Abyss". You must also Tribute monsters from your hand or field whose total Levels equal 6 or more. During your Main Phase, except the turn this card was sent to the Graveyard: You can banish this card from your Graveyard and send 1 "Burning Abyss" monster from your hand to the Graveyard; add 1 "Burning Abyss" card from your Deck to your hand. You can only use this effect of "Good & Evil in the Burning Abyss" once per turn.
target_text: -- Good
  local CARD_ID_0 = 35330871 --Malacoda, Netherlord of the Burning Abyss
  local SETCARD_ID_0 = 0xb1 --Burning
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddRitualProcGreaterCode(c, CARD_ID_0)
  	--search
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_TOHAND + CATEGORY_SEARCH)
  	e1:SetType(EFFECT_TYPE_IGNITION)
  	e1:SetRange(LOCATION_GRAVE)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(aux.exccon)
  	e1:SetCost(s.thcost)
  	e1:SetTarget(s.thtg)
  	e1:SetOperation(s.thop)
  	c:RegisterEffect(e1)
  end
  function s.cfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost()
  end
  function s.thcost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_HAND, 0, 1, nil)
  	end
  	Duel.Remove(e:GetHandler(), POS_FACEUP, REASON_COST)
  	Duel.DiscardHand(tp, s.cfilter, 1, 1, REASON_COST, nil)
  end
  function s.filter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsAbleToHand()
  end
  function s.thtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.filter, tp, LOCATION_DECK, 0, 1, nil)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, tp, LOCATION_DECK)
  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.filter, tp, LOCATION_DECK, 0, 1, 1, nil)
  	if g:GetCount() > 0 then
  		Duel.SendtoHand(g, nil, REASON_EFFECT)
  		Duel.ConfirmCards(1 - tp, g)
  	end
  end
  
  