Skip to content

Commit 8b361c1

Browse files
committed
puppeteer kills instantly
1 parent 4dbec3a commit 8b361c1

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

client/src/resources/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@
498498
"role.puppeteer.name:var.0": "Puppeteers",
499499
"role.puppeteer.smallRoleMenu.marionettesRemaining": "\\0 marionettes remaining.",
500500
"role.puppeteer.smallRoleMenu": "Tonight you will \\0.",
501+
"controllerId.role.puppeteer.0.name": "Target",
501502
"controllerId.role.puppeteer.1.name": "Choose Ability",
502503
"controllerId.role.puppeteer.1.integer.0": "Kill",
503504
"controllerId.role.puppeteer.1.integer.1": "Marionette",

server/src/game/role/puppeteer.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::game::visit::Visit;
1313
use crate::game::Game;
1414
use crate::vec_set;
1515

16-
use super::{AbilitySelection, ControllerID, ControllerParametersMap, IntegerSelection, Priority, Role, RoleState, RoleStateImpl};
16+
use super::{AbilitySelection, ControllerID, ControllerParametersMap, IntegerSelection, Priority, Role, RoleStateImpl};
1717

1818
#[derive(Clone, Debug, Serialize)]
1919
#[serde(rename_all = "camelCase")]
@@ -40,24 +40,27 @@ impl RoleStateImpl for Puppeteer {
4040
}
4141
fn do_night_action(mut self, game: &mut Game, actor_ref: PlayerReference, priority: Priority) {
4242
if priority != Priority::Kill {return;}
43+
if game.day_number() <= 1 {return;}
4344

4445
let actor_visits = actor_ref.untagged_night_visits_cloned(game);
4546
if let Some(visit) = actor_visits.first(){
4647
let target = visit.target;
4748

48-
if game.saved_controllers.get_controller_current_selection_integer(
49-
ControllerID::role(actor_ref, Role::Puppeteer, 1)
50-
).unwrap_or(IntegerSelection(0)).0 == 1 {
49+
if
50+
game.saved_controllers.get_controller_current_selection_integer(
51+
ControllerID::role(actor_ref, Role::Puppeteer, 1)
52+
).unwrap_or(IntegerSelection(0)).0 == 1
53+
{
5154
if !AttackPower::ArmorPiercing.can_pierce(target.defense(game)) {
5255
actor_ref.push_night_message(game, crate::game::chat::ChatMessageVariant::YourConvertFailed);
5356
}else{
5457
if PuppeteerMarionette::string(game, target){
5558
self.marionettes_remaining = self.marionettes_remaining.saturating_sub(1);
5659
}
57-
actor_ref.set_role_state(game, RoleState::Puppeteer(self));
60+
actor_ref.set_role_state(game, self);
5861
}
5962
}else{
60-
actor_ref.try_night_kill_single_attacker(
63+
target.try_night_kill_single_attacker(
6164
actor_ref,
6265
game,
6366
crate::game::grave::GraveKiller::Role(Role::Puppeteer),
@@ -83,7 +86,7 @@ impl RoleStateImpl for Puppeteer {
8386
Some(1)
8487
),
8588
AbilitySelection::new_player_list(vec![]),
86-
Detained::is_detained(game, actor_ref) || !actor_ref.alive(game),
89+
Detained::is_detained(game, actor_ref) || !actor_ref.alive(game) || game.day_number() <= 1,
8790
None,
8891
false,
8992
vec_set!(actor_ref),
@@ -95,7 +98,7 @@ impl RoleStateImpl for Puppeteer {
9598
if self.marionettes_remaining > 0 {1} else {0}
9699
),
97100
AbilitySelection::new_integer(0),
98-
false,
101+
Detained::is_detained(game, actor_ref) || !actor_ref.alive(game) || game.day_number() <= 1,
99102
None,
100103
false,
101104
vec_set!(actor_ref),

server/src/game/role_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl RoleSet{
208208
RoleSet::Neutral =>
209209
vec![
210210
Role::Jester, Role::Revolutionary, Role::Politician, Role::Doomsayer,
211-
Role::Martyr, Role::Chronokaiser
211+
Role::Martyr, Role::Chronokaiser, Role::SantaClaus, Role::Krampus,
212212
],
213213
RoleSet::Fiends =>
214214
vec![

server/tests/role.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,7 @@ fn cult_alternates() {
17311731

17321732
#[test]
17331733
fn puppeteer_marionettes_philosopher(){
1734-
kit::scenario!(game in Night 1 where
1734+
kit::scenario!(game in Night 2 where
17351735
puppeteer: Puppeteer,
17361736
philo: Philosopher,
17371737
townie: Detective,
@@ -1752,7 +1752,7 @@ fn puppeteer_marionettes_philosopher(){
17521752
ChatMessageVariant::SeerResult{ enemies: true }
17531753
);
17541754

1755-
game.skip_to(Night, 2);
1755+
game.skip_to(Night, 3);
17561756

17571757
assert!(philo.send_ability_input_two_player_typical(puppeteer, townie));
17581758

@@ -1765,7 +1765,7 @@ fn puppeteer_marionettes_philosopher(){
17651765

17661766
#[test]
17671767
fn puppeteer_marionettes_die(){
1768-
kit::scenario!(game in Night 1 where
1768+
kit::scenario!(game in Night 2 where
17691769
puppeteer: Puppeteer,
17701770
townie: Detective,
17711771
townie2: Detective,
@@ -1779,19 +1779,17 @@ fn puppeteer_marionettes_die(){
17791779

17801780
assert!(puppeteer.send_ability_input_player_list_typical(townie));
17811781

1782-
game.skip_to(Night, 2);
1782+
game.skip_to(Night, 3);
1783+
1784+
puppeteer.send_ability_input(AbilityInput::new(
1785+
ControllerID::role(puppeteer.player_ref(), Role::Puppeteer, 1),
1786+
AbilitySelection::new_integer(0)
1787+
));
17831788

17841789
assert!(puppeteer.send_ability_input_player_list_typical(townie2));
17851790

17861791
game.next_phase();
17871792

1788-
assert!(!townie.alive());
1789-
assert!(townie2.alive());
1790-
assert!(townie3.alive());
1791-
assert!(puppeteer.alive());
1792-
1793-
game.skip_to(Obituary, 4);
1794-
17951793
assert!(!townie.alive());
17961794
assert!(!townie2.alive());
17971795
assert!(townie3.alive());
@@ -1800,7 +1798,7 @@ fn puppeteer_marionettes_die(){
18001798

18011799
#[test]
18021800
fn puppeteer_marionettes_win(){
1803-
kit::scenario!(game in Night 1 where
1801+
kit::scenario!(game in Night 2 where
18041802
puppeteer: Puppeteer,
18051803
townie: Detective,
18061804
townie2: Detective
@@ -1813,16 +1811,16 @@ fn puppeteer_marionettes_win(){
18131811

18141812
assert!(puppeteer.send_ability_input_player_list_typical(townie));
18151813

1816-
game.skip_to(Nomination, 2);
1814+
game.skip_to(Nomination, 3);
18171815

18181816
puppeteer.vote_for_player(Some(townie2));
18191817
townie.vote_for_player(Some(townie2));
18201818

1821-
game.skip_to(Judgement, 2);
1819+
game.skip_to(Judgement, 3);
18221820

18231821
puppeteer.set_verdict(Verdict::Guilty);
18241822

1825-
game.skip_to(Dusk, 2);
1823+
game.skip_to(Dusk, 3);
18261824

18271825
assert!(puppeteer.alive());
18281826
assert!(townie.alive());
@@ -1835,7 +1833,7 @@ fn puppeteer_marionettes_win(){
18351833

18361834
#[test]
18371835
fn deputy_shoots_marionette(){
1838-
kit::scenario!(game in Night 1 where
1836+
kit::scenario!(game in Night 2 where
18391837
deputy: Deputy,
18401838
puppeteer: Puppeteer,
18411839
townie: Detective
@@ -1847,7 +1845,7 @@ fn deputy_shoots_marionette(){
18471845
));
18481846
assert!(puppeteer.send_ability_input_player_list_typical(townie));
18491847

1850-
game.skip_to(Discussion, 2);
1848+
game.skip_to(Discussion, 3);
18511849

18521850
deputy.send_ability_input_player_list_typical(townie);
18531851

0 commit comments

Comments
 (0)