Skip to content

Commit

Permalink
Fiddle change fixed + add font color (#1776)
Browse files Browse the repository at this point in the history
fiddled effect should work + colored font added - change css for color
as needed.

---------

Co-authored-by: Golbolco <[email protected]>
  • Loading branch information
drewsworthh and Golbolco authored Dec 5, 2024
1 parent a3bae02 commit 4fab737
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Games/core/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ module.exports = class Player {
for (let effect of this.effects) {
effect.hear(message);
if (message.cancel) return;
if(message.fiddled){
message.content = message.sender.name + " says something, but you cannot hear them!";
message.modified = true;
break; }
}

if (!message.modified) message = originalMessage;
Expand Down
2 changes: 1 addition & 1 deletion Games/types/Mafia/effects/Fiddled.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = class Fiddled extends Effect {

hear(message) {
if (!message.isServer && message.sender != this.player) {
message.cancel = true;
message.fiddled = true;
}
}

Expand Down
8 changes: 7 additions & 1 deletion react_main/src/css/game.css
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,13 @@
-moz-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
}

.game .message .content.fiddled{
background: linear-gradient(to right,lightgreen, #1fb61f,lightgreen) !important;
background-clip: text !important;
-webkit-background-clip: text !important;
-moz-background-clip: text !important;
-webkit-text-fill-color: transparent !important;
}
.game .user-name.dead {
color: #bd4c4c !important;
opacity: 1;
Expand Down
8 changes: 7 additions & 1 deletion react_main/src/pages/Game/Game.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1374,10 +1374,14 @@ function Message(props) {
stateMeetings !== undefined &&
stateMeetings[message.meetingId] !== undefined;

const playerDead = props.stateViewing >= 0 && !message.alive;
const playerDead =
props.stateViewing >= 0 &&
message.alive !== undefined &&
message.alive !== true;

var canHaveGreenText = false;
if (player !== undefined) {
const playerFiddled = message.content?.includes(player.name + " says something, but you cannot hear them!") || false;
if (playerDead) {
contentClass += "dead";
} else if (
Expand All @@ -1391,6 +1395,8 @@ function Message(props) {
areSameDay(Date.now(), player.birthday)
) {
contentClass += " party ";
} else if (playerFiddled){
contentClass += "fiddled ";
} else {
canHaveGreenText = true;
}
Expand Down

0 comments on commit 4fab737

Please sign in to comment.