Actually charge for move resolutions
This commit is contained in:
parent
1c8ffb151c
commit
b41e4fa052
@ -337,6 +337,7 @@ impl Game {
|
||||
}
|
||||
|
||||
pub fn resolution(&mut self, move_: Move, agents: &[&dyn Agent]) -> CoupResult<Phase> {
|
||||
self.players[self.turn].coins -= move_.action.coin_cost();
|
||||
match move_.action {
|
||||
Income => self.players[self.turn].coins += 1,
|
||||
ForeignAid => self.players[self.turn].coins += 2,
|
||||
|
@ -291,7 +291,7 @@ fn test_resolution() {
|
||||
let deck = vec![Contessa, Contessa];
|
||||
let discard = vec![];
|
||||
let players = vec![
|
||||
Player { coins: 2, cards: vec![Duke, Assassin] },
|
||||
Player { coins: 7, cards: vec![Duke, Assassin] },
|
||||
Player { coins: 1, cards: vec![Captain] },
|
||||
];
|
||||
let game = Game {
|
||||
@ -308,7 +308,7 @@ fn test_resolution() {
|
||||
action: Income,
|
||||
target: None,
|
||||
}, &[&dummy_agent, &dummy_agent]).unwrap();
|
||||
assert_eq!(game.players[0].coins, 3);
|
||||
assert_eq!(game.players[0].coins, 8);
|
||||
}
|
||||
|
||||
// Test foreign aid
|
||||
@ -318,7 +318,7 @@ fn test_resolution() {
|
||||
action: ForeignAid,
|
||||
target: None,
|
||||
}, &[&dummy_agent, &dummy_agent]).unwrap();
|
||||
assert_eq!(game.players[0].coins, 4);
|
||||
assert_eq!(game.players[0].coins, 9);
|
||||
}
|
||||
|
||||
// Test coup / assassinate
|
||||
@ -330,6 +330,7 @@ fn test_resolution() {
|
||||
}, &[&dummy_agent, &loser_agent]).unwrap();
|
||||
assert!(game.players[1].cards.is_empty());
|
||||
assert_eq!(game.discard, vec![Captain]);
|
||||
assert_eq!(game.players[0].coins, 0);
|
||||
}
|
||||
|
||||
// Test steal
|
||||
@ -339,7 +340,7 @@ fn test_resolution() {
|
||||
action: Steal,
|
||||
target: Some(1),
|
||||
}, &[&dummy_agent, &dummy_agent]).unwrap();
|
||||
assert_eq!(game.players[0].coins, 3);
|
||||
assert_eq!(game.players[0].coins, 8);
|
||||
assert_eq!(game.players[1].coins, 0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user