forked from SWU-Karabast/SWUOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuraAbilities.php
505 lines (460 loc) · 15.8 KB
/
AuraAbilities.php
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
<?php
function PlayAura($cardID, $player, $number = 1, $isToken = false, $rogueHeronSpecial = false)
{
global $CS_NumAuras;
$otherPlayer = ($player == 1 ? 2 : 1);
if(CardType($cardID) == "T") $isToken = true;
if(DelimStringContains(CardSubType($cardID), "Affliction")) {
$otherPlayer = $player;
$player = ($player == 1 ? 2 : 1);
}
$auras = &GetAuras($player);
$myHoldState = AuraDefaultHoldTriggerState($cardID);
if($myHoldState == 0 && HoldPrioritySetting($player) == 1) $myHoldState = 1;
$theirHoldState = AuraDefaultHoldTriggerState($cardID);
if($theirHoldState == 0 && HoldPrioritySetting($otherPlayer) == 1) $theirHoldState = 1;
for($i = 0; $i < $number; ++$i) {
$auras[] = $cardID;
$auras[] = AuraEntersPlayState($cardID);
if($rogueHeronSpecial) $auras[] = 0; //Only happens on the damage effect of the Heron Master in the Roguelike Gamemode
else $auras[] = AuraPlayCounters($cardID); //Miscellaneous Counters
$auras[] = 0; //Attack counters
$auras[] = ($isToken ? 1 : 0); //Is token 0=No, 1=Yes
$auras[] = AuraNumUses($cardID);
$auras[] = GetUniqueId();
$auras[] = $myHoldState; //My Hold priority for triggers setting 2=Always hold, 1=Hold, 0=Don't hold
$auras[] = $theirHoldState; //Opponent Hold priority for triggers setting 2=Always hold, 1=Hold, 0=Don't hold
}
if(DelimStringContains(CardSubType($cardID), "Affliction")) IncrementClassState($otherPlayer, $CS_NumAuras, $number);
else if($cardID != "ELE111") IncrementClassState($player, $CS_NumAuras, $number);
}
function UpgradeDetached($upgradeCardID, $player, $formerBearerMZIndex) {
switch($upgradeCardID) {
case "8055390529"://Traitorous
$formerBearer = new Ally($formerBearerMZIndex, $player);
if($formerBearer->Owner() != $formerBearer->Controller()) AllyTakeControl($formerBearer->Owner(), $formerBearer->UniqueID());
break;
default:
break;
}
}
function AuraEntersPlayState($cardID)
{
switch($cardID)
{
case "hjdu50pces": return 1;//Deep Sea Fractal
default: return 2;
}
}
function AuraNumUses($cardID)
{
switch ($cardID) {
case "EVR140": case "EVR141": case "EVR142": case "EVR143":
case "UPR005":
return 1;
default:
return 0;
}
}
function TokenCopyAura($player, $index)
{
$auras = &GetAuras($player);
PlayAura($auras[$index], $player, 1, true);
}
function PlayMyAura($cardID)
{
global $currentPlayer;
PlayAura($cardID, $currentPlayer, 1);
}
//Scope = Private
//Call DestroyAura to destroy an aura
//FAB
// function AuraDestroyed($player, $cardID, $isToken = false)
// {
// $auras = &GetAuras($player);
// for($i = 0; $i < count($auras); $i += AuraPieces()) {
// switch($auras[$i]) {
// case "EVR141":
// if(!$isToken && $auras[$i + 5] > 0 && ClassContains($cardID, "ILLUSIONIST", $player)) {
// --$auras[$i + 5];
// PlayAura("MON104", $player);
// }
// break;
// case "DYN072":
// if($auras[$i] == $cardID) {
// $char = &GetPlayerCharacter($player);
// for($j = 0; $j < count($char); $j += CharacterPieces()) {
// if(CardSubType($char[$j]) == "Sword") $char[$j + 3] = 0;
// }
// }
// break;
// default: break;
// }
// }
// $goesWhere = GoesWhereAfterResolving($cardID);
// if(HasWard($cardID) && SearchCharacterActive($player, "DYN213") && !$isToken) {
// $char = &GetPlayerCharacter($player);
// $index = FindCharacterIndex($player, "DYN213");
// $char[$index + 1] = 1;
// GainResources($player, 1);
// }
// if(CardType($cardID) == "T" || $isToken) return; //Don't need to add to anywhere if it's a token
// switch($goesWhere) {
// case "GY":
// if(DelimStringContains(CardSubType($cardID), "Affliction")) {
// $player = ($player == 1 ? 2 : 1);
// } //Swap the player if it's an affliction
// AddGraveyard($cardID, $player, "PLAY");
// break;
// case "SOUL":
// AddSoul($cardID, $player, "PLAY");
// break;
// case "BANISH":
// BanishCardForPlayer($cardID, $player, "PLAY", "NA");
// break;
// default: break;
// }
// }
function AuraLeavesPlay($player, $index)
{
$auras = &GetAuras($player);
$cardID = $auras[$index];
$uniqueID = $auras[$index + 6];
$otherPlayer = ($player == 1 ? 2 : 1);
switch($cardID)
{
default: break;
}
}
function AuraPlayCounters($cardID)
{
switch ($cardID) {
default: return 0;
}
}
//FAB
// function DestroyAuraUniqueID($player, $uniqueID)
// {
// $index = SearchAurasForUniqueID($uniqueID, $player);
// if($index != -1) DestroyAura($player, $index, $uniqueID);
// }
//FAB
// function DestroyAura($player, $index, $uniqueID="")
// {
// $auras = &GetAuras($player);
// $isToken = $auras[$index + 4] == 1;
// if($uniqueID != "") $index = SearchAurasForUniqueID($uniqueID, $player);
// AuraDestroyAbility($player, $index, $isToken);
// $cardID = RemoveAura($player, $index);
// AuraDestroyed($player, $cardID, $isToken);
// return $cardID;
// }
function AuraDestroyAbility($player, $index, $isToken)
{
$auras = &GetAuras($player);
$cardID = $auras[$index];
switch($cardID)
{
default: break;
}
}
function RemoveAura($player, $index)
{
AuraLeavesPlay($player, $index);
$auras = &GetAuras($player);
$cardID = $auras[$index];
for($i = $index + AuraPieces() - 1; $i >= $index; --$i) {
unset($auras[$i]);
}
$auras = array_values($auras);
if(IsSpecificAuraAttacking($player, $index)) {
CloseCombatChain();
}
return $cardID;
}
// function AuraCostModifier($cardID)
// {
// global $currentPlayer;
// $otherPlayer = ($currentPlayer == 1 ? 2 : 1);
// $myAuras = &GetAuras($currentPlayer);
// $theirAuras = &GetAuras($otherPlayer);
// $modifier = 0;
// for($i = count($myAuras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// switch($myAuras[$i]) {
// case "4coy34bro8"://Dawn of Ashes
// if(CardElement($cardID) != "NORM") $modifier += 1;
// break;
// default: break;
// }
// }
// for($i = count($theirAuras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// switch($theirAuras[$i]) {
// case "4coy34bro8"://Dawn of Ashes
// if(CardElement($cardID) != "NORM") $modifier += 1;
// break;
// default:
// break;
// }
// }
// return $modifier;
// // }
// // CR 2.1 - 4.2.1. Players do not get priority during the Start Phase.
// // CR 2.1 - 4.3.1. The “beginning of the action phase” event occurs and abilities that trigger at the beginning of the action phase are triggered.
// //FAB
// // function AuraStartTurnAbilities()
// // {
// // global $mainPlayer, $EffectContext;
// // $auras = &GetAuras($mainPlayer);
// // for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// // $EffectContext = $auras[$i];
// // switch($auras[$i]) {
// // case "4coy34bro8"://Dawn of Ashes
// // WriteLog("Dawn of Ashes triggers");
// // $memory = &GetMemory($mainPlayer);
// // if(count($memory) == 0) break;
// // $index = rand(0, (count($memory)/MemoryPieces()) - 1) * MemoryPieces();
// // RevealCards($memory[$index], $mainPlayer);
// // if(CardElement($memory[$index]) != "NORM") DestroyAuraUniqueID($mainPlayer, $auras[$i + 6]);
// // break;
// // case "9w0ejcyuvu"://Prismatic Sanctuary
// // WriteLog("Prismatic Sanctuary triggers");
// // $memory = &GetMemory($mainPlayer);
// // if(count($memory) == 0) break;
// // $index = rand(0, (count($memory)/MemoryPieces()) - 1) * MemoryPieces();
// // RevealCards($memory[$index], $mainPlayer);
// // $element = CardElement($memory[$index]);
// // if($element != "FIRE" && $element != "WATER" && $element != "WIND") DestroyAuraUniqueID($mainPlayer, $auras[$i + 6]);
// // break;
// // case "8bls6g7xgw"://Fertile Grounds
// // AddDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYITEMS:subtype=HERB");
// // AddDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose an herb to copy");
// // AddDecisionQueue("CHOOSEMULTIZONE", $mainPlayer, "<-", 1);
// // AddDecisionQueue("MZOP", $mainPlayer, "GETCARDID", 1);
// // AddDecisionQueue("PUTPLAY", $mainPlayer, "-", 1);
// // break;
// // case "ao8bls6g7x"://Healing Aura
// // Restore(1, $mainPlayer);
// // break;
// // case "c7wklzjmwu"://Palatial Concourse
// // Opt($mainPlayer, 1);
// // break;
// // case "n1voy5ttkk"://Shatterfall Keep
// // if(SearchCount(SearchDiscard($mainPlayer, element:"WATER")) < 3) {
// // WriteLog("Shatterfall Keep sacrifices itself");
// // DestroyAuraUniqueID($mainPlayer, $auras[$i + 6]);
// // }
// // break;
// // default:
// // break;
// // }
// // }
// // }
// function AuraBeginEndPhaseTriggers()
// {
// global $mainPlayer;
// $auras = &GetAuras($mainPlayer);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// switch($auras[$i]) {
// default: break;
// }
// }
// $auras = array_values($auras);
// }
// function AuraBeginEndPhaseAbilities()
// {
// global $mainPlayer;
// global $CID_BloodRotPox, $CID_Inertia, $CID_Frailty;
// $auras = &GetAuras($mainPlayer);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = 0;
// switch($auras[$i]) {
// default: break;
// }
// if($remove == 1) DestroyAura($mainPlayer, $i);
// }
// $auras = array_values($auras);
// }
// function ChannelTalent($index, $talent)
// {
// global $mainPlayer;
// $auras = &GetAuras($mainPlayer);
// $toBottom = ++$auras[$index + 2];
// $numTalent = SearchCount(SearchPitch($mainPlayer, talent:$talent));
// if($toBottom <= $numTalent) {
// $cardName = CardName($auras[$index]);
// for($j = $toBottom; $j > 0; --$j) {
// AddDecisionQueue("MULTIZONEINDICES", $mainPlayer, "MYPITCH:talent=" . $talent, ($j == $toBottom ? 0 : 1));
// AddDecisionQueue("SETDQCONTEXT", $mainPlayer, "Choose $j card(s) to put on the bottom for " . $cardName, 1);
// AddDecisionQueue("MAYCHOOSEMULTIZONE", $mainPlayer, "<-", 1);
// AddDecisionQueue("MZADDZONE", $mainPlayer, "MYBOTDECK", 1);
// AddDecisionQueue("MZREMOVE", $mainPlayer, "-", 1);
// }
// AddDecisionQueue("ELSE", $mainPlayer, "-");
// AddDecisionQueue("PASSPARAMETER", $mainPlayer, "MYAURAS-" . $index, 1);
// AddDecisionQueue("MZDESTROY", $mainPlayer, "-", 1);
// } else {
// WriteLog(CardLink($auras[$index], $auras[$index]) . " was destroyed.");
// DestroyAura($mainPlayer, $index);
// }
// }
// function AuraEndTurnAbilities()
// {
// global $CS_NumNonAttackCards, $mainPlayer, $CS_HitsWithSword;
// $auras = &GetAuras($mainPlayer);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = false;
// switch($auras[$i]) {
// default: break;
// }
// if($remove) DestroyAura($mainPlayer, $i);
// }
// }
// function AuraEndTurnCleanup()
// {
// $auras = &GetAuras(1);
// for($i = 0; $i < count($auras); $i += AuraPieces()) $auras[$i + 5] = AuraNumUses($auras[$i]);
// $auras = &GetAuras(2);
// for($i = 0; $i < count($auras); $i += AuraPieces()) $auras[$i + 5] = AuraNumUses($auras[$i]);
// }
// function AuraDamagePreventionAmount($player, $index)
// {
// $auras = &GetAuras($player);
// switch($auras[$index])
// {
// default: break;
// }
// }
//This function is for effects that prevent damage and DO destroy themselves
// function AuraTakeDamageAbility($player, $index, $damage, $preventable)//FAB
// {
// if($preventable) $damage -= AuraDamagePreventionAmount($player, $index);
// DestroyAura($player, $index);
// return $damage;
// }
//This function is for effects that prevent damage and do NOT destroy themselves
//These are applied first and not prompted (which would be annoying because of course you want to do this before consuming something)
// function AuraTakeDamageAbilities($player, $damage, $type)//FAB
// {
// $auras = &GetAuras($player);
// $otherPlayer = $player == 1 ? 1 : 2;
// //CR 2.1 6.4.10f If an effect states that a prevention effect can not prevent the damage of an event, the prevention effect still applies to the event but its prevention amount is not reduced. Any additional modifications to the event by the prevention effect still occur.
// $preventable = CanDamageBePrevented($otherPlayer, $damage, $type);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// if($damage <= 0) {
// $damage = 0;
// break;
// }
// switch($auras[$i]) {
// default: break;
// }
// }
// return $damage;
// }
// function AuraLoseHealthAbilities($player, $amount)
// {
// global $mainPlayer;
// $auras = &GetAuras($player);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = 0;
// switch($auras[$i]) {
// default:
// break;
// }
// if($remove == 1) DestroyAura($player, $i);
// }
// return $amount;
// }
// function AuraPlayAbilities($attackID, $from="")
// {
// global $currentPlayer, $CS_NumIllusionistActionCardAttacks;
// $auras = &GetAuras($currentPlayer);
// $cardType = CardType($attackID);
// $cardSubType = CardSubType($attackID);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = 0;
// switch($auras[$i]) {
// default: break;
// }
// if($remove == 1) DestroyAura($currentPlayer, $i);
// }
// }
// function AuraAttackAbilities($attackID)
// {
// global $combatChain, $mainPlayer, $CS_PlayIndex, $CS_NumIllusionistAttacks;
// $auras = &GetAuras($mainPlayer);
// $attackType = CardType($attackID);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = 0;
// switch($auras[$i]) {
// default: break;
// }
// if($remove == 1) DestroyAura($mainPlayer, $i);
// }
// }
// function AuraHitEffects($attackID)
// {
// global $mainPlayer;
// $attackType = CardType($attackID);
// $attackSubType = CardSubType($attackID);
// $auras = &GetAuras($mainPlayer);
// for($i = count($auras) - AuraPieces(); $i >= 0; $i -= AuraPieces()) {
// $remove = 0;
// switch($auras[$i]) {
// default: break;
// }
// if($remove == 1) DestroyAura($mainPlayer, $i);
// }
// }
// function AuraAttackModifiers($index)
// {
// global $combatChain, $combatChainState, $CCS_AttackPlayedFrom;
// global $CID_Frailty;
// $modifier = 0;
// $player = $combatChain[$index + 1];
// $otherPlayer = ($player == 1 ? 2 : 1);
// $controlAuras = &GetAuras($player);
// for($i = 0; $i < count($controlAuras); $i += AuraPieces()) {
// switch($controlAuras[$i]) {
// default: break;
// }
// }
// $otherAuras = &GetAuras($otherPlayer);
// for($i = 0; $i < count($otherAuras); $i += AuraPieces()) {
// switch($otherAuras[$i]) {
// default: break;
// }
// }
// return $modifier;
// }
// function NumNonTokenAura($player)
// {
// $count = 0;
// $auras = &GetAuras($player);
// for($i = 0; $i < count($auras); $i += AuraPieces()) {
// if(CardType($auras[$i]) != "T") ++$count;
// }
// return $count;
// }
// function DestroyNumThisAura($player, $cardID, $num=1)
// {
// $auras = &GetAuras($player);
// $count = 0;
// for($i = count($auras) - AuraPieces(); $i >= 0 && $count < $num; $i -= AuraPieces()) {
// if($auras[$i] == $cardID) {
// DestroyAura($player, $i);
// ++$count;
// }
// }
// return $count;
// }
// function GetAuraGemState($player, $cardID)
// {
// global $currentPlayer;
// $auras = &GetAuras($player);
// $offset = ($currentPlayer == $player ? 7 : 8);
// $state = 0;
// for($i = 0; $i < count($auras); $i += AuraPieces()) {
// if($auras[$i] == $cardID && $auras[$i + $offset] > $state) $state = $auras[$i + $offset];
// }
// return $state;
// }