forked from Talishar/Talishar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeaponLogic.php
More file actions
54 lines (50 loc) · 1.86 KB
/
WeaponLogic.php
File metadata and controls
54 lines (50 loc) · 1.86 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
<?php
function IsWeapon($cardID)
{
global $currentPlayer;
return TypeContains($cardID, "W", $currentPlayer);
}
function IsWeaponAttack()
{
global $combatChain, $mainPlayer;
if (count($combatChain) == 0) return false;
if (TypeContains($combatChain[0], "W", $mainPlayer) || DelimStringContains(CardSubType($combatChain[0]), "Aura")) return true;
return false;
}
function WeaponIndices($chooser, $player, $subtype = "")
{
global $mainPlayer;
$whoPrefix = ($player == $chooser ? "MY" : "THEIR");
$character = GetPlayerCharacter($player);
$weapons = "";
for ($i = 0; $i < count($character); $i += CharacterPieces()) {
if ($character[$i + 1] != 0 && CardType($character[$i]) == "W" && ($subtype == "" || CardSubType($character[$i]) == $subtype)) {
if ($weapons != "") $weapons .= ",";
$weapons .= $whoPrefix . "CHAR-" . $i;
}
}
$auraWeapons = (SearchCharacterForCard($player, "MON003") || SearchCharacterForCard($player, "MON088") || SearchCharacterForCard($player, "DTD216") || SearchCharacterForCard($player, "MST130")) && ($player == $mainPlayer);
if ($auraWeapons) {
$auras = GetAuras($player);
for ($i = 0; $i < count($auras); $i += AuraPieces()) {
if (SearchCharacterForCard($player, "MST130")) {
if (HasWard($auras[$i], $player)) {
if ($weapons != "") $weapons .= ",";
$weapons .= $whoPrefix . "AURAS-" . $i;
}
} else if (ClassContains($auras[$i], "ILLUSIONIST", $player)) {
if ($weapons != "") $weapons .= ",";
$weapons .= $whoPrefix . "AURAS-" . $i;
}
}
}
return $weapons;
}
function ApplyEffectToEachWeapon($effectID)
{
global $currentPlayer;
$character = &GetPlayerCharacter($currentPlayer);
for ($i = 0; $i < count($character); $i += CharacterPieces()) {
if (CardType($character[$i]) == "W") AddCharacterEffect($currentPlayer, $i, $effectID);
}
}