Exemple #1
0
 public Gear(GearSlot slot, int powerLevel, AffinityType affinity, string description)
 {
     Slot        = slot;
     PowerLevel  = powerLevel;
     Description = description;
     Affinity    = affinity;
 }
Exemple #2
0
        private string GenerateGearDescription(GearSlot slot, AffinityType affinityType, int powerLevel)
        {
            string adjective   = GenerateAdjective(powerLevel);
            string synonym     = GenerateSynonym(slot);
            string associasion = GenerateAssociasion(affinityType);
            string spacing     = adjective.Length > 0 ? " " : "";

            return(adjective + spacing + synonym + " of " + associasion);
        }
Exemple #3
0
        public Gear Generate()
        {
            GearSlot     slot         = GenerateGearSlot();
            AffinityType affinityType = GenerateAffinityType();
            int          powerLevel   = GeneratePowerLevel();

            string description = GenerateGearDescription(slot, affinityType, powerLevel);

            return(new Gear(slot, powerLevel, affinityType, description));
        }
Exemple #4
0
        public AffinityResults GetAffinityResults(AffinityType attacker, AffinityType defender)
        {
            AffinityResults results = AffinityResults.Normal;

            if (affinityMaps[attacker].strongAgainst == defender)
            {
                results = AffinityResults.Strong;
            }
            if (affinityMaps[attacker].weakagainst == defender)
            {
                results = AffinityResults.Weak;
            }

            return(results);
        }
Exemple #5
0
        public double Affinity(MolecularPattern mp, AffinityType type)
        {
            if (pattern.Length != mp.Length)
            {
                throw new Exception("Patterns must have the same lengths.");
            }

            double ndist = 0;                   // normalized distance (must be between 0 and 1)

            switch (type)
            {
            case AffinityType.Euclidean:
                for (var i = 0; i < pattern.Length; i++)
                {
                    ndist += Math.Pow(pattern[i] - mp[i], 2);
                }
                ndist = Math.Sqrt(ndist) / Math.Sqrt(pattern.Length);
                break;
            }
            return(1 - ndist);
        }
 public static float InteractValue(AffinityType attack, AffinityType target)
 {
     return(affinityInteractionValues[new Tuple <AffinityType, AffinityType>(attack, target)]);
 }
Exemple #7
0
 /// <summary>
 /// Given an Affinity, return the optimal GearBuild for the Hero
 /// for that affinity.
 /// </summary>
 public GearBuild BestGearBuild(AffinityType affinity)
 {
     return(BestGear(affinity).Aggregate(new GearBuild(), (build, gear) => build.AddGear(gear)));
 }
Exemple #8
0
 /// <summary>
 /// Given an Affinity, return a list of Gear objects, such that:
 /// 1) The list contains at most one Gear object for each Gear slot.
 /// 2) A Gear object in the list will be the "best" Gear object for
 ///    that particular gear slot, for given affinity.
 /// In short, the list should define the best possible set of Gear
 /// for the hero, for the given Affinity.
 /// </summary>
 public List <Gear> BestGear(AffinityType affinity)
 {
     return(Setup.GearSlots.Select(slot => BestGearInSlot(slot, affinity)).ToList());
 }
Exemple #9
0
 /// <summary>
 /// Selects the best-in-slot Gear object for the Hero, for the given Affinity.
 /// </summary>
 public Gear BestGearInSlot(GearSlot slot, AffinityType affinity)
 {
     return(BestGearInSlot(slot, g => g.Affinity == affinity));
 }
Exemple #10
0
 /// <summary>
 /// Version of PowerLevel with Affinity as parameter.
 /// Will thus return the (optimal) PowerLevel for the Hero,
 /// for this specific affinity.
 /// </summary>
 public int PowerLevel(AffinityType affinity)
 {
     return(PowerLevel(g => g.Affinity == affinity));
 }
Exemple #11
0
		public double Affinity(MolecularPattern mp, AffinityType type)
		{
			if (pattern.Length != mp.Length)
			{
				throw new Exception("Patterns must have the same lengths.");
			}

			double ndist = 0;	// normalized distance (must be between 0 and 1)
			switch (type)
			{
				case AffinityType.Euclidean:
					for (var i = 0; i < pattern.Length; i++)
					{
						ndist += Math.Pow(pattern[i] - mp[i], 2);
					}
					ndist = Math.Sqrt(ndist) / Math.Sqrt(pattern.Length);
					break;
			}
			return 1 - ndist;
		}
Exemple #12
0
 /// <summary>
 /// Given an Affinity, return the optimal GearBuild for the Hero
 /// for that affinity.
 /// </summary>
 public GearBuild BestGearBuild(AffinityType affinity)
 {
     return(null); // TODO - Implement correctly
 }
Exemple #13
0
 /// <summary>
 /// Given an Affinity, return a list of Gear objects, such that:
 /// 1) The list contains at most one Gear object for each Gear slot.
 /// 2) A Gear object in the list will be the "best" Gear object for
 ///    that particular gear slot, for given affinity.
 /// In short, the list should define the best possible set of Gear
 /// for the hero, for the given Affinity.
 /// </summary>
 public List <Gear> BestGear(AffinityType affinity)
 {
     return(new List <Gear>()); // TODO - Implement correctly
 }
Exemple #14
0
 /// <summary>
 /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider"
 /// /> and <see cref="ignoreCase" />
 /// </summary>
 /// <param name="sourceValue">the <see cref="System.Object"/> to convert from</param>
 /// <param name="destinationType">the <see cref="System.Type" /> to convert to</param>
 /// <param name="formatProvider">not used by this TypeConverter.</param>
 /// <param name="ignoreCase">when set to <c>true</c>, will ignore the case when converting.</param>
 /// <returns>
 /// an instance of <see cref="AffinityType" />, or <c>null</c> if there is no suitable conversion.
 /// </returns>
 public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => AffinityType.CreateFrom(sourceValue);
Exemple #15
0
 private string GenerateAssociasion(AffinityType affinityType)
 {
     return(_gearAssociasions[affinityType][_rng.Next(0, _gearAssociasions[affinityType].Count)]);
 }