Making scripts multiplayer compatible
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			18 posts
			 • Page 2 of 2 • 1, 2
		
	
Re: Making scripts multiplayer compatible
 by Max mtg » 23 Oct 2012, 21:42
by Max mtg » 23 Oct 2012, 21:42 
Hope, 17687 solves the problemHellfish wrote:Yeah, the Archenemy demo.Max mtg wrote:Was it a multiplayer game? I'll have a look
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: Making scripts multiplayer compatible
 by Max mtg » 23 Oct 2012, 22:01
by Max mtg » 23 Oct 2012, 22:01 
TriggerHandler:352 - is there an error?
			- Code: Select all
- if (!playerAP.equals(card.getController()) && !allCards.contains(card)
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: Making scripts multiplayer compatible
 by Sloth » 24 Oct 2012, 05:33
by Sloth » 24 Oct 2012, 05:33 
The changes to the canAtack function should be ok, but please stop reverting getDefendingPlayerRelatedTo. Your version only works for Auras, Equipments and creatures that are attacking, but this function has to work for any source.Max mtg wrote:I have read the code for a second time and found out that combat variable is never null, otherwise there would have been an exception thrown at the very first line. So that default assignment was overwritten anyway.Sloth wrote:In order not to break anything, this function has to return a player, so i've chosen what works in a single player game. The code below will switch to the right player in 90% of the cases.
Feel free to fully implement Rule 802.2a which sucks big time, but there are much more pressing matters regarding multiplayer.
I have commited an edition where there is no check for combat == null and defender player is calculated from the entity under attack. See lines 814-815 of http://svn.slightlymagic.net/websvn/dif ... &peg=17683
Was just upset to see player.getOpponent outside of AI code.
If the comprehensive rules are hacky, we just can't translate this into clean code.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
			18 posts
			 • Page 2 of 2 • 1, 2
		
	
Who is online
Users browsing this forum: No registered users and 24 guests
