It is currently 17 Jun 2019, 10:44
   
Text Size

APNAP

Moderators: melvin, beholder, ubeefx, ShawnieBoy, Lodici, CCGHQ Admins

APNAP

Postby ShawnieBoy » 15 Jul 2014, 10:02

Active Player, Non-Active Player.

For effects which affect all players at the 'same time', we're generally using a for loop for all players:

Code: Select all
for (final MagicPlayer player : game.getPlayers())
This loop will always start with the non-AI player (As found out with the log messages) - However coding everything long-hand to occur in the correct order would take up space and be quite cumbersome.

Would creating a MagicFor/MagicLoop be feasible? Some of the loops can get quite deep, and themselves hold loops of their own.

Although actually - maybe just changing the game.getPlayers() to order the fetched players in APNAP order. (Always miss the obvious, lol)
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: APNAP

Postby melvin » 15 Jul 2014, 13:14

Modifying an existing method may break existing code that expects the order to be player then AI. A new method, say game.getAPNAP(), will be clearer.
User avatar
melvin
AI Programmer
 
Posts: 1054
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 456 times

Re: APNAP

Postby ShawnieBoy » 15 Jul 2014, 13:26

Yes, very good point. I'll have a look at an APNAP method. (I also just like saying APNAP :D)
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: APNAP

Postby ShawnieBoy » 15 Jul 2014, 14:39

Have something added, but now confusing myself with the application of multiple choices across players...

Pox for example

Each player in APNAP order performs all actions
or
Each player performs each action in APNAP order?

Haven't found anything concrete, but is it "Each player loses a third of his or her life, then [each player] discards a third..." etc or Player 1 does everything, then Player 2?

As we don't have simultaneous discard/sacrifice etc, and that APNAP applies to choices. I'd say the former, even though it's not really how it works in the real world.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: APNAP

Postby jerichopumpkin » 15 Jul 2014, 17:08

ShawnieBoy wrote:Have something added, but now confusing myself with the application of multiple choices across players...

Pox for example

Each player in APNAP order performs all actions
or
Each player performs each action in APNAP order?

Haven't found anything concrete, but is it "Each player loses a third of his or her life, then [each player] discards a third..." etc or Player 1 does everything, then Player 2?

As we don't have simultaneous discard/sacrifice etc, and that APNAP applies to choices. I'd say the former, even though it's not really how it works in the real world.
I think that "Each player loses a third of his or her life, then [each player] discards a third..." would be the right answer, but I'm not totally sure. In any case, I don't think choosing either way would impact the game, since nothing can happen (except for triggers, but they would be resolved only once Pox is resolved) during the resolution of the effect... So just go for the easiest to implement ;)
jerichopumpkin
 
Posts: 212
Joined: 12 Sep 2013, 11:21
Has thanked: 19 times
Been thanked: 13 times

Re: APNAP

Postby ShawnieBoy » 15 Jul 2014, 17:22

jerichopumpkin wrote:I think that "Each player loses a third of his or her life, then [each player] discards a third..." would be the right answer, but I'm not totally sure. In any case, I don't think choosing either way would impact the game, since nothing can happen (except for triggers, but they would be resolved only once Pox is resolved) during the resolution of the effect... So just go for the easiest to implement ;)
Well, the only thing that can happen between them, is the possible choice of what to sacrifice.

If it's the first option, the active player chooses which creatures to sacrifice first, then the opponent chooses. The same for lands. So the inactive player has the advantage of knowing what the active player is going to sacrifice.

This information can also give the active player an advantage when multiple choice actions are involved.

Take an example where the active player has made his or her creature sacrifice choices, then the opponent does. The opponent has chosen not to sacrifice a creature with a landwalk ability. The active player can then use that information to choose to sacrifice lands of that type to nullify the landwalk ability. This is before anything leaves the battlefield.

This isn't possible if the active player makes all choices first, then the opponent. But I don't know which is correct #-o

edited for clarity
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times

Re: APNAP

Postby ShawnieBoy » 15 Jul 2014, 20:06

Sorted - each event occurs separately during resolution. So the process for Pox would be:

AP = Active player
NAP = Non-Active player

AP + NAP: Lose 1/3 life.
AP: Chooses a 1/3 of hand to discard (Hidden information if hand is hidden).
NAP: Chooses a 1/3 of hand to discard (Hidden information if hand is hidden).
AP + NAP: Discards chosen cards.
AP: Chooses a 1/3 of creatures to sacrifice (Public information as creatures are visible)
NAP: Chooses a 1/3 of creatures to sacrifice (Public information as creatures are visible)
AP + NAP: Sacrifice chosen creatures.
AP: Chooses a 1/3 of lands to sacrifice (Public information as lands are visible)
NAP: Chooses a 1/3 of lands to sacrifice (Public information as lands are visible)
AP + NAP: Sacrifice chosen lands.

Triggered abilities would be added to the stack in APNAP order when they trigger, but won't resolve until all the actions have completed.
User avatar
ShawnieBoy
Programmer
 
Posts: 601
Joined: 02 Apr 2012, 22:42
Location: UK
Has thanked: 80 times
Been thanked: 50 times


Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 2 guests

Login Form