name: Qlife's
card_text: Special Summon this card as an Effect Monster (Machine-Type/EARTH/Level 4/ATK 1800/DEF 1000). (This card is NOT treated as a Trap Card.) During the turn this card was Summoned this way, "Qli" Spell/Trap Cards you control cannot be destroyed by card effects. If Summoned this way, this card can be treated as 3 Tributes for the Tribute Summon of an "Apoqliphort" monster.
external_ids: local SETCARD_ID_0 = 0x10aa --Apoqli
  local SETCARD_ID_1 = 0xaa --Qli
  
lua: local SETCARD_ID_0 = 0x10aa --Apoqli
  local SETCARD_ID_1 = 0xaa --Qli
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--triple tribute
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_LIMIT_SUMMON_PROC)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_HAND, 0)
  	e3:SetCondition(s.ttcon)
  	e3:SetTarget(s.tttg)
  	e3:SetOperation(s.ttop)
  	e3:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_LIMIT_SET_PROC)
  	c:RegisterEffect(e4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:IsCostChecked()
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id, SETCARD_ID_1, TYPES_EFFECT_TRAP_MONSTER, 1800, 1000, 4, RACE_MACHINE, ATTRIBUTE_EARTH)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.IsPlayerCanSpecialSummonMonster(tp, id, SETCARD_ID_1, TYPES_EFFECT_TRAP_MONSTER, 1800, 1000, 4, RACE_MACHINE, ATTRIBUTE_EARTH) then
  		c:AddMonsterAttribute(TYPE_EFFECT)
  		if Duel.SpecialSummonStep(c, 0, tp, tp, true, false, POS_FACEUP) then
  			c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_FIELD)
  			e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  			e2:SetTargetRange(LOCATION_ONFIELD, 0)
  			e2:SetTarget(s.indtg)
  			e2:SetValue(1)
  			e2:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e2, tp)
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.indtg(e, c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSetCard(SETCARD_ID_1)
  end
  function s.ttfilter(c)
  	return c:GetOriginalCode() == id and c:IsReleasable(REASON_SUMMON) and c:GetFlagEffect(id) ~= 0
  end
  function s.ttcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return minc <= 3 and Duel.GetLocationCount(tp, LOCATION_MZONE) > -1 and Duel.IsExistingMatchingCard(s.ttfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.tttg(e, c)
  	return c:IsSetCard(SETCARD_ID_1)
  end
  function s.ttop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectMatchingCard(tp, s.ttfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	c:SetMaterial(g)
  	Duel.Release(g, REASON_SUMMON + REASON_MATERIAL)
  end
  
  
source_text: Qlife's
  Special Summon this card as an Effect Monster (Machine-Type/EARTH/Level 4/ATK 1800/DEF 1000). (This card is NOT treated as a Trap Card.) During the turn this card was Summoned this way, "Qli" Spell/Trap Cards you control cannot be destroyed by card effects. If Summoned this way, this card can be treated as 3 Tributes for the Tribute Summon of an "Apoqliphort" monster.
target_text: -- Qlife's
  local SETCARD_ID_0 = 0x10aa --Apoqli
  local SETCARD_ID_1 = 0xaa --Qli
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetHintTiming(0, TIMING_END_PHASE)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	--triple tribute
  	local e3 = Effect.CreateEffect(c)
  	e3:SetDescription(aux.Stringid(id, 0))
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_LIMIT_SUMMON_PROC)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_HAND, 0)
  	e3:SetCondition(s.ttcon)
  	e3:SetTarget(s.tttg)
  	e3:SetOperation(s.ttop)
  	e3:SetValue(SUMMON_TYPE_ADVANCE)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_LIMIT_SET_PROC)
  	c:RegisterEffect(e4)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return e:IsCostChecked()
  			and Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
  			and Duel.IsPlayerCanSpecialSummonMonster(tp, id, SETCARD_ID_1, TYPES_EFFECT_TRAP_MONSTER, 1800, 1000, 4, RACE_MACHINE, ATTRIBUTE_EARTH)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, 0, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsRelateToEffect(e) and Duel.IsPlayerCanSpecialSummonMonster(tp, id, SETCARD_ID_1, TYPES_EFFECT_TRAP_MONSTER, 1800, 1000, 4, RACE_MACHINE, ATTRIBUTE_EARTH) then
  		c:AddMonsterAttribute(TYPE_EFFECT)
  		if Duel.SpecialSummonStep(c, 0, tp, tp, true, false, POS_FACEUP) then
  			c:RegisterFlagEffect(id, RESET_EVENT + RESETS_STANDARD, 0, 1)
  			local e2 = Effect.CreateEffect(c)
  			e2:SetType(EFFECT_TYPE_FIELD)
  			e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
  			e2:SetTargetRange(LOCATION_ONFIELD, 0)
  			e2:SetTarget(s.indtg)
  			e2:SetValue(1)
  			e2:SetReset(RESET_PHASE + PHASE_END)
  			Duel.RegisterEffect(e2, tp)
  		end
  		Duel.SpecialSummonComplete()
  	end
  end
  function s.indtg(e, c)
  	return c:IsType(TYPE_SPELL + TYPE_TRAP) and c:IsSetCard(SETCARD_ID_1)
  end
  function s.ttfilter(c)
  	return c:GetOriginalCode() == id and c:IsReleasable(REASON_SUMMON) and c:GetFlagEffect(id) ~= 0
  end
  function s.ttcon(e, c, minc)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return minc <= 3 and Duel.GetLocationCount(tp, LOCATION_MZONE) > -1 and Duel.IsExistingMatchingCard(s.ttfilter, tp, LOCATION_MZONE, 0, 1, nil)
  end
  function s.tttg(e, c)
  	return c:IsSetCard(SETCARD_ID_1)
  end
  function s.ttop(e, tp, eg, ep, ev, re, r, rp, c)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local g = Duel.SelectMatchingCard(tp, s.ttfilter, tp, LOCATION_MZONE, 0, 1, 1, nil)
  	c:SetMaterial(g)
  	Duel.Release(g, REASON_SUMMON + REASON_MATERIAL)
  end
  
  