Page 1 of 1

AI not playing cards in the Upkeep phase

PostPosted: 29 Sep 2011, 20:08
by Sloth
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?

Re: AI not playing cards in the Upkeep phase

PostPosted: 29 Sep 2011, 20:27
by friarsol
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.