name: Pyramid
card_text: If this face-up card is removed from your side of the field, destroy "Andro Sphinx" and "Sphinx Teleia" on your side of the field and remove them from play.
external_ids: local CARD_ID_0 = 15013468 --Andro Sphinx
  local CARD_ID_1 = 51402177 --Sphinx Teleia
  
lua: local CARD_ID_0 = 15013468 --Andro Sphinx
  local CARD_ID_1 = 51402177 --Sphinx Teleia
  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)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EVENT_LEAVE_FIELD_P)
  	e2:SetOperation(s.checkop)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetLabelObject(e2)
  	e3:SetOperation(s.leave)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0, CARD_ID_1)
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsDisabled() or not c:IsStatus(STATUS_EFFECT_ENABLED) then
  		e:SetLabel(1)
  	else
  		e:SetLabel(0)
  	end
  end
  function s.leave(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if e:GetLabelObject():GetLabel() == 0 and c:IsPreviousControler(tp) then
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, 0, nil)
  		Duel.Destroy(g, REASON_EFFECT, LOCATION_REMOVED)
  	end
  end
  
  
source_text: Pyramid
  If this face-up card is removed from your side of the field, destroy "Andro Sphinx" and "Sphinx Teleia" on your side of the field and remove them from play.
target_text: -- Pyramid
  local CARD_ID_0 = 15013468 --Andro Sphinx
  local CARD_ID_1 = 51402177 --Sphinx Teleia
  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)
  	--destroy
  	local e2 = Effect.CreateEffect(c)
  	e2:SetType(EFFECT_TYPE_CONTINUOUS + EFFECT_TYPE_SINGLE)
  	e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e2:SetCode(EVENT_LEAVE_FIELD_P)
  	e2:SetOperation(s.checkop)
  	c:RegisterEffect(e2)
  	local e3 = Effect.CreateEffect(c)
  	e3:SetCategory(CATEGORY_DESTROY + CATEGORY_REMOVE)
  	e3:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e3:SetCode(EVENT_LEAVE_FIELD)
  	e3:SetLabelObject(e2)
  	e3:SetOperation(s.leave)
  	c:RegisterEffect(e3)
  end
  function s.filter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0, CARD_ID_1)
  end
  function s.checkop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsDisabled() or not c:IsStatus(STATUS_EFFECT_ENABLED) then
  		e:SetLabel(1)
  	else
  		e:SetLabel(0)
  	end
  end
  function s.leave(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if e:GetLabelObject():GetLabel() == 0 and c:IsPreviousControler(tp) then
  		local g = Duel.GetMatchingGroup(s.filter, tp, LOCATION_ONFIELD, 0, nil)
  		Duel.Destroy(g, REASON_EFFECT, LOCATION_REMOVED)
  	end
  end
  
  