Created methods Above(), Below(), Highest(), Lowest(), Evens(), Odds(), Matching(), Repeating(), Unique()
...
I need to create a structure / implement these methods one inside the other, as if they were organized in directories, within a class Roll()
.
The goal is for those who try to use the Roll
class to be able to leave their code as close to human language as possible:
ApplyDamage (Physical (Roll (5,d6).Sum.OnlyEvens.Above(2)), ChosenTarget);
Example:
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class Roll
{
List<int> scores;
int maxRange;
public void Roll(int amountOfDices, int maxRange)
{
this.maxRange = maxRange;
for (int i = 0; i < amountOfDices; i++)
{
scores.Add(Random.Range(1,maxRange));
}
}//Construtor
public int Sum (scores)//este é o MEU Sum
{
public int OnlyEvens(scores){
public int Above(scores, int threshold)
{
return(Evens(Above(scores)).Sum());
}
public int Below(scores, int threshold)
{
return(Evens(Below(scores)).Sum());
}
return(Evens(scores).Sum());
}
return(scores.Sum());//este Sum() é proveniente do System.Linq
}
}