It is currently 06 Sep 2025, 21:24
   
Text Size

Combat.java - wrong implementation

Post MTG Forge Related Programming Questions Here

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

Combat.java - wrong implementation

Postby Max mtg » 03 Aug 2013, 20:18

Code: Select all
private List<Card> combatantDealtFirstStrikeDamage = Lists.newArrayList();
Should not be in Combat class. It refers to card damage history if a card was dealt first-strike damage.
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: Combat.java - wrong implementation

Postby friarsol » 04 Aug 2013, 03:36

Max mtg wrote:
Code: Select all
private List<Card> combatantDealtFirstStrikeDamage = Lists.newArrayList();
Should not be in Combat class. It refers to card damage history if a card was dealt first-strike damage.
No, it doesn't. It refers to whether a Card assigned damage during the first strike damage, not whether it received damage. It's needed in the Combat class to determine if a creature will deal damage in the non-first strike damage, since before this we were incorrectly just checking if creatures had first strike, which is not correct since if a creature gains or loses first strike it wouldn't correctly assign damage the second time.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Combat.java - wrong implementation

Postby Max mtg » 04 Aug 2013, 07:50

You are right then.

I have slightly renamed the field and added a comment to prevent other people from making wrong conclusions about this code.
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 60 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 60 users online :: 0 registered, 0 hidden and 60 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 60 guests

Login Form