Coverage Summary for Class: Card09 (it.polimi.ingsw.Model)
| Class | Class, % | Method, % | Branch, % | Line, % |
|---|---|---|---|---|
| Card09 | 100% (1/1) | 100% (3/3) | 100% (2/2) | 100% (5/5) |
1 package it.polimi.ingsw.Model; 2 3 4 import it.polimi.ingsw.Exceptions.Input.InputValidationException; 5 import it.polimi.ingsw.Exceptions.Input.InvalidElementException; 6 import it.polimi.ingsw.Misc.OptionalValue; 7 8 import java.io.Serial; 9 10 /** 11 * EFFECT: Choose a color of Student: during the influence calculation this turn, that color adds no influence 12 */ 13 public class Card09 extends StatelessEffect { 14 @Serial 15 private static final long serialVersionUID = 111L; // convention: 1 for model, (01 -> 99) for objects 16 17 public Card09(Model ctx) { 18 super(9, 3, ctx); 19 } 20 21 /** 22 * Refer to: {@link CharacterCard#overridableCheckInput(CharacterCardInput)} for further information 23 * 24 * @param input CharacterCardInput should contain: 25 * <ul> 26 * <li>A valid PawnColour</li>> 27 * </ul> 28 */ 29 public OptionalValue<InputValidationException> overridableCheckInput(CharacterCardInput input) { 30 if (input.getTargetPawn().isEmpty()) { 31 return OptionalValue.of(new InvalidElementException("Target Pawn Colour")); 32 } 33 return OptionalValue.empty(); 34 } 35 36 /** 37 * Refer to: {@link CharacterCard#unsafeApplyEffect(CharacterCardInput)} for further information 38 */ 39 @Override 40 protected void unsafeApplyEffect(CharacterCardInput input) { 41 this.context.getMutableEffects().setDeniedPawnColour(input.getTargetPawn().get()); 42 } 43 44 //test purpose only 45 }