-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demonic Modifier and more Info Changes (#1777)
Demonic - Cult will Win if a Demonic Player is alive in final 2 or Only Demonic and Cult players are alive. If all Demonic roles are dead, All Cult-Aligned players will die. (Does not change the Demonic player's Win Cons). Info Changes for Empath, Geo, Account, and Orienteer, All now see Hostile 3rds as Evil. All Endangered Cult (Expect Poltergeist) are no longer endangered.
- Loading branch information
Showing
26 changed files
with
938 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
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 DirectionToEvilInfo extends Information{ | ||
constructor(creator, game, target) { | ||
super("Direction To Evil Info", creator, game); | ||
if(target == null){ | ||
this.randomTarget = true; | ||
target = Random.randArrayVal(this.game.alivePlayers()); | ||
} | ||
this.target = target; | ||
|
||
let alive = this.game.alivePlayers(); | ||
var evilPlayers = alive.filter((p) => this.isAppearanceEvil(p)); | ||
let info = ""; | ||
if (evilPlayers.length <= 0) { | ||
info = "Not Applicable"; | ||
} | ||
|
||
var evilTarget = Random.randArrayVal(evilPlayers); | ||
var indexOfTarget = alive.indexOf(this.target); | ||
var rightIdx; | ||
var leftIdx; | ||
var leftAlign; | ||
var rightAlign; | ||
var distance = 0; | ||
var found = false; | ||
//let info = ""; | ||
if(info != "Not Applicable"){ | ||
for (let x = 0; x < alive.length; x++) { | ||
leftIdx = | ||
(indexOfTarget - distance - 1 + alive.length) % alive.length; | ||
rightIdx = (indexOfTarget + distance + 1) % alive.length; | ||
|
||
if(this.isAppearanceEvil(alive[rightIdx])){ | ||
found = true; | ||
info = "Below"; | ||
break; | ||
} | ||
if(this.isAppearanceEvil(alive[leftIdx])){ | ||
found = true; | ||
info = "Above"; | ||
break; | ||
} | ||
if(!found){ | ||
distance = x; | ||
} | ||
} | ||
} | ||
this.mainInfo = info; | ||
} | ||
|
||
getInfoRaw(){ | ||
super.getInfoRaw(); | ||
return this.mainInfo; | ||
} | ||
|
||
getInfoFormated(){ | ||
super.getInfoRaw(); | ||
if(this.target == this.creator){ | ||
return `You Learn that the closest Evil Player to you is ${this.mainInfo} you on the Player List` | ||
} | ||
if(this.randomTarget == true){ | ||
return `You Learn that the closest Evil Player to ${this.target.name} is ${this.mainInfo} them on the Player List` | ||
} | ||
return `You Learn that the closest Evil Player to your Target is ${this.mainInfo} them on the Player List` | ||
} | ||
|
||
isTrue() { | ||
let alive = this.game.alivePlayers(); | ||
var evilPlayers = alive.filter((p) => this.isEvil(p)); | ||
let info = ""; | ||
if (evilPlayers.length <= 0) { | ||
info = "Not Applicable"; | ||
} | ||
|
||
var evilTarget = Random.randArrayVal(evilPlayers); | ||
var indexOfTarget = alive.indexOf(this.target); | ||
var rightIdx; | ||
var leftIdx; | ||
var leftAlign; | ||
var rightAlign; | ||
var distance = 0; | ||
var found = false; | ||
//let info = ""; | ||
if(info != "Not Applicable"){ | ||
for (let x = 0; x < alive.length; x++) { | ||
leftIdx = | ||
(indexOfTarget - distance - 1 + alive.length) % alive.length; | ||
rightIdx = (indexOfTarget + distance + 1) % alive.length; | ||
|
||
if(this.isEvil(alive[rightIdx])){ | ||
found = true; | ||
info = "Below"; | ||
break; | ||
} | ||
if(this.isEvil(alive[leftIdx])){ | ||
found = true; | ||
info = "Above"; | ||
break; | ||
} | ||
|
||
if(!found){ | ||
distance = x; | ||
} | ||
} | ||
} | ||
if(this.mainInfo == info){ | ||
return true; | ||
} | ||
else{ | ||
return false; | ||
} | ||
} | ||
isFalse() { | ||
if(this.isTrue()){ | ||
return false; | ||
} | ||
else{ | ||
return true; | ||
} | ||
} | ||
isFavorable(){ | ||
return true; | ||
} | ||
isUnfavorable(){ | ||
return true; | ||
} | ||
|
||
makeTrue() { | ||
let alive = this.game.alivePlayers(); | ||
var evilPlayers = alive.filter((p) => this.isEvil(p)); | ||
let info = ""; | ||
if (evilPlayers.length <= 0) { | ||
info = "Not Applicable"; | ||
} | ||
|
||
var evilTarget = Random.randArrayVal(evilPlayers); | ||
var indexOfTarget = alive.indexOf(this.target); | ||
var rightIdx; | ||
var leftIdx; | ||
var leftAlign; | ||
var rightAlign; | ||
var distance = 0; | ||
var found = false; | ||
//let info = ""; | ||
if(info != "Not Applicable"){ | ||
for (let x = 0; x < alive.length; x++) { | ||
leftIdx = | ||
(indexOfTarget - distance - 1 + alive.length) % alive.length; | ||
rightIdx = (indexOfTarget + distance + 1) % alive.length; | ||
|
||
|
||
if(this.isEvil(alive[rightIdx])){ | ||
found = true; | ||
info = "Below"; | ||
break; | ||
} | ||
if(this.isEvil(alive[leftIdx])){ | ||
found = true; | ||
info = "Above"; | ||
break; | ||
} | ||
if(!found){ | ||
distance = x; | ||
} | ||
} | ||
} | ||
this.mainInfo = info; | ||
} | ||
makeFalse() { | ||
this.makeTrue(); | ||
if(this.mainInfo == "Above"){ | ||
this.mainInfo = "Below"; | ||
} | ||
else if(this.mainInfo == "Below"){ | ||
this.mainInfo = "Above"; | ||
} | ||
else{ | ||
this.mainInfo = "Below"; | ||
} | ||
} | ||
makeFavorable(){ | ||
this.makeFalse(); | ||
} | ||
makeUnfavorable(){ | ||
this.makeTrue(); | ||
} | ||
}; |
Oops, something went wrong.