name: Trickstar
card_text: 2+ "Trickstar" monsters
  While this Link Summoned card points to no monsters, it is unaffected by other cards' activated effects. If this card points to no monsters: You can inflict 200 damage to your opponent for each "Trickstar" monster in your GY with a different name. You can only use this effect of "Trickstar Bella Madonna" once per turn.
external_ids: local SETCARD_ID_0 = 0xfb --Trickstar
  
lua: local SETCARD_ID_0 = 0xfb --Trickstar
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 2)
  	c:EnableReviveLimit()
  	--immune
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_IMMUNE_EFFECT)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.imcon)
  	e1:SetValue(s.immval)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.imcon(e)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_LINK) and c:IsType(TYPE_LINK) and c:GetLinkedGroupCount() == 0
  end
  function s.immval(e, te)
  	return te:GetOwner() ~= e:GetHandler() and te:IsActivated()
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsType(TYPE_LINK) and c:GetLinkedGroupCount() == 0
  end
  function s.damfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.damfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.damfilter, tp, LOCATION_GRAVE, 0, nil)
  	local dam = g:GetClassCount(Card.GetCode) * 200
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(dam)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local g = Duel.GetMatchingGroup(s.damfilter, tp, LOCATION_GRAVE, 0, nil)
  	local dam = g:GetClassCount(Card.GetCode) * 200
  	Duel.Damage(p, dam, REASON_EFFECT)
  end
  
  
source_text: Trickstar
  2+ "Trickstar" monsters
  While this Link Summoned card points to no monsters, it is unaffected by other cards' activated effects. If this card points to no monsters: You can inflict 200 damage to your opponent for each "Trickstar" monster in your GY with a different name. You can only use this effect of "Trickstar Bella Madonna" once per turn.
target_text: -- Trickstar
  local SETCARD_ID_0 = 0xfb --Trickstar
  local s, id, o = GetID()
  function s.initial_effect(c)
  	--link summon
  	aux.AddLinkProcedure(c, aux.FilterBoolFunction(Card.IsLinkSetCard, SETCARD_ID_0), 2)
  	c:EnableReviveLimit()
  	--immune
  	local e1 = Effect.CreateEffect(c)
  	e1:SetType(EFFECT_TYPE_SINGLE)
  	e1:SetCode(EFFECT_IMMUNE_EFFECT)
  	e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
  	e1:SetRange(LOCATION_MZONE)
  	e1:SetCondition(s.imcon)
  	e1:SetValue(s.immval)
  	c:RegisterEffect(e1)
  	--damage
  	local e2 = Effect.CreateEffect(c)
  	e2:SetDescription(aux.Stringid(id, 0))
  	e2:SetCategory(CATEGORY_DAMAGE)
  	e2:SetType(EFFECT_TYPE_IGNITION)
  	e2:SetRange(LOCATION_MZONE)
  	e2:SetCountLimit(1, id)
  	e2:SetCondition(s.damcon)
  	e2:SetTarget(s.damtg)
  	e2:SetOperation(s.damop)
  	c:RegisterEffect(e2)
  end
  function s.imcon(e)
  	local c = e:GetHandler()
  	return c:IsSummonType(SUMMON_TYPE_LINK) and c:IsType(TYPE_LINK) and c:GetLinkedGroupCount() == 0
  end
  function s.immval(e, te)
  	return te:GetOwner() ~= e:GetHandler() and te:IsActivated()
  end
  function s.damcon(e, tp, eg, ep, ev, re, r, rp)
  	local c = e:GetHandler()
  	return c:IsType(TYPE_LINK) and c:GetLinkedGroupCount() == 0
  end
  function s.damfilter(c)
  	return c:IsSetCard(SETCARD_ID_0) and c:IsType(TYPE_MONSTER)
  end
  function s.damtg(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.IsExistingMatchingCard(s.damfilter, tp, LOCATION_GRAVE, 0, 1, nil)
  	end
  	local g = Duel.GetMatchingGroup(s.damfilter, tp, LOCATION_GRAVE, 0, nil)
  	local dam = g:GetClassCount(Card.GetCode) * 200
  	Duel.SetTargetPlayer(1 - tp)
  	Duel.SetTargetParam(dam)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, dam)
  end
  function s.damop(e, tp, eg, ep, ev, re, r, rp)
  	local p = Duel.GetChainInfo(0, CHAININFO_TARGET_PLAYER)
  	local g = Duel.GetMatchingGroup(s.damfilter, tp, LOCATION_GRAVE, 0, nil)
  	local dam = g:GetClassCount(Card.GetCode) * 200
  	Duel.Damage(p, dam, REASON_EFFECT)
  end
  
  