It is currently 12 Sep 2025, 07:54
   
Text Size

AI not playing cards in the Upkeep phase

Post MTG Forge Related Programming Questions Here

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

AI not playing cards in the Upkeep phase

Postby Sloth » 29 Sep 2011, 20:08

Slapshot scripted Mirror Universe but noticed the AI won't use it. I was curious and checked the AI code and found the reason is that the Upkeep phase is not used by the AI at all:

| Open
Code: Select all
    public final void stackResponse() {
        // if top of stack is empty
        SpellAbility[] sas = null;
        if (AllZone.getStack().size() == 0) {
            sas = getOtherPhases();

            boolean pass = (sas.length == 0)
                    || AllZone.getPhase().is(Constant.Phase.Upkeep, AllZone.getComputerPlayer())
                    || AllZone.getPhase().is(Constant.Phase.Draw, AllZone.getComputerPlayer())
                    || AllZone.getPhase().is(Constant.Phase.End_Of_Turn, AllZone.getComputerPlayer());
            if (!pass) {        // Each AF should check the phase individually
                pass = ComputerUtil.playCards(sas);
            }

            if (pass) {
                AllZone.getPhase().passPriority();
            }
            return;
        }
If "|| AllZone.getPhase().is(Constant.Phase.Upkeep, AllZone.getComputerPlayer())" is removed, the AI will use the ability of Mirror Universe.

Is there any reason for excluding this phase?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: AI not playing cards in the Upkeep phase

Postby friarsol » 29 Sep 2011, 20:27

Not really. It was primarily to reduce the amount of times the AI would try to activate abilities, especially ones it shouldn't be activating. I think the Upkeep should be fine to remove, especially for cases when the only time the AI can activate something is during that Phase.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 61 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 61 users online :: 0 registered, 0 hidden and 61 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 61 guests

Login Form