Skip to content

aux.dpcheck

Source Code | Usage Examples | aux Functions

Creates a SubgroupCheck that returns true for subgroups with cards that have unique/different properties.

Signature

aux.dpcheck(CardPropertyFunction propfn) → SubgroupCheck

lua
aux.dpcheck(propfn)

Parameters

Returns

  • SubgroupCheck

    A function that returns true if cards in a subgroup return different values for propfn.

Usage

dpcheck is usually used with aux.SelectUnselectGroup.

Suppose you want to check and select 3 cards in your hand with different attributes. A simple example would be:

lua
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
	local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,nil)
	if chk==0 then return aux.SelectUnselectGroup(g,e,tp,3,3,aux.dpcheck(Card.GetAttribute),0) end
end

This will return true when there are 3 cards with different Attributes in your hand.

And to use it for selection:

lua
function s.operation(e,tp,eg,ep,ev,re,r,rp)
	local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND,0,nil)
	local sg=aux.SelectUnselectGroup(g,e,tp,3,3,aux.dpcheck(Card.GetAttribute),1,tp,HINTMSG_SELECT)

	if #sg>0 then
		--  you can do something with them here
	end
end