Repository navigation
Expand file tree
/
Copy pathrsbatcore1.ini
More file actions
1091 lines (1091 loc) · 38.9 KB
/
Copy pathrsbatcore1.ini
File metadata and controls
1091 lines (1091 loc) · 38.9 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
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
[aliases]
n0=; Sends a public battle message and logs it
n1=; $1 = game, $2- = message
n2=/mes {
n3= msg $envar(batchan) $+ $hget($+(g,$1),color1) $+ , $+ $hget($+(g,$1),color2) $+ $2-
n4= var %count = 1
n5= while ( $hget($+(g,$1),$+(p,%count,name)) != $null ) {
n6= if ( $hget($+(g,$1),$+(p,%count,private)) == 1 ) {
n7= msg $hget($+(g,$1),$+(p,%count,name)) $2-
n8= }
n9= inc %count
n10= }
n11= write $hget($+(g,$1),logfile) $2-
n12=}
n13=
n14=
n15=; Gets the active player who is controlling a given Pokemon
n16=; $gactiveplayer(game,activeslot)
n17=/gactiveplayer {
n18= if ( $hget($+(g,$1),gametype) == 3 ) {
n19= return $2
n20= }
n21= return $calc( ( ( $2 + 1 ) % 2 ) + 1 )
n22=}
n23=
n24=
n25=; Gets the team who is controlling a given Pokemon
n26=; $gactiveteam(game,activeslot)
n27=/gactiveteam {
n28= return $calc( ( ( $2 + 1 ) % 2 ) + 1 )
n29=}
n30=
n31=
n32=; Returns the value of an active Pokemon variable
n33=; $gavar(game,activeslot,variable)
n34=/gavar {
n35= return $hget($+(g,$1),$+(a,$2,$3))
n36=}
n37=
n38=
n39=; Sets the value of an active Pokemon variable
n40=; savar game activeslot variable value
n41=/savar {
n42= hadd $+(g,$1) $+(a,$2,$3) $4-
n43=}
n44=
n45=
n46=; Returns the value of a team member variable
n47=; $gtvar(gamenum,playernum,slot,variable)
n48=/gtvar {
n49= return $hget($+(g,$1),$+(p,$2,t,$3,$4))
n50=}
n51=
n52=
n53=; Sets the value of a team member variable
n54=; /stvar gamenum playernum slot variable value
n55=/stvar {
n56= hadd $+(g,$1) $+(p,$2,t,$3,$4) $5-
n57=}
n58=
n59=
n60=; Returns the value of a team variable
n61=; $gteamvar(gamenum,teamnum,variable)
n62=/gteamvar {
n63= return $hget($+(g,$1),$+(t,$2,$3))
n64=}
n65=
n66=
n67=; Sets the value of a team variable
n68=; /stvar gamenum teamnum variable value
n69=/steamvar {
n70= hadd $+(g,$1) $+(t,$2,$3) $4-
n71=}
n72=
n73=; Gets a game variable
n74=; $ggvar(gamenum,variable)
n75=/ggvar {
n76= return $hget($+(g,$1),$2)
n77=}
n78=
n79=
n80=; Sets a game variable
n81=; sgvar gamenum variable value
n82=/sgvar {
n83= hadd $+(g,$1) $2 $3-
n84=}
n85=
n86=
n87=; Gets a player game variable
n88=; $ggvar(gamenum,playernum,variable)
n89=/gpvar {
n90= return $hget($+(g,$1),$+(p,$2,$3))
n91=}
n92=
n93=
n94=; Sets a player game variable
n95=; sgvar gamenum playernum variable value
n96=/spvar {
n97= hadd $+(g,$1) $+(p,$2,$3) $4-
n98=}
n99=
n100=
n101=; Counts the number of slots in a game
n102=; $countslot(gametype)
n103=/countslot {
n104= return $calc( 2 * ( $int( $calc( $1 / 2 ) ) + 1 ) )
n105=}
n106=
n107=
n108=; Returns $true if the slot has a Pokemon exiting in it
n109=; $aexists(gamenum,activenum)
n110=/aexists {
n111= if ( ( $gavar($1,$2,eliminated) == 0 ) && ( $gpvar($1,$gactiveplayer($1,$2),eliminated) == 0 ) ) {
n112= return $true
n113= }
n114= return $false
n115=}
n116=
n117=
n118=; Returns a random opponent
n119=; $randopp(gamenum,activenum)
n120=/randopp {
n121= if ( $ggvar($1,gametype) == 1 ) {
n122= return $gopponent($2,1)
n123= }
n124= if ( $aexists($1,$gopponent($2,1)) == $false ) {
n125= return $gopponent($2,2)
n126= }
n127= if ( $aexists($1,$gopponent($2,2)) == $false ) {
n128= return $gopponent($2,1)
n129= }
n130= var %rand = $rand(1,2)
n131= return $gopponent($2,%rand)
n132=}
n133=
n134=; Returns an opponent #
n135=; $gopponent(activenum,opponentnum)
n136=/gopponent {
n137= var %opp = $2 - 1
n138= return $calc( ( $1 % 2 ) + 1 + ( 2 * %opp ) )
n139=}
n140=
n141=
n142=; KOs the active Pokemon
n143=; /throwko gamenum activeslot activefrom (0 if not from attack)
n144=/throwko {
n145= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) fainted!
n146= if ( $3 != 0 ) {
n147= if ( $gavar($1,$2,destinybond) == 1 ) {
n148= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) took $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) with it!
n149= savar $1 $3 curhp 0
n150= }
n151= if ( ( $gavar($1,$2,grudge) == 1 ) && ( $gavar($1,$2,moveslot) != 0 ) ) {
n152= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gmovename($gavar($1,$3,$+(move,$gavar($1,$3,moveslot)))) lost all its PP due to the GRUDGE!
n153= savar $1 $3 $+(pp,$gavar($1,$3,moveslot)) 0
n154= }
n155= }
n156= savar $1 $2 curhp 0
n157= stvar $1 $gactiveplayer($1,$2) $gavar($1,$2,slot) curhp 0
n158= savar $1 $2 eliminated 1
n159= if ( $pokerem($1,$gactiveplayer($1,$2)) == 0 ) {
n160= spvar $1 $gactiveplayer($1,$2) eliminated 1
n161= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) is out of usable Pokemon!
n162= savar $1 $2 command -1
n163= if ( $gpvar($1,$gactivepartner($2),eliminated) != 0 ) {
n164= var %p = 1
n165= var %alldone = 1
n166= while ( %p <= $countslot($ggvar($1,gametype)) ) {
n167= if ( ( $gavar($1,%p,curhp) == 0 ) && ( $gavar($1,%p,eliminated) != 1 ) ) {
n168= var %alldone = 0
n169= }
n170= inc %p
n171= }
n172= if ( %alldone == 1 ) {
n173= endbattle $1
n174= halt
n175= }
n176= }
n177= }
n178= elseif ( ( $ggvar($1,gametype) == 2 ) && ( $pokerem($1,$gactiveplayer($1,$2)) == 1 ) ) {
n179= savar $1 $2 command -1
n180= }
n181= else {
n182= if ( ( $ggvar($1,gametype) == 1 ) && ( $ggvar($1,phase) isnum 1-2 ) ) {
n183= sgvar $1 pcount 1
n184= sgvar $1 phase 3
n185= }
n186= if ( ( $gavar($1,$2,moved) == 1 ) || ( $gavar($1,$2,switchslot) == 0 ) ) {
n187= savar $1 $2 command 1
n188= savar $1 $2 moveslot 0
n189= savar $1 $2 switchslot 0
n190= savar $1 $2 moved 0
n191= if ( ( $ggvar($1,gametype) != 2 ) || $aexists($1,$gactivepartner($2)) ) {
n192= showchoose $1 $2
n193= }
n194= }
n195= }
n196= if ( ( $gavar($1,$2,eliminated) == 1 ) && ( $gavar($1,$2,command) == 0 ) ) {
n197= withdrawpoke $1 $2 1
n198= }
n199=}
n200=
n201=
n202=; Checks for a KO, not damage from an attack
n203=; $kocheck(gamenum) (returns $true if there is a KO)
n204=/kocheck {
n205= var %return = $false
n206= var %count = 1
n207= while ( %count <= $countslot($ggvar($1,gametype)) ) {
n208= if ( ( $gavar($1,%count,curhp) <= 0 ) && ( $gavar($1,%count,eliminated) == 0 ) ) {
n209= throwko $1 %count 0
n210= %return = $true
n211= }
n212= elseif ( $gavar($1,%count,command) == 1 ) {
n213= %return = $true
n214= }
n215= inc %count
n216= }
n217= if ( ( ( $gpvar($1,1,eliminated) != 0 ) && ( $gpvar($1,3,eliminated) != 0 ) ) || ( ( $gpvar($1,2,eliminated) != 0 ) && ( $gpvar($1,4,eliminated) != 0 ) ) ) {
n218= endbattle $1
n219= halt
n220= }
n221= return %return
n222=}
n223=
n224=
n225=; Deals direct damage to an active Pokemon; returns $true if damage dealt successfully with no KO
n226=; $dirdam(gamenum,activenum,damage)
n227=/dirdam {
n228= var %p = $gactiveplayer($1,$2)
n229= ; Automatically does at least 1 damage
n230= if ( $3 == 0 ) {
n231= savar $1 $2 curhp $calc( $gavar($1,$2,maxhp) - 1 )
n232= }
n233= else {
n234= savar $1 $2 curhp $calc( $gavar($1,$2,curhp) - $3 )
n235= }
n236= if ( $gavar($1,$2,curhp) <= 0 ) {
n237= savar $1 $2 curhp 0
n238= return $false
n239= }
n240= mes $1 $gpvar($1,%p,nick) $+ 's $gpokename($gavar($1,$2,species)) $+ 's health fell to $int( $calc( $gavar($1,$2,curhp) * 100 / $gavar($1,$2,maxhp) ) ) $+ % $+ !
n241= return $true
n242=}
n243=
n244=
n245=; Deals damage as from an attack; returns $true if damage dealt successfully with no KO
n246=; $dealdam(gamenum,activefrom,activeto,damage,move,type) (type can be $null)
n247=/dealdam {
n248= var %returnval = $true
n249= var %subbefore = $gavar($1,$3,subhp)
n250= if ( ( $gavar($1,$3,status) == 32 ) && ( $6 == 10 ) ) {
n251= savar $1 $3 status 0
n252= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) was defrosted!
n253= }
n254= ; WATER ABSORB and VOLT ABSORB
n255= if ( ( ( $6 == 11 ) && ( $gavar($1,$3,trait) == 11 ) ) || ( ( $6 == 13 ) && ( $gavar($1,$3,trait) == 10 ) ) ) {
n256= if ( $recoverhp($1,$3) ) {
n257= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) restored HP using its $gtraitname($gavar($1,$3,trait)) $+ !
n258= recoverhp $1 $3 $int($calc( $gavar($1,$3,maxhp) / 4 ))
n259= }
n260= else {
n261= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) made $gmovename($5) useless!
n262= }
n263= return $false
n264= }
n265= ; FLASH FIRE
n266= if ( ( $6 == 10 ) && ( $gavar($1,$3,trait) == 18 ) ) {
n267= if ( $gavar($1,$3,flashfire) == 1 ) {
n268= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) made $gmovename($5) ineffective!
n269= }
n270= else {
n271= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) raised its FIRE power!
n272= savar $1 $3 flashfire 1
n273= }
n274= return $false
n275= }
n276= ; Calculates type modifier
n277= var %tef = 1
n278= var %t = 1
n279= while ( ( %t <= 2 ) && ( ( %t == 1 ) || ( $gavar($1,$3,type1) != $gavar($1,$3,type2) ) ) ) {
n280= if ( $ctypemod($6,$gavar($1,$3,$+(type,%t))) == 0 ) {
n281= inc %t
n282= continue
n283= }
n284= %tef = $calc( %tef * $ctypemod($6,$gavar($1,$3,$+(type,%t))) )
n285= inc %t
n286= }
n287= ; Sends messages
n288= if ( %tef > 1 ) {
n289= mes $1 It's super effective!
n290= }
n291= ; WONDER GUARD
n292= elseif ( $gavar($1,$3,trait) == 25 ) {
n293= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) avoided damage with $gtraitname($gavar($1,$3,trait)) $+ !
n294= return $false
n295= }
n296= elseif ( %tef < 1 ) {
n297= mes $1 It's not very effective...
n298= }
n299= ; Deals damage to a SUBSTITUTE
n300= if ( $gavar($1,$3,substitute) == 1 ) {
n301= mes $1 The SUBSTITUTE took damage for $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ !
n302= savar $1 $3 subhp $calc( $gavar($1,$3,subhp) - $4 )
n303= if ( $gavar($1,$3,subhp) < 0 ) {
n304= savar $1 $2 damdealt %subbefore
n305= }
n306= else {
n307= savar $1 $2 damdealt $calc( %subbefore - $gavar($1,$3,subhp) )
n308= }
n309= return $true
n310= }
n311= ; Deals direct damage if no SUBSTITUTE is up
n312= var %oldhp = $gavar($1,$3,curhp)
n313= var %damret = $dirdam($1,$3,$4)
n314= if ( %damret == $false ) {
n315= ; FALSE SWIPE save
n316= if ( $gmoveeffect($5) == 101 ) {
n317= savar $1 $3 curhp 1
n318= }
n319= ; ENDURE save
n320= elseif ( $gavar($1,$3,endure) == 1 ) {
n321= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) ENDURED the hit!
n322= savar $1 $3 curhp 1
n323= }
n324= ; FOCUS BAND save
n325= elseif ( ( $gavar($1,$3,item) == 196 ) && ( $rand(1,100) <= 10 ) ) {
n326= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) hung on using its $gitemname($gavar($1,$3,item)) $+ !
n327= savar $1 $3 curhp 1
n328= savar $1 $3 lostitem $gavar($1,%p,item)
n329= savar $1 $3 item 0
n330= }
n331= else {
n332= savar $1 $2 damdealt %oldhp
n333= savar $1 $3 curhp 0
n334= throwko $1 $3 $2
n335= var %returnval = $false
n336= }
n337= }
n338= ; SHELL BELL healing
n339= if ( ( $gavar($1,$2,item) == 219 ) && $recoverhp($1,$2) && $cmoveistouch($5) ) {
n340= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) $+ 's $gitemname($gavar($1,$2,item)) restored its HP a little!
n341= if ( $int($calc( $calc( %oldhp - $gavar($1,$3,curhp) ) / 8 )) >= 1 ) {
n342= recoverhp $1 $2 $int($calc( $calc( %oldhp - $gavar($1,$3,curhp) ) / 8 ))
n343= }
n344= else {
n345= recoverhp $1 $2 1
n346= }
n347= }
n348= if ( %returnval == $true ) {
n349= savar $1 $3 $+(damage,$2) $calc( %oldhp - $gavar($1,$3,curhp) )
n350= if ( $gmovetype($5) isnum 0-9 ) {
n351= savar $1 $3 physicalhit $2
n352= }
n353= if ( $gmovetype($5) isnum 10-17 ) {
n354= savar $1 $3 specialhit $2
n355= }
n356= savar $1 $3 lasthit2 $gavar($1,$3,lasthit1)
n357= savar $1 $3 lasthit1 $2
n358= savar $1 $2 damdealt $gavar($1,$3,$+(damage,$2))
n359= if ( $gavar($1,$3,bide) > 0 ) {
n360= savar $1 $3 totaldam $calc( $gavar($1,$3,totaldam) + $gavar($1,$3,$+(damage,$2)) )
n361= }
n362= if ( ( $gavar($1,$3,rage) == 1 ) && ( $gavar($1,$3,attackmod) < 12 ) ) {
n363= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) $+ 's RAGE is building!
n364= var %effsuc = $throweffect($1,$3,$3,2,statup,attack,1)
n365= }
n366= ; COLOR CHANGE
n367= if ( ( $gavar($1,$3,trait) == 16 ) && ( $6 != $null ) ) {
n368= savar $1 $3 type1 $6
n369= savar %1 $3 type2 $6
n370= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) made it the $gtypename($6) type!
n371= }
n372= ; Applies these for touch moves
n373= if ( $cmoveistouch($5) ) {
n374= ; ROUGH SKIN damage
n375= if ( $gavar($1,$3,trait) == 24 ) {
n376= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) hurt $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) $+ !
n377= var %koed = $dirdam($1,$2,$int($calc( $gavar($1,$2,maxhp) / 16 )))
n378= if ( %koed ) {
n379= %koed = $kocheck($1)
n380= }
n381= }
n382= ; EFFECT SPORE effect
n383= elseif ( $gavar($1,$3,trait) == 27 ) {
n384= var %randthrow = $rand(0,99)
n385= if ( %randthrow < 10 ) {
n386= var %effect = $throweffect2($1,$3,$2,4,status,$rand(2,5))
n387= }
n388= elseif ( %randthrow < 20 ) {
n389= var %effect = $throweffect2($1,$3,$2,4,status,8)
n390= }
n391= elseif ( %randthrow < 30 ) {
n392= var %effect = $throweffect2($1,$3,$2,4,status,64)
n393= }
n394= }
n395= ; POISON POINT effect
n396= elseif ( ( $gavar($1,$3,trait) == 38 ) && ( $rand(0,99) < 30 ) ) {
n397= var %effect = $throweffect2($1,$3,$2,4,status,8)
n398= }
n399= ; FLAME BODY effect
n400= elseif ( ( $gavar($1,$3,trait) == 49 ) && ( $rand(0,99) < 30 ) ) {
n401= var %effect = $throweffect2($1,$3,$2,4,status,16)
n402= }
n403= ; STATIC effect
n404= elseif ( ( $gavar($1,$3,trait) == 9 ) && ( $rand(0,99) < 30 ) ) {
n405= var %effect = $throweffect2($1,$3,$2,4,status,64)
n406= }
n407= ; CUTE CHARM effect
n408= elseif ( ( $gavar($1,$3,trait) == 56 ) && ( $rand(0,99) < 30 ) ) {
n409= var %effect = $throweffect2($1,$3,$2,4,attract)
n410= }
n411= }
n412= }
n413= return %returnval
n414=}
n415=
n416=
n417=; Checks the current weather effect that is considered and returns its base number
n418=; $cweather(gamenum)
n419=/cweather {
n420= var %count = 1
n421= while ( %count <= $countslot($ggvar($1,gametype)) ) {
n422= if ( ( $gavar($1,%count,trait) == 13 ) || ( $gavar($1,%count,trait) == 77 ) ) {
n423= return 0
n424= }
n425= inc %count
n426= }
n427= return $calc( $ggvar($1,weather) % 5 )
n428=}
n429=
n430=
n431=; Calculates the overall modifier of a type against a Pokemon
n432=; $ctypemodactive(type,game,activeslotfrom,activeslotto)
n433=/ctypemodactive {
n434= var %mod = 1
n435= var %t = 1
n436= while ( ( %t <= 2 ) && ( ( %t == 1 ) || ( $gavar($2,$4,type1) != $gavar($2,$4,type2) ) ) ) {
n437= if ( ( $gavar($2,$4,foresight) == $3 ) && ( ( $1 == 0 ) || ( $1 == 1 ) ) && ( $gavar($2,$4,$+(type,%t)) == 7 ) ) {
n438= inc %t
n439= continue
n440= }
n441= %mod = $calc( %mod * $ctypemod($1,$gavar($2,$4,$+(type,%t))) )
n442= inc %t
n443= }
n444= ; Victim trait modifiers
n445= ; LEVITATE negating GROUND
n446= if ( ( $1 == 4 ) && ( $gavar($2,$4,trait) == 26 ) ) {
n447= %mod = 0
n448= }
n449= ; THICK FAT multipliers {
n450= elseif ( ( ( $1 == 10 ) || ( $1 == 15 ) ) && ( $gavar($2,$4,trait) == 47 ) ) {
n451= %mod = $calc( %mod / 2 )
n452= }
n453= ; STAB
n454= if ( ( $gavar($2,$3,type1) == $1 ) || ( $gavar($2,$3,type2) == $1 ) ) {
n455= %mod = $calc( %mod * 1.5 )
n456= }
n457= ; User trait modifiers
n458= ; HUSTLE multiplier
n459= if ( $gavar($2,$3,trait) == 55 ) {
n460= %mod = $calc( %mod * 1.5 )
n461= }
n462= ; FLASH FIRE multiplier
n463= elseif ( ( $1 == 10 ) && ( $gavar($2,$3,flashfire) == 1 ) ) {
n464= %mod = $calc( %mod * 1.5 )
n465= }
n466= ; OVERGROW multiplier
n467= elseif ( ( $1 == 12 ) && ( $gavar($2,$3,trait) == 65 ) ) {
n468= %mod = $calc( %mod * 1.5 )
n469= }
n470= ; BLAZE multiplier
n471= elseif ( ( $1 == 10 ) && ( $gavar($2,$3,trait) == 66 ) ) {
n472= %mod = $calc( %mod * 1.5 )
n473= }
n474= ; TORRENT multiplier
n475= elseif ( ( $1 == 11 ) && ( $gavar($2,$3,trait) == 67 ) ) {
n476= %mod = $calc( %mod * 1.5 )
n477= }
n478= ; SWARM multiplier
n479= elseif ( ( $1 == 6 ) && ( $gavar($2,$3,trait) == 68 ) ) {
n480= %mod = $calc( %mod * 1.5 )
n481= }
n482= ; Weather modifiers
n483= if ( $cweather($2) == 1 ) {
n484= if ( $1 == 11 ) {
n485= %mod = $calc( %mod * 1.5 )
n486= }
n487= elseif ( $1 == 10 ) {
n488= %mod = $calc( %mod / 2 )
n489= }
n490= }
n491= if ( $cweather($2) == 3 ) {
n492= if ( $1 == 11 ) {
n493= %mod = $calc( %mod / 2 )
n494= }
n495= elseif ( $1 == 10 ) {
n496= %mod = $calc( %mod * 1.5 )
n497= }
n498= }
n499= ; Elemental
n500= ; SILVERPOWDER
n501= elseif ( ( $gavar($2,$3,item) == 188 ) && ( $1 == 6 ) ) {
n502= %mod = $calc( %mod * 1.1 )
n503= }
n504= ; METAL COAT
n505= elseif ( ( $gavar($2,$3,item) == 199 ) && ( $1 == 8 ) ) {
n506= %mod = $calc( %mod * 1.1 )
n507= }
n508= ; SOFT SAND
n509= elseif ( ( $gavar($2,$3,item) == 203 ) && ( $1 == 4 ) ) {
n510= %mod = $calc( %mod * 1.1 )
n511= }
n512= ; HARD STONE
n513= elseif ( ( $gavar($2,$3,item) == 204 ) && ( $1 == 5 ) ) {
n514= %mod = $calc( %mod * 1.1 )
n515= }
n516= ; MIRACLE SEED
n517= elseif ( ( $gavar($2,$3,item) == 205 ) && ( $1 == 12 ) ) {
n518= %mod = $calc( %mod * 1.1 )
n519= }
n520= ; BLACKGLASSES
n521= elseif ( ( $gavar($2,$3,item) == 206 ) && ( $1 == 17 ) ) {
n522= %mod = $calc( %mod * 1.1 )
n523= }
n524= ; BLACKBELT
n525= elseif ( ( $gavar($2,$3,item) == 207 ) && ( $1 == 1 ) ) {
n526= %mod = $calc( %mod * 1.1 )
n527= }
n528= ; MAGNET
n529= elseif ( ( $gavar($2,$3,item) == 208 ) && ( $1 == 13 ) ) {
n530= %mod = $calc( %mod * 1.1 )
n531= }
n532= ; MYSTIC WATER
n533= elseif ( ( $gavar($2,$3,item) == 209 ) && ( $1 == 11 ) ) {
n534= %mod = $calc( %mod * 1.1 )
n535= }
n536= ; SHARP BEAK
n537= elseif ( ( $gavar($2,$3,item) == 210 ) && ( $1 == 2 ) ) {
n538= %mod = $calc( %mod * 1.1 )
n539= }
n540= ; POISON BARB
n541= elseif ( ( $gavar($2,$3,item) == 211 ) && ( $1 == 3 ) ) {
n542= %mod = $calc( %mod * 1.1 )
n543= }
n544= ; NEVERMELTICE
n545= elseif ( ( $gavar($2,$3,item) == 212 ) && ( $1 == 15 ) ) {
n546= %mod = $calc( %mod * 1.1 )
n547= }
n548= ; SPELL TAG
n549= elseif ( ( $gavar($2,$3,item) == 213 ) && ( $1 == 7 ) ) {
n550= %mod = $calc( %mod * 1.1 )
n551= }
n552= ; TWISTEDSPOON
n553= elseif ( ( $gavar($2,$3,item) == 214 ) && ( $1 == 14 ) ) {
n554= %mod = $calc( %mod * 1.1 )
n555= }
n556= ; CHARCOAL
n557= elseif ( ( $gavar($2,$3,item) == 215 ) && ( $1 == 10 ) ) {
n558= %mod = $calc( %mod * 1.1 )
n559= }
n560= ; DRAGON FANG
n561= elseif ( ( $gavar($2,$3,item) == 216 ) && ( $1 == 16 ) ) {
n562= %mod = $calc( %mod * 1.1 )
n563= }
n564= ; SILK SCARF
n565= elseif ( ( $gavar($2,$3,item) == 217 ) && ( $1 == 0 ) ) {
n566= %mod = $calc( %mod * 1.1 )
n567= }
n568= ; SEA INCENSE
n569= elseif ( ( $gavar($2,$3,item) == 220 ) && ( $1 == 11 ) ) {
n570= %mod = $calc( %mod * 1.05 )
n571= }
n572=
n573= ; CHARGE
n574= if ( ( $gavar($2,$3,charge) > 0 ) && ( $1 == 13 ) ) {
n575= %mod = $calc( %mod * 2 )
n576= }
n577= ; HELPING HAND
n578= if ( $gavar($2,$3,helpinghand) == 1 ) {
n579= %mod = $calc( %mod * 1.5 )
n580= }
n581= ; MUD SPORT
n582= if ( $1 == 13 ) {
n583= var %c = 1
n584= while ( %c <= $countslot($ggvar($2,gametype)) ) {
n585= if ( $aexists($2,%c) && ( $gavar($2,%c,mudsport) == 1 ) ) {
n586= %mod = $calc( %mod / 2 )
n587= break
n588= }
n589= inc %c
n590= }
n591= }
n592= ; WATER SPORT
n593= if ( $1 == 11 ) {
n594= var %c = 1
n595= while ( %c <= $countslot($ggvar($2,gametype)) ) {
n596= if ( $aexists($2,%c) && ( $gavar($2,%c,watersport) == 1 ) ) {
n597= %mod = $calc( %mod / 2 )
n598= break
n599= }
n600= inc %c
n601= }
n602= }
n603=
n604= return %mod
n605=}
n606=
n607=
n608=; Checks the accuracy of a move
n609=; $checkacc(gamenum,useractive,targetactive,baseaccuracy)
n610=/checkacc {
n611= ; PROTECT/DETECT check
n612= if ( ( $gavar($1,$3,protect) == 1 ) && ( $cmovecanmiss($gavar($1,$2,curmove)) ) ) {
n613= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) protected itself!
n614= return $false
n615= }
n616= ; Checks for two-turn skip moves
n617= if ( ( ( $gavar($1,$3,automove) > 1 ) || ( ( $gavar($1,$3,automove) == 1 ) && ( $gavar($1,$3,moved) == 0 ) ) ) && ( $gmoveeffect($gavar($1,$3,lastmove)) == 155 ) && ( $cmovecanmiss($gavar($1,$2,curmove)) ) ) {
n618= var %exc = 0
n619= ; Checks exceptions on FLY/BOUNCE
n620= if ( ( $gavar($1,$3,lastmove) == 19 ) || ( $gavar($1,$3,lastmove) == 340 ) ) {
n621= if ( ( $gmoveeffect($gavar($1,$2,curmove)) == 146 ) || ( $gmoveeffect($gavar($1,$2,curmove)) == 149 ) || ( $gmoveeffect($gavar($1,$2,curmove)) == 207 ) || ( ( $gmoveeffect($gavar($1,$2,curmove)) == 152 ) && ( $cweather($1) == 1 ) ) ) {
n622= %exc = 1
n623= }
n624= }
n625= ; Checks for exceptions on DIVE
n626= elseif ( $gavar($1,$3,lastmove) == 291 ) {
n627= if ( $gavar($1,$2,curmove) == 57 ) {
n628= %exc = 1
n629= }
n630= }
n631= ; Checks for exceptions on DIG
n632= elseif ( $gavar($1,$3,lastmove) == 91 ) {
n633= if ( ( $gmoveeffect($gavar($1,$2,curmove)) == 126 ) || ( $gmoveeffect($gavar($1,$2,curmove)) == 147 ) || ( $gavar($1,$2,curmove) == 90 ) ) {
n634= %exc = 1
n635= }
n636= }
n637= }
n638= if ( %exc == 0 ) {
n639= if ( ( $gmovetarget($gavar($1,$2,curmove)) == 8 ) || ( $gmovetarget($gavar($1,$2,curmove)) == 32 ) ) {
n640= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) avoided the attack!
n641= }
n642= else {
n643= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) $+ 's attack missed!
n644= }
n645= return $false
n646= }
n647=
n648= ; Check SOUNDPROOF
n649= if ( ( $gavar($1,$3,trait) == 43 ) && ( $gmoveissound($gavar($1,$2,curmove)) ) ) {
n650= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) $+ 's $gtraitname($gavar($1,$3,trait)) blocks $gmovename($gavar($1,$2,curmove)) $+ !
n651= return $false
n652= }
n653=
n654= ; Confirm perfect accuracy moves
n655= if ( ( $gmoveaccuracy($gavar($1,$2,curmove)) == 0 ) || ( $gmoveeffect($gavar($1,$2,curmove)) == 187 ) || ( $gmoveeffect($gavar($1,$2,curmove)) == 191 ) ) {
n656= return $true
n657= }
n658= ; Confirm Thunder during Rain Dance
n659= if ( ( $gmoveeffect($gavar($1,$2,curmove)) == 152 ) && ( $cweather($1) == 1 ) ) {
n660= return $true
n661= }
n662= ; Confirm perfect accuracy effect
n663= if ( ( $gavar($1,$3,perfacc) != 0 ) && ( $gavar($1,$3,perfaccfrom) == $2 ) ) {
n664= return $true
n665= }
n666=
n667= var %acc = $4
n668=
n669= ; Evade and accuracy modifiers
n670= %acc = $int($calc( %acc * $cevamod($gavar($1,$3,evasivenessmod)) ))
n671= %acc = $int($calc( %acc * $caccmod($gavar($1,$2,accuracymod)) ))
n672=
n673= ; COMPOUNDEYES
n674= if ( $gavar($1,$2,trait) == 14 ) {
n675= %acc = $int($calc( %acc * 1.2 ))
n676= }
n677=
n678= ; SAND VEIL
n679= if ( ( $cweather($1) == 2 ) && ( $gavar($1,$3,trait) == 8 ) ) {
n680= %acc = $int($calc( %acc * .92 ))
n681= }
n682=
n683= ; HUSTLE
n684= if ( $gavar($1,$2,trait) == 55 ) {
n685= %acc = $int($calc( %acc * .8 ))
n686= }
n687=
n688= ; BRIGHTPOWDER
n689= if ( $gavar($1,$3,item) == 179 ) {
n690= %acc = $int($calc( %acc * .91 ))
n691= }
n692= ; LAX INCENSE
n693= elseif ( $gavar($1,$3,item) == 221 ) {
n694= %acc = $int($calc( %acc * .95 ))
n695= }
n696=
n697= ; Checks for FORESIGHT
n698= if ( ( $gavar($1,$3,foresight) == $2 ) && ( %acc < $4 ) ) {
n699= %acc = $4
n700= }
n701=
n702= var %roll = $rand(1,100)
n703= if ( %roll <= %acc ) {
n704= return $true
n705= }
n706= else {
n707= if ( ( $gmovetarget($gavar($1,$2,curmove)) == 8 ) || ( $gmovetarget($gavar($1,$2,curmove)) == 32 ) ) {
n708= mes $1 $gpvar($1,$gactiveplayer($1,$3),nick) $+ 's $gpokename($gavar($1,$3,species)) avoided the attack!
n709= }
n710= else {
n711= mes $1 $gpvar($1,$gactiveplayer($1,$2),nick) $+ 's $gpokename($gavar($1,$2,species)) $+ 's attack missed!
n712= }
n713= return $false
n714= }
n715=}
n716=
n717=
n718=; Checks for a critical hit (returns $true if so, $false if not
n719=; $checkch(gamenum,useractive,victimactive,highCH)
n720=/checkch {
n721= ; BATTLE ARMOR and SHELL ARMOR
n722= if ( ( $gavar($1,$3,trait) == 4 ) || ( $gavar($1,$3,trait) == 75 ) ) {
n723= return $false
n724= }
n725= var %randroll = 1
n726= var %add = 0
n727= if ( $4 == $true ) {
n728= %add = $calc( %add + 2 )
n729= }
n730= if ( $gavar($1,$2,focusenergy) == 1 ) {
n731= %add = $calc( %add + 1 )
n732= }
n733= ; SCOPE LENS
n734= if ( $gavar($1,$2,item) == 198 ) {
n735= %add = $calc( %add + 1 )
n736= }
n737= ; STICK
n738= if ( ( $gavar($1,$2,item) == 225 ) && ( $gavar($1,$2,species) == 83 ) ) {
n739= %add = $calc( %add + 2 )
n740= }
n741= ; LUCKY PUNCH
n742= if ( ( $gavar($1,$2,item) == 222 ) && ( $gavar($1,$2,species) == 113 ) ) {
n743= %add = $calc( %add + 2 )
n744= }
n745= if ( %add > 0 ) {
n746= %randroll = $calc( %add * 2 )
n747= }
n748= if ( %randroll > 8 ) {
n749= %randroll = 8
n750= }
n751= if ( $rand(1,16) <= %randroll ) {
n752= mes $1 A critical hit!
n753= return $true
n754= }
n755= else {
n756= return $false
n757= }
n758=}
n759=
n760=
n761=; Calculates the damage an attack will deal
n762=; $calcbdf(gamenum,useractive,victimactive,damage,type,CH)
n763=; $1 = gamenum, $2 = useractive, $3 = victimactive, $4 = base damage, $5 = type, $6 = CH ($true or $false)
n764=/calcbdf {
n765= ; Begins with level modifier
n766= if ( $6 == $true ) {
n767= var %dam = $int($calc( ( $gavar($1,$2,level) * 4 / 5 ) + 2 ))
n768= }
n769= else {
n770= var %dam = $int($calc( ( $gavar($1,$2,level) * 2 / 5 ) + 2 ))
n771= }
n772= ; For physical attacks
n773= if ( ( $5 < 9 ) || ( $5 == $null ) ) {
n774= var %attack = $gavar($1,$2,attack)
n775= ; Apply ATTACK modifier
n776= if ( ( $6 == $false ) || ( $gavar($1,$2,attackmod) > 6 ) ) {
n777= %attack = $int($calc( %attack * $cstatmod($gavar($1,$2,attackmod)) ))
n778= }
n779= var %defense = $gavar($1,$3,defense)
n780= ; Apply DEFENSE modifier
n781= if ( ( $6 == $false ) || ( $gavar($1,$3,defensemod) < 6 ) ) {
n782= %defense = $int($calc( %defense * $cstatmod($gavar($1,$3,defensemod)) ))
n783= }
n784= if ( $6 == $false ) {
n785= ; Apply HUGE POWER or PURE POWER
n786= if ( ( $gavar($1,$2,trait) == 37 ) || ( $gavar($1,$2,trait) == 74 ) ) {
n787= %attack = $int($calc( %attack * 2 ))
n788= }
n789= ; Apply GUTS
n790= if ( ( $gavar($1,$2,status) != 0 ) && ( $gavar($1,$2,trait) == 62 ) ) {
n791= %attack = $int($calc( %attack * 1.5 ))
n792= }
n793= ; Apply REFLECT modifier
n794= if ( $gteamvar($1,$gactiveteam($1,$3),reflect) > 0 ) {
n795= if ( $aexists($1,$gactivepartner($3)) == $false ) {
n796= %attack = $int($calc( %attack / 2 ))
n797= }
n798= else {
n799= %attack = $int($calc( %attack * 2 / 3 ))
n800= }
n801= }
n802= ; Apply MARVEL SCALE
n803= if ( ( $gavar($1,$3,status) != 0 ) && ( $gavar($1,$3,trait) == 63 ) ) {
n804= %defense = $int($calc( %defense * 1.5 ))
n805= }
n806= ; Apply BURN modifier
n807= if ( ( $gavar($1,$2,status) == 16 ) && ( $gavar($1,$2,trait) != 62 ) ) {
n808= %defense = $int($calc( %defense * 2 ))
n809= }
n810= }
n811= ; Item modifiers
n812= ; CHOICE BAND
n813= if ( $gavar($1,$2,item) == 186 ) {
n814= %attack = $int($calc( %attack * 1.5 ))
n815= }
n816= ; Apply THICK CLUB for CUBONE or MAROWAK
n817= if ( ( $gavar($1,$2,item) == 224 ) && ( ( $gavar($1,$2,species) == 104 ) || ( $gavar($1,$2,species) == 105 ) ) ) {
n818= %attack = $int($calc( %attack * 2 ))
n819= }
n820= ; Apply METAL POWDER on DITTO
n821= if ( ( $gavar($1,$3,item) == 223 ) && ( $gavar($1,$3,species) == 132 ) ) {
n822= %defense = $int($calc( %defense * 1.5 ))
n823= }
n824= }
n825= ; For special attacks
n826= else {
n827= var %attack = $gavar($1,$2,spatk)
n828= ; Apply SPATK modifier
n829= if ( ( $6 == $false ) || ( $gavar($1,$2,spatkmod) > 6 ) ) {
n830= %attack = $int($calc( %attack * $cstatmod($gavar($1,$2,spatkmod)) ))
n831= }
n832= var %defense = $gavar($1,$3,spdef)
n833= ; Apply SPDEF modifier
n834= if ( ( $6 == $false ) || ( $gavar($1,$3,spdefmod) < 6 ) ) {
n835= %defense = $int($calc( %defense * $cstatmod($gavar($1,$3,spdefmod)) ))
n836= }
n837= if ( $6 == $false ) {
n838= ; Apply PLUS/MINUS modifier
n839= if ( $aexists($gactivepartner($2)) ) {
n840= if ( ( ( $gavar($1,$2,trait) == 57 ) && ( $gavar($1,$gactivepartner($2),trait) == 58 ) ) || ( ( $gavar($1,$2,trait) == 58 ) && ( $gavar($1,$gactivepartner($2),trait) == 57 ) ) ) {
n841= %attack = $int($calc( %attack * 1.5 ))
n842= }
n843= }
n844= ; Apply LIGHT SCREEN modifier
n845= if ( $gteamvar($1,$gactiveteam($1,$3),lightscreen) > 0 ) {
n846= if ( $aexists($1,$gactivepartner($3)) == $false ) {
n847= %attack = $int($calc( %attack / 2 ))
n848= }
n849= else {
n850= %attack = $int($calc( %attack * 2 / 3 ))
n851= }
n852= }
n853= }
n854= ; Apply LIGHT BALL on PIKACHU
n855= if ( ( $gavar($1,$2,item) == 202 ) && ( $gavar($1,$2,species) == 25 ) ) {
n856= %attack = $int($calc( %attack * 2 ))
n857= }
n858= ; Apply SOUL DEW for LATIOS/LATIAS
n859= if ( ( $gavar($1,$2,item) == 191 ) && ( ( $gavar($1,$2,species) == 382 ) || ( $gavar($1,$2,species) == 383 ) ) ) {
n860= %attack = $int($calc( %attack * 1.5 ))
n861= }
n862= ; Apply DEEPSEATOOTH on CLAMPERL
n863= if ( ( $gavar($1,$2,item) == 192 ) && ( $gavar($1,$2,species) == 348 ) ) {
n864= %attack = $int($calc( %attack * 2 ))
n865= }
n866= ; Apply DEEPSEASCALE on CLAMPERL
n867= if ( ( $gavar($1,$3,item) == 192 ) && ( $gavar($1,$3,species) == 348 ) ) {
n868= %defense = $int($calc( %defense * 2 ))
n869= }
n870= ; Apply METAL POWDER on DITTO
n871= if ( ( $gavar($1,$3,item) == 223 ) && ( $gavar($1,$3,species) == 132 ) ) {
n872= %defense = $int($calc( %defense * 1.5 ))
n873= }
n874= ; Apply SOUL DEW for LATIOS/LATIAS
n875= if ( ( $gavar($1,$3,item) == 191 ) && ( ( $gavar($1,$3,species) == 382 ) || ( $gavar($1,$3,species) == 383 ) ) ) {
n876= %defense = $int($calc( %defense * 1.5 ))
n877= }
n878= }
n879=
n880= var %basedam = $4
n881= if ( ( ( $gavar($1,$3,automove) > 1 ) || ( ( $gavar($1,$3,automove) == 1 ) && ( $gavar($1,$3,moved) == 0 ) ) ) && ( $gmoveeffect($gavar($1,$3,lastmove)) == 155 ) && ( $gmoveeffect($gavar($1,$2,curmove)) != 152 ) ) {
n882= %basedam = $calc( %basedam * 2 )
n883= }
n884= %dam = $int($calc( %dam * %attack * %basedam / %defense ))
n885= %dam = $int($calc( %dam / 50 ))
n886= %dam = $calc( %dam + 2 )
n887= if ( $5 != $null ) {
n888= %dam = $int($calc( %dam * $ctypemodactive($5,$1,$2,$3) ))
n889= }
n890= %dam = $int($calc( %dam * $rand(85,100) / 100 ))
n891=
n892= return %dam
n893=}
n894=
n895=
n896=; Withdraws a Pokemon
n897=; /withdrawpoke [gamenum] [activeslot]
n898=; Change $3 to anything to make it a force-out
n899=/withdrawpoke {
n900= var %p = $gactiveplayer($1,$2)
n901= if ( $3 == $null ) {
n902= mes $1 $gpvar($1,%p,nick) withdrew $gpokename($gavar($1,$2,species)) $+ !
n903= }
n904=
n905= ; PURSUIT
n906= if ( $gavar($1,$2,eliminated) == 0 ) {
n907= var %c = 1
n908= while ( %c <= $countslot($ggvar($1,gametype)) ) {
n909= if ( ( $gavar($1,%c,curmove) == 228 ) && ( $gavar($1,%c,moved) == 0 ) && ( $gavar($1,%c,target) == $2 ) ) {
n910= moveturn $1 %c P
n911= }
n912= if ( $gavar($1,$2,curhp) == 0 ) {
n913= break
n914= }
n915= inc %c
n916= }
n917= }
n918=
n919= stvar $1 %p $gavar($1,$2,slot) curhp $gavar($1,$2,curhp)
n920= ; NATURAL CURE
n921= if ( $gavar($1,$2,trait) == 30 ) {
n922= stvar $1 %p $gavar($1,$2,slot) status 0
n923= }
n924= else {
n925= stvar $1 %p $gavar($1,$2,slot) status $gavar($1,$2,status)
n926= }
n927= stvar $1 %p $gavar($1,$2,slot) item $gavar($1,$2,item)
n928= if ( $gavar($1,$2,transform) == 0 ) {
n929= stvar $1 %p $gavar($1,$2,slot) pp1 $gavar($1,$2,pp1)
n930= stvar $1 %p $gavar($1,$2,slot) pp2 $gavar($1,$2,pp2)
n931= stvar $1 %p $gavar($1,$2,slot) pp3 $gavar($1,$2,pp3)
n932= stvar $1 %p $gavar($1,$2,slot) pp4 $gavar($1,$2,pp4)
n933= }
n934=
n935= ; BATON PASS holds
n936= if ( $3 != B ) {
n937= savar $1 $2 slot 0
n938= savar $1 $2 perfacc 0
n939= savar $1 $2 perfaccfrom 0
n940= var %c = 1
n941= while ( %c <= $countslot($ggvar($1,gametype)) ) {
n942= if ( $gavar($1,%c,perfaccfrom) == $2 ) {
n943= savar $1 %c perfacc 0
n944= savar $1 %c perfaccfrom 0
n945= }
n946= inc %c
n947= }
n948= savar $1 $2 leechseed 0
n949= savar $1 $2 ingrain 0
n950= savar $1 $2 mudsport 0
n951= savar $1 $2 watersport 0
n952= savar $1 $2 subhp 0
n953= savar $1 $2 perishsong 0
n954= savar $1 $2 attackmod 6
n955= savar $1 $2 defensemod 6
n956= savar $1 $2 speedmod 6
n957= savar $1 $2 spatkmod 6
n958= savar $1 $2 spdefmod 6
n959= savar $1 $2 accuracymod 6
n960= savar $1 $2 evasivenessmod 6
n961= savar $1 $2 confusion 0
n962= savar $1 $2 focusenergy 0
n963= savar $1 $2 curse 0
n964= savar $1 $2 permhold 0
n965= var %c = 1
n966= while ( %c <= $countslot($ggvar($1,gametype)) ) {
n967= if ( $gavar($1,%c,permhold) == $2 ) {
n968= savar $1 %c permhold 0
n969= }
n970= inc %c
n971= }
n972= savar $1 $2 substitute 0
n973= }
n974= savar $1 $2 holdmove 0
n975= savar $1 $2 holdfrom 0
n976= savar $1 $2 holdcount 0
n977= var %c = 1
n978= while ( %c <= $countslot($ggvar($1,gametype)) ) {
n979= if ( $gavar($1,%c,holdfrom) == $2 ) {
n980= savar $1 %c holdmove 0
n981= savar $1 %c holdfrom 0
n982= savar $1 %c holdcount 0
n983=
n984= }
n985= inc %c
n986= }
n987= savar $1 $2 flashfire 0
n988= savar $1 $2 chosenmove 0
n989= savar $1 $2 chosenslot 0
n990= savar $1 $2 curmove 0
n991= savar $1 $2 lastmove 0
n992= savar $1 $2 mirrormove 0
n993= savar $1 $2 damage1 0
n994= savar $1 $2 damage2 0
n995= savar $1 $2 damage3 0
n996= savar $1 $2 damage4 0
n997= savar $1 $2 physicalhit 0
n998= savar $1 $2 specialhit 0