GeezerVison is showing github.com — Add the points a kill adds to a time-space's running score (#189) · NosCoreIO/NosCore.Algorithm@bb4f506
File treeExpand file treeCollapse file tree Open diff view settings test/NosCore.Algorithm.Tests
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +14Lines changed: 14 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# Time-Space Kill Points Table | | 2 | + | | 3 | +Points a kill adds to the running score, by how far the monster is above its killer and how many marked monsters in a row the kill completes (0 for an unmarked monster). | | 4 | +- -5 level(s) above the killer - Points for a chain of 0 to 5: 1, 6, 11, 16, 21, 26 | | 5 | +- -4 level(s) above the killer - Points for a chain of 0 to 5: 1, 6, 11, 16, 21, 26 | | 6 | +- -3 level(s) above the killer - Points for a chain of 0 to 5: 1, 6, 11, 16, 21, 26 | | 7 | +- -2 level(s) above the killer - Points for a chain of 0 to 5: 1, 6, 11, 16, 21, 26 | | 8 | +- -1 level(s) above the killer - Points for a chain of 0 to 5: 2, 7, 12, 17, 22, 27 | | 9 | +- 0 level(s) above the killer - Points for a chain of 0 to 5: 3, 8, 13, 18, 23, 28 | | 10 | +- 1 level(s) above the killer - Points for a chain of 0 to 5: 4, 9, 14, 19, 24, 29 | | 11 | +- 2 level(s) above the killer - Points for a chain of 0 to 5: 4, 9, 14, 19, 24, 29 | | 12 | +- 3 level(s) above the killer - Points for a chain of 0 to 5: 4, 9, 14, 19, 24, 29 | | 13 | +- 4 level(s) above the killer - Points for a chain of 0 to 5: 4, 9, 14, 19, 24, 29 | | 14 | +- 5 level(s) above the killer - Points for a chain of 0 to 5: 4, 9, 14, 19, 24, 29 |
Collapse file Copy file name to clipboardExpand all lines: src/NosCore.Algorithm/Constants.cs +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -26,6 +26,11 @@ internal class Constants | 26 | 26 | internal const short MaxDignityLoss = 50; | 27 | 27 | internal const byte TimeSpacePenaltyPerLevel = 2; | 28 | 28 | internal const byte MaxTimeSpacePenalty = 100; | | 29 | + internal const byte TimeSpaceKillPointsAtSameLevel = 3; | | 30 | + // Packet traces show 4 for monsters one to ten levels above the killer, though a few kills of a | | 31 | + // monster nine levels above score 3, so the ceiling past one level above is not settled. | | 32 | + internal const byte MaxTimeSpaceKillLevelPoints = 4; | | 33 | + internal const byte TimeSpaceKillPointsPerChain = 5; | 29 | 34 | internal const byte TimeSpaceExperiencePerLevel = 3; | 30 | 35 | internal const byte TimeSpaceJobExperienceNumerator = 21; | 31 | 36 | internal const byte TimeSpaceJobExperienceDenominator = 4; | |
Collapse file Copy file name to clipboard +23Lines changed: 23 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// __ _ __ __ ___ __ ___ ___ | | 2 | +// | \| |/__\ /' _/ / _//__\| _ \ __| | | 3 | +// | | ' | \/ |`._`.| \_| \/ | v / _| | | 4 | +// |_|\__|\__/ |___/ \__/\__/|_|_\___| | | 5 | +// ----------------------------------- | | 6 | + | | 7 | +namespace NosCore.Algorithm.TimeSpaceScoreService | | 8 | +{ | | 9 | + /// <summary> | | 10 | + /// Service for the points a kill adds to a time-space's running score | | 11 | + /// </summary> | | 12 | + public interface ITimeSpaceScoreService | | 13 | + { | | 14 | + /// <summary> | | 15 | + /// Gets the points a kill adds to the running score | | 16 | + /// </summary> | | 17 | + /// <param name="monsterLevel">The level of the monster killed</param> | | 18 | + /// <param name="killerLevel">The level of whoever killed it</param> | | 19 | + /// <param name="chain">How many marked monsters in a row this kill completes, 0 for a monster that was not marked</param> | | 20 | + /// <returns>The points added</returns> | | 21 | + int GetKillPoints(byte monsterLevel, byte killerLevel, int chain); | | 22 | + } | | 23 | +} |
Collapse file Copy file name to clipboard +24Lines changed: 24 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// __ _ __ __ ___ __ ___ ___ | | 2 | +// | \| |/__\ /' _/ / _//__\| _ \ __| | | 3 | +// | | ' | \/ |`._`.| \_| \/ | v / _| | | 4 | +// |_|\__|\__/ |___/ \__/\__/|_|_\___| | | 5 | +// ----------------------------------- | | 6 | + | | 7 | +using System; | | 8 | + | | 9 | +namespace NosCore.Algorithm.TimeSpaceScoreService | | 10 | +{ | | 11 | + /// <summary> | | 12 | + /// Provides the points a kill adds to a time-space's running score | | 13 | + /// </summary> | | 14 | + public class TimeSpaceScoreService : ITimeSpaceScoreService | | 15 | + { | | 16 | + /// <inheritdoc /> | | 17 | + public int GetKillPoints(byte monsterLevel, byte killerLevel, int chain) | | 18 | + { | | 19 | + var levelPoints = Math.Clamp(monsterLevel - killerLevel + Constants.TimeSpaceKillPointsAtSameLevel, | | 20 | + 1, Constants.MaxTimeSpaceKillLevelPoints); | | 21 | + return levelPoints + Math.Max(0, chain) * Constants.TimeSpaceKillPointsPerChain; | | 22 | + } | | 23 | + } | | 24 | +} |
Collapse file Copy file name to clipboardExpand all lines: test/NosCore.Algorithm.Tests/DocumentationTest.cs +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -894,6 +894,27 @@ public void TimeSpaceExperienceDocumentation() | 894 | 894 | Approvals.Verify(WriterFactory.CreateTextWriter(resultBuilder.ToString(), "md")); | 895 | 895 | } | 896 | 896 |
| | 897 | + [TestMethod] | | 898 | + public void TimeSpaceScoreDocumentation() | | 899 | + { | | 900 | + var timeSpaceScoreService = new TimeSpaceScoreService.TimeSpaceScoreService(); | | 901 | + | | 902 | + var resultBuilder = new StringBuilder("# Time-Space Kill Points Table"); | | 903 | + resultBuilder.AppendLine(); | | 904 | + resultBuilder.AppendLine(); | | 905 | + resultBuilder.AppendLine("Points a kill adds to the running score, by how far the monster is above its killer and how many marked monsters in a row the kill completes (0 for an unmarked monster)."); | | 906 | + for (var difference = -5; difference <= 5; difference++) | | 907 | + { | | 908 | + const byte killerLevel = 30; | | 909 | + var monsterLevel = (byte)(killerLevel + difference); | | 910 | + var points = Enumerable.Range(0, 6).Select(chain => timeSpaceScoreService.GetKillPoints(monsterLevel, killerLevel, chain)); | | 911 | + resultBuilder.AppendLine( | | 912 | + $"- {difference,2} level(s) above the killer - Points for a chain of 0 to 5: {string.Join(", ", points)}"); | | 913 | + } | | 914 | + | | 915 | + Approvals.Verify(WriterFactory.CreateTextWriter(resultBuilder.ToString(), "md")); | | 916 | + } | | 917 | + | 897 | 918 | [TestMethod] | 898 | 919 | public void RarityPointDocumentation() | 899 | 920 | { | |
|