name: Amorphous
card_text: All "Amorphage" monsters on the field gain 300 ATK/DEF. Up to twice per turn, if an "Amorphage" monster(s) you control is Tributed, draw 1 card. You can banish this card from your GY; Tribute Pendulum Monsters from your hand or field whose total Levels exactly equal 8, then Ritual Summon 1 "Amorphactor Pain, the Imagination Dracoverlord" from your hand.
external_ids: local CARD_ID_0 = 98287529 --Amorphactor Pain, the Imagination Dracoverlord
  local SETCARD_ID_0 = 0xe0 --Amorphage
  
lua: local CARD_ID_0 = 98287529 --Amorphactor Pain, the Imagination Dracoverlord
  local SETCARD_ID_0 = 0xe0 --Amorphage
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk/def up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--draw
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCode(EVENT_RELEASE)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(2)
  	e4:SetCondition(s.drcon)
  	e4:SetOperation(s.drop)
  	c:RegisterEffect(e4)
  	--ritural
  	local e5 = aux.AddRitualProcEqualCode(c, CARD_ID_0, nil, nil, s.mfilter, true)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetCode(0)
  	e5:SetRange(LOCATION_GRAVE)
  	e5:SetCost(aux.bfgcost)
  	c:RegisterEffect(e5)
  end
  function s.cfilter(c, tp)
  	return c:IsPreviousSetCard(SETCARD_ID_0) and c:IsReason(REASON_RELEASE) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp)
  end
  function s.drcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, e:GetHandler():GetCode())
  	Duel.Draw(tp, 1, REASON_EFFECT)
  end
  function s.mfilter(c)
  	return c:IsType(TYPE_PENDULUM)
  end
  
  
source_text: Amorphous
  All "Amorphage" monsters on the field gain 300 ATK/DEF. Up to twice per turn, if an "Amorphage" monster(s) you control is Tributed, draw 1 card. You can banish this card from your GY; Tribute Pendulum Monsters from your hand or field whose total Levels exactly equal 8, then Ritual Summon 1 "Amorphactor Pain, the Imagination Dracoverlord" from your hand.
target_text: -- Amorphous
  local CARD_ID_0 = 98287529 --Amorphactor Pain, the Imagination Dracoverlord
  local SETCARD_ID_0 = 0xe0 --Amorphage
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	c:RegisterEffect(e1)
  	--atk/def up
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetCode(EFFECT_UPDATE_ATTACK)
  	e2:SetRange(LOCATION_FZONE)
  	e2:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard, SETCARD_ID_0))
  	e2:SetValue(300)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e3)
  	--draw
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_CONTINUOUS)
  	e4:SetRange(LOCATION_FZONE)
  	e4:SetCode(EVENT_RELEASE)
  	e4:SetProperty(EFFECT_FLAG_DELAY)
  	e4:SetCountLimit(2)
  	e4:SetCondition(s.drcon)
  	e4:SetOperation(s.drop)
  	c:RegisterEffect(e4)
  	--ritural
  	local e5 = aux.AddRitualProcEqualCode(c, CARD_ID_0, nil, nil, s.mfilter, true)
  	e5:SetType(EFFECT_TYPE_IGNITION)
  	e5:SetCode(0)
  	e5:SetRange(LOCATION_GRAVE)
  	e5:SetCost(aux.bfgcost)
  	c:RegisterEffect(e5)
  end
  function s.cfilter(c, tp)
  	return c:IsPreviousSetCard(SETCARD_ID_0) and c:IsReason(REASON_RELEASE) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp)
  end
  function s.drcon(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter, 1, nil, tp)
  end
  function s.drop(e, tp, eg, ep, ev, re, r, rp)
  	Duel.Hint(HINT_CARD, 0, e:GetHandler():GetCode())
  	Duel.Draw(tp, 1, REASON_EFFECT)
  end
  function s.mfilter(c)
  	return c:IsType(TYPE_PENDULUM)
  end
  
  