Skip to content

Commit

Permalink
Learn player info (#4)
Browse files Browse the repository at this point in the history
* Prettified Code!

* Update TrackerInfo.js

* Create BinaryTrackerInfo.js

* Prettified Code!

* Update TrackPlayerBoolean.js

* Update MissingSupplies.js

* Create WatcherInfo.js

* Update WatchPlayer.js

* Create BinaryWatcherInfo.js

* Update WatchPlayerBoolean.js

* Update WatcherInfo.js

* Update WatcherInfo.js

* Update WatcherInfo.js

* Update ModifierLoud.js

* Update TrackAndWatchPlayer.js

* Update ModifierLoud.js

* Update WatcherInfo.js

* Update LearnVisitorsPerson.js

* Update LearnVisitorsAndArm.js

* Update BegumsSenses.js

* Update RoleInfo.js

* Update AlignmentInfo.js

* Update Information.js

* Create CompareAlignmentInfo.js

* Create TwoPlayersOneEvilInfo.js

* Update Information.js

* Update modifiers.js

* Update TwoPlayersOneEvilInfo.js

* Update MakePlayerLearnOneOfTwoPlayersOnDeath.js

* m- "Beguiler"

* Prettified Code!

* Update modifiers.js

* Prettified Code!

* Update LearnAndLifeLinkToPlayer.js

* Prettified Code!

* Create LearnTargetInfo.js

* Update LearnTargetInfo.js

* Update BegumsSenses.js

* Update RevealRoleToTarget.js

* Update RevealNameToTarget.js

* Update ConfirmSelf.js

* Update RoleDisguiser.js

* Update IdentityStealer.js

---------

Co-authored-by: SawJester <[email protected]>
  • Loading branch information
SawJester and SawJester authored Dec 23, 2024
1 parent c8214a8 commit 593d412
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 72 deletions.
81 changes: 81 additions & 0 deletions Games/types/Mafia/information/LearnTargetInfo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
const Information = require("../Information");
const Random = require("../../../../lib/Random");
const {
EVIL_FACTIONS,
NOT_EVIL_FACTIONS,
CULT_FACTIONS,
MAFIA_FACTIONS,
FACTION_LEARN_TEAM,
FACTION_WIN_WITH_MAJORITY,
FACTION_WITH_MEETING,
FACTION_KILL,
} = require("../const/FactionList");

module.exports = class LearnTargetInfo extends Information {
constructor(creator, game, target) {
super("Learn Target Info", creator, game);
if (target == null) {
this.randomTarget = true;
target = Random.randArrayVal(this.game.alivePlayers());
}
this.target = target;
this.mainInfo = this.target;

}

getInfoRaw() {
super.getInfoRaw();
return this.mainInfo;
}

getInfoFormated() {
super.getInfoRaw();

return `You Learn ${this.mainInfo}`;

//return `You Learn that your Target is ${this.mainInfo}`
}

isTrue() {
if (this.mainInfo == this.target) {
return true;
} else {
return false;
}
}
isFalse() {
if (this.isTrue()) {
return false;
} else {
return true;
}
}
isFavorable() {
if(!this.isEvil(this.mainInfo)){
return false;
}
return true;
}
isUnfavorable() {
if(this.isEvil(this.mainInfo)){
return true;
}
return false;
}

makeTrue() {
this.mainInfo = this.target;
}
makeFalse() {
let players = this.game.alivePlayers().filter((p) => p != this.target && p != this.creator)
this.mainInfo = Random.randArrayVal(players);
}
makeFavorable() {
let players = this.game.alivePlayers().filter((p) => !this.isEvil(p));
this.mainInfo = Random.randArrayVal(players);
}
makeUnfavorable() {
let players = this.game.alivePlayers().filter((p) => this.isEvil(p));
this.mainInfo = Random.randArrayVal(players);
}
};
24 changes: 9 additions & 15 deletions Games/types/Mafia/roles/cards/BegumsSenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,17 @@ module.exports = class BegumsSenses extends Card {
run: function () {
if (this.target == "No") return;

if (this.actor.hasEffect("FalseMode")) {
let wrongTargets = this.game
.alivePlayers()
.filter((p) => p != this.actor);
wrongTargets = wrongTargets.filter(
(p) => p != this.actor.role.begumTarget
);
this.actor.queueAlert(
`You learn that your target was ${
Random.randArrayVal(wrongTargets).name
}!`
);
} else {
let info = this.game.createInformation(
"LearnTargetInfo",
this.actor,
this.game,
this.actor.role.begumTarget
);
info.processInfo();
this.actor.queueAlert(
`You learn that your target was ${this.actor.role.begumTarget.name}!`
`You learn that your target was ${info.getInfoRaw()}!`
);
}

delete this.actor.role.begumTarget;
},
},
Expand Down
21 changes: 8 additions & 13 deletions Games/types/Mafia/roles/cards/ConfirmSelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,15 @@ module.exports = class ConfirmSelf extends Card {
labels: ["investigate", "role"],
priority: PRIORITY_INVESTIGATIVE_DEFAULT,
run: function () {
var alert = `:mask: You learn that ${
this.actor.name
}'s role is ${this.actor.getRoleAppearance()}.`;

if (this.actor.hasEffect("FalseMode")) {
let players = this.game
.alivePlayers()
.filter((p) => p != this.target);
players = players.filter((p) => p != this.actor);
let playerNames = players.map((p) => p.name);
alert = `:mask: You learn that ${Random.randArrayVal(
playerNames
)}'s role is ${this.actor.getRoleAppearance()}.`;
}
let info = this.game.createInformation(
"LearnTargetInfo",
this.actor,
this.game,
this.actor
);
info.processInfo();
var alert = `:mask: You learn that ${info.getInfoRaw()}'s role is ${this.actor.getRoleAppearance()}.`;

this.target.queueAlert(alert);
},
Expand Down
18 changes: 8 additions & 10 deletions Games/types/Mafia/roles/cards/RevealNameToTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,14 @@ module.exports = class RevealNameToTarget extends Card {
priority: PRIORITY_INVESTIGATIVE_AFTER_RESOLVE_DEFAULT,
labels: ["investigate", "hidden"],
run: function () {
var alert = `:mask: You learn that you were visited by ${this.actor.name}.`;

if (this.actor.hasEffect("FalseMode")) {
let players = this.game
.alivePlayers()
.filter((p) => p != this.actor);
alert = `:mask: You learn that you were visited by ${
Random.randArrayVal(players).name
}.`;
}
let info = this.game.createInformation(
"LearnTargetInfo",
this.actor,
this.game,
this.actor
);
info.processInfo();
var alert = `:mask: You learn that you were visited by ${info.getInfoRaw()}.`;

let visits = this.getVisits(this.actor);
visits.map((v) => v.queueAlert(alert));
Expand Down
23 changes: 8 additions & 15 deletions Games/types/Mafia/roles/cards/RevealRoleToTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,14 @@ module.exports = class RevealRoleToTarget extends Card {
priority: PRIORITY_INVESTIGATIVE_AFTER_RESOLVE_DEFAULT,
labels: ["investigate", "hidden"],
run: function () {
var alert = `:mask: You learn that you were targeted by ${this.actor.getRoleAppearance()}.`;

if (this.actor.hasEffect("FalseMode")) {
let players = this.game
.alivePlayers()
.filter(
(p) =>
p.getRoleAppearance("condemn").split(" (")[0] !=
this.actor.role.name
);
alert = `:mask: You learn that you were visited by ${Random.randArrayVal(
players
).getRoleAppearance()}.`;
}

let info = this.game.createInformation(
"RoleInfo",
this.actor,
this.game,
this.actor
);
info.processInfo();
var alert = `:mask: You learn that you were targeted by ${info.getInfoRaw()}.`;
let visits = this.getVisits(this.actor);
visits.map((v) => v.queueAlert(alert));
},
Expand Down
27 changes: 8 additions & 19 deletions Games/types/Mafia/roles/cards/RoleDisguiser.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,17 @@ module.exports = class RoleDisguiser extends Card {
priority: PRIORITY_INVESTIGATIVE_DEFAULT,
run: function () {
let role = this.target.getAppearance("investigate", true);
let info = this.game.createInformation(
"RoleInfo",
this.actor,
this.game,
this.actor.role.begumTarget
);
info.processInfo();
let alert = `:mask: After studying ${
this.target.name
}, you learn to act like ${addArticle(role)}.`;
}, you learn to act like ${addArticle(info.getInfoRaw())}.`;
this.actor.holdItem("Suit", { type: role });

if (this.actor.hasEffect("FalseMode")) {
let wrongPlayers = this.game
.alivePlayers()
.filter(
(p) =>
p.getRoleAppearance("investigate").split(" (")[0] !=
this.target.role.name
);
let wrongRole =
Random.randArrayVal(wrongPlayers).getRoleAppearance(
"investigate"
);
alert = `:mask: After studying ${
this.target.name
}, you learn to act like ${addArticle(wrongRole)}.`;
}

this.actor.queueAlert(alert);
},
},
Expand Down

0 comments on commit 593d412

Please sign in to comment.