-
Notifications
You must be signed in to change notification settings - Fork 1
/
Player.cs
179 lines (162 loc) · 5.21 KB
/
Player.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
public struct Position
{
public int x;
public int y;
public Position(int x, int y)
{
this.x = x;
this.y = y;
}
}
class Player
{
public static int _nbOfPlayers = 0;
public IntPtr _playerPtr;
public int _playerNumber;
public string _currentAnim;
public int _HP;
public int _defenseModifier;
public int _meter;
public int _RISC;
public int _stun;
public int _stunThreshold;
public bool _isBlocking = false;
public bool _isHit = false;
public int _hitstop;
public int _flags0x4d3c;
public int _flags0x4d48;
public int _forceDisableFlags;
public Position _pos;
public Player()
{
++_nbOfPlayers;
_playerNumber = _nbOfPlayers;
}
public int characterIndex;
static public List<string> charactersList = new List<string>() { "Sol", "Ky", "May", "Millia", "Zato=1", "Potemkin", "Chipp", "Faust", "Axl", "Venom", "Slayer", "I-no", "Bedman", "Ramlethal", "Sin", "Elphelt", "Leo", "Johnny", "Jack-O'", "Jam", "Haehyun", "Raven", "Dizzy", "Baiken", "Answer" };
static public List<int> stunList = new List<int>() { 6000, 6000, 7000, 5500, 6000, 8000, 5000, 6500, 6000, 6000, 7000, 5500, 6000, 6000, 6000, 6000, 7000, 7000, 6000, 6500, 7000, 5500, 5000, 5500, 5500 };
// 90% 76% 60% 50% 40% Answer, Bedman, Elphelt, Faust, Zato
// 87% 72% 58% 48% 40% Axl, I-No, Ramlethal, Sin, Slayer, Sol, Venom, Dizzy
// 84% 68% 56% 46% 38% Ky, Haehyun, Jack-O'
// 81% 66% 54% 44% 38% Johnny, Leo, May, Millia, Potemkin, Jam
// 78% 64% 50% 42% 38% Baiken, Chipp
// 75% 60% 48% 40% 36% Raven
public double getDefenseModifier()
{
float actualDefenseModifier = (float)(256 + _defenseModifier) / 256;
// Truncate instead of rounding to line up with the Dustloop
return Math.Truncate(actualDefenseModifier * 100) / 100;
}
private class IsIdleResponse {
public Player player;
public bool isIdle;
};
static private Dictionary<(string charName, string animName), EventHandler<IsIdleResponse>> idleAnimHash;
public static void setHashSets()
{
idleAnimHash = new Dictionary<(string charName, string animName), EventHandler<IsIdleResponse>>
{
{ ("Chipp", "HaritsukiKeep"), IsIdleHaritsukiKeep },
{ ("Faust", "Souten"), IsIdleSouten },
{ ("Faust", "SoutenA"), IsIdleSouten },
{ ("Faust", "Souten9"), IsIdleSouten },
{ ("Faust", "Souten44"), IsIdleSouten },
{ ("Faust", "Souten66"), IsIdleSouten },
{ ("Faust", "SoutenB"), IsIdleSouten },
{ ("Faust", "SoutenC"), IsIdleSouten },
{ ("Faust", "SoutenE"), IsIdleSouten },
{ ("Faust", "Souten8"), IsIdleSouten8 },
{ ("Axl", "DaiRensen"), IsIdleDaiRensen },
{ ("Elphelt", "Rifle_Start"), IsIdleRifle },
{ ("Elphelt", "Rifle_Reload"), IsIdleRifle },
{ ("Elphelt", "Rifle_Reload_Perfect"), IsIdleRifle },
{ ("Elphelt", "Rifle_Reload_Roman"), IsIdleRifle },
{ ("Leo", "Semuke"), IsIdleSemuke },
{ ("Jam", "NeoHochihu"), IsIdleNeoHochihu },
{ ("Answer", "Ami_Hold"), IsIdleAmi_Hold },
{ ("Answer", "Ami_Move"), IsIdleAmi_Move }
};
}
public void assignPlayerPtr(IntPtr ptr)
{
_playerPtr = ptr;
}
public bool IsCompletelyIdle()
{
(string charName, string animName) charAndAnim = (charactersList[characterIndex], _currentAnim);
if (!idleAnimHash.ContainsKey(charAndAnim))
{
return (_flags0x4d3c & 0x1000) != 0; // enableNormals
}
EventHandler<IsIdleResponse> handler = idleAnimHash[charAndAnim];
IsIdleResponse response = new IsIdleResponse{
isIdle = false,
player = this
};
handler(this, response);
return response.isIdle;
}
public bool IsBlocking()
{
return _isBlocking;
}
public bool IsHit()
{
return _isHit;
}
public bool IsUnderAttack()
{
return IsBlocking() || IsHit();
}
// Chipp wall cling idle/moving up/down
static private void IsIdleHaritsukiKeep(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0; // enableWhiffCancels
}
// Faust pogo
static private void IsIdleSouten(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0; // enableWhiffCancels
}
// Faust pogo helicopter
static private void IsIdleSouten8(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x1) == 0; // !enableGatlings
}
// Axl Haitaka stance
static private void IsIdleDaiRensen(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0; // enableWhiffCancels
}
// Elphelt Ms. Confille (rifle)
static private void IsIdleRifle(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0 // enableWhiffCancels
&& (e.player._forceDisableFlags & 0x2) == 0; // 0x2 is the force disable flag for Rifle_Fire
}
// Leo backturn idle
static private void IsIdleSemuke(object sender, IsIdleResponse e)
{
e.isIdle = true;
}
// Jam parry
static private void IsIdleNeoHochihu(object sender, IsIdleResponse e)
{
e.isIdle = false;
}
// Answer scroll cling idle
static private void IsIdleAmi_Hold(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0;
}
// Answer s.D
static private void IsIdleAmi_Move(object sender, IsIdleResponse e)
{
e.isIdle = (e.player._flags0x4d48 & 0x2) != 0
&& e.player._hitstop == 0;
}
}