-
Notifications
You must be signed in to change notification settings - Fork 0
/
Game1.cs
551 lines (495 loc) · 27.6 KB
/
Game1.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
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using ScumbagGalaxy.UI;
using System;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Text;
using ScumbagGalaxy.Managers;
using ScumbagGalaxy.UI.UIUnits;
using ScumbagGalaxy.UI.UIStartScreen;
namespace ScumbagGalaxy
{
/// <summary>
/// This is the main type for your game.
/// </summary>
public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
//Save the mouse state in a variable
MouseState mousePrevState;
MouseState mouseState;
//Create a game window
GameWindow gameWindow;
//Size (in pixels) of the game
int gameWidth;
int gameHeight;
//Size (in pixels) of the game window
int windowWidth;
int windowHeight;
//Default UIBox texture
Texture2D UIBoxSprite;
//Lists of players
List<Player> playList;
//UIGrid
UIGrid UIGrid;
//TODO: Have a rockManager or something
TokenUnit rock;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
//Mouse Visibility
this.IsMouseVisible = true;
//Set the game size
this.gameWidth = 2080;
this.gameHeight = 1198;
//Set the window size
this.windowWidth = 1280;
this.windowHeight = 720;
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize() {
//Create a game board for each game state (gameMenu, teamSelect, and game)
GameBoard.game = new GameBoard(this.gameWidth, this.gameHeight, 8);
GameBoard.teamSelect = new GameBoard(this.windowWidth, this.windowHeight, 8);
GameBoard.startMenu = new GameBoard(this.windowWidth, this.windowHeight, 8);
GameBoard.endMenu = new GameBoard(this.windowWidth, this.windowHeight, 8);
//Save the monitor size
int monitorWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
int monitorHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
//Calculate new window size
this.windowHeight = (int)(monitorHeight / 1.2);
this.windowWidth = (int)(this.windowHeight * 1.7777778);
//Set the screen location
//Window.IsBorderless = true; //Make the window borderless
Window.Position = new Point((monitorWidth - this.windowWidth) / 2, (monitorHeight - this.windowHeight) / 2);
//Set the view size to be the window size
GameBoard.game.viewWidth = this.windowWidth;
GameBoard.game.viewHeight = this.windowHeight;
GameBoard.teamSelect.viewWidth = this.windowWidth;
GameBoard.teamSelect.viewHeight = this.windowHeight;
GameBoard.startMenu.viewWidth = this.windowWidth;
GameBoard.startMenu.viewHeight = this.windowHeight;
GameBoard.endMenu.viewWidth = this.windowWidth;
GameBoard.endMenu.viewHeight = this.windowHeight;
//Set the active game state to the game menu
GameBoard.activeState = 1;
//Grab the mouse state
mouseState = Mouse.GetState();
//Set the screen size
graphics.PreferredBackBufferWidth = GameBoard.game.viewWidth;
graphics.PreferredBackBufferHeight = GameBoard.game.viewHeight;
graphics.ApplyChanges();
//Create the game grid
Grid.mainGrid = new Grid(30, 16);
//Create two players and put them in the playList
playList = new List<Player>();
playList.Add(new Player(OwnerPlayer.One));
playList.Add(new Player(OwnerPlayer.Two));
//Import all units
ImportUnit(playList[0], "Shiv.bin");
ImportUnit(playList[0], "Berserker.bin");
ImportUnit(playList[0], "Bomblobber.bin");
ImportUnit(playList[0], "Portmage.bin");
ImportUnit(playList[0], "Optimist.bin");
ImportUnit(playList[0], "Shade.bin");
ImportUnit(playList[0], "Hauler.bin");
ImportUnit(playList[0], "Stinger.bin");
ImportUnit(playList[0], "Blunderstriker.bin");
ImportUnit(playList[0], "Shiv.bin");
ImportUnit(playList[1], "Shiv.bin");
ImportUnit(playList[1], "Paladin.bin");
ImportUnit(playList[1], "Telepriest.bin");
ImportUnit(playList[1], "Portmage.bin");
ImportUnit(playList[1], "Shiv.bin");
ImportUnit(playList[1], "Optimist.bin");
ImportUnit(playList[1], "Hauler.bin");
ImportUnit(playList[1], "Bomblobber.bin");
ImportUnit(playList[1], "Paladin.bin");
ImportUnit(playList[1], "Shade.bin");
Grid practiceGrid = new Grid(4, 6);
practiceGrid.Set(1, 0, playList[0].Units[0]);
practiceGrid.Set(2, 1, playList[0].Units[1]);
practiceGrid.Set(0, 2, playList[0].Units[2]);
practiceGrid.Set(1, 2, playList[0].Units[3]);
practiceGrid.Set(3, 2, playList[0].Units[4]);
practiceGrid.Set(0, 3, playList[0].Units[5]);
practiceGrid.Set(1, 3, playList[0].Units[6]);
practiceGrid.Set(3, 3, playList[0].Units[7]);
practiceGrid.Set(2, 4, playList[0].Units[8]);
practiceGrid.Set(1, 5, playList[0].Units[9]);
Grid.mainGrid.SetRegion(5, 6, practiceGrid);
practiceGrid.Clear();
practiceGrid.Set(2, 0, playList[1].Units[0]);
practiceGrid.Set(1, 1, playList[1].Units[1]);
practiceGrid.Set(0, 2, playList[1].Units[2]);
practiceGrid.Set(2, 2, playList[1].Units[3]);
practiceGrid.Set(3, 2, playList[1].Units[4]);
practiceGrid.Set(0, 3, playList[1].Units[5]);
practiceGrid.Set(2, 3, playList[1].Units[6]);
practiceGrid.Set(3, 3, playList[1].Units[7]);
practiceGrid.Set(1, 4, playList[1].Units[8]);
practiceGrid.Set(2, 5, playList[1].Units[9]);
Grid.mainGrid.SetRegion(21, 6, practiceGrid);
//adding some obstacles
//rock = new TokenUnit(null, OwnerPlayer.None);
//rock.SpritePath = "Images/CharacterArt/hauler";
//rock.StackBuff(new Buff(BuffType.IsImmortal));//as they are not owned by any player, this buff will not decrement
//rock.StackBuff(new Buff(BuffType.IsUnselectable));
//Grid.mainGrid.Set(8, 8, rock);
//Grid.mainGrid.Set(9, 9, rock);
//Create instances of the player manager and the unit manager
PlayerManager.Manager = new PlayerManager(playList);
UnitManager.Manager = new UnitManager();
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
/*
Load content for the "game" state
*/
//Load the background
UIBox background = new UIBox(GameBoard.game, 0, 0, this.gameWidth, this.gameHeight);
background.thisSprite = Content.Load<Texture2D>(@"Images/background");
background.layer = 100;
background.visible = true;
background.mouseEvents = false;
//Create a new UIGrid
this.UIGrid = new UIGrid(Grid.mainGrid);
//Pass that grid to the UnitManager object
UnitManager.Manager.UIGrid = this.UIGrid;
//Load grid textures
UIGridCell.Load(Content);
//Load health bar textures
UIHealthBar.Load(Content);
//Load moves left textures
UIMovesLeft.Load(Content);
//Load the active unit UI textures
UIStatBackground.Load(Content);
UITextBox.Load(Content);
UISkillButton.Load(Content);
UIDefaultActionButton.Load(Content);
//Load UIUnit textures
for (int p = 0; p < playList.Count; p++) {
for (int i = 0; i < playList[p].Units.Count; i++) {
playList[p].Units[i].sprite.Load(Content);
}
}
//rock.sprite.Load(Content);
/*
Load content for the "teamSelect" state
*/
/*
Load content for the "startMenu" state
*/
//Load the background
UIBox startMenuBackground = new UIBox(GameBoard.startMenu, 0, 0, this.windowWidth, this.windowHeight);
startMenuBackground.thisSprite = Content.Load<Texture2D>(@"Images/TitleScreen/titleScreenBackground");
startMenuBackground.layer = 100;
startMenuBackground.visible = true;
startMenuBackground.mouseEvents = false;
startMenuBackground.viewMove = false;
//Load the start button
UIStartButton startButton = new UIStartButton(GameBoard.startMenu, (this.windowWidth - 672)/2, (this.windowHeight - 217)/2, 672, 217);
UIStartButton.Load(Content);
startButton.layer = 99;
startButton.visible = true;
startButton.viewMove = false;
/*
Load content for the 'endMenu' state
*/
UIBox endMenuBackground = new UIBox(GameBoard.endMenu, 0, 0, this.windowWidth, this.windowHeight);
endMenuBackground.thisSprite = Content.Load<Texture2D>(@"Images/EndScreen/endScreenBackground");
endMenuBackground.layer = 100;
endMenuBackground.visible = true;
endMenuBackground.mouseEvents = false;
endMenuBackground.viewMove = false;
//Load the exit button
UIExitButton exitButton = new UIExitButton(GameBoard.endMenu, (this.windowWidth - 672) / 2, ((this.windowHeight - 217) / 2) + 150, 672, 217);
UIExitButton.Load(Content);
exitButton.layer = 99;
exitButton.visible = true;
exitButton.viewMove = false;
//Load other content here
//Load fonts
GameBoard.font = Content.Load<SpriteFont>("Fonts/dosis");
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// game-specific content.
/// </summary>
protected override void UnloadContent()
{
Content.Unload();
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
//UPDATE GAME BOARD
//Set the previous state to the old game state
mousePrevState = mouseState;
//Get the new mouse state
mouseState = Mouse.GetState();
//Switch to determine game state
switch (GameBoard.activeState) {
case 1:
//Pass the old and new mouse state variables to the "update" function of the menu game board
GameBoard.startMenu.Update(mouseState, mousePrevState);
break;
case 2:
break;
case 3:
//Pass the old and new mouse state variables to the "update" function of the game board
GameBoard.game.Update(mouseState, mousePrevState);
//UPDATE ALL GAME STATE MANAGERS
PlayerManager.Manager.Update();
break;
case 4:
GameBoard.endMenu.Update(mouseState, mousePrevState);
break;
}
base.Update(gameTime);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise);
//Draw the active game state
//Switch to determine which game state is active
switch (GameBoard.activeState) {
case 1:
GameBoard.startMenu.Draw(spriteBatch);
break;
case 2:
break;
case 3:
GameBoard.game.Draw(spriteBatch);
break;
case 4:
GameBoard.endMenu.Draw(spriteBatch);
break;
}
spriteBatch.End();
base.Draw(gameTime);
}
private void ImportUnit(Player whichPlayer, string whichfile)
{
BinaryReader myBR = new BinaryReader(File.Open(whichfile, FileMode.Open));
String defaultAttackFileName = "";
String ability1FileName = "";
String ability2FileName = "";
String ability3FileName = "";
String ability4FileName = "";
try {
char[] delims = { ',' };
String dataString = System.Text.Encoding.ASCII.GetString(myBR.ReadBytes((int)myBR.BaseStream.Length));
String[] dataStringArray = dataString.Split(delims);
Console.WriteLine(dataStringArray[0]);
if (playList[0] == whichPlayer) {
whichPlayer.Units.Add(new LiveUnit(int.Parse(dataStringArray[3]), OwnerPlayer.One));
} else {
whichPlayer.Units.Add(new LiveUnit(int.Parse(dataStringArray[3]), OwnerPlayer.Two));
}
whichPlayer.Units[whichPlayer.Units.Count - 1].name = dataStringArray[0];
whichPlayer.Units[whichPlayer.Units.Count - 1].description = dataStringArray[1];
whichPlayer.Units[whichPlayer.Units.Count - 1].unitClass = dataStringArray[2];
whichPlayer.Units[whichPlayer.Units.Count - 1].speed = int.Parse(dataStringArray[4]);
whichPlayer.Units[whichPlayer.Units.Count - 1].critChance = int.Parse(dataStringArray[5]);
whichPlayer.Units[whichPlayer.Units.Count - 1].critDamage = int.Parse(dataStringArray[6]);
whichPlayer.Units[whichPlayer.Units.Count - 1].attackRange = int.Parse(dataStringArray[7]);
whichPlayer.Units[whichPlayer.Units.Count - 1].attackDamage = int.Parse(dataStringArray[8]);
whichPlayer.Units[whichPlayer.Units.Count - 1].baseHealsTaken = int.Parse(dataStringArray[9]);
defaultAttackFileName = dataStringArray[10];
ability1FileName = dataStringArray[11];
ability2FileName = dataStringArray[12];
ability3FileName = dataStringArray[13];
ability4FileName = dataStringArray[14];
Console.WriteLine("Problem free 1");
try {
ImportAbility(defaultAttackFileName, whichPlayer);
Console.WriteLine("Problem free 2");
} catch {
Console.WriteLine("Default attack not loaded");
}
try {
ImportAbility(ability1FileName, whichPlayer);
Console.WriteLine("Problem free 3");
} catch {
Console.WriteLine("Ability 1 not loaded");
}
try {
ImportAbility(ability2FileName, whichPlayer);
Console.WriteLine("Problem Free 4");
} catch {
Console.WriteLine("Ability 2 not loaded");
}
try {
ImportAbility(ability3FileName, whichPlayer);
Console.WriteLine("Problem Free 5");
} catch {
Console.WriteLine("Ability 3 not loaded");
}
try {
ImportAbility(ability4FileName, whichPlayer);
Console.WriteLine("Problem Free 6");
} catch {
Console.WriteLine("Ability 4 not loaded");
}
whichPlayer.Units[whichPlayer.Units.Count - 1].PortraitPath = dataStringArray[15];
Console.WriteLine("Problem Free 7");
whichPlayer.Units[whichPlayer.Units.Count - 1].SpritePath = dataStringArray[16];
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Something went wrong. Your character was not fully loaded.");
}
finally
{
myBR.Close();
Console.WriteLine("Closed.");
}
}
private void ImportAbility(string AbilityFileName, Player whichPlayer)
{
BinaryReader myBR = null;
try
{
myBR = new BinaryReader(File.Open(AbilityFileName, FileMode.Open));
char[] delims = { ',' };
String dataString = System.Text.Encoding.ASCII.GetString(myBR.ReadBytes((int)myBR.BaseStream.Length));
String[] dataStringArray = dataString.Split(delims);
int whattype = int.Parse(dataStringArray[7]);//What Type of Ability
//Attack Ability
if (whattype == 1)
{
//Check for Buff
if (File.Exists(dataStringArray[5]))
{
BinaryReader newBR = new BinaryReader(File.Open(dataStringArray[5], FileMode.Open));
String secondString = System.Text.Encoding.ASCII.GetString(newBR.ReadBytes((int)newBR.BaseStream.Length));
String[] secondDataStringArray = secondString.Split(delims);
String[] thirdDataStringArray = secondDataStringArray;
String[] fourthDataStringArray = secondDataStringArray;
BuffType thistype = (BuffType)int.Parse(secondDataStringArray[2]);
List<Buff> BuffList = new List<Buff>();
BuffList.Add(new Buff(thistype, int.Parse(secondDataStringArray[3]), bool.Parse(secondDataStringArray[5]), int.Parse(secondDataStringArray[4])));
if (File.Exists(dataStringArray[dataStringArray.Length - 2]))
{
BinaryReader secondBR = new BinaryReader(File.Open(dataStringArray[dataStringArray.Length - 2], FileMode.Open));
String thirdString = System.Text.Encoding.ASCII.GetString(secondBR.ReadBytes((int)secondBR.BaseStream.Length));
thirdDataStringArray = thirdString.Split(delims);
thistype = (BuffType)int.Parse(thirdDataStringArray[2]);
BuffList.Add(new Buff(thistype, int.Parse(thirdDataStringArray[3]), bool.Parse(thirdDataStringArray[5]), int.Parse(thirdDataStringArray[4])));
secondBR.Close();
}
if (File.Exists(dataStringArray[dataStringArray.Length - 1]))
{
BinaryReader thirdBR = new BinaryReader(File.Open(dataStringArray[dataStringArray.Length - 1], FileMode.Open));
String fourthString = System.Text.Encoding.ASCII.GetString(thirdBR.ReadBytes((int)thirdBR.BaseStream.Length));
fourthDataStringArray=fourthString.Split(delims);
thistype = (BuffType)int.Parse(fourthDataStringArray[2]);
BuffList.Add(new Buff(thistype, int.Parse(fourthDataStringArray[3]), bool.Parse(fourthDataStringArray[5]), int.Parse(fourthDataStringArray[4])));
thirdBR.Close();
}
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Add(new AttackAbility(int.Parse(dataStringArray[8]), int.Parse(dataStringArray[3]), int.Parse(dataStringArray[4]), int.Parse(dataStringArray[2]), BuffList));
Console.WriteLine("Where");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[0].Title = secondDataStringArray[0];
Console.WriteLine("It");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[0].Tooltip = secondDataStringArray[1];
Console.WriteLine("Is");
if (thirdDataStringArray.Equals(secondDataStringArray)==false)
{
Console.WriteLine("Is this happening?");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[1].Title = thirdDataStringArray[0];
Console.WriteLine("Yes it is.");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[1].Tooltip = thirdDataStringArray[1];
}
if (fourthDataStringArray.Equals(secondDataStringArray) == false)
{
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[2].Title = fourthDataStringArray[0];
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[2].Tooltip = fourthDataStringArray[1];
}
Console.WriteLine("On");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Title = dataStringArray[0];
Console.WriteLine("Going");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Tooltip = dataStringArray[1];
newBR.Close();
}
else
{
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Add(new AttackAbility(int.Parse(dataStringArray[8]), int.Parse(dataStringArray[3]), int.Parse(dataStringArray[4]), int.Parse(dataStringArray[2])));
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Title = dataStringArray[0];
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Tooltip = dataStringArray[1];
}
}
//Passive Ability
else if (whattype == 2)
{
if (File.Exists(dataStringArray[5]))
{
BinaryReader newBR = new BinaryReader(File.Open(dataStringArray[5], FileMode.Open));
String secondString = System.Text.Encoding.ASCII.GetString(newBR.ReadBytes((int)newBR.BaseStream.Length));
String[] secondDataStringArray = secondString.Split(delims);
BuffType thistype = (BuffType)int.Parse(secondDataStringArray[2]);
Console.WriteLine("Is");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Add(new PassiveAbility(new Buff(thistype, int.Parse(secondDataStringArray[3]), bool.Parse(secondDataStringArray[5]), int.Parse(secondDataStringArray[4])), int.Parse(dataStringArray[4])));
Console.WriteLine("This");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[0].Title = secondDataStringArray[0];
Console.WriteLine("It?");
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AppliedBuffs[0].Tooltip = secondDataStringArray[1];
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Title = dataStringArray[0];
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Tooltip = dataStringArray[1];
newBR.Close();
}
}
//Teleport Ability
else if (whattype == 3)
{
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Add(new TeleportAbility(int.Parse(dataStringArray[3]), int.Parse(dataStringArray[4]), int.Parse(dataStringArray[8]), int.Parse(dataStringArray[2])));
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Title = dataStringArray[0];
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].Tooltip = dataStringArray[1];
}
//Adds Picture
if (File.Exists(dataStringArray[6]))
{
whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities[whichPlayer.Units[whichPlayer.Units.Count - 1].Abilities.Count - 1].AbTexturePath = dataStringArray[6];
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Something went wrong. Your ability is not fully loaded.");
}
finally
{
myBR.Close();
}
}
}
}