Skip to content

Commit 85c6a6e

Browse files
author
Fizo55
committed
Move classcount to constant
1 parent 72280d3 commit 85c6a6e

File tree

13 files changed

+18
-24
lines changed

13 files changed

+18
-24
lines changed

src/NosCore.Algorithm/CloseDefenceService/CloseDefenceService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using NosCore.Shared.Enumerations;
2-
using System;
32

43
namespace NosCore.Algorithm.CloseDefenceService
54
{
65
public class CloseDefenceService : ICloseDefenceService
76
{
8-
private readonly long[,] _closeDefence = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
7+
private readonly long[,] _closeDefence = new long[Constants.ClassCount, Constants.MaxLevel];
98

109
public CloseDefenceService()
1110
{

src/NosCore.Algorithm/Constants.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
namespace NosCore.Algorithm
1+
using NosCore.Shared.Enumerations;
2+
using System;
3+
4+
namespace NosCore.Algorithm
25
{
36
internal class Constants
47
{
58
internal const byte MaxLevel = 99;
69
internal const byte MaxFairyLevel = 80;
710
internal const byte MaxJobLevel = 80;
811
internal const byte MaxHeroLevel = 60;
12+
internal static readonly int ClassCount = Enum.GetNames(typeof(CharacterClassType)).Length;
913
}
1014
}

src/NosCore.Algorithm/DamageService/DamageService.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
// -----------------------------------
66

77
using NosCore.Shared.Enumerations;
8-
using System;
98

109
namespace NosCore.Algorithm.DamageService
1110
{
1211
public class DamageService : IDamageService
1312
{
14-
private readonly long[,] _minDamage = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
13+
private readonly long[,] _minDamage = new long[Constants.ClassCount, Constants.MaxLevel];
1514

1615
public DamageService()
1716
{
1817
_minDamage[(byte)CharacterClassType.Adventurer, 0] = 10;
19-
_minDamage[(byte)CharacterClassType.Swordsman, 0] = 10;
2018
_minDamage[(byte)CharacterClassType.Archer, 0] = 60;
19+
_minDamage[(byte)CharacterClassType.Swordsman, 0] = 10;
2120
_minDamage[(byte)CharacterClassType.Mage, 0] = 10;
2221
_minDamage[(byte)CharacterClassType.MartialArtist, 0] = 10;
2322

src/NosCore.Algorithm/DistanceDefenceService/DistanceDefenceService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using NosCore.Shared.Enumerations;
2-
using System;
32

43
namespace NosCore.Algorithm.DistanceDefenceService
54
{
65
public class DistanceDefenceService : IDistanceDefenceService
76
{
8-
private readonly long[,] _distanceDefence = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
7+
private readonly long[,] _distanceDefence = new long[Constants.ClassCount, Constants.MaxLevel];
98

109
public DistanceDefenceService()
1110
{

src/NosCore.Algorithm/DistanceDodgeService/DistanceDodgeService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using NosCore.Shared.Enumerations;
2-
using System;
32

43
namespace NosCore.Algorithm.DistanceDodgeService
54
{
65
public class DistanceDodgeService : IDistanceDodgeService
76
{
8-
private readonly long[,] _distanceDodge = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
7+
private readonly long[,] _distanceDodge = new long[Constants.ClassCount, Constants.MaxLevel];
98

109
public DistanceDodgeService()
1110
{

src/NosCore.Algorithm/DodgeService/HitDodgeService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using NosCore.Shared.Enumerations;
2-
using System;
32

43
namespace NosCore.Algorithm.HitDodgeService
54
{
65
public class HitDodgeService : IHitDodgeService
76
{
8-
private readonly long[,] _hitDodge = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
7+
private readonly long[,] _hitDodge = new long[Constants.ClassCount, Constants.MaxLevel];
98

109
public HitDodgeService()
1110
{

src/NosCore.Algorithm/HitRateService/HitRateService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
// -----------------------------------
66

77
using NosCore.Shared.Enumerations;
8-
using System;
98

109
namespace NosCore.Algorithm.HitRateService
1110
{
1211
public class HitRateService : IHitRateService
1312
{
14-
private readonly long[,] _hitRate = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
13+
private readonly long[,] _hitRate = new long[Constants.ClassCount, Constants.MaxLevel];
1514
public HitRateService()
1615
{
1716
var archerHitRate = 31;

src/NosCore.Algorithm/HpService/HpService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace NosCore.Algorithm.HpService
1111
{
1212
public class HpService : IHpService
1313
{
14-
private readonly long[,] _hpData = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
14+
private readonly long[,] _hpData = new long[Constants.ClassCount, Constants.MaxLevel];
1515
public readonly int[][] ClassConstants = new int[][] { new int[] { 0, 0, 0 }, new int[] { 8, 2, 0 }, new int[] { 3, 6, 1 }, new int[] { 0, 2, 8 }, new int[] { 5, 3, 2 } };
1616

1717
public HpService()

src/NosCore.Algorithm/JobExperienceService/JobExperienceService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
// -----------------------------------
66

77
using NosCore.Shared.Enumerations;
8-
using System;
98

109
namespace NosCore.Algorithm.JobExperienceService
1110
{
1211
public class JobExperienceService : IJobExperienceService
1312
{
14-
private readonly long[,] _jobXpData = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxJobLevel];
13+
private readonly long[,] _jobXpData = new long[Constants.ClassCount, Constants.MaxJobLevel];
1514

1615
public JobExperienceService()
1716
{

src/NosCore.Algorithm/MagicDefenceService/MagicDefenceService.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using NosCore.Shared.Enumerations;
2-
using System;
32

43
namespace NosCore.Algorithm.MagicDefenceService
54
{
65
public class MagicDefenceService : IMagicDefenceService
76
{
8-
private readonly long[,] _magicDefence = new long[Enum.GetNames(typeof(CharacterClassType)).Length, Constants.MaxLevel];
7+
private readonly long[,] _magicDefence = new long[Constants.ClassCount, Constants.MaxLevel];
98

109
public MagicDefenceService()
1110
{

0 commit comments

Comments
 (0)