Page 1 of 1

Controlling other player

PostPosted: 12 May 2013, 03:26
by Max mtg
I have some bad news. There are a few cards that read "you control target player during his next turn" or just give you control over some phases of an opponent:
Mindslaver,
Sorin Markov
There is also Odric, Master Tactician who instucts to assign blockers on behalf of defending player.

In our code we have HumanPlayer and AIPlayer, I have also made lots of changes to have AI methods accept player parameter of type AIPlayer and moved methods to invoke human's spells and abilities from methods into HumanPlayer class.

So with current codebase human cannot control ai player and AI cannot control human's player.

Solution?
Now I think we should eliminate the dirreference between HumanPlayer and AiPlayer classes - there should be an only shared Player class. As player changes controller - its 'controller' member gets replaced for until the end of turn. All the AI and Gui methods should make no difference which type of player they perform actions on.

Re: Controlling other player

PostPosted: 12 May 2013, 14:15
by friarsol
Here's a few other cards that affect who chooses attackers and blockers:

Master Warcraft
Melee

I think the general idea is right here, since it's more along the lines of a Player has a life total, library, deck, and can be targeted. And the person who is interacting with the game is the PlayerController.

But it seems like we need to migrate everything from these Player specific classes to the Controller specific classes.

Re: Controlling other player

PostPosted: 12 May 2013, 15:12
by Max mtg
friarsol wrote:But it seems like we need to migrate everything from these Player specific classes to the Controller specific classes.
There's nothing specific left in derived player classes already.
Still there is a number of checks like 'instance of specific-player-class' thoughout the code to deal with.

There is already no longer HumanPlayer or AIPlayer.
All the specifics are concentrated in controllers now.