r9843 Discussion
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
3 posts
• Page 1 of 1
r9843 Discussion
by Braids » 22 Aug 2011, 02:47
@Max mtg, were the reasons for these changes influenced by any particular issues in Mantis? it looks like you may have been partially addressing multiple issues. based on your comments alone, i couldn't determine your goals very clearly.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
Re: r9843 Discussion
by Max mtg » 22 Aug 2011, 04:59
Well, it's issue 0047 - decouple view from model+controller.
The main goal was to provide options for quest reward booster generation. Although it's somewhat easy, requiring just to add a parameter to QuestData.addCards, the way the Gui_WinLose code was organized didn't please me. It contained comparisons against strings for determining special win conditions, like that
Old code also calculated some victory conditions on the fly, that is exactly inside the Gui_WinLose class, I mean
So, considering this way of victory condition checks awful, I decided to rewrite the whole system.
Now it is extensible and allows us to introduce more stats and achievements, like total damage dealt to creatures, max number of creatures on battlefield, anmount of lives gained throughout the game and so on... We can analyse these metrics after the match is complete and award something in case they are somehow notable.
The original goal was committed in r9853: player can now choose cards from which format he would like to receive as a reward booster. Though, without proper UI this looks quite ugly - a choice window pops on, then a dialog, then another dialog about credits gained, and yet another one with random rare.
The main goal was to provide options for quest reward booster generation. Although it's somewhat easy, requiring just to add a parameter to QuestData.addCards, the way the Gui_WinLose code was organized didn't please me. It contained comparisons against strings for determining special win conditions, like that
- Code: Select all
for (String s : wins) {
if (s != null) {
sb.append("Alternate win condition: ");
sb.append("<u>");
sb.append(s);
sb.append("</u>");
sb.append("! Bonus: <b>+");
if (s.equals("Poison Counters"))
sb.append(QuestPreferences.getMatchRewardPoisonWinBonus());
else if (s.equals("Milled"))
sb.append(QuestPreferences.getMatchRewardMilledWinBonus());
else if (s.equals("Battle of Wits") ||
s.equals("Felidar Sovereign") || s.equals("Helix Pinnacle") || s.equals("Epic Struggle") ||
s.equals("Door to Nothingness") || s.equals("Barren Glory") || s.equals("Near-Death Experience") ||
s.equals("Mortal Combat") || s.equals("Test of Endurance")) {
sb.append(QuestPreferences.getMatchRewardAltWinBonus());
}
sb.append(" credits</b>.<br>");
}
}
Old code also calculated some victory conditions on the fly, that is exactly inside the Gui_WinLose class, I mean
- Code: Select all
// This is Gui_WinLose.setup() body!
if (winLose.didWinRecently()) {
titleLabel.setText(ForgeProps.getLocalized(WINLOSE_TEXT.WIN));
int game = 0;
if (winLose.getWinTurns()[0] != 0)
game = 1;
int turn = AllZone.getPhase().getTurn();
if (AllZone.getGameInfo().isComputerStartedThisGame())
turn--;
if (turn < 1)
turn = 1;
winLose.setWinTurn(game, turn);
winLose.setMulliganedToZero(game, AllZone.getGameInfo().getHumanMulliganedToZero());
So, considering this way of victory condition checks awful, I decided to rewrite the whole system.
Now it is extensible and allows us to introduce more stats and achievements, like total damage dealt to creatures, max number of creatures on battlefield, anmount of lives gained throughout the game and so on... We can analyse these metrics after the match is complete and award something in case they are somehow notable.
The original goal was committed in r9853: player can now choose cards from which format he would like to receive as a reward booster. Though, without proper UI this looks quite ugly - a choice window pops on, then a dialog, then another dialog about credits gained, and yet another one with random rare.
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: r9843 Discussion
by Braids » 22 Aug 2011, 14:22
thank you!
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. 

-
Braids - Programmer
- Posts: 556
- Joined: 22 Jun 2011, 00:39
- Location: Unknown. Hobby: Driving myself and others to constructive madness.
- Has thanked: 1 time
- Been thanked: 1 time
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 31 guests