name: Alien
card_text: You can Tribute 1 face-up Level 3 or lower monster on your opponent's side of the field to Special Summon this card to your opponent's side of the field. If you Special Summon this monster this way, place 1 A-Counter on this card, and you cannot Normal Summon or Set the same turn. (If a monster with an A-Counter battles an "Alien" monster, it loses 300 ATK and DEF for each A-Counter during damage calculation only.)
external_ids: local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  
lua: local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_SPSUM_PARAM)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetTargetRange(POS_FACEUP, 1)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	e1:SetValue(SUMMON_VALUE_SELF)
  	c:RegisterEffect(e1)
  	--counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_COUNTER)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.ctcon)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	--atk def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetCondition(s.adcon)
  	e3:SetTarget(s.adtg)
  	e3:SetValue(s.adval)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e4)
  end
  s.counter_add_list = { 0x100e }
  function s.spfilter(c, tp)
  	return c:IsLevelBelow(3) and c:IsFaceup() and c:IsReleasable(REASON_SPSUMMON) and Duel.GetMZoneCount(1 - tp, c, tp)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetActivityCount(tp, ACTIVITY_NORMALSUMMON) == 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, 0, LOCATION_MZONE, 1, nil, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, 0, LOCATION_MZONE, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_MSET)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetSummonType() == SUMMON_TYPE_SPECIAL + SUMMON_VALUE_SELF
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.adcon(e)
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and Duel.GetAttackTarget()
  end
  function s.adtg(e, c)
  	local bc = c:GetBattleTarget()
  	return bc and c:GetCounter(COUNTER_ID_0) ~= 0 and bc:IsSetCard(SETCARD_ID_0)
  end
  function s.adval(e, c)
  	return c:GetCounter(COUNTER_ID_0) * -300
  end
  
  
source_text: Alien
  You can Tribute 1 face-up Level 3 or lower monster on your opponent's side of the field to Special Summon this card to your opponent's side of the field. If you Special Summon this monster this way, place 1 A-Counter on this card, and you cannot Normal Summon or Set the same turn. (If a monster with an A-Counter battles an "Alien" monster, it loses 300 ATK and DEF for each A-Counter during damage calculation only.)
target_text: -- Alien
  local SETCARD_ID_0 = 0xc --Alien
  local COUNTER_ID_0 = 0x100e --A-Counter
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--special summon
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_SPSUMMON_PROC)
  	e1:SetProperty(EFFECT_FLAG_UNCOPYABLE + EFFECT_FLAG_SPSUM_PARAM)
  	e1:SetRange(LOCATION_HAND)
  	e1:SetTargetRange(POS_FACEUP, 1)
  	e1:SetCondition(s.spcon)
  	e1:SetTarget(s.sptg)
  	e1:SetOperation(s.spop)
  	e1:SetValue(SUMMON_VALUE_SELF)
  	c:RegisterEffect(e1)
  	--counter
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_COUNTER)
  	e2:SetType(EFFECT_TYPE_SINGLE + EFFECT_TYPE_CONTINUOUS)
  	e2:SetCode(EVENT_SPSUMMON_SUCCESS)
  	e2:SetCondition(s.ctcon)
  	e2:SetOperation(s.ctop)
  	c:RegisterEffect(e2)
  	--atk def
  	local e3 = Effect.CreateEffect(c)
  	e3:SetType(EFFECT_TYPE_FIELD)
  	e3:SetCode(EFFECT_UPDATE_ATTACK)
  	e3:SetRange(LOCATION_MZONE)
  	e3:SetTargetRange(LOCATION_MZONE, LOCATION_MZONE)
  	e3:SetCondition(s.adcon)
  	e3:SetTarget(s.adtg)
  	e3:SetValue(s.adval)
  	c:RegisterEffect(e3)
  	local e4 = e3:Clone()
  	e4:SetCode(EFFECT_UPDATE_DEFENSE)
  	c:RegisterEffect(e4)
  end
  s.counter_add_list = { 0x100e }
  function s.spfilter(c, tp)
  	return c:IsLevelBelow(3) and c:IsFaceup() and c:IsReleasable(REASON_SPSUMMON) and Duel.GetMZoneCount(1 - tp, c, tp)
  end
  function s.spcon(e, c)
  	if c == nil then
  		return true
  	end
  	local tp = c:GetControler()
  	return Duel.GetActivityCount(tp, ACTIVITY_NORMALSUMMON) == 0 and Duel.IsExistingMatchingCard(s.spfilter, tp, 0, LOCATION_MZONE, 1, nil, tp)
  end
  function s.sptg(e, tp, eg, ep, ev, re, r, rp, chk, c)
  	local g = Duel.GetMatchingGroup(s.spfilter, tp, 0, LOCATION_MZONE, nil, tp)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_RELEASE)
  	local tc = g:SelectUnselect(nil, tp, false, true, 1, 1)
  	if tc then
  		e:SetLabelObject(tc)
  		return true
  	else
  		return false
  	end
  end
  function s.spop(e, tp, eg, ep, ev, re, r, rp, c)
  	local g = e:GetLabelObject()
  	Duel.Release(g, REASON_SPSUMMON)
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetCode(EFFECT_CANNOT_SUMMON)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	e1:SetTargetRange(1, 0)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = e1:Clone()
  	e2:SetCode(EFFECT_CANNOT_MSET)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.ctcon(e, tp, eg, ep, ev, re, r, rp)
  	return e:GetHandler():GetSummonType() == SUMMON_TYPE_SPECIAL + SUMMON_VALUE_SELF
  end
  function s.ctop(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	if c:IsFaceup() then
  		c:AddCounter(COUNTER_ID_0, 1)
  	end
  end
  function s.adcon(e)
  	return Duel.GetCurrentPhase() == PHASE_DAMAGE_CAL and Duel.GetAttackTarget()
  end
  function s.adtg(e, c)
  	local bc = c:GetBattleTarget()
  	return bc and c:GetCounter(COUNTER_ID_0) ~= 0 and bc:IsSetCard(SETCARD_ID_0)
  end
  function s.adval(e, c)
  	return c:GetCounter(COUNTER_ID_0) * -300
  end
  
  