GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add the points a kill adds to a time-space's running score (#189) · NosCoreIO/NosCore.Algorithm@bb4f506

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • documentation
    • DocumentationTest.TimeSpaceScoreDocumentation.approved.md
  • src/NosCore.Algorithm
    • Constants.cs
    • TimeSpaceScoreService
      • ITimeSpaceScoreService.cs
      • TimeSpaceScoreService.cs
  • test/NosCore.Algorithm.Tests
    • DocumentationTest.cs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎documentation/DocumentationTest.TimeSpaceScoreDocumentation.approved.md‎

Copy file name to clipboard
+14Lines changed: 14 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

‎src/NosCore.Algorithm/Constants.cs‎

Copy file name to clipboardExpand all lines: src/NosCore.Algorithm/Constants.cs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ internal class Constants
2626
internal const short MaxDignityLoss = 50;
2727
internal const byte TimeSpacePenaltyPerLevel = 2;
2828
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;
2934
internal const byte TimeSpaceExperiencePerLevel = 3;
3035
internal const byte TimeSpaceJobExperienceNumerator = 21;
3136
internal const byte TimeSpaceJobExperienceDenominator = 4;
Collapse file

‎src/NosCore.Algorithm/TimeSpaceScoreService/ITimeSpaceScoreService.cs‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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

‎src/NosCore.Algorithm/TimeSpaceScoreService/TimeSpaceScoreService.cs‎

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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

‎test/NosCore.Algorithm.Tests/DocumentationTest.cs‎

Copy file name to clipboardExpand all lines: test/NosCore.Algorithm.Tests/DocumentationTest.cs
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,27 @@ public void TimeSpaceExperienceDocumentation()
894894
Approvals.Verify(WriterFactory.CreateTextWriter(resultBuilder.ToString(), "md"));
895895
}
896896

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+
897918
[TestMethod]
898919
public void RarityPointDocumentation()
899920
{

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.