name: Parallel
card_text: If this card is Special Summoned by the effect of "Parallel eXceed", its Level becomes 4 and its original ATK/DEF become halved. You can only use each of the following effects of "Parallel eXceed" once per turn.
  ● If you Link Summon: You can Special Summon this card from your hand to your zone that Link Monster points to.
  ● If this card is Normal or Special Summoned: You can Special Summon 1 "Parallel eXceed" from your Deck.
lua: local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon1)
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	c:RegisterEffect(e1)
  	--spsummon2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--lv and atk/def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetCondition(s.lvcon)
  	e4:SetOperation(s.lvop)
  	c:RegisterEffect(e4)
  end
  function s.lvcon(e, tp, eg, ep, ev, re, r, rp)
  	local code1, code2 = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_CODE, CHAININFO_TRIGGERING_CODE2)
  	return re and (code1 == id or code2 == id)
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local batk = c:GetBaseAttack()
  	local bdef = c:GetBaseDefense()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CHANGE_LEVEL)
  	e1:SetValue(4)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_BASE_ATTACK)
  	e2:SetValue(math.ceil(batk / 2))
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_SET_BASE_DEFENSE)
  	e3:SetValue(math.ceil(bdef / 2))
  	c:RegisterEffect(e3)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsSummonType(SUMMON_TYPE_LINK) and c:IsSummonPlayer(tp)
  end
  function s.spcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter1, 1, nil, tp)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if eg:GetCount() ~= 1 then
  		return false
  	end
  	local tc = eg:GetFirst()
  	local zone = tc:GetLinkedZone(tp)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
  	end
  	Duel.SetTargetCard(tc)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	local zone = tc:GetLinkedZone(tp)
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and zone & 0x1f ~= 0 then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP, zone)
  	end
  end
  function s.cfilter2(c, e, tp)
  	return c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter2, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  
source_text: Parallel
  If this card is Special Summoned by the effect of "Parallel eXceed", its Level becomes 4 and its original ATK/DEF become halved. You can only use each of the following effects of "Parallel eXceed" once per turn.
  ● If you Link Summon: You can Special Summon this card from your hand to your zone that Link Monster points to.
  ● If this card is Normal or Special Summoned: You can Special Summon 1 "Parallel eXceed" from your Deck.
target_text: -- Parallel
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--spsummon1
  	local e1 = Effect.CreateEffect(c)
  	e1:SetDescription(aux.Stringid(id, 0))
  	e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e1:SetType(EFFECT_TYPE_FIELD + EFFECT_TYPE_TRIGGER_O)
  	e1:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e1:SetProperty(EFFECT_FLAG_DELAY)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetCountLimit(1, id)
  	e1:SetCondition(s.spcon1)
  	e1:SetTarget(s.sptg1)
  	e1:SetOperation(s.spop1)
  	c:RegisterEffect(e1)
  	--spsummon2
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 1))
  	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_TRIGGER_O)
  	e2:SetCode(EVENT_SUMMON_SUCCESS)
  	e2:SetProperty(EFFECT_FLAG_DELAY)
  	e2:SetCountLimit(1, id + 1)
  	e2:SetTarget(s.sptg2)
  	e2:SetOperation(s.spop2)
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EVENT_SPSUMMON_SUCCESS)
  	c:RegisterEffect(e3)
  	--lv and atk/def
  	local e4 = Effect.CreateEffect(c)
  	e4:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
  	e4:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e4:SetCondition(s.lvcon)
  	e4:SetOperation(s.lvop)
  	c:RegisterEffect(e4)
  end
  function s.lvcon(e, tp, eg, ep, ev, re, r, rp)
  	local code1, code2 = Duel.GetChainInfo(ev, CHAININFO_TRIGGERING_CODE, CHAININFO_TRIGGERING_CODE2)
  	return re and (code1 == id or code2 == id)
  end
  function s.lvop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local batk = c:GetBaseAttack()
  	local bdef = c:GetBaseDefense()
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_CHANGE_LEVEL)
  	e1:SetValue(4)
  	e1:SetReset(RESET_EVENT + RESETS_STANDARD + RESET_DISABLE)
  	c:RegisterEffect(e1)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_SET_BASE_ATTACK)
  	e2:SetValue(math.ceil(batk / 2))
  	c:RegisterEffect(e2)
  	local e3 = e2:Clone()
  	e3:SetCode(EFFECT_SET_BASE_DEFENSE)
  	e3:SetValue(math.ceil(bdef / 2))
  	c:RegisterEffect(e3)
  end
  function s.cfilter1(c, tp)
  	return c:IsFaceup() and c:IsSummonType(SUMMON_TYPE_LINK) and c:IsSummonPlayer(tp)
  end
  function s.spcon1(e, tp, eg, ep, ev, re, r, rp)
  	return eg:IsExists(s.cfilter1, 1, nil, tp)
  end
  function s.sptg1(e, tp, eg, ep, ev, re, r, rp, chk)
  	if eg:GetCount() ~= 1 then
  		return false
  	end
  	local tc = eg:GetFirst()
  	local zone = tc:GetLinkedZone(tp)
  	local c = e:GetHandler()
  	if chk == 0 then
  		return c:IsCanBeSpecialSummoned(e, 0, tp, false, false, POS_FACEUP, tp, zone)
  	end
  	Duel.SetTargetCard(tc)
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
  end
  function s.spop1(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	local tc = Duel.GetFirstTarget()
  	local zone = tc:GetLinkedZone(tp)
  	if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and zone & 0x1f ~= 0 then
  		Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP, zone)
  	end
  end
  function s.cfilter2(c, e, tp)
  	return c:IsCode(id) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false)
  end
  function s.sptg2(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and Duel.IsExistingMatchingCard(s.cfilter2, tp, LOCATION_DECK, 0, 1, nil, e, tp)
  	end
  	Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, nil, 1, tp, LOCATION_DECK)
  end
  function s.spop2(e, tp, eg, ep, ev, re, r, rp)
  	if Duel.GetLocationCount(tp, LOCATION_MZONE) <= 0 then
  		return
  	end
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
  	local g = Duel.SelectMatchingCard(tp, s.cfilter2, tp, LOCATION_DECK, 0, 1, 1, nil, e, tp)
  	if g:GetCount() > 0 then
  		Duel.SpecialSummon(g, 0, tp, tp, false, false, POS_FACEUP)
  	end
  end
  
  