Refactor: replaced sourceId by source and introduced source param in some methods (part 2);

This commit is contained in:
Oleg Agafonov 2020-12-13 02:01:49 +04:00
parent db239a1055
commit 35f5a8257b
50 changed files with 189 additions and 118 deletions

View file

@ -3043,6 +3043,11 @@ public class TestPlayer implements Player {
computerPlayer.setCanLoseLife(canLoseLife);
}
@Override
public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) {
return computerPlayer.loseLife(amount, game, source, atCombat, attackerId);
}
@Override
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
return computerPlayer.loseLife(amount, game, source, atCombat);
@ -3300,13 +3305,13 @@ public class TestPlayer implements Player {
}
@Override
public int rollDice(Game game, int numSides) {
return computerPlayer.rollDice(game, numSides);
public int rollDice(Ability source, Game game, int numSides) {
return computerPlayer.rollDice(source, game, numSides);
}
@Override
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
return computerPlayer.rollDice(game, appliedEffects, numSides);
public int rollDice(Ability source, Game game, List<UUID> appliedEffects, int numSides) {
return computerPlayer.rollDice(source, game, appliedEffects, numSides);
}
@Override
@ -4007,17 +4012,17 @@ public class TestPlayer implements Player {
}
@Override
public PlanarDieRoll rollPlanarDie(Game game) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View file

@ -121,6 +121,11 @@ public class PlayerStub implements Player {
}
@Override
public int loseLife(int amount, Game game, Ability source, boolean atCombat, UUID attackerId) {
return 0;
}
@Override
public int loseLife(int amount, Game game, Ability source, boolean atCombat) {
return 0;
@ -625,12 +630,12 @@ public class PlayerStub implements Player {
}
@Override
public int rollDice(Game game, int numSides) {
public int rollDice(Ability source, Game game, int numSides) {
return 1;
}
@Override
public int rollDice(Game game, List<UUID> appliedEffects, int numSides) {
public int rollDice(Ability source, Game game, List<UUID> appliedEffects, int numSides) {
return 1;
}
@ -1330,17 +1335,17 @@ public class PlayerStub implements Player {
}
@Override
public PlanarDieRoll rollPlanarDie(Game game) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PlanarDieRoll rollPlanarDie(Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
public PlanarDieRoll rollPlanarDie(Ability source, Game game, List<UUID> appliedEffects, int numberChaosSides, int numberPlanarSides) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}

View file

@ -101,7 +101,7 @@ public class RandomTest {
for (int x = 0; x < weight; x++) {
for (int y = 0; y < height; y++) {
// roll dice
int diceVal = player.rollDice(game, 12);
int diceVal = player.rollDice(null, game, 12);
int colorMult = Math.floorDiv(255, 12);
image.setRGB(x, y, new Color(colorMult * diceVal, colorMult * diceVal, colorMult * diceVal).getRGB());
@ -124,7 +124,7 @@ public class RandomTest {
for (int x = 0; x < weight; x++) {
for (int y = 0; y < height; y++) {
// roll planar dice
PlanarDieRoll res = player.rollPlanarDie(game);
PlanarDieRoll res = player.rollPlanarDie(null, game);
image.setRGB(x, y, new Color(
res.equals(PlanarDieRoll.CHAOS_ROLL) ? 255 : 0,
res.equals(PlanarDieRoll.PLANAR_ROLL) ? 255 : 0,