Lobby Player vs Quest Player
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Lobby Player vs Quest Player
by friarsol » 12 Jan 2014, 22:21
I believe this question is mostly for Max, but figured I'd post it just in case there was other ancillary concerns that popped up due to the conversation:
I'm trying to reuse AnteResult with Gain Ownership cards (like Darkpact). Along with this, I'm moving some logic out of the Quest WinLose View to Match.executeAnte() where it makes more sense. Now I believe I have everything setup properly, but one thing I just ran across seems odd to me, and prevents things from working...
The "Quest Player" LobbyPlayer questPlayer = FServer.instance.getLobby().getQuestPlayer() that adds cards into the trunk of the Quest in QuestWinLose, doesn't seem to match any of the players actually participating in the Match.
So when I do questPlayer.getPlayer(lastGame) I get null, instead of getting one of the registered Players in lastGame.getRegisteredPlayers() as I was expecting?
lastGame.getRegisteredPlayers() gives me a list of two Players named:
1) Sol
2) Wyatt Earp (or whoever I happened to be playing)
But FServer.instance.getLobby().getQuestPlayer() gives me:
a LobbyPlayerHuman named:
1) Human
Any idea why the LobbyPlayer that enters a quest match isn't actually the Quest Player?
I'm trying to reuse AnteResult with Gain Ownership cards (like Darkpact). Along with this, I'm moving some logic out of the Quest WinLose View to Match.executeAnte() where it makes more sense. Now I believe I have everything setup properly, but one thing I just ran across seems odd to me, and prevents things from working...
The "Quest Player" LobbyPlayer questPlayer = FServer.instance.getLobby().getQuestPlayer() that adds cards into the trunk of the Quest in QuestWinLose, doesn't seem to match any of the players actually participating in the Match.
So when I do questPlayer.getPlayer(lastGame) I get null, instead of getting one of the registered Players in lastGame.getRegisteredPlayers() as I was expecting?
lastGame.getRegisteredPlayers() gives me a list of two Players named:
1) Sol
2) Wyatt Earp (or whoever I happened to be playing)
But FServer.instance.getLobby().getQuestPlayer() gives me:
a LobbyPlayerHuman named:
1) Human
Any idea why the LobbyPlayer that enters a quest match isn't actually the Quest Player?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Lobby Player vs Quest Player
by Max mtg » 13 Jan 2014, 05:56
Sol, Please do not move any quest-specific logic to Match. Match (part of game package) will not know about quests and how they are handled. There's going to be only a "Quest" GameMode in forge.game.
If quest mode is ever needed for multiplayer, we'll exract a dedicated module for it
So I believe a better destination for that quest logic is forge.quest.* package.
forge.game.player.LobbyPlayer.getPlayer(Game) is a factory method to create ingame Player from the Lobby* one. I'll rename it to avoid further confusion.
The code to find your quest player from a list of ingame ones looks like this:
If quest mode is ever needed for multiplayer, we'll exract a dedicated module for it
So I believe a better destination for that quest logic is forge.quest.* package.
forge.game.player.LobbyPlayer.getPlayer(Game) is a factory method to create ingame Player from the Lobby* one. I'll rename it to avoid further confusion.
The code to find your quest player from a list of ingame ones looks like this:
- Code: Select all
for (Player p : lastGame.getRegisteredPlayers()) {
if (p.getLobbyPlayer().equals(questPlayer)) { /* Give them prizes */ }
}
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: Lobby Player vs Quest Player
by friarsol » 13 Jan 2014, 15:35
Nope, I wasn't planning on it. There's just some duplicate code in executeAnte and QuestWinLose, that I was merging into executeAnte. The actual part that would add/remove cards from the Quest trunk still would happen in QuestWinLose.Max mtg wrote:Sol, Please do not move any quest-specific logic to Match. Match (part of game package) will not know about quests and how they are handled. There's going to be only a "Quest" GameMode in forge.game.
If quest mode is ever needed for multiplayer, we'll exract a dedicated module for it
So I believe a better destination for that quest logic is forge.quest.* package.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Lobby Player vs Quest Player
by Max mtg » 13 Jan 2014, 17:35
Ok, sound great then.friarsol wrote:Nope, I wasn't planning on it. There's just some duplicate code in executeAnte and QuestWinLose, that I was merging into executeAnte. The actual part that would add/remove cards from the Quest trunk still would happen in QuestWinLose.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 71 guests