# Gooner Training Academy - Desktop Application

*How long can you last?*

A modern, cross-platform desktop edging game built with Electron. Test your willpower against an unforgiving system that floods your screen with consequences when you try to cheat. Face up to 40 punishment popups that can't be closed when you skip tasks.

## 🔥 Features

### Core Gameplay
- **Edging Challenge System**: Push your limits with timed endurance tasks
- **Punishment Protocol**: Skip tasks and face flooding consequence popups (1-40 images)
- **Aspect Ratio Perfection**: Each popup dynamically sized to its image proportions
- **Unclosable Torment**: Popups can't be dismissed - endure the full timer
- **Smart Positioning**: Random, cascade, grid, or centered popup layouts

### Desktop Power Features
- **🖥️ Native File Management**: Full file system access for adult content
- **📁 Drag & Drop Support**: Easy NSFW image importing with native dialogs
- **💾 Unlimited Storage**: No browser storage quotas - use your full disk space
- **🎵 Background Music**: Optional audio with volume controls
- **🌓 Theme Support**: Light and dark themes with system integration
- **⚡ Performance Optimized**: Native desktop speed for intensive popup flooding

### Image Management
- **📋 Task Images**: Import and manage images for regular tasks
- **⚠️ Consequence Images**: Import and manage images for consequence tasks  
- **🔍 Auto-Discovery**: Automatically scan directories for new images
- **📂 Direct Folder Access**: Open image folders directly from the app
- **🗑️ File Operations**: Delete, organize, and manage images with native tools

## 🚀 Quick Start

### Prerequisites
- **Node.js** (v16 or higher) - [Download here](https://nodejs.org/)
- **npm** (comes with Node.js)

### Installation

#### Windows
```bash
# Run the setup script
setup.bat

# Or manually:
npm install
```

#### macOS/Linux  
```bash
# Run the setup script
chmod +x setup.sh
./setup.sh

# Or manually:
npm install
```

### Running the Application

```bash
# Start the desktop application
npm start

# Development mode (with DevTools)
npm run dev
```

### Building Executables

```bash
# Build for all platforms
npm run build

# Build for specific platforms
npm run build-win    # Windows
npm run build-mac    # macOS  
npm run build-linux  # Linux
```

## 📁 Project Structure

```
task-challenge-game/
├── main.js                 # Electron main process
├── preload.js             # Secure IPC bridge
├── desktop-file-manager.js # Desktop file operations
├── index.html             # Main UI
├── game.js               # Core game logic
├── styles.css            # Styling and themes
├── gameData.js           # Game data and tasks
├── images/               # Image assets
│   ├── tasks/           # Task images
│   └── consequences/    # Consequence images
├── audio/               # Background music
├── package.json         # Dependencies and build config
└── README.md           # This file
```

## 🎯 How to Play

1. **Start the Game**: Click "Start Game" from the main menu
2. **Choose Task Time**: Select your preferred task duration
3. **Complete Tasks**: Follow the displayed instructions
4. **Make Choices**: Complete the task or skip to face consequences
5. **Track Progress**: Monitor your score and statistics

### Game Mechanics

- **✅ Complete Task**: Earn points and maintain your streak
- **⏭️ Skip Task**: Face a consequence task with penalty
- **🎯 Consequence Tasks**: More challenging tasks when you skip
- **📈 Difficulty Scaling**: Tasks adapt based on your performance
- **🏆 Scoring**: Points for completed tasks, penalties for skipping

## 🖼️ Image Management

### Adding Images

#### Desktop Method (Recommended)
1. Go to "Manage Images" from the main menu
2. Click "Import Task Images" or "Import Consequence Images"  
3. Select multiple images using the native file dialog
4. Images are automatically copied to the app directory

#### Manual Method
1. Place images in the appropriate folders:
   - `images/tasks/` for task images
   - `images/consequences/` for consequence images
2. Click "Scan Image Directories" to detect new files

### Supported Formats
- JPG/JPEG
- PNG  
- GIF (including animated)
- WebP
- BMP

### Image Organization
- **Task Images**: Fun, motivational, or neutral images
- **Consequence Images**: More serious or challenging imagery
- **Auto-Classification**: Images are automatically sorted by filename patterns

## ⚙️ Configuration

### Settings Storage
Settings are stored in:
- **Windows**: `%APPDATA%/task-challenge-game/`
- **macOS**: `~/Library/Application Support/task-challenge-game/`
- **Linux**: `~/.config/task-challenge-game/`

### Custom Tasks
Add your own tasks by editing the in-game task manager or modifying `gameData.js`.

## 🔧 Development

### Development Setup
```bash
# Install dependencies
npm install

# Run in development mode
npm run dev

# The app will reload automatically when files change
```

### Project Architecture
- **Electron Main Process**: `main.js` handles app lifecycle and native features
- **Renderer Process**: `game.js` contains the game logic and UI
- **IPC Communication**: `preload.js` provides secure bridge between processes
- **File Management**: `desktop-file-manager.js` handles all file operations

### Adding Features
1. Add UI elements to `index.html`
2. Implement logic in `game.js` or create new modules
3. Add IPC handlers in `main.js` if native features are needed
4. Update `preload.js` to expose new APIs to the renderer

## 🌐 Web vs Desktop

| Feature | Web Version | Desktop Version |
|---------|------------|-----------------|
| Image Import | Limited browser upload | Native file dialogs |
| Storage | Browser localStorage (limited) | Unlimited disk space |
| File Management | Basic browser operations | Full file system access |
| Performance | Browser constraints | Native performance |
| Installation | None required | One-time setup |
| Offline Usage | Limited | Full offline support |

## 🛠️ Troubleshooting

### Common Issues

**Images not showing up**
- Check that images are in the correct folders
- Run "Scan Image Directories" to refresh
- Verify image formats are supported

**App won't start**
- Ensure Node.js is installed and up to date
- Run `npm install` to install dependencies
- Check console for error messages

**Build failures**
- Make sure all dependencies are installed
- Check that you have write permissions in the project directory
- Try clearing `node_modules` and reinstalling

### Getting Help

1. Check the console (F12) for error messages
2. Verify all files are in the correct locations
3. Ensure you have the latest version of Node.js
4. Try rebuilding: `rm -rf node_modules && npm install`

## 📜 License

MIT License - feel free to modify and distribute!

## 🎵 Credits

- **Electron** - Cross-platform desktop framework
- **Node.js** - JavaScript runtime
- Built with modern web technologies (HTML5, CSS3, ES6+)

---

**Ready to challenge yourself?** 🚀

Run `npm start` and begin your task challenge adventure!