Skip to content

Group.GetMaxGroup ​

Signature ​

lua
Group.GetMaxGroup(Group g, function f, [... any]) -> Group|nil,int|nil

Description ​

Calls f for each card in g, forwards any extra arguments, and returns a Group containing every card tied for the maximum value. The second return is the maximum integer value. If g is empty, this binding returns no Lua values. Keep all ties when the card text affects every highest-scoring card; call Group.Select when a player must choose one tied card.

How To Use It ​

Use this to find every card tied for the highest score in an existing Group.

lua
local highg,atk=g:GetMaxGroup(Card.GetAttack)
if #highg>0 then
    Duel.HintSelection(highg)
end

The score function receives each candidate card first, then any extra arguments. Ties stay in the returned Group so the script can let a player choose or affect all tied cards.

Parameters ​

  • g Group
  • f function
  • ... any optional

Returns ​

  • Group|nil - Cards tied for maximum value.
  • int|nil - Maximum value.

Source ​

  • D:\Programs\GitHub\ygopro-core\libgroup.cpp:925

Guided Examples ​

Learn how to use this function in context:

Used By ​

Generated from the local Scripts/ folder and cards.cdb.

  • Detected in 54 indexed script(s).
  • Search this function in the Script Explorer with Group.GetMaxGroup.
CardIDScriptDetected Calls
DoSolfachord Coolia80776622Scripts/c80776622.lua1
Theia, the Primal Being85687952Scripts/c85687952.lua1
Gouki The Master Ogre30286474Scripts/c30286474.lua1
Keel, Shipwright Fur Hire66736884Scripts/c66736884.lua1
Tri-Brigade Nervall14816857Scripts/c14816857.lua1
GMX Applied Experiment #5518795635Scripts/c18795635.lua4
Tri-Brigade Fraktall87209160Scripts/c87209160.lua1
Naturia Mole Cricket93454062Scripts/c93454062.lua1
Tri-Brigade Kitt56196385Scripts/c56196385.lua1
Tri-Brigade Kerass50810455Scripts/c50810455.lua1
Tri-Brigade Hammer92269002Scripts/c92269002.lua1
Armed Neos31817415Scripts/c31817415.lua1
Winged Kuriboh Sabatiel LV1040237839Scripts/c40237839.lua1
Centur-Ion Legatia15982593Scripts/c15982593.lua1
Dreamland26920296Scripts/c26920296.lua2
Drill Armed Dragon46221535Scripts/c46221535.lua1
Tri-Brigade Revolt40975243Scripts/c40975243.lua2
Ancient Warriors - Rebellious Lu Feng82791472Scripts/c82791472.lua4
Divine Serpent Geh82103466Scripts/c82103466.lua2
Mind Mirror Force66247039Scripts/c66247039.lua1
Rock of the Vanquisher28168628Scripts/c28168628.lua1
Timaeus the Knight of Destiny53315891Scripts/c53315891.lua2
Ace★Spades Speculation10796448Scripts/c10796448.lua1
Pandemic Dragon68299524Scripts/c68299524.lua1
...and 30 more

Script Examples ​

DoSolfachord Coolia (80776622) ​

Source: Scripts/c80776622.lua

lua
	local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,0)
	if g:GetCount()==0 then return false end
	local _,max=g:GetMaxGroup(Card.GetCurrentScale)
	return rc:IsAttackBelow(max*300)
end

Theia, the Primal Being (85687952) ​

Source: Scripts/c85687952.lua

lua
		local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
		if g:GetCount()>0 then
			local tg=g:GetMaxGroup(Card.GetAttack)
			if tg:GetCount()>1 then
				Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)

Gouki The Master Ogre (30286474) ​

Source: Scripts/c30286474.lua

lua
function c30286474.atlimit(e,c)
	local g=Duel.GetMatchingGroup(Card.IsFaceup,e:GetHandlerPlayer(),0,LOCATION_MZONE,nil)
	local tg=g:GetMaxGroup(Card.GetAttack)
	return not tg:IsContains(c) or c:IsFacedown()
end