-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCharacterRegistry.cs
More file actions
248 lines (223 loc) · 11.3 KB
/
CharacterRegistry.cs
File metadata and controls
248 lines (223 loc) · 11.3 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
using Il2Cpp;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using UnityEngine;
namespace RevealDilemmaMod;
public readonly struct CharacterSet
{
public CharacterSet(CharacterData saboteur, CharacterData shroud, CharacterData auditor, CharacterData martyr, CharacterData ambusher)
{
Saboteur = saboteur;
Shroud = shroud;
Auditor = auditor;
Martyr = martyr;
Ambusher = ambusher;
}
public CharacterData Saboteur { get; }
public CharacterData Shroud { get; }
public CharacterData Auditor { get; }
public CharacterData Martyr { get; }
public CharacterData Ambusher {get;}
}
public static class CharacterRegistry
{
public static void RegisterAll(GameData gameData)
{
CharacterSet characters = Register(gameData);
ConfigureAscensions(gameData, characters);
}
public static void injectCharacters()
{
ClassInjector.RegisterTypeInIl2Cpp<Saboteur>();
ClassInjector.RegisterTypeInIl2Cpp<Shroud>();
ClassInjector.RegisterTypeInIl2Cpp<Auditor>();
ClassInjector.RegisterTypeInIl2Cpp<Martyr>();
ClassInjector.RegisterTypeInIl2Cpp<Ambusher>();
}
private static CharacterSet Register(GameData gameData)
{
Il2CppSystem.Collections.Generic.List<CharacterData> allCharacters = gameData.allCharacterData;
// Sprite alchemistArt = null;
// Sprite jesterArt = null;
// Sprite wretchArt = null;
// foreach (CharacterData character in allCharacters)
// {
// MelonLogger.Msg(character.characterId);
// if (character.characterId == "Alchemist_94446803")
// {
// alchemistArt = character.art;
// }
// if (character.characterId == "Wretch_Evil_91222191")
// {
// wretchArt = character.art;
// }
// if (character.characterId == "Jester_41367606")
// {
// jesterArt = character.art;
// }
// }
CharacterData martyr = new CharacterData();
martyr.role = new Martyr();
martyr.name = "Martyr";
martyr.description = "When you execute me and there are other evils alive, I deal 2 damage to you. \n\nI Lie and Disguise.";
martyr.flavorText = "\"BOOM!\"";
martyr.hints = "Kill me last!";
martyr.ifLies = "";
martyr.picking = false;
martyr.startingAlignment = EAlignment.Evil;
martyr.type = ECharacterType.Minion;
martyr.abilityUsage = EAbilityUsage.Once;
martyr.bluffable = false;
martyr.characterId = "Martyr_rdm";
martyr.artBgColor = new Color(1f, 0f, 0f);
martyr.cardBgColor = new Color(0.0941f, 0.0431f, 0.0431f);
martyr.cardBorderColor = new Color(0.8208f, 0f, 0.0241f);
martyr.color = new Color(0.8491f, 0.4555f, 0f);
CharacterData ambusher = new CharacterData();
ambusher.role = new Ambusher();
ambusher.name = "Ambusher";
ambusher.description = "When you reveal the last unrevealed character, I deal 3 damage to you. \n\nI Lie and Disguise.";
ambusher.flavorText = "\"There was no hiding from the Ambusher.\"";
ambusher.hints = "I do not deal damage if I am dead.";
ambusher.ifLies = "";
ambusher.picking = false;
ambusher.startingAlignment = EAlignment.Evil;
ambusher.type = ECharacterType.Minion;
ambusher.abilityUsage = EAbilityUsage.Once;
ambusher.bluffable = false;
ambusher.characterId = "Ambush_rdm";
ambusher.artBgColor = new Color(1f, 0f, 0f);
ambusher.cardBgColor = new Color(0.0941f, 0.0431f, 0.0431f);
ambusher.cardBorderColor = new Color(0.8208f, 0f, 0.0241f);
ambusher.color = new Color(0.8491f, 0.4555f, 0f);
CharacterData saboteur = new CharacterData();
saboteur.role = new Saboteur();
saboteur.name = "Saboteur";
saboteur.description = "When you reveal me, I kill the next character you reveal who has an ability. I deal 2 damage if they were good.";
saboteur.flavorText = "\"Looking for any excuse to achieve their goals.\"";
saboteur.hints = "I can still kill even if I die.";
saboteur.ifLies = "I don't kill or deal damage to you.";
saboteur.picking = false;
saboteur.startingAlignment = EAlignment.Good;
saboteur.type = ECharacterType.Outcast;
saboteur.abilityUsage = EAbilityUsage.Once;
saboteur.bluffable = true;
saboteur.characterId = "Sabo_rdm";
// saboteur.art = jesterArt;
saboteur.artBgColor = new Color(0.3679f, 0.2014f, 0.1541f);
saboteur.cardBgColor = new Color(0.102f, 0.0667f, 0.0392f);
saboteur.cardBorderColor = new Color(0.7843f, 0.6471f, 0f);
saboteur.color = new Color(0.9659f, 1f, 0.4472f);
CharacterData shroud = new CharacterData();
shroud.role = new Shroud();
shroud.name = "Shroud";
shroud.description = "When you reveal a character, I deal 1 damage to you. \n\nI Lie and Disguise.";
shroud.flavorText = "\"Awaiting in the darkness, the shroud lurks.\"";
shroud.hints = "";
shroud.ifLies = "";
shroud.picking = false;
shroud.startingAlignment = EAlignment.Evil;
shroud.type = ECharacterType.Demon;
shroud.abilityUsage = EAbilityUsage.Once;
shroud.bluffable = false;
shroud.characterId = "Shroud_rdm";
// shroud.art = wretchArt;
shroud.artBgColor = new Color(1f, 0f, 0f);
shroud.cardBgColor = new Color(0.0941f, 0.0431f, 0.0431f);
shroud.cardBorderColor = new Color(0.8208f, 0f, 0.0241f);
shroud.color = new Color(1f, 0.3811f, 0.3811f);
CharacterData auditor = new CharacterData();
auditor.role = new Auditor();
auditor.name = "Auditor";
auditor.description = "Pick 2 characters. Heal 2 for each Villager you selected.";
auditor.flavorText = "\"Verifying the legitimacy of the village.\"";
auditor.hints = "I Register as a random Outsider.";
auditor.ifLies = "I never heal you.";
auditor.picking = true;
auditor.startingAlignment = EAlignment.Good;
auditor.type = ECharacterType.Villager;
auditor.abilityUsage = EAbilityUsage.Once;
auditor.bluffable = true;
auditor.characterId = "Auditor_rdm";
// auditor.art = alchemistArt;
auditor.artBgColor = new Color(0.111f, 0.0833f, 0.1415f);
auditor.cardBgColor = new Color(0.26f, 0.1519f, 0.3396f);
auditor.cardBorderColor = new Color(0.7133f, 0.339f, 0.8679f);
auditor.color = new Color(1f, 0.935f, 0.7302f);
allCharacters.Add(shroud);
allCharacters.Add(saboteur);
allCharacters.Add(auditor);
allCharacters.Add(martyr);
allCharacters.Add(ambusher);
return new CharacterSet(saboteur, shroud, auditor, martyr, ambusher);
}
private static void ConfigureAscensions(GameData gameData, CharacterSet characters)
{
CharacterData saboteur = characters.Saboteur;
CharacterData shroud = characters.Shroud;
CharacterData auditor = characters.Auditor;
CharacterData martyr = characters.Martyr;
CharacterData ambusher = characters.Ambusher;
AscensionsData advancedAscension = gameData.advancedAscension;
CustomScriptData shroudScriptData = new CustomScriptData();
shroudScriptData.name = "Shroud1";
ScriptInfo shroudScript = new ScriptInfo();
Il2CppSystem.Collections.Generic.List<CharacterData> shroudMustInclude = new Il2CppSystem.Collections.Generic.List<CharacterData>();
shroudMustInclude.Add(shroud);
shroudMustInclude.Add(auditor);
shroudScript.mustInclude = shroudMustInclude;
Il2CppSystem.Collections.Generic.List<CharacterData> shroudDemonList = new Il2CppSystem.Collections.Generic.List<CharacterData>();
shroudDemonList.Add(shroud);
shroudScript.startingDemons = shroudDemonList;
Il2CppSystem.Collections.Generic.List<CharacterData> shroudTownsfolkList = new Il2CppSystem.Collections.Generic.List<CharacterData>(
gameData.advancedAscension.possibleScriptsData[0].scriptInfo.startingTownsfolks.Pointer);
shroudTownsfolkList.Add(auditor);
shroudScript.startingTownsfolks = shroudTownsfolkList;
shroudScript.startingOutsiders = gameData.advancedAscension.possibleScriptsData[0].scriptInfo.startingOutsiders;
shroudScript.startingMinions = gameData.advancedAscension.possibleScriptsData[0].scriptInfo.startingMinions;
// CharactersCount shroudCounter1 = new CharactersCount(7, 4, 1, 1, 1);
// shroudCounter1.dOuts = shroudCounter1.outs + 1;
// CharactersCount shroudCounter2 = new CharactersCount(8, 5, 1, 1, 1);
// shroudCounter2.dOuts = shroudCounter2.outs + 1;
// CharactersCount shroudCounter3 = new CharactersCount(9, 5, 1, 2, 1);
// shroudCounter3.dOuts = shroudCounter3.outs + 1;
CharactersCount shroudCounter4 = new CharactersCount(10, 6, 1, 1, 2);
shroudCounter4.dOuts = shroudCounter4.outs + 1;
Il2CppSystem.Collections.Generic.List<CharactersCount> shroudCounterList = new Il2CppSystem.Collections.Generic.List<CharactersCount>();
// shroudCounterList.Add(shroudCounter1);
// shroudCounterList.Add(shroudCounter2);
// shroudCounterList.Add(shroudCounter3);
shroudCounterList.Add(shroudCounter4);
shroudScript.characterCounts = shroudCounterList;
shroudScriptData.scriptInfo = shroudScript;
Il2CppReferenceArray<CharacterData> advancedAscensionDemons = new Il2CppReferenceArray<CharacterData>(advancedAscension.demons.Length + 1);
advancedAscensionDemons = advancedAscension.demons;
advancedAscensionDemons[advancedAscensionDemons.Length - 1] = shroud;
advancedAscension.demons = advancedAscensionDemons;
Il2CppReferenceArray<CharacterData> advancedAscensionStartingDemons = new Il2CppReferenceArray<CharacterData>(advancedAscension.startingDemons.Length + 1);
advancedAscensionStartingDemons = advancedAscension.startingDemons;
advancedAscensionStartingDemons[advancedAscensionStartingDemons.Length - 1] = shroud;
advancedAscension.startingDemons = advancedAscensionStartingDemons;
Il2CppReferenceArray<CustomScriptData> advancedAscensionScriptsData = new Il2CppReferenceArray<CustomScriptData>(advancedAscension.possibleScriptsData.Length + 1);
advancedAscensionScriptsData = advancedAscension.possibleScriptsData;
advancedAscensionScriptsData[advancedAscensionScriptsData.Length - 1] = shroudScriptData;
advancedAscension.possibleScriptsData = advancedAscensionScriptsData;
foreach (CustomScriptData scriptData in advancedAscension.possibleScriptsData)
{
ScriptInfo script = scriptData.scriptInfo;
AddRole(script.startingTownsfolks, auditor);
// AddRole(script.startingDemons, shroud);
AddRole(script.startingOutsiders, saboteur);
AddRole(script.startingMinions, martyr);
AddRole(script.startingMinions, ambusher);
}
}
private static void AddRole(Il2CppSystem.Collections.Generic.List<CharacterData> list, CharacterData data)
{
if (list.Contains(data))
{
return;
}
list.Add(data);
}
}