Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add MTG Forge game #2640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/updates/Forge.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

webVer=$(get_release card-forge/forge)

source $GITHUB_WORKSPACE/.github/workflows/update_github_script.sh
1 change: 1 addition & 0 deletions apps/Forge/credits
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Script created by ArcharGelod
12 changes: 12 additions & 0 deletions apps/Forge/description
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Forge is a "Rules Engine" for the most popular card game Magic: the Gathering.

Forge creates a unique experience by combining an enormous card library with some RPG elements in Quest mode (comparable to the 'Shandalar', the late 90's PC Game) and Planar Conquest on the mobile version.
Forge also includes a Graphical Map Based game mode called "Adventure Mode", which is more akin to 'Shandalar.' (Only in Mobile UI version)

Start Forge with Desktop UI: Menu -> Games -> MTG Forge
Start Forge with Mobile UI: Menu -> Games -> MTG Forge Adventure
Start with Desktop UI in terminal: ~/.local/share/mtg-forge/forge.sh
Start with Mobile UI in terminal: ~/.local/share/mtg-forge/forge-mobile.sh
Start Simulation mode in terminal: ~/.local/share/mtg-forge/forge.sh sim

Forge is open source software released under the GNU Public License and not related in any way with Wizards of the Coast.
Binary file added apps/Forge/icon-24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/Forge/icon-64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions apps/Forge/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
version=forge-1.6.64
subversion=${version/forge-} # remove "forge-" from string

game_folder="$HOME/.local/share/mtg-forge"
repo_url="https://github.com/card-forge/forge/releases/download/${version}"
archive_name="forge-gui-desktop-${subversion}.tar.bz2"

#cleanup
trap "rm -f /tmp/$archive_name; exit" EXIT

status "Installing Java 17"
case "$__os_id" in
# Raspbian is not reported as a derivative of Debian (no /etc/upstream-release/lsb-release file)
Raspbian | Debian | Kali)
adoptium_installer || exit 1
install_packages temurin-17-jre || exit 1
;;
Ubuntu)
install_packages openjdk-17-jre || exit 1
;;
*)
error "$__os_id appears to be an unsupported OS"
;;
esac

status "Downloading snapshot archive."
[[ -f "/tmp/$archive_name" ]] && rm -f "/tmp/$archive_name"
wget "$repo_url/$archive_name" --directory-prefix /tmp || error 'Failed to download latest release!'

# check if folder already exists
if [[ -d "$game_folder" ]]; then
warning "Found existing Forge directory in $game_folder !!!" && echo "It will be moved to /tmp/mtg-forge-old !!!"
mv "$game_folder" /tmp/MTG-Forge-old || error "Failed to move $game_folder directory to /tmp/ !!! Please, move or delete it yourself and then try installing again."
fi

mkdir "$game_folder"

status "Extracting the game archive."
tar -xvf "/tmp/forge-gui-desktop-${subversion}.tar.bz2" --directory="$game_folder" || error 'Failed to extract the game archive!'

# problem: forge-adventure doesn't launch with java versions > 8
# workaround: create `forge-mobile.sh` script that's a modified copy of `forge.sh` script
status "Creating workaround for adventure shell script."
jarname="$(find "$game_folder" -name 'forge-gui-mobile*.jar' | xargs basename)"
cp "$game_folder/forge.sh" "$game_folder/forge-mobile.sh"
sed -i "s|forge-gui-desktop-.*-jar-with-dependencies.jar|$jarname|" "$game_folder/forge-mobile.sh"
Comment on lines +42 to +47
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the goal here? if the program doesn't launch with java > 8 then why are you installing java 17?

Copy link
Author

@janAkali janAkali Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with java > 8 then why are you installing java 17?

the app itself does work with java version > 8, but iirc launch scripts for "adventure" mode doesn't have proper flags so it just fails.

Why not just install java 8? Because it doesn't work with java 8 😂. Forge needs a java fx library that's not available in free (as in freedom) builds of java 8, apparently it has support only for official oracle's build of java 8 and that's certainly harder to legally obtain.

Maybe it's possible to make it work with java 8 on linux, but with my limited knowledge of java - I couldn't. But all other versions of java should be supported, I chose java 17 because most software in pi-apps use that version, so good chances that it will be already installed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link an upstream bug report for that issue (or PR to fix it if one is open). If it's just bad flags it would be better to have it corrected upstream.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you link an upstream bug report for that issue (or PR to fix it if one is open). If it's just bad flags it would be better to have it corrected upstream.

Here's my issue from 1+ year ago - Card-Forge/forge#2221, it was marked as stale and closed. Note, that I was absolutely unfamiliar with git at that time.
Looking at it now, I could try to submit PR that fixes the issue and we will see if it gets somewhere 😅.


# create desktop menu entries
echo "[Desktop Entry]
Type=Application
Name=MTG Forge
GenericName=Forge
Comment=Rules Engine for MTG card game.
Path=$game_folder
Exec=$game_folder/forge.sh
Icon=$game_folder/res/skins/default/hd_logo.png
Terminal=false
Categories=Game;Java;
Keywords=MTG;Forge;Adventure;Card;Game;Magic
StartupNotify=true" > "$HOME/.local/share/applications/Forge.desktop"

echo "[Desktop Entry]
Type=Application
Name=MTG Forge Adventure
GenericName=Forge-mobile
Comment=Mobile UI version of Forge with the Adventure mode.
Path=$game_folder
Exec=$game_folder/forge-mobile.sh
Icon=$game_folder/res/skins/default/adv_logo.png
Terminal=false
Categories=Game;Java;
Keywords=MTG;Forge;Adventure;Card;Game;Magic
StartupNotify=true" > "$HOME/.local/share/applications/Forge-Adventure.desktop"
11 changes: 11 additions & 0 deletions apps/Forge/uninstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

purge_packages || exit 1
remove_repofile_if_unused /etc/apt/sources.list.d/adoptium.list

#remove game folder
rm -rf "$HOME/.local/share/mtg-forge"

#remove desktop menu entries
rm -f "$HOME/.local/share/applications/Forge.desktop"
rm -f "$HOME/.local/share/applications/Forge-Adventure.desktop"
1 change: 1 addition & 0 deletions apps/Forge/website
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/Card-Forge/forge/wiki