name: Harpie
card_text: If you control 3 or more "Harpie Lady" and/or "Harpie Lady Sisters": Target as many monsters your opponent controls as possible, but not more than the total number of "Harpie Lady" and "Harpie Lady Sisters" you control; destroy those targets, and if you do, inflict damage to your opponent equal to the highest original ATK among those destroyed monsters (your choice, if tied). You cannot Special Summon monsters from the Main Deck or Extra Deck, nor conduct your Battle Phase, the turn you activate this card.
external_ids: local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  
lua: local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsSummonLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0, CARD_ID_1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 3, nil)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0 and Duel.GetCurrentPhase() == PHASE_MAIN1
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.sumlimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e2:SetCode(EFFECT_CANNOT_BP)
  	e2:SetTargetRange(1, 0)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.sumlimit(e, c, sump, sumtype, sumpos, targetp)
  	return c:IsLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, 0, LOCATION_MZONE, ct, ct, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  		local og = Duel.GetOperatedGroup()
  		local mg, matk = og:GetMaxGroup(Card.GetBaseAttack)
  		if matk > 0 then
  			Duel.Damage(1 - tp, matk, REASON_EFFECT)
  		end
  	end
  end
  
  
source_text: Harpie
  If you control 3 or more "Harpie Lady" and/or "Harpie Lady Sisters": Target as many monsters your opponent controls as possible, but not more than the total number of "Harpie Lady" and "Harpie Lady Sisters" you control; destroy those targets, and if you do, inflict damage to your opponent equal to the highest original ATK among those destroyed monsters (your choice, if tied). You cannot Special Summon monsters from the Main Deck or Extra Deck, nor conduct your Battle Phase, the turn you activate this card.
target_text: -- Harpie
  local CARD_ID_0 = 76812113 --Harpie Lady
  local CARD_ID_1 = 12206212 --Harpie Lady Sisters
  local s, id, o = GetID()
  function s.initial_effect(c)
  	aux.AddCodeList(c, CARD_ID_1)
  	--Activate
  	local e1 = Effect.CreateEffect(c)
  	e1:SetCategory(CATEGORY_DESTROY + CATEGORY_DAMAGE)
  	e1:SetType(EFFECT_TYPE_ACTIVATE)
  	e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
  	e1:SetCode(EVENT_FREE_CHAIN)
  	e1:SetCondition(s.condition)
  	e1:SetCost(s.cost)
  	e1:SetTarget(s.target)
  	e1:SetOperation(s.activate)
  	c:RegisterEffect(e1)
  	Duel.AddCustomActivityCounter(id, ACTIVITY_SPSUMMON, s.counterfilter)
  end
  function s.counterfilter(c)
  	return not c:IsSummonLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.cfilter(c)
  	return c:IsFaceup() and c:IsCode(CARD_ID_0, CARD_ID_1)
  end
  function s.condition(e, tp, eg, ep, ev, re, r, rp)
  	return Duel.IsExistingMatchingCard(s.cfilter, tp, LOCATION_MZONE, 0, 3, nil)
  end
  function s.cost(e, tp, eg, ep, ev, re, r, rp, chk)
  	if chk == 0 then
  		return Duel.GetCustomActivityCount(id, tp, ACTIVITY_SPSUMMON) == 0 and Duel.GetCurrentPhase() == PHASE_MAIN1
  	end
  	local e1 = Effect.CreateEffect(e:GetHandler())
  	e1:SetType(EFFECT_TYPE_FIELD)
  	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
  	e1:SetTargetRange(1, 0)
  	e1:SetTarget(s.sumlimit)
  	e1:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e1, tp)
  	local e2 = Effect.CreateEffect(e:GetHandler())
  	e2:SetType(EFFECT_TYPE_FIELD)
  	e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET + EFFECT_FLAG_OATH)
  	e2:SetCode(EFFECT_CANNOT_BP)
  	e2:SetTargetRange(1, 0)
  	e2:SetReset(RESET_PHASE + PHASE_END)
  	Duel.RegisterEffect(e2, tp)
  end
  function s.sumlimit(e, c, sump, sumtype, sumpos, targetp)
  	return c:IsLocation(LOCATION_DECK + LOCATION_EXTRA)
  end
  function s.target(e, tp, eg, ep, ev, re, r, rp, chk, chkc)
  	if chkc then
  		return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1 - tp)
  	end
  	if chk == 0 then
  		return Duel.IsExistingTarget(aux.TRUE, tp, 0, LOCATION_MZONE, 1, nil)
  	end
  	local ct = Duel.GetMatchingGroupCount(s.cfilter, tp, LOCATION_MZONE, 0, nil)
  	Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_DESTROY)
  	local g = Duel.SelectTarget(tp, aux.TRUE, tp, 0, LOCATION_MZONE, ct, ct, nil)
  	Duel.SetOperationInfo(0, CATEGORY_DESTROY, g, g:GetCount(), 0, 0)
  	Duel.SetOperationInfo(0, CATEGORY_DAMAGE, nil, 0, 1 - tp, 0)
  end
  function s.activate(e, tp, eg, ep, ev, re, r, rp)
  	local g = Duel.GetChainInfo(0, CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect, nil, e)
  	if Duel.Destroy(g, REASON_EFFECT) ~= 0 then
  		local og = Duel.GetOperatedGroup()
  		local mg, matk = og:GetMaxGroup(Card.GetBaseAttack)
  		if matk > 0 then
  			Duel.Damage(1 - tp, matk, REASON_EFFECT)
  		end
  	end
  end
  
  