Add: Building0Test. Fix: Sustenence And CavePainting

This commit is contained in:
GabrieleRadice
2026-03-19 18:03:16 +01:00
parent 677a12a833
commit 07dde9711b
3 changed files with 60 additions and 1 deletions
@@ -40,7 +40,7 @@ public class CavePaintings extends EventCard {
player.removePrestige(NPrestigeRem); player.removePrestige(NPrestigeRem);
} }
else{ else{
player.addPrestige(NPrestigeMul * NUpper); player.addPrestige(NPrestigeMul * NArtists);
} }
} }
} }
@@ -21,6 +21,7 @@ public class Sustenance extends EventCard {
this.PrestigeDebt = PrestigeDebt; this.PrestigeDebt = PrestigeDebt;
} }
// Sustenence va eseguito per ultimo tra gli eventi
@Override @Override
public void activateEvent (ArrayList <Player> playerList) throws NullPointerException { public void activateEvent (ArrayList <Player> playerList) throws NullPointerException {
for(Player player : playerList){ for(Player player : playerList){
@@ -0,0 +1,58 @@
package it.polimi.ingsw.gc14.Model.Cards.Building.Effects;
import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Characters.*;
import it.polimi.ingsw.gc14.Model.Player;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class Building0Test {
@Test
@DisplayName("After")
void applyEffect() {
Building0 b0 = new Building0(1, 0);
int Era = 1;
Player p = new Player("test");
b0.applyEffect(p);
assertEquals(0, p.getFoodValue());
Artist a = new Artist(Era);
Builder b = new Builder(Era, 0, 0);
Gatherers g = new Gatherers(Era);
Hunter h = new Hunter(Era, true);
Inventor i = new Inventor(Era, 1);
Shaman s = new Shaman(Era,1);
p.artists.add(a);
p.builders.add(b);
p.gatherers.add(g);
p.hunters.add(h);
p.inventors.add(i);
p.shamans.add(s);
b0.applyEffect(p);
assertEquals(5, p.getFoodValue());
}
@Test
@DisplayName("Before")
void applyEffect2() {
int Era = 1;
Player p = new Player("test");
assertEquals(0, p.getFoodValue());
Artist a = new Artist(Era);
Builder b = new Builder(Era, 0, 0);
Gatherers g = new Gatherers(Era);
Hunter h = new Hunter(Era, true);
Inventor i = new Inventor(Era, 1);
Shaman s = new Shaman(Era,1);
p.artists.add(a);
p.builders.add(b);
p.gatherers.add(g);
p.hunters.add(h);
p.inventors.add(i);
p.shamans.add(s);
Building0 b0 = new Building0(1, 0);
b0.applyEffect(p);
assertEquals(0, p.getFoodValue());
}
}