Skip to content

Instantly share code, notes, and snippets.

@gastrop0d

gastrop0d/crit2.cs Secret

Created Feb 9, 2018
Embed
What would you like to do?
public bool HasAdvantage()
{
// Oh god, okay lets go fetch all our modifiers and check them...
foreach( Modifier mod in _modifiers )
{
if( mod.GivesAdvantage() )
{
return true;
}
}
// Oh maybe our current action will have something to say?
if( _actionControl.currentAction.GivesAdvantage() )
{
return true;
}
// Don’t forget the perks!
foreach( Perk perk in _perks )
{
if( perk.GivesAdvantage() )
{
return true;
}
}
//
// On and on it goes…
//
// ...aaaand our function is 100+ lines long.
// See you next time the design calls for another addition to this function!
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.