Controlling other player
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
3 posts
• Page 1 of 1
Controlling other player
by Max mtg » 12 May 2013, 03:26
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.
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.
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: Controlling other player
by friarsol » 12 May 2013, 14:15
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.
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.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Controlling other player
by Max mtg » 12 May 2013, 15:12
There's nothing specific left in derived player classes already.friarsol wrote:But it seems like we need to migrate everything from these Player specific classes to the Controller specific classes.
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.
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 19 guests