Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
danbastin committed Jan 28, 2025
2 parents 921bbf9 + 21c7551 commit ac72499
Show file tree
Hide file tree
Showing 20 changed files with 371 additions and 254 deletions.
21 changes: 21 additions & 0 deletions APIs/GetCosmetics.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@
$cardBack->name = "Force Fam";
$cardBack->id = 14;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Holocron Card Club";
$cardBack->id = 15;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Maclunky Gaming";
$cardBack->id = 16;
$response->cardBacks[] = $cardBack;
$cardBack->name = "The Cantina Crew";
$cardBack->id = 17;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Rajeux TCG";
$cardBack->id = 18;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Under The Twin Suns";
$cardBack->id = 19;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Too Many Hans";
$cardBack->id = 20;
$response->cardBacks[] = $cardBack;
$cardBack->name = "Porg Depot";
$cardBack->id = 21;
$response->cardBacks[] = $cardBack;

$response->playmats = [];
if(IsUserLoggedIn()) {
Expand Down
404 changes: 231 additions & 173 deletions AllyAbilities.php

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion BootPlayer.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
$gameToken = TryGET("gameToClose", "");
$playerToBoot = TryGET("playerToBoot", "");

SetCachePiece($gameToken, $playerToBoot+3, 2);
SetCachePiece($gameToken, $playerToBoot+3, 2);//internet connection status
SetCachePiece($gameToken, $playerToBoot+14, 3);//forced disconnect status

header("Location: ./zzModPage.php");

Expand Down
32 changes: 28 additions & 4 deletions CardDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ function HasShielded($cardID, $player, $index)
{
switch($cardID)
{
//SOR
//Spark of Rebellion
case "b0dbca5c05"://Iden Versio Leader Unit
return !LeaderAbilitiesIgnored();
case "0700214503"://Crafty Smuggler
Expand All @@ -703,7 +703,7 @@ function HasShielded($cardID, $player, $index)
case "7728042035"://Chimaera
case "7870435409"://Bib Fortuna
return true;
//SHD
//Shadows of the Galaxy
case "0088477218"://Privateer Scyk
return SearchCount(SearchAllies($player, aspect:"Cunning")) > 1;
case "6939947927"://Hunter of the Haxion Brood
Expand All @@ -717,7 +717,7 @@ function HasShielded($cardID, $player, $index)
case "6635692731"://Hutt's Henchman
case "4341703515"://Supercommando Squad
return true;
//JTL
//Jump to Lightspeed
case "6311662442"://Director Krennic
case "1519837763"://Shuttle ST-149
case "6300552434"://Gold Leader
Expand Down Expand Up @@ -1187,6 +1187,14 @@ function CheckJTLAbilityTypes($cardID) {
return LeaderAbilitiesIgnored() ? "" : "A";
case "0011262813"://Wedge Antilles Leader
return LeaderAbilitiesIgnored() ? "" : "A";
case "3933322003"://Rose Tico Leader
return LeaderAbilitiesIgnored() ? "" : "A";
case "0616724418"://Han Solo Leader
return LeaderAbilitiesIgnored() ? "" : "A";
case "3658069276"://Lando Calrissian Leader
return LeaderAbilitiesIgnored() ? "" : "A";
case "7514405173"://Admiral Ackbar Leader
return LeaderAbilitiesIgnored() ? "" : "A";
default: return "";
}
}
Expand Down Expand Up @@ -1449,6 +1457,15 @@ function CheckJTLAbilityNames($cardID) {
return LeaderAbilitiesIgnored() ? "" : "Play";
case "0011262813"://Wedge Antilles Leader
return LeaderAbilitiesIgnored() ? "" : "Play";
case "3933322003"://Rose Tico Leader
return LeaderAbilitiesIgnored() ? "" : "Heal";
case "0616724418"://Han Solo Leader
return LeaderAbilitiesIgnored() ? "" : "Odds";
case "3658069276"://Lando Calrissian Leader
return LeaderAbilitiesIgnored() ? "" : "Play";
case "7514405173"://Admiral Ackbar Leader
return LeaderAbilitiesIgnored() ? "" : "Exhaust";

default: return "";
}
}
Expand Down Expand Up @@ -1829,6 +1846,10 @@ function LeaderUnit($cardID) {
return "f6eb711cf3";
case "4030832630"://Admiral Piett
return "649c6a9dbd";
case "5846322081"://Grand Admiral Thrawn
return "53207e4131";
case "3933322003"://Rose Tico
return "590b638b18";
default: return "";
}
}
Expand Down Expand Up @@ -1959,7 +1980,10 @@ function LeaderUndeployed($cardID) {
return "9831674351";
case "649c6a9dbd"://Admiral Piett
return "4030832630";

case "53207e4131"://Grand Admiral Thrawn
return "5846322081";
case "590b638b18"://Rose Tico
return "3933322003";
default: return "";
}
}
Expand Down
71 changes: 9 additions & 62 deletions CardLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -612,15 +612,12 @@ function ProcessTrigger($player, $parameter, $uniqueID, $additionalCosts, $targe
}
break;
case "SHIELDED":
$index = SearchAlliesForUniqueID($uniqueID, $player);
$ally = new Ally("MYALLY-" . $index, $player);
$ally = new Ally($uniqueID, $player);
$ally->Attach("8752877738");//Shield Token
break;
case "AFTERPLAYABILITY":
$arr = explode(",", $uniqueID);
$abilityID = $arr[0];
$uniqueID = $arr[1];
AllyPlayCardAbility($target, $player, from: $additionalCosts, abilityID:$abilityID, uniqueID:$uniqueID);
$data = explode(",",$target); // $cardID, $player, $numUses, $playedCardID
AllyPlayCardAbility($data[1], $data[0], $uniqueID, $data[2], $data[3], from:$additionalCosts);
break;
case "AFTERDESTROYTHEIRSABILITY":
$data=explode(",",$target);
Expand Down Expand Up @@ -795,18 +792,6 @@ function ProcessTrigger($player, $parameter, $uniqueID, $additionalCosts, $targe
AddDecisionQueue("PASSPARAMETER", $player, "{0}", 1);
AddDecisionQueue("MZOP", $player, "PLAYCARD", 1);
break;
case "724979d608"://Cad Bane Leader Unit
$cadIndex = SearchAlliesForCard($player, "724979d608");
$otherPlayer = ($player == 1 ? 2 : 1);
AddDecisionQueue("YESNO", $player, "if you want use Cad Bane's ability");
AddDecisionQueue("NOPASS", $player, "-");
AddDecisionQueue("PASSPARAMETER", $player, "MYALLY-" . $cadIndex, 1);
AddDecisionQueue("ADDMZUSES", $player, "-1", 1);
AddDecisionQueue("MULTIZONEINDICES", $otherPlayer, "MYALLY", 1);
AddDecisionQueue("SETDQCONTEXT", $otherPlayer, "Choose a unit to deal 2 damage to", 1);
AddDecisionQueue("CHOOSEMULTIZONE", $otherPlayer, "<-", 1);
AddDecisionQueue("MZOP", $otherPlayer, "DEALDAMAGE,2", 1);
break;
case "1384530409"://Cad Bane Leader ability
$otherPlayer = ($player == 1 ? 2 : 1);
AddDecisionQueue("YESNO", $player, "if you want use Cad Bane's ability");
Expand All @@ -817,25 +802,13 @@ function ProcessTrigger($player, $parameter, $uniqueID, $additionalCosts, $targe
AddDecisionQueue("CHOOSEMULTIZONE", $otherPlayer, "<-", 1);
AddDecisionQueue("MZOP", $otherPlayer, "DEALDAMAGE,1", 1);
break;
case "4088c46c4d"://Mandalorian Leader Unit
AddDecisionQueue("MULTIZONEINDICES", $player, "THEIRALLY:maxHealth=6");
AddDecisionQueue("SETDQCONTEXT", $player, "Choose a unit to exhaust", 1);
AddDecisionQueue("MAYCHOOSEMULTIZONE", $player, "<-", 1);
AddDecisionQueue("MZOP", $player, "REST", 1);
break;
case "9005139831"://Mandalorian Leader Ability
AddDecisionQueue("MULTIZONEINDICES", $player, "THEIRALLY:maxHealth=4");
AddDecisionQueue("SETDQCONTEXT", $player, "Choose a unit to exhaust", 1);
AddDecisionQueue("MAYCHOOSEMULTIZONE", $player, "<-", 1);
AddDecisionQueue("MZOP", $player, "REST", 1);
AddDecisionQueue("EXHAUSTCHARACTER", $player, FindCharacterIndex($player, "9005139831"), 1);
break;
case "3589814405"://tactical droid commander
AddDecisionQueue("MULTIZONEINDICES", $player, "THEIRALLY:maxCost=".$target);
AddDecisionQueue("SETDQCONTEXT", $player, "Choose a unit to exhaust", 1);
AddDecisionQueue("MAYCHOOSEMULTIZONE", $player, "<-", 1);
AddDecisionQueue("MZOP", $player, "REST", 1);
break;
case "2358113881"://Quinlan Vos
$allies = &GetAllies($player);
if(count($allies) == 0) break;
Expand All @@ -846,22 +819,6 @@ function ProcessTrigger($player, $parameter, $uniqueID, $additionalCosts, $targe
AddDecisionQueue("MZOP", $player, "DEALDAMAGE,1", 1);
AddDecisionQueue("EXHAUSTCHARACTER", $player, FindCharacterIndex($player, "2358113881"), 1);
break;
case "4935319539"://Krayt Dragon
$otherPlayer = ($player == 1 ? 2 : 1);
$damage = CardCost($target);
AddDecisionQueue("MULTIZONEINDICES", $otherPlayer, "THEIRALLY:arena=Ground");
AddDecisionQueue("PREPENDLASTRESULT", $otherPlayer, "THEIRCHAR-0,");
AddDecisionQueue("SETDQCONTEXT", $otherPlayer, "Choose a card to deal " . $damage . " damage to");
AddDecisionQueue("MAYCHOOSEMULTIZONE", $otherPlayer, "<-", 1);
AddDecisionQueue("MZOP", $otherPlayer, "DEALDAMAGE," . $damage, 1);
break;
case "0199085444"://Lux Bonteri
$otherPlayer = ($player == 1 ? 2 : 1);
AddDecisionQueue("MULTIZONEINDICES", $otherPlayer, "MYALLY&THEIRALLY");
AddDecisionQueue("SETDQCONTEXT", $otherPlayer, "Choose a unit to ready or exhaust");
AddDecisionQueue("CHOOSEMULTIZONE", $otherPlayer, "<-", 1);
AddDecisionQueue("SPECIFICCARD", $otherPlayer, "LUXBONTERI", 1);
break;
case "3045538805"://Hondo Ohnaka Leader
AddDecisionQueue("MULTIZONEINDICES", $player, "MYALLY&THEIRALLY");
AddDecisionQueue("SETDQCONTEXT", $player, "Choose a unit to give an experience token", 1);
Expand All @@ -877,16 +834,6 @@ function ProcessTrigger($player, $parameter, $uniqueID, $additionalCosts, $targe
PrependDecisionQueue("SETDQCONTEXT", $player, "Choose a card to give +1 power");
PrependDecisionQueue("MULTIZONEINDICES", $player, "MYALLY");
break;
case "3952758746"://Toro Calican
$toroIndex = SearchAlliesForCard($player, "3952758746");
AddDecisionQueue("YESNO", $player, "if you want to use Toro Calican's ability");
AddDecisionQueue("NOPASS", $player, "-");
AddDecisionQueue("PASSPARAMETER", $player, "MYALLY-" . LastAllyIndex($player), 1);
AddDecisionQueue("MZOP", $player, "DEALDAMAGE,1", 1);
AddDecisionQueue("PASSPARAMETER", $player, "MYALLY-" . $toroIndex, 1);
AddDecisionQueue("MZOP", $player, "READY", 1);
AddDecisionQueue("ADDMZUSES", $player, "-1", 1);
break;
case "0754286363"://The Mandalorian's Rifle
AddDecisionQueue("MULTIZONEINDICES", $player, "THEIRALLY");
AddDecisionQueue("MZFILTER", $player, "definedType=Leader");
Expand Down Expand Up @@ -1163,25 +1110,25 @@ function UIDIsAffectedByMalevolence($uniqueID) {
return $found;
}

function IndirectDamage($player, $amount)
function IndirectDamage($player, $amount, $fromUnitEffect=false)
{
$sourcePlayer = $player == 1 ? 2 : 1;
$amount += SearchCount(SearchAlliesForCard($sourcePlayer, "4560739921"));
$amount += SearchCount(SearchAlliesForCard($sourcePlayer, "4560739921"));//Hunting Aggressor
if(SearchCount(SearchAlliesForCard($sourcePlayer, "1330473789")) > 0) { //Devastator
for($i=0; $i<$amount; ++$i) {
AddDecisionQueue("MULTIZONEINDICES", $sourcePlayer, "THEIRALLY", $i == 0 ? 0 : 1);
AddDecisionQueue("PREPENDLASTRESULT", $sourcePlayer, "THEIRCHAR-0,", $i == 0 ? 0 : 1);
AddDecisionQueue("SETDQCONTEXT", $sourcePlayer, "Choose a card to deal an indirect damage (Remaining: " . ($amount-$i) . ")", $i == 0 ? 0 : 1);
AddDecisionQueue("MAYCHOOSEMULTIZONE", $sourcePlayer, "<-", 1);
AddDecisionQueue("MZOP", $sourcePlayer, "DEALDAMAGE,1,$sourcePlayer,0,0", 1);
AddDecisionQueue("CHOOSEMULTIZONE", $sourcePlayer, "<-", 1);
AddDecisionQueue("MZOP", $sourcePlayer, "DEALDAMAGE,1,$sourcePlayer," . ($fromUnitEffect ? "1" : "0") . ",0", 1);
}
} else {
for($i=0; $i<$amount; ++$i) {
AddDecisionQueue("MULTIZONEINDICES", $player, "MYALLY", $i == 0 ? 0 : 1);
AddDecisionQueue("PREPENDLASTRESULT", $player, "MYCHAR-0,", $i == 0 ? 0 : 1);
AddDecisionQueue("SETDQCONTEXT", $player, "Choose a card to deal an indirect damage (Remaining: " . ($amount-$i) . ")", $i == 0 ? 0 : 1);
AddDecisionQueue("MAYCHOOSEMULTIZONE", $player, "<-", 1);
AddDecisionQueue("MZOP", $player, "DEALDAMAGE,1,$player,0,0", 1);
AddDecisionQueue("CHOOSEMULTIZONE", $player, "<-", 1);
AddDecisionQueue("MZOP", $player, "DEALDAMAGE,1,$sourcePlayer," . ($fromUnitEffect ? "1" : "0") . ",0", 1);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function CharacterPieces()
return 11;
}

//TODO(TwinSuns): look into how many places are calling charArr[CharacterPieces()] to get the leader cardID

//0 - Card ID
//1 - Mods (INT == Intimidated)
//2 - Unique ID?
Expand Down
41 changes: 37 additions & 4 deletions CoreLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -2005,13 +2005,13 @@ function SelfCostModifier($cardID, $from, $reportMode=false)
$allies = &GetAllies($currentPlayer);
for($i=0; $i<count($allies); $i+=AllyPieces())
{
//SHD
//Shadows of the Galaxy
if($allies[$i+1] == 0) continue;
switch($allies[$i]) {
case "5035052619"://Jabba the Hutt
if(DefinedTypesContains($cardID, "Event", $currentPlayer) && TraitContains($cardID, "Trick", $currentPlayer)) $modifier -= 1;
break;
//JTL
//Jump to Lightspeed
case "649c6a9dbd"://Admiral Piett
if(TraitContains($cardID, "Capital Ship", $currentPlayer)) $modifier -= 2;
break;
Expand Down Expand Up @@ -5817,7 +5817,7 @@ function PlayAbility($cardID, $from, $resourcesPaid, $target = "-", $additionalC
IndirectDamage($otherPlayer, $indirectAmount);
break;
case "2778554011"://General Draven
PlayAlly("9415311381", $currentPlayer); //X-Wing
CreateXWing($currentPlayer);
break;
case "1303370295"://Death Space Skirmisher
if (SearchCount(SearchAllies($currentPlayer, arena: "Space")) > 1) {
Expand All @@ -5829,7 +5829,7 @@ function PlayAbility($cardID, $from, $resourcesPaid, $target = "-", $additionalC
break;
case "1330473789"://Devastator
$otherPlayer = $currentPlayer == 1 ? 2 : 1;
IndirectDamage($otherPlayer, 4);
IndirectDamage($otherPlayer, 4, true);
break;
case "2388374331"://Blue Leader
AddDecisionQueue("YESNO", $currentPlayer, "Do you want to pay 2 to gain 2 experience tokens?", 1);
Expand Down Expand Up @@ -5888,10 +5888,43 @@ function PlayAbility($cardID, $from, $resourcesPaid, $target = "-", $additionalC
AddDecisionQueue("MZOP", $currentPlayer, "PLAYCARD", 1);
}
break;
case "3933322003"://Rose Tico Leader
if(GetResolvedAbilityName($cardID) == "Heal") {
AddDecisionQueue("MULTIZONEINDICES", $currentPlayer, "MYALLY:trait=Vehicle&THEIRALLY:trait=Vehicle");
AddDecisionQueue("MZFILTER", $currentPlayer, "numAttacks=0");
AddDecisionQueue("SETDQCONTEXT", $currentPlayer, "Choose a vehicle unit to heal");
AddDecisionQueue("CHOOSEMULTIZONE", $currentPlayer, "<-", 1);
AddDecisionQueue("MZOP", $currentPlayer, "RESTORE,2", 1);
}
break;
case "0616724418"://Han Solo Leader
if(GetResolvedAbilityName($cardID) == "Odds") {
WriteLog(CardLink($cardID, $cardID) . " ability is not implemented yet. Reverting gamestate");
RevertGamestate();
}
break;
case "3658069276"://Lando Calrissian Leader
if(GetResolvedAbilityName($cardID) == "Play") {
WriteLog(CardLink($cardID, $cardID) . " ability is not implemented yet. Reverting gamestate");
RevertGamestate();
}
break;
case "7514405173"://Admiral Ackbar Leader
if(GetResolvedAbilityName($cardID) == "Exhaust") {
WriteLog(CardLink($cardID, $cardID) . " ability is not implemented yet. Reverting gamestate");
RevertGamestate();
}
break;
case "1519837763"://Shuttle ST-149
if($from != "PLAY") {
ShuttleST149($currentPlayer);
}
break;
case "6648978613"://Fett's Firespray (Feared Silhouettte)
$damage = ControlsNamedCard($currentPlayer, "Boba Fett") ? 2 : 1;
$otherPlayer = $currentPlayer == 1 ? 2 : 1;
IndirectDamage($otherPlayer, $damage, true);
break;
//PlayAbility End
default: break;
}
Expand Down
13 changes: 6 additions & 7 deletions GetNextTurn2.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,8 @@
$currentPlayerInputTimeout = true;
$lastUpdate = 0;
} else if ($gameState == 5 && $lastCurrentPlayer == $otherP && ($currentTime - $lastActionTime) > $InputTimeoutMS && $lastActionWarning == $otherP && $finalWarning == $otherP) {
WriteLog("Player $otherP has disconnected.");
$opponentDisconnected = true;
SetCachePiece($gameName, $otherP + 3, "2");
WriteLog("Player $otherP is inactive.");
SetCachePiece($gameName, $otherP + 14, 3);
SetCachePiece($gameName, 18, 0);
GamestateUpdated($gameName);
}
}
Expand All @@ -156,7 +153,7 @@
if ($count == 100) break;
}
$otherP = ($playerID == 1 ? 2 : 1);
$opponentDisconnected = GetCachePiece($gameName, $otherP + 3) == "2";
$opponentDisconnected = GetCachePiece($gameName, $otherP + 3) == "2" || GetCachePiece($gameName, $otherP + 14) == "3";

if ($lastUpdate != 0 && $cacheVal <= $lastUpdate) {
echo "0";
Expand Down Expand Up @@ -470,7 +467,7 @@ function getCaption($layer) {

// Add the card to the content
$cardId = $layerName;
if($cardId == "AFTERPLAYABILITY") $cardId = explode(',', $layers[$i+5])[0];
if($cardId == "AFTERPLAYABILITY") $cardId = explode(',', $layers[$i+3])[0];
if($cardId == "AFTERDESTROYABILITY") $cardId = $layers[$i+3];
if($cardId == "AFTERDESTROYFRIENDLYABILITY") $cardId = explode(",", $layers[$i+3])[0];
if($cardId == "AFTERDESTROYTHEIRSABILITY") {
Expand Down Expand Up @@ -552,8 +549,10 @@ function getCaption($layer) {
}

if ($turn[0] == "YESNO" && $turn[1] == $playerID) {
$content = CreateButton($playerID, "Yes", 20, "YES", "20px");
$content = "<div style='display:flex;justify-content:center;margin-top:24px;'>";
$content .= CreateButton($playerID, "Yes", 20, "YES", "20px");
$content .= CreateButton($playerID, "No", 20, "NO", "20px");
$content .= "</div>";
if (GetDQHelpText() != "-") $caption = implode(" ", explode("_", GetDQHelpText()));
else $caption = "Choose " . TypeToPlay($turn[0]);
echo CreatePopup("YESNO", [], 0, 1, $caption, 1, $content);
Expand Down
Loading

0 comments on commit ac72499

Please sign in to comment.