forked from tylercamp/palcalc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGameConstants.cs
142 lines (122 loc) · 4.92 KB
/
GameConstants.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PalCalc.Model
{
public static class GameConstants
{
public static readonly int PlayerPartySize = 5;
public static readonly Dictionary<LocationType, int> LocationTypeGridWidths = new() {
{ LocationType.PlayerParty, 5 },
{ LocationType.Palbox, 6 },
{ LocationType.Base, 5 },
{ LocationType.ViewingCage, 6 },
// (not real, just so it's defined)
{ LocationType.Custom, 8 },
};
public static readonly Dictionary<LocationType, int?> LocationTypeGridHeights = new()
{
{ LocationType.Palbox, 5 },
{ LocationType.PlayerParty, null },
{ LocationType.Base, null },
{ LocationType.ViewingCage, null },
{ LocationType.Custom, null },
};
/// <summary>
/// Passive skills which affect breeding times
/// </summary>
public static readonly Dictionary<string, float> PassiveSkillTimeFactors = new()
{
// TODO - could this be scraped from game files?
{ "Test_PalEgg_HatchingSpeed_Up", 0.5f }
};
// Used for calculating map coords from world coords
//
// (these values are fetched from game files and output at the end of `PalCalc.GenDB.BuildDBProgram`)
public static readonly double Map_MinX = -582888.0;
public static readonly double Map_MaxX = 335112.0;
public static readonly double Map_MinY = -301000.0;
public static readonly double Map_MaxY = 617000.0;
/*
* Outstanding questions:
*
* - What's the formula for how long breeding will take?
* - What's the probability of wild pals having a specific gender?
* - What's the probability of wild pals having exactly N passives?
*/
public static readonly int MaxTotalPassives = 4;
// probability of inheriting exactly N IVs from parents
public static readonly Dictionary<int, float> IVProbabilityDirect = new()
{
// will always inherit at least 1
{ 0, 0.0f },
// (determined manually by gathering samples, unlike passive probabilities which were reverse engineered)
{ 1, 0.5f },
{ 2, 0.25f },
{ 3, 0.25f },
};
// roughly estimate time to catch a given pal
public static TimeSpan TimeToCatch(Pal pal)
{
var minTime = TimeSpan.FromMinutes(3);
// TODO - tweak
var rarityModifier = (pal.Price - 1000) / 100.0f + (pal.Id.IsVariant ? 5 : 0);
return minTime + TimeSpan.FromMinutes(rarityModifier);
}
// https://www.reddit.com/r/Palworld/comments/1af9in7/passive_skill_inheritance_mechanics_in_breeding/
// supposedly the child will always inherit at least 1 passive directly from a parent?
// probability of getting N passives from parent pool
public static readonly IReadOnlyDictionary<int, float> PassiveProbabilityDirect = new Dictionary<int, float>()
{
{ 4, 0.10f },
{ 3, 0.20f },
{ 2, 0.30f },
{ 1, 0.40f },
{ 0, 0.0f },
};
// probability of getting N passives from parent pool without any random passives
public static readonly IReadOnlyDictionary<int, float> PassiveProbabilityNoRandom = new Dictionary<int, float>()
{
{ 4, 0.10f },
{ 3, 0.08f },
{ 2, 0.12f },
{ 1, 0.16f },
};
public static readonly IReadOnlyDictionary<int, float> PassiveProbabilityAtLeastN = new Dictionary<int, float>()
{
{ 4, 0.10f },
{ 3, 0.30f },
{ 2, 0.60f },
{ 1, 1.00f },
};
public static readonly IReadOnlyDictionary<int, float> PassiveProbabilityNoRandomAtLeastN = new Dictionary<int, float>()
{
{ 4, 0.10f },
{ 3, 0.12f },
{ 2, 0.24f },
{ 1, 0.40f },
};
// probability of getting N additional random passives added
public static readonly IReadOnlyDictionary<int, float> PassiveRandomAddedProbability = new Dictionary<int, float>()
{
{ 4, 0.0f },
{ 3, 0.10f },
{ 2, 0.20f },
{ 1, 0.30f },
{ 0, 0.40f },
};
// probability of a wild pal having, at most, N random passives
// (assume equal probability of gaining anywhere from 0 through 4 random passives)
// (20% chance of exactly N passives)
public static readonly IReadOnlyDictionary<int, float> PassivesWildAtMostN = new Dictionary<int, float>()
{
{ 0, 0.2f },
{ 1, 0.4f },
{ 2, 0.6f },
{ 3, 0.8f },
{ 4, 1.0f },
};
}
}