Skip to content

Commit

Permalink
Merge branch '0.0.x/main' into lobbystate-on-frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsSammyM committed Dec 13, 2023
2 parents fb4f30c + 38ba11f commit d1f4e7c
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 25 deletions.
13 changes: 5 additions & 8 deletions client/src/components/ChatMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,8 @@ export function translateChatMessage(message: ChatMessage): string {
case "deathCollectedSouls":
case "arsonistCleanedSelf":
case "arsonistDousedPlayers":
case "doctorHealed":
case "bodyguardProtected":
case "protectedYou":
case "targetWasAttacked":
case "youWereProtected":
case "executionerWon":
case "framerFramedPlayers":
case "gameOver":
Expand Down Expand Up @@ -319,8 +318,6 @@ export type ChatMessage = {
} | {
type: "playerDied",
grave: Grave
} | {
type: "youDied"
} | {
type: "gameOver"
} | {
Expand Down Expand Up @@ -435,11 +432,11 @@ export type ChatMessage = {
} | {
type: "vigilanteSuicide"
} | {
type: "doctorHealed"
type: "targetWasAttacked"
} | {
type: "bodyguardProtected"
type: "youWereProtected"
} | {
type: "protectedYou"
type: "youDied"
} | {
type: "transported"
} | {
Expand Down
5 changes: 2 additions & 3 deletions client/src/resources/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,8 @@
"chatMessage.veteranAttackedYou":"You were attacked by the veteran you visited.",
"chatMessage.veteranAttackedVisitor":"You attacked a visitor.",
"chatMessage.vigilanteSuicide":"You committed suicide over the guilt of killing an innocent person.",
"chatMessage.doctorHealed":"Your target was attacked.",
"chatMessage.bodyguardProtected": "You protected your target.",
"chatMessage.protectedYou": "You were attacked but someone protected you.",
"chatMessage.targetWasAttacked":"Your target was attacked.",
"chatMessage.youWereProtected": "You were attacked but someone protected you.",
"chatMessage.transported": "You were transported!",
"chatMessage.silenced": "You were silenced! You must not speak, chat, point, or otherwise communicate until tomorrow!",
"chatMessage.playersRoleAndWill": "Your target's role was \\0 and their will stated this: \\1",
Expand Down
5 changes: 2 additions & 3 deletions client/src/resources/styling/chatMessage.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
"mediumSeance": "special",
"arsonistCleanedSelf": "result",
"arsonistDousedPlayers": "result",
"doctorHealed": "result",
"bodyguardProtected": "result",
"protectedYou": "result",
"targetWasAttacked": "result",
"youWereProtected": "result",
"executionerWon": "result",
"framerFramedPlayers": "result",
"gameOver": "important center",
Expand Down
3 changes: 2 additions & 1 deletion server/src/game/chat/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ pub enum ChatMessage {
TargetSurvivedAttack,
YouSurvivedAttack,
// TODO rename YouWereProtected or ProtectedFromAttack
ProtectedYou,
TargetWasAttacked,
YouWereProtected,
YouDied,

/*
Expand Down
4 changes: 2 additions & 2 deletions server/src/game/role/bodyguard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ impl RoleStateImpl for Bodyguard {
}
Priority::Investigative => {
if let Some(target_protected_ref) = self.target_protected_ref {
actor_ref.push_night_message(game, ChatMessage::ProtectedYou);
target_protected_ref.push_night_message(game, ChatMessage::ProtectedYou);
actor_ref.push_night_message(game, ChatMessage::TargetWasAttacked);
target_protected_ref.push_night_message(game, ChatMessage::YouWereProtected);
}
}
_ => {}
Expand Down
4 changes: 2 additions & 2 deletions server/src/game/role/crusader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl RoleStateImpl for Crusader {
if let Some(target_protected_ref) = self.target_protected_ref {
if target_protected_ref.night_attacked(game){

actor_ref.push_night_message(game, ChatMessage::ProtectedYou);
target_protected_ref.push_night_message(game, ChatMessage::ProtectedYou);
actor_ref.push_night_message(game, ChatMessage::TargetWasAttacked);
target_protected_ref.push_night_message(game, ChatMessage::YouWereProtected);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions server/src/game/role/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ impl RoleStateImpl for Doctor {
if let Some(target_healed_ref) = self.target_healed_ref {
if target_healed_ref.night_attacked(game){

actor_ref.push_night_message(game, ChatMessage::ProtectedYou);
target_healed_ref.push_night_message(game, ChatMessage::ProtectedYou);
actor_ref.push_night_message(game, ChatMessage::TargetWasAttacked);
target_healed_ref.push_night_message(game, ChatMessage::YouWereProtected);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/game/role/spy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl RoleStateImpl for Spy {
ChatMessage::RoleBlocked { immune: _ } =>{
actor_ref.push_night_message(game, ChatMessage::SpyBug { bug: SpyBug::Roleblocked });
}
ChatMessage::ProtectedYou => {
ChatMessage::YouWereProtected => {
actor_ref.push_night_message(game, ChatMessage::SpyBug { bug: SpyBug::Protected });
}
ChatMessage::Transported => {
Expand Down
7 changes: 4 additions & 3 deletions server/tests/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ fn bodyguard_basic() {

game.skip_to(PhaseType::Morning, 2);

assert!(townie.get_messages().contains(&ChatMessage::ProtectedYou));
assert!(townie.get_messages().contains(&ChatMessage::YouWereProtected));

assert!(townie.alive());
assert!(!bg.alive());
Expand Down Expand Up @@ -229,8 +229,9 @@ fn bodyguard_protects_transported_target() {
assert!(!bg.alive());
assert!(!maf.alive());

assert_not_contains!(t1.get_messages(), ChatMessage::ProtectedYou);
assert_contains!(t2.get_messages(), ChatMessage::ProtectedYou);
assert_not_contains!(t1.get_messages(), ChatMessage::YouWereProtected);
assert_contains!(t2.get_messages(), ChatMessage::YouWereProtected);
assert_contains!(bg.get_messages(), ChatMessage::TargetWasAttacked);
}

#[test]
Expand Down

0 comments on commit d1f4e7c

Please sign in to comment.