It is currently 31 Oct 2025, 19:37
   
Text Size

Making scripts multiplayer compatible

Post MTG Forge Related Programming Questions Here

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

Re: Making scripts multiplayer compatible

Postby Max mtg » 23 Oct 2012, 21:42

Hellfish wrote:
Max mtg wrote:Was it a multiplayer game? I'll have a look
Yeah, the Archenemy demo.
Hope, 17687 solves the problem
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

Postby Max mtg » 23 Oct 2012, 22:01

TriggerHandler:352 - is there an error?
Code: Select all
if (!playerAP.equals(card.getController()) && !allCards.contains(card)
Should there be nap instead of "ap"?
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

Postby Sloth » 24 Oct 2012, 05:33

Max mtg wrote:
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 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.
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.
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.
If the comprehensive rules are hacky, we just can't translate this into clean code.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 24 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 24 users online :: 0 registered, 0 hidden and 24 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 24 guests

Login Form