/// <summary> /// Returns an int based on a comparison between creatures /// </summary> /// <param name="c1">The first creature to compare</param> /// <param name="c2">The second creature to compare</param> /// <returns>An int, 1 if the first creature is better and -1 if the second is better</returns> public static int judgeCreatures(Creature c1, Creature c2) { int ret; int c1Health = (int)c1.getHealth() * Simulation.getHealthWeight(); int c1Energy = (int)c1.getEnergy() * Simulation.getEnergyWeight(); int c2Health = (int)c2.getHealth() * Simulation.getHealthWeight(); int c2Energy = (int)c2.getEnergy() * Simulation.getEnergyWeight(); ; if (c1Health + c1Energy > c2Health + c2Energy) { ret = -1; } else if (c1Health + c1Energy == c2Health + c2Energy) { int c1Stats = c1.getStatValue(); int c2Stats = c2.getStatValue(); if (c1Stats > c2Stats) { ret = -1; } else if (c2Stats < c1Stats) { ret = 1; } else { ret = 0; //in this case they are equal } } else //if c1stuff < c2stuff { ret = -1; } return ret; }