UNPKG

crush-feelings

Version:

Simulate crush interactions in code!

68 lines (67 loc) 2.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Relationship = void 0; const errors_1 = require("./errors"); class Relationship { constructor(person1, person2) { this.MAX_INTERACTIONS = 5; this.interactions = [ 'small talk', 'awkward wave', 'shared laugh', 'accidental eye contact' ]; this.person1 = person1; this.person2 = person2; this.interactionCount = 0; } getRandomInteraction() { const index = Math.floor(Math.random() * this.interactions.length); return this.interactions[index]; } getRandomMood() { const moods = ['happy', 'nervous', 'flustered', 'overthinking']; const index = Math.floor(Math.random() * moods.length); return moods[index]; } simulateInteraction() { this.interactionCount++; if (this.interactionCount > this.MAX_INTERACTIONS) { throw new errors_1.CrushError("Too many interactions! Time to take a break and overthink everything."); } const interaction = this.getRandomInteraction(); const mood = this.getRandomMood(); this.person1.setMood(mood); const responses = [ `${this.person1.getName()} ${interaction} with ${this.person2.getName()}. Current mood: ${mood}`, `During ${interaction}, ${this.person1.getName()} becomes ${mood}`, `Another awkward moment: ${this.person1.getName()} attempts ${interaction} and ends up ${mood}`, `${interaction} occurred! ${this.person1.getName()} is now feeling ${mood}` ]; return `Interaction #${this.interactionCount}: ${responses[Math.floor(Math.random() * responses.length)]}`; } tryToDevelopFeelings() { const errorMessages = [ "Error: Cannot process feelings.exe - Overthinking detected", "Critical failure: Butterflies in stomach causing system malfunction", "Fatal error: Brain.exe stopped working near crush", `Stack overflow: Too many thoughts about ${this.person2.getName()}`, "Exception: Heart.js failed to compile due to excess emotions", `Runtime Error: Failed to maintain composure in presence of ${this.person2.getName()}`, "System Failure: Nervous system overloaded with crush-induced anxiety" ]; throw new errors_1.CrushError(errorMessages[Math.floor(Math.random() * errorMessages.length)]); } getInteractionCount() { return this.interactionCount; } reset() { this.interactionCount = 0; this.person1.setMood('happy'); } getCrushIntensity() { const intensity = Math.min((this.interactionCount / this.MAX_INTERACTIONS) * 100, 100); return `Crush intensity: ${intensity.toFixed(1)}%`; } } exports.Relationship = Relationship;