-
Notifications
You must be signed in to change notification settings - Fork 2
/
JokemonDriver.java
13470 lines (12388 loc) · 401 KB
/
JokemonDriver.java
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//////////////////////////////////////
//Driver Main Class for Jokemon
//
//By Camtendo (logic), Justinian (cartography), and Patches (pre-build)
//
//
//When Editing Tilemaps Change:
//createCurrentMap
//saveTileSet
//switchMap
import java.awt.Image;
import java.awt.Point;
import java.awt.Container;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Font;
import java.awt.Toolkit;
import java.awt.GridLayout;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequencer;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.JOptionPane;
import javax.swing.JApplet;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.net.URL;
import java.net.Socket;
import java.net.ServerSocket;
import java.net.InetAddress;
import java.io.*;
import java.net.URI;
import java.applet.AudioClip;
import java.util.Scanner;
public class JokemonDriver extends JPanel implements Runnable,KeyListener
{
public final boolean DEBUG=true;
public final boolean DONATE=false;
//Pick Correct Version and TitleScreen at compile time
public final static String VERSION="Peaches";
final TitleScreen_Peaches title=new TitleScreen_Peaches();
//public static final String VERSION="Cream";
//TitleScreen_Cream title=new TitleScreen_Cream();
static Image icon,loading;
static final File file=new File("savedata");
static boolean titleScreen=true;
static boolean makeTheArea = false;
static boolean cancelSwitch = false;
public static boolean mute = false;
private townMap map = new townMap();
private InventoryWindow iWin;
private Sequencer sequencer;
//Location Enums
public enum Area
{
//Towns and Cities
Stringville, Args_Harbor, Mount_Java, Villa_Del_Joe, Streamreader_Hotel,
Recursive_Hot_Springs, Polymorph_Town, Binary_City, Champions_Walk, Victory_Road,
Peach_City, Cream_City, Nested_Village, Enumville,
//Routes
Route_0, Route_1, Route_2, Route_3, Route_4, Route_5, Route_6, Route_7,
Route_8, Route_9, Route_10,Route_11,Route_12,Route_13, Route_14,
Route_ARRAYINDEXOUTOFBOUNDSEXCEPTION,
Null_Zone,Intville,Slipspace,Mountain_Dew_Paradise,
Pokecenter,Mart,MegaMart,YourHouse,Babbs_Lab,Rival_House,H_Border,
V_Border,
Generic_1, Generic_2, Generic_3, Generic_4, Generic_5, Generic_6,
Gym_1,Gym_2,Gym_3,Gym_4,Gym_5,Gym_6,Gym_7,Gym_8,
J_Inc_Radio_Tower,J_Inc_Building,Hotel_Lobby,Elite_4,Battle_Tower,
Hexadecimal_Forest,Class_Cave,Diglett_Cave,Moltres_Cave,Articuno_Cave,Power_Plant,Public_Cave,Primal_Cave,
Java_Cave, Victory_Road_Cave, Challenge_Cave,
Rocket_Right_Tower,Rocket_Left_Tower,Rocket_Central_Tower,
Lighthouse, Lighthouse_F2,
}
static final Area[] areasWithPCs={Area.Stringville,Area.Args_Harbor,Area.Mount_Java,Area.Villa_Del_Joe,Area.Streamreader_Hotel,
Area.Recursive_Hot_Springs,Area.Polymorph_Town,Area.Binary_City,Area.Nested_Village,Area.Enumville, Area.Route_6, Area.Champions_Walk, Area.Elite_4,Area.Peach_City,Area.Cream_City};
static int houseInt = 0;
ErrorWindow messageBox;
//Minigame Variables
int minigameInt=0;
boolean playingMinigame=false;
boolean invokeMinigame=false;
//Cartographer Vars
boolean cartographer=false;
int assignTileIntOutdoors=0;
int assignTileIntIndoors=0;
static boolean performingAction = false;
//LAN Trade Vars
TradeWindow tWin;
static boolean CONNECTED=false;
static int port=45897;
static String ipAddress;
static String netName;
static private Socket connection;
static private Scanner input;
static private ServerSocket ss;
static private InputStream sin;
static private OutputStream sout;
static private DataInputStream in;
static private DataOutputStream out;
static private InetAddress ipAddresss;
//Friend Vars
static String friendName="";
static final String[] friendPokemon={"","","","","",""};
static boolean tradeConfirm=false;
static boolean friendTradeConfirm=false;
static int offerIndex;
static int friendOfferIndex;
//Tileset Values
final byte OUTDOORS = 0;
final byte INDOORS = 1;
byte tileSet = OUTDOORS;
//Area Vars
static Area area=Area.Stringville;
static int[][] currentArea;
static URL bgm;
Mart mart = new Mart();
//Tileset Variables
final Image[] tileImgOutdoors=new Image[246];
final Image[] tileImgIndoors=new Image[366];
//Window Vars
private JFrame jf;
//Thread Vars
Thread thread;
//Frame Rate Vars
String fps="1";
long lastFPS;
int frames, slp;
//Location Vars
public static final Point location=new Point(15,12);
static final Point widthHeight = new Point(51,55);
//Character Vars
final Image[] charStand=new Image[4];
final Image[] charWalk1=new Image[4];
final Image[] charWalk2=new Image[4];
final Image[] charSurf=new Image[4];
final Image[] charBike0=new Image[4];
final Image[] charBike1=new Image[4];
final Image[] charBike2=new Image[4];
static int direction=270;
boolean moving=false;
int movingFrame=0;
boolean surfing = false;
boolean bicycling=false;
boolean forceBike=false;
boolean invokeBicycle=false;
boolean invokeMap=false;
static URL surfSong;
static URL bikeSong;
//NPC Trainer Vars
int numTrainers=2;
int trainerToFight;
Trainer trainer[]=new Trainer[numTrainers];
boolean trainerEnc=false;
URL maleEncounter,femaleEncounter,evilEncounter,rivalEncounter,leaderEncounter;
//Item Vars
Item mapItems[];
int numItems=0;
static boolean foundItem[];
static Item rodType;
//Transitioning Vars
boolean encounter = false;
static boolean transition=false;
boolean alreadyBattled=false;
boolean drawPoison=false;
boolean flyMenu=false;
Area flyAreas[];
int flyMenuInt=0;
static boolean fishing=false;
static int repelSteps=0;
boolean showCredits=false;
// private final Image BACK = Toolkit.getDefaultToolkit().getImage(Item.class.getResource("Sprites/background.jpg"));
//Point for leaving and entering buildings
static final Point returnPoint = new Point(5,38);
static Area returnArea = Area.Stringville;
static final Point returnPoint2 = new Point(5,38);
static Area returnArea2 = Area.Stringville;
//Game Vars
static String name="John";
static String rivalName="Jacob";
static int timesBeatRival=0;
static boolean justBeatRival=false;
static int badges=0;
static final Image[] badgeImg=new Image[8];
static int trainerIdNumber=(int)(Math.random()*90000)+10000;
static String idString;
static int playTimeSecs=1;
//minutes is automatically incremented
static int playTimeMins=-1;
static int playTimeHours=0;
static long launchTime=0;
static boolean timeBoolean=false;
static String timeString;
static long encryptionKey;
//Pokemon Vars
static final Pokemon[] partyPokemon=new Pokemon[6];
static final Pokemon[] pcPokemon=new Pokemon[120];
static final Pokemon[] enemy=new Pokemon[6];
//Pause Menu Items and Such
boolean paused=false;
static final String[] pauseMenu={"Pokedex","Pokemon"," Item",name," Save"};
int pauseMenuInt=0;
int pokemonMenuInt=0;
final Image[] playerImages=new Image[6];
int toggleInt=0;
int toggleIndexToSwitch=0;
boolean togglingPokemon=false;
static boolean recentlySaved=false;
//Objective Vars
static String currentObjective="Go talk to Babb!";
static final boolean[] objectiveComplete=new boolean[12];
static final boolean[] gotItem=new boolean[16];
//Pokedex Vars
Image pokedexImg;
int pokedexInt=1;
//Computer Vars
int compBox;
int compInt;
String compMode="";
boolean onComp=false;
public static void main(String[] jokes)
{
JokemonDriver j=new JokemonDriver();
//Pokemon.createAllMoves();
j.initTiles();
j.initCharSprites();
j.loadAudio();
Pokedex.makeArrays();
j.setIdentification();
j.setupGUI();
j.beginThread();
}
public void beginThread()
{
if (thread == null)
{
thread = new Thread(this,"JokemonMainThread");
thread.start();
}
}
//Returns game version
public static String getVersion()
{
return VERSION;
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
if(titleScreen)
{
if(VERSION.equals("Peaches"))
{
g.setColor(Color.BLACK);
g.fillRect(0,0,getWidth(),getHeight());
}
else
{
g.setColor(Color.CYAN);
g.fillRect(0,0,getWidth(),getHeight());
}
title.paintTitle(g);
return;
}
if(showCredits)
{
g.setColor(new Color(255,126,0,title.creditInt%256));
g.fillRect(0,0,getWidth(),getHeight());
title.paintCredits(g);
return;
}
if(CONNECTED)
{
drawTrade(g);
return;
}
g.setColor(Color.BLACK);
g.fillRect(0,0,getWidth(),getHeight());
if (!encounter&&!transition&&!trainerEnc)
{
drawMap(g);
if(drawPoison)
{
g.setColor(Color.MAGENTA);
g.fillRect(0,0,getWidth(),getHeight());
}
}
if(transition)
{
g.setColor(Color.WHITE);
g.setFont(new Font("Sanserif",Font.BOLD,36));
String str=""+area;
str=str.replace("_"," ");
g.drawString(str,400-(str.length()*10),300);
g.drawImage(loading,0,0,this);
g.drawImage(loading,0,600-148,this);
g.drawImage(loading,800-148,0,this);
g.drawImage(loading,800-148,600-148,this);
}
if(cartographer)
{
g.setColor(new Color(0,0,200,100));
g.fillRect(64*6,64*4,64,64);
switch (tileSet)
{
case OUTDOORS:
g.drawImage(tileImgOutdoors[assignTileIntOutdoors],64*6+16,64*4+16,32,32,this);
break;
case INDOORS:
g.drawImage(tileImgIndoors[assignTileIntIndoors],64*6+16,64*4+16,32,32,this);
break;
}
for(int i=0; i<5; i++)
{
try
{
g.setColor(new Color(50,50,50,50));
g.fillRect(64*7,64*3,32,32*5);
if(i!=2)
{
switch (tileSet)
{
case OUTDOORS:
g.drawImage(tileImgOutdoors[assignTileIntOutdoors-(2-i)],64*7,64*3+36*i,32,32,this);
break;
case INDOORS:
g.drawImage(tileImgIndoors[assignTileIntIndoors-(2-i)],64*7,64*3+36*i,32,32,this);
break;
}
}
}
catch(Exception ignored){}
}
}
else if(!transition)
drawCharacter(g);
if (!transition)
{
for(int i = 0; i<numTrainers; i++)
{
if (trainer[i] != null)
trainer[i].drawTrainer(g);
}
for(int i = 0; i<numItems; i++)
{
if (mapItems[i] != null)
mapItems[i].drawItem(g);
}
}
if(paused)
drawPauseMenu(g);
else if(onComp)
drawComputer(g);
else if(flyMenu)
drawFlyMenu(g);
else if(playingMinigame)
drawMinigameMenu(g);
}
//Draws Map
public void drawMap(Graphics g)
{
for(int i=0; i<13; i++)
{
for(int j=0; j<12; j++)
{
int HEIGHT = 64;
int WIDTH = 64;
try
{
switch (tileSet)
{
case OUTDOORS:
g.drawImage(tileImgOutdoors[currentArea[location.x-(6-i)][location.y-(4-j)]],64*i,64*j, WIDTH, HEIGHT,this);
break;
case INDOORS:
g.drawImage(tileImgIndoors[currentArea[location.x-(6-i)][location.y-(4-j)]],64*i,64*j, WIDTH, HEIGHT,this);
break;
}
}
catch(Exception e)
{
g.drawImage(tileImgOutdoors[29],64*i,64*j, WIDTH, HEIGHT,this);
}
}
}
}
public void drawMinigameMenu(Graphics g)
{
g.setColor(new Color(0,0,0,200));
g.fillRect(0,0,getWidth(),getHeight());
g.setFont(new Font("Sanserif",Font.BOLD,12));
g.setColor(Color.WHITE);
g.drawImage(icon,80,85,16,16,this);
g.drawString("Pick a minigame (Data will be saved when game starts!!!)",100,70);
String str="";
switch(minigameInt)
{
case 0:
str=Escape.getDescription();
g.drawString("Game: "+Escape.getGameName(),100,100);
g.drawString("By: "+Escape.getAuthor(),100,130);
g.drawString(str.substring(0,115),100,160);
g.drawString(str.substring(115,214),100,180);
g.drawString(str.substring(214,350-20),100,200);
g.drawString(str.substring(350-20),100,220);
break;
case 1:
g.drawString("Game: "+"Frogger",100,100);
g.drawString("By: "+"Sam Rohl",100,130);
g.drawString("Cross the road and dodge the NERDY_BIKERS!",100,160);
break;
case 2:
g.drawString("Game: "+"Tron",100,100);
g.drawString("By: "+"Patches",100,130);
g.drawString("Get on your lightcycle and have some fun! 2-Players",100,160);
break;
}
g.drawString("Press Spacebar to play!",100,300);
g.drawString("Press Arrow Keys to switch to another game!",100,320);
g.drawString("Press Backspace to quit!",100,340);
}
//Draws all components of the computer
public void drawComputer(Graphics g)
{
g.setColor(Color.GRAY);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(Color.BLACK);
g.fillRect(10,10,getWidth()-20,getHeight()-20);
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawString("Party Pokemon",50,70);
try
{
for(int i=0; i<partyPokemon.length; i++)
{
if(partyPokemon[i]!=null)
g.drawString(partyPokemon[i].nickname+" Lvl. "+partyPokemon[i].level,50,20*i+100);
else
g.drawString("--------",50,20*i+100);
}
}
catch(Exception ignored){}
g.drawString("Box "+(compBox+1),250,70);
try
{
for(int i=0; i<12; i++)
{
if(pcPokemon[compBox*12+i]!=null)
g.drawString(pcPokemon[compBox*12+i].nickname+" Lvl. "+pcPokemon[compBox*12+i].level,250,20*i+100);
else
g.drawString("--------",250,20*i+100);
}
}
catch(Exception ignored){}
if(!compMode.equals(""))
{
g.drawString("Mode: "+compMode,600,450);
}
if(compMode.equals("Deposit"))
{
g.drawImage(icon,30,compInt*20+85,16,16,this);
if(partyPokemon[compInt]!=null)
{
g.setColor(Color.WHITE);
g.drawString("Species: "+partyPokemon[compInt].species,500,100);
g.drawString("Nickname: "+partyPokemon[compInt].nickname,500,120);
g.drawString("Original Trainer: "+partyPokemon[compInt].originalTrainer,500,140);
g.drawString("Status: "+partyPokemon[compInt].status,500,160);
g.drawString("HP: "+partyPokemon[compInt].health+"/"+partyPokemon[compInt].healthMax,500,200);
g.drawString("ATK: "+partyPokemon[compInt].atk,500,220);
g.drawString("DEF: "+partyPokemon[compInt].def,500,240);
g.drawString("SPCL: "+partyPokemon[compInt].spcl,500,260);
g.drawString("SPEED: "+partyPokemon[compInt].speed,500,280);
String str=""+partyPokemon[compInt].move[0];
str=str.replace("_"," ");
g.drawString("Move 1: "+str+" "+partyPokemon[compInt].TRUE_PP[0]+"/"+
partyPokemon[compInt].TRUE_PPMAX[0],500,320);
if(partyPokemon[compInt].move[1]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[compInt].move[1];
str=str.replace("_"," ");
g.drawString("Move 2: "+str+" "+partyPokemon[compInt].TRUE_PP[1]+"/"+
partyPokemon[compInt].TRUE_PPMAX[1],500,340);
}
if(partyPokemon[compInt].move[2]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[compInt].move[2];
str=str.replace("_"," ");
g.drawString("Move 3: "+str+" "+partyPokemon[compInt].TRUE_PP[2]+"/"+
partyPokemon[compInt].TRUE_PPMAX[2],500,360);
}
if(partyPokemon[compInt].move[3]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[compInt].move[3];
str=str.replace("_"," ");
g.drawString("Move 4: "+str+" "+partyPokemon[compInt].TRUE_PP[3]+"/"+
partyPokemon[compInt].TRUE_PPMAX[3],500,380);
}
}
}
else if(compMode.equals("Withdraw")||compMode.equals("Release"))
{
g.drawImage(icon,230,compInt*20+85,16,16,this);
if(pcPokemon[compBox*12+compInt]!=null)
{
g.setColor(Color.WHITE);
g.drawString("Species: "+pcPokemon[compBox*12+compInt].species,500,100);
g.drawString("Nickname: "+pcPokemon[compBox*12+compInt].nickname,500,120);
g.drawString("Original Trainer: "+pcPokemon[compBox*12+compInt].originalTrainer,500,140);
g.drawString("Status: "+pcPokemon[compBox*12+compInt].status,500,160);
g.drawString("HP: "+pcPokemon[compBox*12+compInt].health+"/"+pcPokemon[compBox*12+compInt].healthMax,500,200);
g.drawString("ATK: "+pcPokemon[compBox*12+compInt].atk,500,220);
g.drawString("DEF: "+pcPokemon[compBox*12+compInt].def,500,240);
g.drawString("SPCL: "+pcPokemon[compBox*12+compInt].spcl,500,260);
g.drawString("SPEED: "+pcPokemon[compBox*12+compInt].speed,500,280);
String str=""+pcPokemon[compBox*12+compInt].move[0];
str=str.replace("_"," ");
g.drawString("Move 1: "+str+" "+pcPokemon[compBox*12+compInt].TRUE_PP[0]+"/"+
pcPokemon[compBox*12+compInt].TRUE_PPMAX[0],500,320);
if(pcPokemon[compBox*12+compInt].move[1]!=Pokemon.Move.NONE)
{
str=""+pcPokemon[compBox*12+compInt].move[1];
str=str.replace("_"," ");
g.drawString("Move 2: "+str+" "+pcPokemon[compBox*12+compInt].TRUE_PP[1]+"/"+
pcPokemon[compBox*12+compInt].TRUE_PPMAX[1],500,340);
}
if(pcPokemon[compBox*12+compInt].move[2]!=Pokemon.Move.NONE)
{
str=""+pcPokemon[compBox*12+compInt].move[2];
str=str.replace("_"," ");
g.drawString("Move 3: "+str+" "+pcPokemon[compBox*12+compInt].TRUE_PP[2]+"/"+
pcPokemon[compBox*12+compInt].TRUE_PPMAX[2],500,360);
}
if(pcPokemon[compBox*12+compInt].move[3]!=Pokemon.Move.NONE)
{
str=""+pcPokemon[compBox*12+compInt].move[3];
str=str.replace("_"," ");
g.drawString("Move 4: "+str+" "+pcPokemon[compBox*12+compInt].TRUE_PP[3]+"/"+
pcPokemon[compBox*12+compInt].TRUE_PPMAX[3],500,380);
}
}
}
g.drawString("Withdraw: W",600,480);
g.drawString("Deposit: D",600,500);
g.drawString("Release: R",600,520);
g.drawString("Log Off: Backspace",600,540);
}
//Draws all components of the trade process
public void drawTrade(Graphics g)
{
//g.setColor(new Color(255,126,0,200));
//g.drawImage(BACK,0,0,getWidth(),getHeight(),this);
g.setColor(Color.BLUE);
g.drawRect(0, 0, getWidth(), getHeight());
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawString("You",50,70);
try
{
for(int i=0; i<partyPokemon.length; i++)
{
if(partyPokemon[i]!=null)
g.drawString(partyPokemon[i].nickname,50,20*i+100);
else
g.drawString("--------",50,20*i+100);
}
}
catch(Exception ignored){}
g.drawImage(icon,30,offerIndex*20+85,16,16,this);
if(tradeConfirm)
{
g.drawString("Trade!",50,230);
}
g.drawString("Friend: "+friendName,550,70);
try
{
for(int i=0; i<friendPokemon.length; i++)
{
if(!friendPokemon[i].equalsIgnoreCase("null")&&!friendPokemon[i].equals(""))
g.drawString(friendPokemon[i],550,20*i+100);
else
g.drawString("--------",550,20*i+100);
}
}
catch(Exception ignored){}
g.drawImage(icon,530,friendOfferIndex*20+85,16,16,this);
if(friendTradeConfirm)
{
g.drawString("Trade!",550,230);
}
}
//Draws menu for flying
public void drawFlyMenu(Graphics g)
{
g.setColor(new Color(0,0,0,200));
g.fillRect(0,0,getWidth(),getHeight());
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawImage(icon,330,flyMenuInt*20+85,16,16,this);
g.drawString("Fly where? ('F' to cancel)",350,70);
try
{
for(int i=0; i<flyAreas.length; i++)
{
g.drawString(""+flyAreas[i],350,20*i+100);
}
}
catch(Exception e){e.printStackTrace();}
}
//Draws all components of the pause menu
public void drawPauseMenu(Graphics g)
{
g.setColor(new Color(0,0,0,200));
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(Color.WHITE);
for(int i=0; i<pauseMenu.length; i++)
{
int strHeight=24;
if(i==pauseMenuInt)
strHeight=36;
g.setFont(new Font("Sanserif",Font.BOLD,strHeight));
if (i != 3)
g.drawString(pauseMenu[i],(i*800)/5,50);
else
{
if (name.equalsIgnoreCase("Red")||name.equalsIgnoreCase("Wasabi"))
g.setColor(Color.RED);
if (name.equalsIgnoreCase("Yellow"))
g.setColor(Color.YELLOW);
if (name.equalsIgnoreCase("Green")||name.equalsIgnoreCase("Justinian"))
g.setColor(Color.GREEN);
if (name.equalsIgnoreCase("Blue")||name.equalsIgnoreCase("Camtendo"))
g.setColor(Color.BLUE);
if (name.equalsIgnoreCase("Gold"))
g.setColor(Color.ORANGE);
if (name.equalsIgnoreCase("Silver"))
g.setColor(Color.LIGHT_GRAY);
if (name.equalsIgnoreCase("Black"))
g.setColor(Color.BLACK);
if (name.equalsIgnoreCase("Pink"))
g.setColor(Color.PINK);
if (name.equalsIgnoreCase("Magenta"))
g.setColor(Color.MAGENTA);
if (name.equalsIgnoreCase("Cyan")||name.equalsIgnoreCase("Patches"))
g.setColor(Color.CYAN);
if (name.equalsIgnoreCase("Rainbow")||name.equalsIgnoreCase("Joe"))
g.setColor(new Color((int)(Math.random()*256),(int)(Math.random()*256),(int)(Math.random()*256)));
g.drawString(pauseMenu[i],(i*800)/5,50);
g.setColor(Color.WHITE);
}
}
switch(pauseMenuInt)
{
case 0:
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawImage(icon,30,85,16,16,this);
try
{
for(int i=0; i<23; i++)
{
if(Pokedex.seen[pokedexInt-1+i])
g.drawString(""+(pokedexInt+i)+": "+Pokedex.getSpecies(pokedexInt+i),50,20*i+100);
else
g.drawString(""+(pokedexInt+i)+": "+"????????",50,20*i+100);
}
}
catch(Exception ignored){}
if(Pokedex.caught[pokedexInt-1])
{
int width = Pokedex.pokedexImg[pokedexInt-1].getWidth(this)*3;
int height = Pokedex.pokedexImg[pokedexInt-1].getHeight(this)*3;
g.drawImage(Pokedex.pokedexImg[pokedexInt-1],425-(width/2),275-(height/2),width,height,this);
g.drawString(""+Pokedex.getSpecies(pokedexInt),600,100);
g.drawString("Height: "+Pokedex.height[pokedexInt-1],600,130);
g.drawString("Weight: "+Pokedex.weight[pokedexInt-1],600,150);
g.drawString("Location ",620,180);
String[] str=Pokedex.getAreas(pokedexInt-1);
for(int i=0; i<str.length; i++)
{
g.drawString(str[i],600,i*20+200);
}
g.setFont(new Font("Sanserif",Font.BOLD,10));
g.drawString(Pokedex.descriptions[pokedexInt-1],220,400);
}
else if(Pokedex.seen[pokedexInt-1])
{
int width = Pokedex.pokedexImg[pokedexInt-1].getWidth(this)*3;
int height = Pokedex.pokedexImg[pokedexInt-1].getHeight(this)*3;
g.drawImage(Pokedex.pokedexImg[pokedexInt-1],425-(width/2),275-(height/2),width,height,this);
g.drawString(""+Pokedex.getSpecies(pokedexInt),600,100);
g.drawString("Height: ???",600,130);
g.drawString("Weight: ???",600,150);
g.drawString("Location ",620,180);
String[] str=Pokedex.getAreas(pokedexInt-1);
for(int i=0; i<str.length; i++)
{
g.drawString(str[i],600,i*20+200);
}
}
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.drawString("Total Seen: "+Pokedex.totalSeen,600,480);
g.drawString("Total Caught: "+Pokedex.totalCaught,600,500);
break;
case 1:
int Yzer = 70;
for (int i = 0; i < 6 && partyPokemon[i] != null; i++)
{
g.drawImage(playerImages[i],100,Yzer+20-playerImages[i].getHeight(this)/2,this);
g.setColor(Color.WHITE);
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.drawString(partyPokemon[i].nickname+" ("+partyPokemon[i].getTypeString()+")",175,i*75+75);
g.drawString("Lvl. "+partyPokemon[i].level,175,i*75+95);
Yzer+=75;
}
g.drawImage(icon,35,pokemonMenuInt*75+70,32,32,this);
if(togglingPokemon)
g.drawImage(icon,45,toggleIndexToSwitch*75+75,16,16,this);
g.setColor(Color.WHITE);
g.drawString("Species: "+partyPokemon[pokemonMenuInt].species,500,100);
g.drawString("Nickname: "+partyPokemon[pokemonMenuInt].nickname,500,120);
g.drawString("Original Trainer: "+partyPokemon[pokemonMenuInt].originalTrainer,500,140);
g.drawString("Status: "+partyPokemon[pokemonMenuInt].status,500,160);
g.drawString("HP: "+partyPokemon[pokemonMenuInt].health+"/"+partyPokemon[pokemonMenuInt].healthMax,500,200);
g.drawString("ATK: "+partyPokemon[pokemonMenuInt].atk,500,220);
g.drawString("DEF: "+partyPokemon[pokemonMenuInt].def,500,240);
g.drawString("SPCL: "+partyPokemon[pokemonMenuInt].spcl,500,260);
g.drawString("SPEED: "+partyPokemon[pokemonMenuInt].speed,500,280);
String str=""+partyPokemon[pokemonMenuInt].move[0];
str=str.replace("_"," ");
g.drawString("Move 1: "+str+" "+partyPokemon[pokemonMenuInt].TRUE_PP[0]+"/"+
partyPokemon[pokemonMenuInt].TRUE_PPMAX[0],500,320);
if(partyPokemon[pokemonMenuInt].move[1]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[pokemonMenuInt].move[1];
str=str.replace("_"," ");
g.drawString("Move 2: "+str+" "+partyPokemon[pokemonMenuInt].TRUE_PP[1]+"/"+
partyPokemon[pokemonMenuInt].TRUE_PPMAX[1],500,340);
}
if(partyPokemon[pokemonMenuInt].move[2]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[pokemonMenuInt].move[2];
str=str.replace("_"," ");
g.drawString("Move 3: "+str+" "+partyPokemon[pokemonMenuInt].TRUE_PP[2]+"/"+
partyPokemon[pokemonMenuInt].TRUE_PPMAX[2],500,360);
}
if(partyPokemon[pokemonMenuInt].move[3]!=Pokemon.Move.NONE)
{
str=""+partyPokemon[pokemonMenuInt].move[3];
str=str.replace("_"," ");
g.drawString("Move 4: "+str+" "+partyPokemon[pokemonMenuInt].TRUE_PP[3]+"/"+
partyPokemon[pokemonMenuInt].TRUE_PPMAX[3],500,380);
}
g.drawString("Exp: "+partyPokemon[pokemonMenuInt].exp,500,420);
int lev=partyPokemon[pokemonMenuInt].level;
g.drawString("To Next: "+(lev*lev*lev-partyPokemon[pokemonMenuInt].exp),500,440);
break;
case 2:
g.setFont(new Font("Sanserif",Font.BOLD,36));
g.setColor(Color.WHITE);
g.drawImage(icon,220,220,32,32,this);
g.drawString("Activate Item Menu",275,250);
//Hotkeys
g.setFont(new Font("Sanserif",Font.BOLD,18));
g.setColor(Color.WHITE);
g.drawString("Hotkeys (Press on map to activate when able)",280,300);
g.drawString("'B'- Use Bicycle",300,320);
g.drawString("'F'- Use Fly",300,340);
g.drawString("Spacebar- Use Strength, Fish",300,360);
g.drawString("Arrow Keys- Use Surf (near water)",300,380);
g.drawString("'M'- Use Town Map",300,400);
break;
case 3:
g.setColor(Color.WHITE);
g.setFont(new Font("Sanserif",Font.BOLD,24));
g.drawString("Trainer ID: "+idString,100,150);
g.drawString("Money: "+Inventory.money,100,180);
g.drawString("Current Objective:",100,360);
g.drawString(currentObjective,100,400);
drawBadges(g);
break;
case 4:
g.setFont(new Font("Sanserif",Font.BOLD,24));
g.setColor(Color.WHITE);
g.drawString("Would you like to save your progress?",150,100);
g.drawImage(icon,220,150,32,32,this);
g.drawString("Yes!",275,180);
g.drawString(name,450,250);
g.drawString("Time: "+timeString,450,275);
g.drawString("Money: "+Inventory.money,450,300);
if(recentlySaved)
g.drawString("Saved!",275,350);
break;
}
}
//Draws Badges
public void drawBadges(Graphics g)
{
g.setColor(Color.WHITE);
g.setFont(new Font("Sanserif",Font.BOLD,36));
g.drawString("Badges",485,140);
//Box
//g.setColor(Color.BLUE);
//g.fillRect(400,150,320,200);
if(badges>0)
{
//Abstract Badge
g.drawImage(badgeImg[0],420,170,64,64,this);
}
if(badges>1)
{
//Native Badge
g.drawImage(badgeImg[1],490,170,64,64,this);
}
if(badges>2)
{
//Static Badge
g.drawImage(badgeImg[2],560,170,64,64,this);
}
if(badges>3)
{
//Super Badge
g.drawImage(badgeImg[3],630,170,64,64,this);
}
if(badges>4)
{
//Null Badge
g.drawImage(badgeImg[4],420,250,64,64,this);
}
if(badges>5)
{
//Transient Badge
g.drawImage(badgeImg[5],490,250,64,64,this);
}
if(badges>6)
{
//Interface Badge
g.drawImage(badgeImg[6],560,250,64,64,this);
}
if(badges>7)
{
//Final Badge
g.drawImage(badgeImg[7],630,250,64,64,this);
}
}
//Draws Character
public void drawCharacter(Graphics g)
{
if(!moving&&!surfing&&!bicycling)
g.drawImage(charStand[direction/90],64*6,64*4,64,64,this);
else if(bicycling&&!moving)
{
g.drawImage(charBike0[direction/90],64*6,64*4,64,64,this);
}
else if(bicycling&&moving)
{
if(movingFrame==0)
g.drawImage(charBike1[direction/90],64*6,64*4,64,64,this);
else
g.drawImage(charBike2[direction/90],64*6,64*4,64,64,this);
}
else if(!surfing&&moving)
{
if(movingFrame==0)
g.drawImage(charWalk1[direction/90],64*6,64*4,64,64,this);
else
g.drawImage(charWalk2[direction/90],64*6,64*4,64,64,this);
}
else if(surfing)
{
g.drawImage(charSurf[direction/90],64*6,64*4,64,64,this);
}
}
//Initiates Tiles
public void initTiles()
{
try
{
for(int i=0; i<tileImgOutdoors.length; i++)