-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfraymotifs.php
More file actions
1307 lines (1307 loc) · 50.6 KB
/
fraymotifs.php
File metadata and controls
1307 lines (1307 loc) · 50.6 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
<?php
require_once("header.php");
require_once("includes/fieldparser.php");
if (empty($_SESSION['username'])) {
echo "Log in to purchase and use fraymotifs.</br>";
} else {
$userrow = parseEnemydata($userrow);
//This will register which abilities the player has in $abilities. The standard check is if (!empty($abilities[ID of ability to be checked for>]))
//We check abilities in this file because some interact with fraymotifs.
$abilityresult = mysql_query("SELECT `ID`, `Usagestr` FROM `Abilities` WHERE `Abilities`.`Aspect` IN ('$userrow[Aspect]','All') AND `Abilities`.`Class` IN ('$userrow[Class]','All')
AND `Abilities`.`Rungreq` BETWEEN 0 AND $userrow[Echeladder] AND `Abilities`.`Godtierreq` BETWEEN 0 AND $userrow[Godtier] ORDER BY `Abilities`.`Rungreq` DESC;");
$abilities = array(0 => "Null ability. No, not void.");
while ($temp = mysql_fetch_array($abilityresult)) {
$abilities[$temp['ID']] = $temp['Usagestr']; //Create entry in abilities array for the ability the player has. We save the usage message in, so pulling the usage message is as simple
//as pulling the correct element out of the abilities array via the ID. Note that an ability with an empty usage message will be unusable since the empty function will spit empty at you.
}
//Some fraymotifs use the player's current base attacking power (Echeladder + power boosts + weapons). This is calculated here and stored in $powerlevel
if ($userrow['equipped'] != "") {
$itemname = str_replace("'", "\\\\''", $userrow[$userrow['equipped']]); //Add escape characters so we can find item correctly in database. Also those backslashes are retarded.
$itemresult = mysql_query("SELECT * FROM Captchalogue WHERE `Captchalogue`.`name` = '" . $itemname . "'");
while ($row = mysql_fetch_array($itemresult)) {
$itemname = $row['name'];
$itemname = str_replace("\\", "", $itemname); //Remove escape characters.
if ($itemname == $userrow[$userrow['equipped']]) {
$mainpower = $row['power'];
$mainrow = $row; //We save this to check weapon-specific bonuses to various commands.
}
}
} else {
$mainpower = 0;
}
if ($userrow['offhand'] != "" && $userrow['offhand'] != $equippedmain && $userrow['offhand'] != "2HAND") {
$itemname = str_replace("'", "\\\\''", $userrow[$userrow['offhand']]); //Add escape characters so we can find item correctly in database. Also those backslashes are retarded.
$itemresult = mysql_query("SELECT * FROM Captchalogue WHERE `Captchalogue`.`name` = '" . $itemname . "'");
while ($row = mysql_fetch_array($itemresult)) {
$itemname = $row['name'];
$itemname = str_replace("\\", "", $itemname); //Remove escape characters.
if ($itemname == $userrow[$userrow['offhand']]) {
$offpower = ($row['power'] / 2);
$offrow = $row;
}
}
} else {
$offpower = 0;
}
$max_enemies = 5; //I'M SO GOOD AT CODING. -_-
//Begin fraymotif purchasing code here.
if (!empty($_POST['buymotif'])) {
$purchase = $_POST['buymotif'];
switch ($purchase) {
case "solo1":
$requirement = 10000000;
break;
case "solo2":
$requirement = 100000000;
break;
case "solo3":
$requirement = 1000000000;
break;
default:
$requirement = 10000000000;
break;
}
if ($userrow['Boondollars'] < $requirement) { //Player cannot afford motif.
echo "You can't afford to purchase that!</br>";
} else {
echo "You successfully purchase the fraymotif!</br>";
mysql_query("UPDATE `Players` SET `" . $purchase . "` = 1 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
mysql_query("UPDATE `Players` SET `Boondollars` = $userrow[Boondollars]-$requirement WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$newmotif = $purchase;
}
}
//End fraymotif purchasing code here. Begin fraymotif usage code here.
//NOTE - The below stack of switch statements is effectively where fraymotif effect is stored for lookup.
if (!empty($_POST['usemotif'])) {
$usagestr = "";
$fail = False;
if ($userrow['fraymotifuses'] == 0) { //User is out of fraymotifs
echo "You have no more fraymotif uses left!</br>";
$fail = True;
} elseif ($userrow[$_POST['usemotif']] == 0) { //HAAAAAX!
echo "Niice try, iidiiot.</br>";
$fail = True;
} elseif ($userrow['combatmotifuses'] == 0) {
echo "Okay, I'm sure you thought getting into a fight and waiting a day for all your fraymotifs to come back DURING that fight was clever. And it kind of was. Unfortunately, it's also a stupid tactic to need to balance around so you're not allowed to do it.</br>";
$fail = True;
} else {
//Check for enemy flags and stuff here. The first two arrays are used to store the new values for health/power resulting from a fraymotif.
$monsterpowers = array(1 => $userrow['enemy1power'], $userrow['enemy2power'], $userrow['enemy3power'], $userrow['enemy4power'], $userrow['enemy5power']);
$monsterhealth = array(1 => $userrow['enemy1health'], $userrow['enemy2health'], $userrow['enemy3health'], $userrow['enemy4health'], $userrow['enemy5health']);
$oldpowers = array(1 => $userrow['enemy1power'], $userrow['enemy2power'], $userrow['enemy3power'], $userrow['enemy4power'], $userrow['enemy5power']);
$oldhealth = array(1 => $userrow['enemy1health'], $userrow['enemy2health'], $userrow['enemy3health'], $userrow['enemy4health'], $userrow['enemy5health']);
$reductionresist = array(1 => 0, 0, 0, 0, 0);
$massiveresist = array(1 => 100, 100, 100, 100, 100);
$i = 1;
while ($i <= $max_enemies) {
$enemystr = "enemy" . strval($i) . "name";
$enemyresult = mysql_query("SELECT * FROM Enemy_Types WHERE `Enemy_Types`.`basename` = '" . $userrow[$enemystr] . "'");
if ($enemyrow = mysql_fetch_array($enemyresult)) { //Didn't have grist appended to it.
if ($enemyrow['reductionresist'] != 0) { //Enemy resists having their power reduced.
$reductionresist[$i] = $enemyrow['reductionresist'];
}
if ($enemyrow['massiveresist'] != 100) { //Enemy resists massive damage.
$massiveresist[$i] = $enemyrow['massiveresist'];
}
}
$i++;
}
$powerlevel = ($userrow['Echeladder'] * pow(2,$userrow['Godtier'])) + $userrow['powerboost'] + $userrow['temppowerboost'] + $mainpower + $offpower;
$offensepower = $powerlevel + $userrow['offenseboost'] + $userrow['tempoffenseboost'];
$defensepower = $powerlevel + $userrow['defenseboost'] + $userrow['tempdefenseboost'];
$luck = ceil($userrow['Luck'] + $userrow['Brief_Luck']); //Calculate the player's luck total. Paranoia: Make sure we don't somehow have a non-integer.
if (!empty($abilities[19])) { //Light's Favour activates. Increase luck.
$luck += floor($userrow['Echeladder'] / 30);
echo "$abilities[19]</br>";
}
if ($luck > 100) $luck = 100; //We work with luck as a percentage generally. This may be changed later.
$motif = $_POST['usemotif'];
if ($motif == "Blood(motif)") $motif = "Blood"; //Turn blood back so we can check for it properly.
$motifresult = mysql_query("SELECT * FROM Fraymotifs WHERE `Fraymotifs`.`Aspect` = '" . $userrow['Aspect'] . "'");
while ($row = mysql_fetch_array($motifresult)) {
if ($row['Aspect'] == $userrow['Aspect']) $motifrow = $row;
}
$motifresult = mysql_query("SELECT * FROM Fraymotifs");
while ($col = mysql_fetch_field($motifresult)) {
$motifaspect = $col->name;
if ($motifaspect == $motif) {
if (empty($motifrow[$motifaspect])) {
$motifname = "Unnamed Fraymotif";
} else {
$motifname = $motifrow[$motifaspect];
}
}
}
switch ($motif) {
case "solo1":
switch ($userrow['Aspect']) { //We're using a solo motif. Grab the player's aspect and go!
case "Breath": //Feathercadence
$usagestr = "Your enemies are buffeted by powerful winds, making it harder for them to fight.";
$i = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$newpower = floor($userrow[$powerstr] / 2);
$monsterpowers[$i] = $newpower;
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = " . strval($newpower) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$powerstr] = $newpower;
$i++;
}
break;
case "Heart":
$usagestr = "Your spirit is bolstered, empowering your strikes and parries.";
$boost = 1500;
mysql_query("UPDATE `Players` SET `powerboost` = $userrow[powerboost]+$boost WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Life": //Gaea's Anthem
$usagestr = "You are infused with the rhythm of Life, completely healing your wounds.";
mysql_query("UPDATE `Players` SET `" . $healthvialstr . "` = " . $userrow['Gel_Viscosity'] . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Hope":
$usagestr = "The health and power you have give you hope that you may yet prevail.";
$boost = floor(($userrow['Health_Vial'] + (($userrow['offenseboost'] + $userrow['defenseboost']) / 2) + ($userrow['Echeladder'] * pow(2,$userrow['Godtier'])) + $userrow['powerboost']) / 12);
$boost = $boost + floor(((($userrow['tempoffenseboost'] + $userrow['tempdefenseboost']) / 2) + $userrow['temppowerboost']) / 12);
mysql_query("UPDATE `Players` SET `powerboost` = $userrow[powerboost]+$boost WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Light":
$usagestr = "Fortune favours you utterly as you dance with the Light.";
$lucky = 100;
mysql_query("UPDATE `Players` SET `Brief_Luck` = $userrow[Brief_Luck]+$lucky WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Mind":
$usagestr = "You lash out at the minds of your enemies, injuring them and impairing their judgment.";
$i = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$healthstr = "enemy" . strval($i) . "health";
$newpower = $userrow[$powerstr] - 1200;
$newhealth = $userrow[$healthstr] - 12000;
if ($newpower < 0) $newpower = 0;
if ($newhealth < 1) $newhealth = 1;
$monsterpowers[$i] = $newpower;
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = " . $newpower . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$powerstr] = $newpower;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$i++;
}
break;
case "Blood":
$usagestr = "You strike your enemies hard, their wounds inspiring your bloodlust.";
$i = 1;
$boost = 0;
while ($i <= $max_enemies) {
$healthstr = "enemy" . strval($i) . "health";
$newhealth = $userrow[$healthstr] - 9001;
if ($newhealth < 1) $newhealth = 1;
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$boost = $boost + floor(($userrow[$healthstr] - $newhealth) / 30);
$i++;
}
mysql_query("UPDATE `Players` SET `powerboost` = " . strval($userrow['powerboost'] + $boost) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Doom":
$usagestr = "You strike your opponents with dark tendrils, bringing them closer to death.";
$i = 1;
while ($i <= $max_enemies) {
$healthstr = "enemy" . strval($i) . "health";
$newhealth = floor(($userrow[$healthstr] / 5) * 2);
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$i++;
}
break;
case "Rage": //Allaggressimo
$usagestr = "A quick, lively rhythm enrages you as you notice the wounds you have taken, inspiring you to hit things harder.";
$offenseboost = floor(($userrow['Gel_Viscosity'] - $userrow['Health_Vial']) / 2);
mysql_query("UPDATE `Players` SET `offenseboost` = $userrow[offenseboost]+$offenseboost WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Void": //Missing Notes
$usagestr = "A bunch of things that look like glitchy blocks of pixels appear around your enemies, which messes them up pretty bad.";
$i = 1;
while ($i <= $max_enemies) {
$healthstr = "enemy" . strval($i) . "health";
$powerstr = "enemy" . strval($i) . "power";
$newhealth = rand(1,$userrow[$healthstr]);
$newpower = rand(1,$userrow[$powerstr]);
$monsterpowers[$i] = $newpower;
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = " . $newpower . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$powerstr] = $newpower;
$i++;
}
break;
case "Space":
$usagestr = "You bend space around a single enemy, grievously injuring them.";
$highestpower = -1;
$target = "";
$i = 1;
while ($i <= $max_enemies) {
$enemystr = "enemy" . strval($i) . "name";
$powerstr = "enemy" . strval($i) . "power";
$healthstr = "enemy" . strval($i) . "health";
if ($userrow[$powerstr] > $highestpower && !empty($userrow[$enemystr])) {
$highestpower = $userrow[$powerstr];
$target = $healthstr;
$j = $i;
}
$i++;
}
$newhealth = $userrow[$target] - 61200;
if ($newhealth < 1) $newhealth = 1;
$monsterhealth[$j] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $target . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
break;
case "Time":
$usagestr = "You strike your foes, then turn back time to strike them again!"; //Tehcnically deals flat damage rather than simulating an attack, but still.
$i = 1;
while ($i <= $max_enemies) {
$healthstr = "enemy" . strval($i) . "health";
$damage = $powerlevel;
if (($userrow[$healthstr] - $damage) < 1) $damage = $userrow[$healthstr] - 1;
$monsterhealth[$i] = $userrow[$healthstr] - $damage;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . ($userrow[$healthstr] - $damage) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = ($userrow[$healthstr] - $damage);
$i++;
}
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "solo2":
switch ($userrow['Aspect']) { //We're using a solo motif. Grab the player's aspect and go!
case "Breath": //Pneumatic Progression
$usagestr = "Pockets of highly pressurized air slam into your enemies, inflicting heavy damage.";
$i = 1;
while ($i <= $max_enemies) {
$healthstr = "enemy" . strval($i) . "health";
$newhealth = $userrow[$healthstr] - 50000;
if ($newhealth < 1) $newhealth = 1;
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$i++;
}
break;
case "Heart":
$usagestr = "With perfect form you strike each enemy in turn, combining your power and theirs into a devastating blow.";
$i = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$healthstr = "enemy" . strval($i) . "health";
$newhealth = $userrow[$healthstr] - (($userrow[$powerstr] * 2) + ($powerlevel * 2));
if ($newhealth < 1) $newhealth = 1;
$monsterhealth[$i] = $newhealth;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$i++;
}
break;
case "Life":
$usagestr = "The power of the fraymotif protects your life utterly, making you seem immortal.";
$invuln = 7;
mysql_query("UPDATE `Players` SET `invulnerability` = " . strval($userrow['invulnerability'] + $invuln) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Hope":
$usagestr = "You discourage one of your enemies so completely that they no longer possess the will to fight.";
$highestpower = 0;
$target = "";
$i = 1;
while ($i <= $max_enemies) {
$enemystr = "enemy" . strval($i) . "name";
$powerstr = "enemy" . strval($i) . "power";
if ($userrow[$powerstr] > $highestpower && !empty($userrow[$enemystr])) {
$highestpower = $userrow[$powerstr];
$target = $powerstr;
$j = $i;
}
$i++;
}
$monsterpowers[$j] = 0;
//mysql_query("UPDATE `Players` SET `" . $target . "` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$target] = 0;
break;
case "Light":
$usagestr = "A barrage of scintillating colours strike your foes, invoking a bizarre assortment of effects!";
$i = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$healthstr = "enemy" . strval($i) . "health";
$maxhealthstr = "enemy" . strval($i) . "maxhealth";
$namestr = "enemy" . strval($i) . "name";
$descstr = "enemy" . strval($i) . "desc";
$rolls = 1;
$damage = 0;
if (!empty($userrow[$namestr])) {
while ($rolls > 0) {
$roll = rand(floor(1+($luck/50)),8);
switch ($roll) {
case 1:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " is incinerated!";
$damage += 10000;
break;
case 2:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " is coated in acid!";
$damage += 20000;
break;
case 3:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " is struck by electricity!";
$damage += 40000;
break;
case 4:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " looks ill...";
$damage += ceil(($userrow[$maxhealthstr] / 5) * 2);
break;
case 5:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " is turned to stone!";
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$powerstr] = 0; //In case it rolls berserk later.
$monsterpowers[$i] = 0;
break;
case 6:
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " goes berserk and attacks everything!";
$j = 1;
while ($j <= $max_enemies) {
$healthstr2 = "enemy" . strval($j) . "health";
$newhealth2 = $userrow[$healthstr2] - ($userrow[$powerstr] * 2);
if ($newhealth2 < 1) $newhealth2 = 1;
//mysql_query("UPDATE `Players` SET `" . $healthstr2 . "` = " . $newhealth2 . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$monsterhealth[$i] = $newhealth2;
$userrow[$healthstr2] = $newhealth2; //So that damage is recorded properly.
$j++;
}
break;
case 7:
if ($reductionresist[$i] == 0 && $massiveresist[$i] == 100) { //Enemy has neither power reduction resistance or damage resistance.
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . " is sent to another dimension!";
$newdesc = 'It is a small paper replica of a ' . $userrow[$namestr] . ' with a note pinned to it that says "Piñata. Enjoy! -The Management"';
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = 1 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
//mysql_query("UPDATE `Players` SET `" . $descstr . "` = '" . $newdesc . "' WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$descstr] = $newdesc;
$rolls = 1; //It's gone, that'll do.
$userrow[$healthstr] = 1;
$userrow[$powerstr] = 0;
} else {
$usagestr = $usagestr . "</br>The " . $userrow[$namestr] . "resists the dimensional phasing.";
$rolls += 1; //Try again.
}
break;
case 8:
$rolls += 2; //Two extra rolls! Yay!
break;
default:
break;
}
$rolls--;
}
if ($damage > 0) {
$newhealth = $userrow[$healthstr] - $damage;
if ($newhealth < 1) $newhealth = 1;
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth;
$monsterhealth[$i] = $monsterhealth[$i] - $damage;
if ($monsterhealth[$i] < 1) $monsterhealth[$i] = 1; //Needs to be done this way because berserk ALSO inflicts damage.
$userrow[$healthstr] = $newhealth;
}
}
$i++;
}
break;
case "Mind":
$usagestr = "You bring your mind into perfect focus, able to read the actions of your opponents like an open book and react accordingly.";
$invuln = 3;
$powerboost = 1800;
mysql_query("UPDATE `Players` SET `invulnerability` = " . strval($userrow['invulnerability']+$invuln) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
mysql_query("UPDATE `Players` SET `powerboost` = " . strval($userrow['powerboost']+$powerboost) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
case "Blood":
$usagestr = "The mournful tune slows the pulses of your opponents, their movements becoming sluggish.";
$i = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$newpower = $userrow[$powerstr] - 3000;
if ($newpower < 0) $newpower = 0;
$monsterpowers[$i] = $newpower;
//mysql_query("UPDATE `Players` SET `" . $powerstr . "` = " . strval($newpower) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$powerstr] = $newpower;
$i++;
}
break;
case "Doom":
$usagestr = "Dark power curses an enemy, sealing their fate.";
$highestpower = 0;
$target = "";
$i = 1;
while ($i <= $max_enemies) {
$namestr = "enemy" . strval($i) . "name";
$powerstr = "enemy" . strval($i) . "power";
$healthstr = "enemy" . strval($i) . "health";
if ($userrow[$powerstr] > $highestpower && $userrow[$namestr] != "") {
$highestpower = $userrow[$powerstr];
$target = $healthstr;
$j = $i;
}
$i++;
}
$monsterhealth[$j] = 1;
//mysql_query("UPDATE `Players` SET `" . $target . "` = 1 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$target] = 1;
break;
case "Rage":
$usagestr = "Unbridled rage courses through your enemies, causing them to turn on each other.";
$i = 1;
$j = 1;
while ($i <= $max_enemies) {
$powerstr = "enemy" . strval($i) . "power";
$namestr = "enemy" . strval($i) . "name";
if ($userrow[$namestr] != "") { //Enemy exists, perform attacks.
while ($j <= $max_enemies) {
$healthstr = "enemy" . strval($j) . "health";
$newhealth = $userrow[$healthstr] - ceil($userrow[$powerstr] / 2);
if ($newhealth < 1) $newhealth = 1;
$monsterhealth[$j] = $monsterhealth[$j] - ceil($userrow[$powerstr] / 2);
if ($monsterhealth[$j] < 1) $monsterhealth[$j] = 1; //Needs to be done this way because damage is inflicted multiple times.
//mysql_query("UPDATE `Players` SET `" . $healthstr . "` = " . $newhealth . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
$userrow[$healthstr] = $newhealth; //So that damage is recorded properly.
$j++;
}
}
$i++;
}
break;
case "Void":
$usagestr = "You fade from sight, becoming impossible to hit and gaining a significant advantage in attacking.";
$invuln = 3;
$tempoffenseboost = 5000;
$tempoffenseduration = 3;
mysql_query("UPDATE `Players` SET `invulnerability` = " . strval($userrow['invulnerability']+$invuln) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
if ($tempoffenseboost > $userrow['tempoffenseboost']) {
mysql_query("UPDATE `Players` SET `tempoffenseboost` = " . strval($tempoffenseboost) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
}
if ($tempoffenseduration < $userrow['tempoffenseduration'] || $userrow['tempoffenseduration'] == 0) {
mysql_query("UPDATE `Players` SET `tempoffenseduration` = " . strval($tempoffenseduration) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
}
break;
case "Space":
$temppowerboost = 15000;
$temppowerduration = 1;
$usagestr = "You prepare to perform a rapid series of teleporting strikes, inflicting massively increased damage and becoming basically impossible to hit.";
if ($temppowerboost > $userrow['temppowerboost']) {
mysql_query("UPDATE `Players` SET `temppowerboost` = " . strval($temppowerboost) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
}
if ($temppowerduration < $userrow['temppowerduration'] || $userrow['temppowerduration'] == 0) {
mysql_query("UPDATE `Players` SET `temppowerduration` = " . strval($temppowerduration) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
}
break;
case "Time":
$usagestr = "Your motions accelerate impossibly, allowing you to perform an incredible number of attacks before your opponents get a chance to retaliate.";
$invuln = 7;
mysql_query("UPDATE `Players` SET `invulnerability` = " . strval($userrow['invulnerability'] + $invuln) . " WHERE `Players`.`username` = '$username' LIMIT 1 ;");
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "solo3":
//NOTE - This will set "motifactive" on, which will provide a specific effect at the end of every turn depending on aspect. The usage message is all that is coded here.
switch ($userrow['Aspect']) {
case "Breath": //Breathless Battaglia
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,3);
switch ($randomthing) {
case 1:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/heir-conditioning' target='_blank'>windy rhythm</a> begins playing.";
break;
case 2:
$usagestr = "<a href='http://homestuck.bandcamp.com/track/heir-transparent' target='_blank'>The melody of an ancient Heir</a> begins playing.";
break;
case 3:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/rex-duodecim-angelus' target='_blank'>towering, thunderous song</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Heart":
if ($userrow['motifcounter'] == 0) {
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/valhalla' target='_blank'>soul-stirring melody</a> begins playing.";
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Life":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/sburban-jungle-2' target='_blank'>melody of new beginnings</a> begins playing.";
break;
case 2:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/song-of-life' target='_blank'>lifey song</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Hope":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "An <a href='http://homestuck.bandcamp.com/track/skaian-skirmish' target='_blank'>uprising, uplifting song</a> begins playing.";
break;
case 2:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/savior-of-the-dreaming-dead' target='_blank'>melody of triumph against all odds</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Light":
if ($userrow['motifcounter'] == 0) {
$usagestr = "<a href='http://homestuck.bandcamp.com/track/aggrievance' target='_blank'>The song of an ancient Seer</a> begins playing.";
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Mind":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "An <a href='http://homestuck.bandcamp.com/track/versus' target='_blank'>intense, yet focused theme</a> begins playing.";
break;
case 2:
$usagestr = "An <a href='http://homestuck.bandcamp.com/track/bl1nd-just1c3-1nv3st1g4t1on' target='_blank'>investigative song</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Blood":
if ($userrow['motifcounter'] == 0) {
$usagestr = "<a href='http://homestuck.bandcamp.com/track/showdown' target='_blank'>The tune of an ancient Knight</a> begins playing.";
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Doom":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,3);
switch ($randomthing) {
case 1:
$usagestr = "<a href='http://homestuck.bandcamp.com/track/dance-of-thorns' target='_blank'>The best Homestuck song ever</a> begins playing.";
break;
case 2:
$usagestr = "An <a href='http://homestuck.bandcamp.com/track/an-unbreakable-union' target='_blank'>ominous-sounding song</a> begins playing.";
break;
case 3:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/blackest-heart' target='_blank'>soul-blackening dirge</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Rage":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/knifes-edge' target='_blank'>speedy, rousing tune</a> begins playing.";
break;
case 2:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/chaotic-strength' target='_blank'>fast, furious song</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Void":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/pumpkin-cravings' target='_blank'>bizarre tune</a> begins playing.";
break;
case 2:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/black-rose-green-sun' target='_blank'>song of strength and emptiness</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Space":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,2);
switch ($randomthing) {
case 1:
$usagestr = "A <a href='http://homestuck.bandcamp.com/track/atomic-bonsai' target='_blank'>lively, powerful rhythm</a> begins playing.";
break;
case 2:
$usagestr = "<a href='http://homestuck.bandcamp.com/track/sunslammer' target='_blank'>The song of an ancient Witch</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
case "Time":
if ($userrow['motifcounter'] == 0) {
$randomthing = rand(1,3);
switch ($randomthing) {
case 1:
$usagestr = "An <a href='http://homestuck.bandcamp.com/track/time-on-my-side' target='_blank'>incredibly funky jam</a> begins playing.";
break;
case 2:
$usagestr = "A <a http://homestuck.bandcamp.com/track/swing-of-the-clock' target='_blank'>curious ticking piece</a> begins playing.";
break;
case 3:
$usagestr = "<a http://homestuck.bandcamp.com/track/beatdown-round-2-2' target='_blank'>The song of an ancient Knight</a> begins playing.";
break;
default:
break;
}
mysql_query("UPDATE `Players` SET `motifcounter` = 1, `motifvar` = 0 WHERE `Players`.`username` = '$username' LIMIT 1 ;");
} else {
echo "A battle theme is already playing!</br>";
$fail = True;
}
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
default:
$combo = False; //We look for an assister who can perform the combomotif
$sessionmates = mysql_query("SELECT * FROM Players WHERE `Players`.`session_name` = '" . $userrow['session_name'] . "'");
while ($row = mysql_fetch_array($sessionmates)) {
if ($row['aiding'] == $username) { //Aiding character.
$useraspect = $userrow['Aspect'];
if ($useraspect == "Blood") $useraspect = "Blood(motif)";
if ($row['Aspect'] == $motif && $row[$useraspect] == 1) $combo = True; //Applicable player found.
}
}
if ($combo == False) { //No assisting player with the correct aspect and fraymotif
echo "You are not being assisted by any player able to help you perform this fraymotif!</br>";
$fail = True;
} else { //Gogogo!
switch ($motif) { //We're using a combo motif. Grab the non-player part of the combo.
case "Breath":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Heart":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Life":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Hope":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Light":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Mind":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Blood":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;
break;
}
break;
case "Doom":
switch ($userrow['Aspect']) { //We're using a combo motif. Grab the player part of the combo and go!
case "Breath":
break;
case "Heart":
break;
case "Life":
break;
case "Hope":
break;
case "Light":
break;
case "Mind":
break;
case "Blood":
break;
case "Doom":
break;
case "Rage":
break;
case "Void":
break;
case "Space":
break;
case "Time":
break;
default:
echo "Player aspect $userrow[Aspect] unrecognized. This is probably a bug.";
$fail = True;