Skip to content

Commit

Permalink
Merge pull request #653 from mafia-rust/true-wildcard
Browse files Browse the repository at this point in the history
True wildcard
  • Loading branch information
ItsSammyM authored May 8, 2024
2 parents 310f4c4 + 129ab8a commit fd67289
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 69 deletions.
28 changes: 24 additions & 4 deletions client/src/components/styledText.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,38 @@
font-style: italic;
color: gray;
}
.keyword-disabled, .keyword-disabled * {
color: gray
}
.keyword-pride, .keyword-trans {
background-clip: text;
color: rgba(255,255,255,.2);
-webkit-background-clip: text;
-webkit-text-fill-color: rgba(255,255,255,.2);
}
.keyword-pride {
background-image: linear-gradient(to left, violet, indigo, cyan, green, yellow, orange, red);
background-image: linear-gradient(to left, red, violet, rgb(103, 0, 177), rgb(0, 202, 202), green, rgb(216, 216, 0), orange, red);
background-size: 100px;
animation: scrolling-rainbow 3s linear infinite;
text-shadow: -.05rem -.05rem .1rem #ffffff66, .1rem .1rem .1rem rgb(0, 0, 0);

}
.keyword-trans {
background-image: linear-gradient(to left, cyan, pink, white, pink, cyan);
}
.keyword-disabled * {
color: gray;
background-color: gray;
background-clip: text;
background-image: unset;
text-shadow: none;

}
@keyframes scrolling-rainbow {
0% {
background-position: 0;
}
50% {
background-position: 50px;
}
100% {
background-position: 100px;
}
}
2 changes: 1 addition & 1 deletion client/src/game/gameManager.d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type GameManager = {
[number, DoomsayerGuess],
[number, DoomsayerGuess]
]): void;
sendSetWildCardRoleOutline(roleOutline: Role): void;
sendSetWildcardRoleOutline(roleOutline: Role): void;
sendSetJournalistJournal(journal: string): void;
sendSetJournalistJournalPublic(isPublic: boolean): void;
sendSetConsortOptions(
Expand Down
4 changes: 2 additions & 2 deletions client/src/game/gameManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ export function createGameManager(): GameManager {
guesses: guesses
});
},
sendSetWildCardRoleOutline(role) {
sendSetWildcardRoleOutline(role) {
this.server.sendPacket({
type: "setWildCardRole",
type: "setWildcardRole",
role: role
});
},
Expand Down
2 changes: 1 addition & 1 deletion client/src/game/packet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export type ToServerPacket = {
[number, DoomsayerGuess]
]
} | {
type: "setWildCardRole",
type: "setWildcardRole",
role: Role
} | {
type: "setJournalistJournal",
Expand Down
4 changes: 2 additions & 2 deletions client/src/game/roleListState.d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ export function getRolesFromRoleListRemoveExclusionsAddConversions(roleList: Rol


for(let role of roles){
if(role==="wildcard"){
if(role==="wildcard"||role==="trueWildcard"){
getRolesComplement(excludedRoles).forEach((role) => {
out.push(role);
});
break;
}
if(role==="mafiaWildCard"){
if(role==="mafiaWildcard"){
getRolesComplement(excludedRoles)
.filter((role)=>getFactionFromRole(role)==="mafia")
.filter((role)=>role!=="godfather" && role!=="mafioso")
Expand Down
5 changes: 4 additions & 1 deletion client/src/game/roleState.d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export type RoleState = {
} | {
type: "witch"
} | {
type: "mafiaWildCard"
type: "mafiaWildcard"
role: Role
} | {
type: "jester"
Expand All @@ -112,6 +112,9 @@ Doomsayer
} | {
type: "wildcard"
role: Role
} | {
type: "trueWildcard"
role: Role
} | {
type: "apostle"
} | {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,26 +120,27 @@ export default class SmallRoleSpecificMenu extends React.Component<SmallRoleSpec
return <SmallOjoMenu action={this.state.gameState.clientState.roleState.chosenAction}/>;
return null;
case "wildcard":
case "trueWildcard":
return <><StyledText>{translate("role.wildcard.smallRoleMenu")}</StyledText><div><RoleDropdown
value={this.state.gameState.clientState.roleState.role ?? "wildcard"}
disabledRoles={this.state.gameState.excludedRoles}
onChange={(rle)=>{
GAME_MANAGER.sendSetWildCardRoleOutline(rle);
GAME_MANAGER.sendSetWildcardRoleOutline(rle);
}}
/></div></>;
case "mafiaWildCard":
case "mafiaWildcard":
const all_choosable_mafia: Role[] = Object.keys(ROLES).filter((rle)=>
ROLES[rle as keyof typeof ROLES].faction === "mafia" &&
rle !== "godfather" &&
rle !== "mafioso" &&
!this.state.gameState.excludedRoles.includes(rle as Role)
).map((r)=>r as Role);

return <><StyledText>{translate("role.mafiaWildCard.smallRoleMenu")}</StyledText><div><RoleDropdown
value={this.state.gameState.clientState.roleState.role ?? "mafiaWildCard"}
return <><StyledText>{translate("role.mafiaWildcard.smallRoleMenu")}</StyledText><div><RoleDropdown
value={this.state.gameState.clientState.roleState.role ?? "mafiaWildcard"}
disabledRoles={getRolesComplement(all_choosable_mafia)}
onChange={(rle)=>{
GAME_MANAGER.sendSetWildCardRoleOutline(rle);
GAME_MANAGER.sendSetWildcardRoleOutline(rle);
}}
/></div></>;
case "martyr":
Expand Down
Loading

0 comments on commit fd67289

Please sign in to comment.