forked from SWU-Petranaki/SWUOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCurrentEffectAbilities.php
More file actions
819 lines (769 loc) · 28.5 KB
/
CurrentEffectAbilities.php
File metadata and controls
819 lines (769 loc) · 28.5 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
<?php
//Return 1 if the effect should be removed
function EffectHitEffect($cardID)
{
global $combatChainState, $CCS_GoesWhereAfterLinkResolves, $defPlayer, $mainPlayer, $CCS_WeaponIndex, $combatChain, $CCS_DamageDealt;
$attackID = $combatChain[0];
switch($cardID) {
case "6954704048"://Heroic Sacrifice
$ally = new Ally(AttackerMZID($mainPlayer), $mainPlayer);
WriteLog("Heroic Sacrifice defeated " . CardLink($ally->CardID(), $ally->CardID()));
$ally->Destroy();
break;
case "8988732248-1"://Rebel Assault
AddCurrentTurnEffect("8988732248-2", $mainPlayer);
break;
case "0802973415"://Outflank
AddCurrentTurnEffect("0802973415-1", $mainPlayer);
break;
case "5896817672-1"://Headhunting
case "5896817672-2":
AddCurrentTurnEffect("5896817672" . (str_ends_with($cardID, "-1") ? "-2" : "-3"), $mainPlayer);
break;
case "6514927936-1"://Leia Organa
AddCurrentTurnEffectFromCombat("6514927936-2", $mainPlayer);
break;
default:
break;
}
return 0;
}
//Return true if there's a chained action
function FinalizeChainLinkEffects()
{
global $mainPlayer, $currentTurnEffects;
for($i=0; $i<count($currentTurnEffects); $i+=CurrentTurnPieces()) {
switch($currentTurnEffects[$i]) {
case "8988732248-2"://Rebel Assault
PrependDecisionQueue("REMOVECURRENTEFFECT", $mainPlayer, $currentTurnEffects[$i]);
PrependDecisionQueue("SWAPTURN", $mainPlayer, "-");
PrependDecisionQueue("ELSE", $mainPlayer, "-");
PrependDecisionQueue("MZOP", $mainPlayer, "ATTACK", 1);
PrependDecisionQueue("CHOOSEMULTIZONE", $mainPlayer, "<-", 1);
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose a unit to attack with");
PrependDecisionQueue("MZFILTER", $mainPlayer, "status=1");
PrependDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYALLY:trait=Rebel");
return true;
case "0802973415-1"://Outflank
PrependDecisionQueue("REMOVECURRENTEFFECT", $mainPlayer, $currentTurnEffects[$i]);
PrependDecisionQueue("SWAPTURN", $mainPlayer, "-");
PrependDecisionQueue("ELSE", $mainPlayer, "-");
PrependDecisionQueue("MZOP", $mainPlayer, "ATTACK", 1);
PrependDecisionQueue("CHOOSEMULTIZONE", $mainPlayer, "<-", 1);
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose a unit to attack with");
PrependDecisionQueue("MZFILTER", $mainPlayer, "status=1");
PrependDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYALLY");
return true;
case "5896817672-2"://Headhunting
case "5896817672-3":
global $CCS_CantAttackBase;
PrependDecisionQueue("REMOVECURRENTEFFECT", $mainPlayer, $currentTurnEffects[$i]);
PrependDecisionQueue("MZOP", $mainPlayer, "ATTACK", 1);
PrependDecisionQueue("PASSPARAMETER", $mainPlayer, "{0}");
PrependDecisionQueue("ADDLIMITEDCURRENTEFFECT", $mainPlayer, "5896817672", 1);
PrependDecisionQueue("MZOP", $mainPlayer, "GETUNIQUEID", 1);
PrependDecisionQueue("MZALLCARDTRAITORPASS", $mainPlayer, "Bounty Hunter", 1);
PrependDecisionQueue("PASSPARAMETER", $mainPlayer, "{0}", 1);
PrependDecisionQueue("SETCOMBATCHAINSTATE", $mainPlayer, $CCS_CantAttackBase, 1);
PrependDecisionQueue("PASSPARAMETER", $mainPlayer, 1, 1);
PrependDecisionQueue("SETDQVAR", $mainPlayer, "0");
PrependDecisionQueue("MAYCHOOSEMULTIZONE", $mainPlayer, "<-", 1);
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose a unit to attack with");
PrependDecisionQueue("MZFILTER", $mainPlayer, "status=1");
PrependDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYALLY");
return true;
case "6514927936-2"://Leia Organa
PrependDecisionQueue("SWAPTURN", $mainPlayer, "-");
PrependDecisionQueue("ELSE", $mainPlayer, "-");
PrependDecisionQueue("MZOP", $mainPlayer, "ATTACK", 1);
PrependDecisionQueue("MAYCHOOSEMULTIZONE", $mainPlayer, "<-", 1);
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose a unit to attack with");
PrependDecisionQueue("MZFILTER", $mainPlayer, "status=1");
PrependDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYALLY:trait=Rebel");
return true;
case "87e8807695"://Leia Organa - Leader Unit
SearchCurrentTurnEffects("87e8807695", $mainPlayer, remove:true);
PrependDecisionQueue("SWAPTURN", $mainPlayer, "-");
PrependDecisionQueue("ELSE", $mainPlayer, "-");
PrependDecisionQueue("MZOP", $mainPlayer, "ATTACK", 1);
PrependDecisionQueue("MAYCHOOSEMULTIZONE", $mainPlayer, "<-", 1);
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose a unit to attack with");
PrependDecisionQueue("MZFILTER", $mainPlayer, "status=1");
PrependDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYALLY:trait=Rebel");
return true;
case "9560139036"://Ezra Bridger
SearchCurrentTurnEffects("9560139036", $mainPlayer, remove:true);
PrependDecisionQueue("MODAL", $mainPlayer, "EZRABRIDGER", 1);
PrependDecisionQueue("SHOWMODES", $mainPlayer, $currentTurnEffects[$i], 1);
PrependDecisionQueue("MULTICHOOSETEXT", $mainPlayer, "1-Leave,Play,Discard-1");
PrependDecisionQueue("SETDQCONTEXT", $mainPlayer, "The top card is <0>; Choose a mode for Ezra Bridger");
PrependDecisionQueue("SETDQVAR", $mainPlayer, "0");
PrependDecisionQueue("DECKCARDS", $mainPlayer, "0");
return true;
default: break;
}
}
return false;
}
function EffectAttackModifier($cardID, $playerID="")
{
global $mainPlayer, $defPlayer;
$params = explode("_", $cardID);
if(count($params) == 1) {
$params = explode("-", $cardID);
}
$cardID = $params[0];
if(count($params) > 1) $subparam = $params[1];
switch($cardID)
{
case "2587711125": return -4;//Disarm
case "2569134232": return -4;//Jedha City
case "1323728003": return -1;//Electrostaff
case "2651321164": return 2;//Tactical Advantage
case "1701265931": return 4;//Moment of Glory
case "1900571801": return 2;//Overwhelming Barrage
case "3809048641": return 3;//Surprise Strike
case "3038238423": return 2;//Fleet Lieutenant
case "9757839764": return 2;//Adelphi Patrol Wing
case "3208391441": return -2;//Make an Opening
case "4036958275": return -4;//Hello There
case "5013214638": return -2;//Equalize
case "9999079491": return -2;//Mystic Reflection
case "6432884726": return 2;//Steadfast Battalion
case "8244682354": return -1;//Jyn Erso
case "8600121285": return 1;//IG-88
case "6954704048": return 2;//Heroic Sacrifice
case "20f21b4948": return -1;//Jyn Erso
case "9097690846": return 2;//Snowtrooper Lieutenant
case "9210902604"://Precision Fire
$attacker = new Ally(AttackerMZID($mainPlayer), $mainPlayer);
return TraitContains($attacker->CardID(), "Trooper", $mainPlayer) ? 2 : 0;
case "5896817672": if(!$subparam) return 2; else return 0;//Headhunting
case "8297630396": return 1;//Shoot First
case "5464125379": return -2;//Strafing Gunship
case "8495694166": return -2;//Jedi Lightsaber
case "3789633661": return 4;//Cunning
case "1939951561": return $subparam;//Attack Pattern Delta
case "8988732248": return 1;//Rebel Assault
case "7922308768": return NumResources($mainPlayer) < NumResources($defPlayer) ? 2 : 0;//Valiant Assault Ship
case "7109944284": return -1* $subparam;//Luke Skywalker
case "1885628519": return 1;//Crosshair
case "1480894253": return 2;//Kylo Ren
case "2503039837": return IsAllyAttackTarget() ? 1 : 0;//Moff Gideon Leader
case "4534554684": return 2;//Freetown Backup
case "4721657243": return 3;//Kihraxz Heavy Fighter
case "7171636330": return -4;//Chain Code Collector
case "2526288781": return 1;//Bossk
case "1312599620": return -3;//Smuggler's Starfighter
case "8107876051": return -3;//Enfys Nest
case "9334480612": return 1;//Boba Fett Green Leader
case "6962053552": return 2;//Desperate Attack
case "4085341914": return 4;//Heroic Resolve
case "1938453783": return 2;//Armed to the Teeth
case "6263178121": return 2;//Kylo Ren (Killing the Past)
case "8307804692": return -3;//Padme Admidala
case "7578472075"://Let the Wookie Win
$attacker = new Ally(AttackerMZID($mainPlayer), $mainPlayer);
return TraitContains($attacker->CardID(), "Wookiee", $mainPlayer) ? 2 : 0;
case "4663781580"://Swoop Down
$attackTarget = GetAttackTarget();
if(!IsAllyAttackTarget()) return 0;
$ally = new Ally($attackTarget, $defPlayer);
$modifier = $playerID == $defPlayer ? -2 : 2;
return CardArenas($ally->CardID()) == "Ground" ? $modifier : 0;
case "3399023235": return isset($subparam) && $subparam == "2" ? -2 : 0;//Fenn Rau
case "8777351722": return IsAllyAttackTarget() ? 2 : 0;//Anakin Skywalker Leader
case "4910017138": return 2;//Breaking In
case "8929774056": return 1;//Asajj Ventress
case "2155351882": return 1;//Ahsoka Tano
case "6436543702": return -2;//Providence Destroyer
case "7000286964": return -1;//Vulture Interceptor Wing
case "0249398533": return 2;//Obedient Vanguard
case "1686059165": return 2;//Wat Tambor
case "12122bc0b1": return 2;//Wat Tambor
case "2395430106": return 2;//Republic Tactical Officer
case "3381931079": return -4;//Malevolence
case "5333016146": return -1;//Rune Haako
case "fb7af4616c": return 1;//General Grievous
case "3556557330": return 3;//Asajj Ventress
case "8418001763": return 2;//Huyang
case "0216922902": return -5;//The Zillo Beast
case "7979348081": return 1;//Kraken
default: return 0;
}
}
function EffectHasBlockModifier($cardID)
{
switch($cardID)
{
default: return false;
}
}
function EffectBlockModifier($cardID, $index)
{
global $combatChain, $defPlayer, $mainPlayer;
switch($cardID) {
default:
return 0;
}
}
function RemoveEffectsOnChainClose()
{
}
function OnAttackEffects($attack)
{
global $currentTurnEffects, $mainPlayer, $defPlayer;
$attackType = CardType($attack);
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $mainPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
function CurrentEffectBaseAttackSet($cardID)
{
global $currentPlayer, $currentTurnEffects;
$mod = -1;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
if($currentTurnEffects[$i + 1] == $currentPlayer && IsCombatEffectActive($currentTurnEffects[$i])) {
switch($currentTurnEffects[$i]) {
default: break;
}
}
}
return $mod;
}
function CurrentEffectCostModifiers($cardID, $from, $reportMode=false)
{
global $currentTurnEffects, $currentPlayer, $CS_PlayUniqueID;
$costModifier = 0;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
case "TTFREE"://Free
$costModifier -= 99;
$remove = true;
break;
case "5707383130"://Bendu
if($from != "PLAY" && !AspectContains($cardID, "Heroism", $currentPlayer) && !AspectContains($cardID, "Villainy", $currentPlayer)) {
$costModifier -= 2;
$remove = true;
}
break;
case "4919000710"://Home One
$costModifier -= 3;
$remove = true;
break;
case "5351496853"://Gideon's Light Cruiser
$costModifier -= 99;
$remove = true;
break;
case "2756312994"://Alliance Dispatcher
$costModifier -= 1;
$remove = true;
break;
case "3509161777"://You're My Only Hope
$costModifier -= PlayerRemainingHealth($currentPlayer) <= 5 ? 99 : 5;
$remove = true;
break;
case "5494760041"://Galactic Ambition
$costModifier -= 99;
$remove = true;
break;
case "3426168686"://Sneak Attack
if($from != "PLAY") {
$costModifier -= 3;
$remove = true;
}
break;
case "5696041568"://Triple Dark Raid
$costModifier -= 5;
$remove = true;
break;
case "7870435409"://Bib Fortuna
$costModifier -= 1;
$remove = true;
break;
case "8506660490"://Darth Vader
$costModifier -= 99;
$remove = true;
break;
case "8968669390"://U-Wing Reinforcement
$costModifier -= 99;
$remove = true;
break;
case "5440730550"://Lando Calrissian Leader
case "040a3e81f3"://Lando Calrissian Leader Unit
$costModifier -= 3;
$remove = true;
break;
case "4643489029"://Palpatine's Return
$costModifier -= TraitContains($cardID, "Force", $currentPlayer) ? 8 : 6;
$remove = true;
break;
case "7270736993"://Unrefusable Offer
case "4717189843"://A New Adventure
$costModifier -= 99;
$remove = true;
break;
case "9642863632"://Bounty Hunter's Quarry
$costModifier -= 99;
$remove = true;
break;
case "9226435975"://Han Solo Red
$costModifier -= 1;
$remove = true;
break;
case "0622803599-3"://Jabba the Hutt
if($from != "PLAY" && DefinedTypesContains($cardID, "Unit", $currentPlayer)) {
$costModifier -= 1;
$remove = true;
}
break;
case "f928681d36-3"://Jabba the Hutt Leader Unit
if($from != "PLAY" && DefinedTypesContains($cardID, "Unit", $currentPlayer)) {
$costModifier -= 2;
$remove = true;
}
break;
case "5576996578"://Endless Legions
$costModifier -= 99;
$remove = true;
break;
case "3399023235"://Fenn Rau
$costModifier -= 2;
$remove = true;
break;
case "7642980906"://Stolen Landspeeder
$costModifier -= 99;
$remove = false;
break;
case "6772128891"://Exploit Effect
$costModifier -= 2;
$remove = true;
break;
case "6849037019"://Now There Are Two of Them
$costModifier -= 5;
$remove = true;
break;
case "0414253215"://General's Blade
if($from != "PLAY" && DefinedTypesContains($cardID, "Unit", $currentPlayer)) {
$costModifier -= 2;
$remove = true;
}
break;
default: break;
}
if($remove && !$reportMode) RemoveCurrentTurnEffect($i);
}
}
return $costModifier;
}
function CurrentEffectPreventDamagePrevention($player, $type, $damage, $source)
{
global $currentTurnEffects;
for($i = count($currentTurnEffects) - CurrentTurnEffectPieces(); $i >= 0; $i -= CurrentTurnEffectPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $player) {
switch ($currentTurnEffects[$i]) {
default: break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
return $damage;
}
function CurrentEffectDamagePrevention($player, $type, $damage, $source, $preventable, $uniqueID=-1)
{
global $currentPlayer, $currentTurnEffects;
for($i = count($currentTurnEffects) - CurrentTurnEffectPieces(); $i >= 0 && $damage > 0; $i -= CurrentTurnEffectPieces()) {
if($uniqueID != -1 && $currentTurnEffects[$i + 2] != $uniqueID) continue;
$remove = false;
if($currentTurnEffects[$i + 1] == $player || $uniqueID != -1) {
$effects = explode("-", $currentTurnEffects[$i]);
switch($effects[0]) {
case "pv4n1n3gyg"://Cleric's Robe
if($preventable) $damage -= 1;
$remove = true;
break;
default: break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
return $damage;
}
function CurrentEffectAttackAbility()
{
global $currentTurnEffects, $combatChain, $mainPlayer;
global $CS_PlayIndex;
if(count($combatChain) == 0) return;
$attackID = $combatChain[0];
$attackType = CardType($attackID);
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $mainPlayer) {
switch ($currentTurnEffects[$i]) {
default:
break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
function CurrentEffectPlayAbility($cardID, $from)
{
global $currentTurnEffects, $currentPlayer, $actionPoints, $CS_LastDynCost;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
return false;
}
function CurrentEffectPlayOrActivateAbility($cardID, $from)
{
global $currentTurnEffects, $currentPlayer;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
$currentTurnEffects = array_values($currentTurnEffects); //In case any were removed
return false;
}
function CurrentEffectGrantsNonAttackActionGoAgain($cardID)
{
global $currentTurnEffects, $currentPlayer;
$hasGoAgain = false;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
return $hasGoAgain;
}
function CurrentEffectGrantsGoAgain()
{
global $currentTurnEffects, $mainPlayer, $combatChainState, $CCS_AttackFused;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnEffectPieces()) {
if($currentTurnEffects[$i + 1] == $mainPlayer && IsCombatEffectActive($currentTurnEffects[$i]) && !IsCombatEffectLimited($i)) {
switch ($currentTurnEffects[$i]) {
default:
break;
}
}
}
return false;
}
function CurrentEffectPreventsGoAgain()
{
global $currentTurnEffects, $mainPlayer;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnEffectPieces()) {
if($currentTurnEffects[$i + 1] == $mainPlayer) {
switch($currentTurnEffects[$i]) {
default: break;
}
}
}
return false;
}
function CurrentEffectPreventsDefenseReaction($from)
{
global $currentTurnEffects, $currentPlayer;
$reactionPrevented = false;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnEffectPieces()) {
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
}
}
return $reactionPrevented;
}
function CurrentEffectPreventsDraw($player, $isMainPhase)
{
global $currentTurnEffects;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnEffectPieces()) {
if($currentTurnEffects[$i + 1] == $player) {
switch ($currentTurnEffects[$i]) {
default: break;
}
}
}
return false;
}
function CurrentEffectIntellectModifier()
{
global $currentTurnEffects, $mainPlayer;
$intellectModifier = 0;
for($i = count($currentTurnEffects) - CurrentTurnEffectPieces(); $i >= 0; $i -= CurrentTurnEffectPieces()) {
if($currentTurnEffects[$i + 1] == $mainPlayer) {
switch($currentTurnEffects[$i]) {
default: break;
}
}
}
return $intellectModifier;
}
function CurrentEffectEndTurnAbilities()
{
global $currentTurnEffects, $mainPlayer;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
$params = explode("_", $currentTurnEffects[$i]);
$cardID = $params[0];
if(count($params) > 1) $subparam = $params[1];
if(SearchCurrentTurnEffects($cardID . "-UNDER", $currentTurnEffects[$i + 1])) {
AddNextTurnEffect($currentTurnEffects[$i], $currentTurnEffects[$i + 1]);
}
switch($cardID) {
case "3426168686-2"://Sneak Attack
case "7270736993-2"://Unrefusable Offer
$ally = new Ally("MYALLY-" . SearchAlliesForUniqueID($currentTurnEffects[$i+2], $currentTurnEffects[$i+1]), $currentTurnEffects[$i+1]);
$ally->Destroy();
break;
case "1626462639"://Change of Heart
$index = SearchAlliesForUniqueID($currentTurnEffects[$i+2], $currentTurnEffects[$i+1]);
if($index > -1) {
$ally = new Ally("MYALLY-" . $index, $currentTurnEffects[$i+1]);
$owner = $ally->Owner();
WriteLog("Change of Heart unit reverted control of " . CardLink($ally->CardID(), $ally->CardID()) . "back to player $owner");
AddDecisionQueue("PASSPARAMETER", $owner, "THEIRALLY-" . $index, 1);
AddDecisionQueue("MZOP", $owner, "TAKECONTROL", 1);
}
break;
case "5696041568-2"://Triple Dark Raid
$allyId = SearchAlliesForUniqueID($currentTurnEffects[$i+2], $currentTurnEffects[$i+1]);
if($allyId > -1) {
$ally = new Ally("MYALLY-" . $allyId, $currentTurnEffects[$i+1]);
MZBounce($currentTurnEffects[$i+1], "MYALLY-" . $ally->Index());
}
break;
case "1910812527":
DealDamageAsync($currentTurnEffects[$i+1], 999999);
break;
case "6117103324"://Jetpack
$allyIndex = SearchAlliesForUniqueID($currentTurnEffects[$i+2], $currentTurnEffects[$i+1]);
if($allyIndex > -1) {
$ally = new Ally("MYALLY-" . $allyIndex, $currentTurnEffects[$i+1]);
$ally->DefeatUpgrade("8752877738");
}
break;
case "4002861992"://DJ (Blatant Thief)
AddNextTurnEffect($currentTurnEffects[$i], $currentTurnEffects[$i + 1]);
break;
case "8418001763"://Huyang
if(SearchAlliesForCard($currentTurnEffects[$i+1], "8418001763")) {
AddNextTurnEffect($currentTurnEffects[$i], $currentTurnEffects[$i + 1], $currentTurnEffects[$i + 2]);
}
break;
default: break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
function CurrentEffectStartRegroupAbilities()
{
global $currentTurnEffects, $mainPlayer;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
$params = explode("_", $currentTurnEffects[$i]);
$cardID = $params[0];
if(count($params) > 1) $subparam = $params[1];
if(SearchCurrentTurnEffects($cardID . "-UNDER", $currentTurnEffects[$i + 1])) {
AddNextTurnEffect($currentTurnEffects[$i], $currentTurnEffects[$i + 1]);
}
switch($cardID) {
case "2522489681"://Zorii Bliss
PummelHit($currentTurnEffects[$i+1]);
break;
default: break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
function CurrentEffectStartTurnAbilities()
{
global $currentTurnEffects, $mainPlayer;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
$cardID = substr($currentTurnEffects[$i], 0, 6);
if(SearchCurrentTurnEffects($cardID . "-UNDER", $currentTurnEffects[$i + 1])) {
AddNextTurnEffect($currentTurnEffects[$i], $currentTurnEffects[$i + 1]);
}
switch($currentTurnEffects[$i]) {
case "5954056864": case "5e90bd91b0"://Han Solo
MZChooseAndDestroy($currentTurnEffects[$i+1], "MYRESOURCES", context:"Choose a resource to destroy");
break;
case "8800836530"://No Good To Me Dead
$ally = new Ally("MYALLY-" . SearchAlliesForUniqueID($currentTurnEffects[$i+2], $currentTurnEffects[$i+1]), $currentTurnEffects[$i+1]);
$ally->Exhaust();
$remove = true;
break;
default: break;
}
if($remove) RemoveCurrentTurnEffect($i);
}
}
function IsCombatEffectActive($cardID)
{
global $combatChain;
if(count($combatChain) == 0) return;
$effectArr = explode("-", $cardID);
$cardID = $effectArr[0];
switch($cardID)
{
case "2587711125": return true;//Disarm
case "2569134232": return true;//Jedha City
case "1323728003": return true;//Electrostaff
case "3809048641": return true;//Surprise Strike
case "9757839764": return true;//Adelphi Patrol Wing
case "3038238423": return true;//Fleet Lieutenant
case "8244682354": return true;//Jyn Erso
case "8600121285": return true;//IG-88
case "6954704048": return true;//Heroic Sacrifice
case "20f21b4948": return true;//Jyn Erso
case "9097690846": return true;//Snowtrooper Lieutenant
case "9210902604": return true;//Precision Fire
case "8297630396": return true;//Shoot First
case "5464125379": return true;//Strafing Gunship
case "8495694166": return true;//Jedi Lightsaber
case "3789633661": return true;//Cunning
case "8988732248": return true;//Rebel Assault
case "7922308768": return true;//Valiant Assault Ship
case "6514927936": return true;//Leia Organa
case "0802973415": return true;//Outflank
case "1480894253": return true;//Kylo Ren
case "2503039837": return true;//Moff Gideon Leader
case "4721657243": return true;//Kihraxz Heavy Fighter
case "7171636330": return true;//Chain Code Collector
case "8107876051": return true;//Enfys Nest
case "7578472075": return true;//Let the Wookie Win
case "4663781580": return true;//Swoop Down
case "4085341914": return true;//Heroic Resolve
case "5896817672": return true;//Headhunting
case "6962053552": return true;//Desperate attack
case "3399023235"://Fenn Rau
case "8777351722"://Anakin Skywalker Leader
case "4910017138"://Breaking In
case "8929774056"://Asajj Ventress
case "2155351882"://Ahsoka Tano
case "6669050232"://Grim Resolve
case "2395430106"://Republic Tactical Officer
return true;
default: return false;
}
}
function IsCombatEffectPersistent($cardID)
{
switch($cardID) {
case "2587711125": return true;//Disarm
case "2569134232": return true;//Jedha City
case "3789633661": return true;//Cunning
case "1480894253": return true;//Kylo Ren
default: return false;
}
}
function IsEffectPersistent($cardID)
{
global $currentPlayer;
$effectArr = explode(",", $cardID);
switch($cardID) {
case "7dedg616r0": return true;//Freydis, Master Tactician
default:
return false;
}
}
function BeginEndPhaseEffects()
{
global $currentTurnEffects, $mainPlayer, $EffectContext;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnPieces()) {
$EffectContext = $currentTurnEffects[$i];
if(IsEffectPersistent($EffectContext)) AddNextTurnEffect($EffectContext, $currentTurnEffects[$i+1]);
switch($currentTurnEffects[$i]) {
default:
break;
}
}
}
function BeginEndPhaseEffectTriggers()
{
global $currentTurnEffects, $mainPlayer;
for($i = 0; $i < count($currentTurnEffects); $i += CurrentTurnPieces()) {
switch($currentTurnEffects[$i]) {
case "blq7qXGvWH":
DiscardHand($mainPlayer);
WriteLog("Arcane Disposition discarded your hand");
break;
default: break;
}
}
}
function ActivateAbilityEffects()
{
global $currentPlayer, $currentTurnEffects;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $currentPlayer) {
switch($currentTurnEffects[$i]) {
default:
break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
$currentTurnEffects = array_values($currentTurnEffects);
}
function CurrentEffectNameModifier($effectID, $effectParameter)
{
$name = "";
switch($effectID)
{
default: break;
}
return $name;
}
function CurrentEffectAllyEntersPlay($player, $index)
{
global $currentTurnEffects;
for($i = count($currentTurnEffects) - CurrentTurnPieces(); $i >= 0; $i -= CurrentTurnPieces()) {
$remove = false;
if($currentTurnEffects[$i + 1] == $player) {
switch($currentTurnEffects[$i]) {
case "7642980906"://Stolen Landspeeder
$remove = true;
$ally = new Ally("MYALLY-" . $index, $player);
$ally->Attach("2007868442");//Experience token
break;
default:
break;
}
}
if($remove) RemoveCurrentTurnEffect($i);
}
$currentTurnEffects = array_values($currentTurnEffects);
}
?>