12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- enum Reputations {
- HATED, // Pretty much Kill-on-sight
- NEUTRAL, // Doesn't care much
- ACCEPTED, // The player has done something that they liked
- ADORED, // The player is a hero to them
- SLUT2, // The player is known for being a slut among them
- SLUT1, // The player is known for being a little slutty among them
- PRUDE1, // The player is known for rejecting sexual advances often
- PRUDE2, // The player is expected to reject all sexual advances
- }
- /**
- * Never never use this in a permanent manne. Reputation must be generated and discarded after use.
- */
- class Reputation {
- private values : Array<Reputations> = [Reputations.NEUTRAL, undefined];
- constructor (...values : Array<Reputations>) {
- for (let i = 0; i < values.length; i++) {
- this.add(values[i]);
- }
- }
- public add (value : Reputations) {
- let mutual1 = [Reputations.HATED, Reputations.NEUTRAL, Reputations.ACCEPTED, Reputations.ADORED];
- let mutual2 = [Reputations.SLUT1, Reputations.SLUT2, Reputations.PRUDE1, Reputations.PRUDE2];
- if (mutual2.includes(value)) {
- this.values[1] = value;
- } else if (mutual1.includes(value)) {
- this.values[0] = value;
- }
- return this;
- }
- public contains (...values : Array<Reputations>) {
- for (let i = 0; i < values.length; i++) {
- if (!this.values.includes(values[i])) {
- return false;
- }
- }
- return true;
- }
- public is (value : Reputations) {
- return this.values.includes(value);
- }
- public isPrude () {
- return this.values.includes(Reputations.PRUDE1) || this.values.includes(Reputations.PRUDE2);
- }
- public isSlut () {
- return this.values.includes(Reputations.SLUT1) || this.values.includes(Reputations.SLUT2);
- }
- }
|