It is currently 13 Sep 2025, 14:32
   
Text Size

About Constants,java

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

About Constants,java

Postby Max mtg » 15 Aug 2011, 15:03

I am about to a couple of enums to project to make quest victory conditions more convinient to track, so I guess I should include them into constants.java?

I have also noted that the constants already defined are stored as strings. Why not enums?

Code: Select all
    public enum GameEndReason
    {
        AllOpponentsLost,
        // Noone won
        Draw,       // Max mtg: I have little idea how they can reach a draw, so I didn't enumerate possible reasons here 
        // Special conditions, they force one player to win and thus end the game
        BattleOfWits,
        HelixPinnacle,
        EpicStruggle,
        BarrenGlory,
        NearDeathExperience,
        MortalCombat,
        FelidarSovereign,
        TestOfEndurance,
    }
   
    public enum PlayerLossReason // what makes this particular players lose (while others, if any, may keep playing)
    {
        DidNotLoseYet,      // a winner must have this status by the end of the game 
       
        Conceded,           // rule 104.3a
        LifeReachedZero,    // rule 104.3b
        Milled,             // 104.3c
        Poisoned,           // 104.3d

        // 104.3e and others
        DoorToNothingness,              // Door To Nothingness's ability activated
       
        // TODO: Implement game logics for the ones below
        Transcendence20Life,            // When you have 20 or more life, you lose the game.
        FailedToPayPactUpkeep,          // Pacts from Future Sight series (cost 0 but you must pay their real cost at next turn's upkeep, otherwise GL)
        PhageTheUntouchableDamage,      // Whenever Phage deals combat damage to a player, that player loses the game.
        PhageTheUntouchableWrongETB,    // When Phage the Untouchable ETB, if you didn't cast it from your hand, you lose the game.
        NefariousLichLeavesTB,          // When Nefarious Lich leaves the battlefield, you lose the game.
        NefariousLichCannotExileGrave,  // If damage would be dealt to you, exile that many cards from your graveyard instead. If you can't, you lose the game.
        LichWasPutToGraveyard,          // When Lich is put into a graveyard from the battlefield, you lose the game.
        FinalFortune,                   // same as Warrior's Oath - lose at the granted extra turn's end step
        ImmortalCoilEmptyGraveyard,     // When there are no cards in your graveyard, you lose the game.
        ForbiddenCryptEmptyGraveyard,   // If you would draw a card, return a card from your graveyard to your hand instead. If you can't, you lose the game.

        // Amulet of quoz skipped for using ante,
        // Form of the Squirrel and Rocket-Powered Turbo Slug skipped for being part of UN- set

        // refer to http://gatherer.wizards.com/Pages/Search/Default.aspx?output=standard&text=+[%22lose+the+game%22] for more cards when they are printed
    }
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: About Constants,java

Postby Braids » 17 Aug 2011, 00:19

Max mtg wrote:I am about to a couple of enums to project to make quest victory conditions more convinient to track, so I guess I should include them into constants.java?
if it's specific to the quest, you might consider modifying or placing a new class in forge.quest.data. if it's not quest-specific, i would suggest something under forge.model.

Max mtg wrote:I have also noted that the constants already defined are stored as strings. Why not enums?
age, probably. i believe Forge has been around longer than Java has supported enums.
"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. ;)
User avatar
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


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 39 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 39 users online :: 0 registered, 0 hidden and 39 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 39 guests

Login Form