public Gear(GearSlot slot, int powerLevel, AffinityType affinity, string description) { Slot = slot; PowerLevel = powerLevel; Description = description; Affinity = affinity; }
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); }
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)); }
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); }
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)]); }
/// <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))); }
/// <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()); }
/// <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)); }
/// <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)); }
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; }
/// <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 }
/// <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 }
/// <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);
private string GenerateAssociasion(AffinityType affinityType) { return(_gearAssociasions[affinityType][_rng.Next(0, _gearAssociasions[affinityType].Count)]); }