Corrigé un bug concernant les parties à 5-6 joueurs à 1 contre 4-5
This commit is contained in:
		@@ -7,8 +7,8 @@ android {
 | 
				
			|||||||
        applicationId "fr.ynerant.tarot"
 | 
					        applicationId "fr.ynerant.tarot"
 | 
				
			||||||
        minSdkVersion 24
 | 
					        minSdkVersion 24
 | 
				
			||||||
        targetSdkVersion 29
 | 
					        targetSdkVersion 29
 | 
				
			||||||
        versionCode 6
 | 
					        versionCode 7
 | 
				
			||||||
        versionName "0.2.2"
 | 
					        versionName "0.2.3"
 | 
				
			||||||
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 | 
					        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    buildTypes {
 | 
					    buildTypes {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -287,10 +287,12 @@ public class Game {
 | 
				
			|||||||
			if (p != attacker && p != follower)
 | 
								if (p != attacker && p != follower)
 | 
				
			||||||
				playerScore = -score;
 | 
									playerScore = -score;
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				if (p == attacker)
 | 
									if (p == attacker && p == follower)
 | 
				
			||||||
					playerScore += getGameType().getAttackMultiplier() * score;
 | 
										playerScore += (getGameType().getNbPlayers() - 1) * score;
 | 
				
			||||||
				if (p == follower)
 | 
									else if (p == attacker)
 | 
				
			||||||
					playerScore += getGameType().getFollowMultiplier() * score;
 | 
										playerScore += (getGameType().getNbPlayers() - 1 - (follower == null ? 0 : 2)) * score;
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										playerScore += score;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			scores.put(p, playerScore);
 | 
								scores.put(p, playerScore);
 | 
				
			||||||
@@ -405,9 +407,8 @@ public class Game {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
						g.calculateScores();
 | 
											g.calculateScores();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						for (Player p : g.getPlayers()) {
 | 
											for (Player p : g.getPlayers())
 | 
				
			||||||
							p.addScore(g.getGameType(), g.getPoints(p));
 | 
												p.addScore(g.getGameType(), g.getPoints(p));
 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				catch (IOException ex) {
 | 
									catch (IOException ex) {
 | 
				
			||||||
@@ -418,23 +419,7 @@ public class Game {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public enum GameType {
 | 
						public enum GameType {
 | 
				
			||||||
		THREE_PLAYERS(2, 0), FOUR_PLAYERS(3, 0), FIVE_PLAYERS(2, 1), SIX_PLAYERS(3, 1);
 | 
							THREE_PLAYERS, FOUR_PLAYERS, FIVE_PLAYERS, SIX_PLAYERS;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		private final int attackMultiplier;
 | 
					 | 
				
			||||||
		private final int followMultiplier;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		GameType(int attack, int follow) {
 | 
					 | 
				
			||||||
			this.attackMultiplier = attack;
 | 
					 | 
				
			||||||
			this.followMultiplier = follow;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public int getAttackMultiplier() {
 | 
					 | 
				
			||||||
			return attackMultiplier;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public int getFollowMultiplier() {
 | 
					 | 
				
			||||||
			return followMultiplier;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public int getNbPlayers() {
 | 
							public int getNbPlayers() {
 | 
				
			||||||
			return ordinal() + 3;
 | 
								return ordinal() + 3;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user