forked from Talishar/Talishar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWeaponLogic.php
54 lines (49 loc) · 1.8 KB
/
WeaponLogic.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
<?php
function IsWeapon($cardID)
{
return CardType($cardID) == "W";
}
function IsWeaponAttack()
{
global $combatChain;
if(count($combatChain) == 0) return false;
if(CardType($combatChain[0]) == "W" || 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")) && ($player == $mainPlayer);
if($auraWeapons) {
$auras = GetAuras($player);
for($i = 0; $i < count($auras); $i += AuraPieces()) {
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);
}
}
function IsAuraWeapon($cardID, $player, $from)
{
if((SearchCharacterForCard($player, "MON003") || SearchCharacterForCard($player, "MON088") || SearchCharacterForCard($player, "DTD216")) && DelimStringContains(CardSubType($cardID), "Aura") && $from == "PLAY") return true;
else return false;
}