It is currently 29 Oct 2025, 09:00
   
Text Size

Controlling other player

Post MTG Forge Related Programming Questions Here

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

Controlling other player

Postby 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.
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

Postby 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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Controlling other player

Postby Max mtg » 12 May 2013, 15:12

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.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 19 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 19 users online :: 0 registered, 0 hidden and 19 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 19 guests

Login Form