Skip to content

Instantly share code, notes, and snippets.

@gastrop0d
Created February 9, 2018 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gastrop0d/3074c7836d7fc6f7a6ceffea0fbd90a3 to your computer and use it in GitHub Desktop.
Save gastrop0d/3074c7836d7fc6f7a6ceffea0fbd90a3 to your computer and use it in GitHub Desktop.
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