diff --git a/app/Models/Character.php b/app/Models/Character.php index 5edca19..7f8a6ea 100644 --- a/app/Models/Character.php +++ b/app/Models/Character.php @@ -50,6 +50,9 @@ class Character extends Model 'max_energy', 'health', 'max_health', + 'nerve', + 'max_nerve', + 'nerve_regen_at', 'strength', 'defense', 'speed', @@ -66,6 +69,7 @@ class Character extends Model 'in_hospital_until' => 'datetime', 'in_jail_until' => 'datetime', 'last_action_at' => 'datetime', + 'nerve_regen_at' => 'datetime', 'status' => CharacterStatus::class, ]; @@ -251,6 +255,49 @@ class Character extends Model $this->save(); } + /** + * Check if character has enough nerve for an action + */ + public function hasNerve(int $amount): bool + { + return $this->nerve >= $amount; + } + + /** + * Consume nerve + */ + public function consumeNerve(int $amount): bool + { + if (!$this->hasNerve($amount)) { + return false; + } + + $this->nerve -= $amount; + $this->save(); + + return true; + } + + /** + * Add nerve (up to max) + */ + public function addNerve(int $amount): void + { + $this->nerve = min($this->max_nerve, $this->nerve + $amount); + $this->save(); + } + + /** + * Get nerve percentage + */ + public function getNervePercentageAttribute(): float + { + if ($this->max_nerve <= 0) { + return 0; + } + return min(100, ($this->nerve / $this->max_nerve) * 100); + } + /** * Set energy to max */ @@ -317,6 +364,7 @@ class Character extends Model $this->experience -= $this->experience_for_next_level; $this->max_health += 5; $this->max_energy += 5; + $this->max_nerve += 2; $this->health = $this->max_health; $this->energy = $this->max_energy; $this->money += 1000; diff --git a/app/Models/Crime.php b/app/Models/Crime.php index b537f98..6a9194b 100644 --- a/app/Models/Crime.php +++ b/app/Models/Crime.php @@ -19,6 +19,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany; * @property int $reward_max * @property int $experience * @property int $energy_cost + * @property int $nerve_cost * @property int $cooldown * @property int|null $requires_level * @property int|null $location_id @@ -39,6 +40,7 @@ class Crime extends Model 'reward_max', 'experience', 'energy_cost', + 'nerve_cost', 'cooldown', 'requires_level', 'location_id', diff --git a/app/Models/CrimeAttempt.php b/app/Models/CrimeAttempt.php index 6380a54..d30e89f 100644 --- a/app/Models/CrimeAttempt.php +++ b/app/Models/CrimeAttempt.php @@ -25,6 +25,7 @@ class CrimeAttempt extends Model 'success', 'reward', 'experience_gained', + 'nerve_cost', 'attempted_at', ]; diff --git a/config/game.php b/config/game.php index cef4610..83b29c8 100644 --- a/config/game.php +++ b/config/game.php @@ -27,6 +27,7 @@ return [ 'attack' => 15, 'travel' => 5, 'train' => 20, + 'gym' => 20, ], ], @@ -40,6 +41,22 @@ return [ 'death_threshold' => 0, // Health <= 0 = dead ], + // Nerve system configuration + 'nerve' => [ + 'start_amount' => 100, + 'max' => 100, + 'regen_rate' => 1, // nerve per tick + 'regen_interval' => 300, // seconds (5 minutes) + 'midnight_refill' => true, + ], + + // Gym training configuration + 'gym' => [ + 'energy_cost' => 20, + 'daily_cap' => 5, // sessions per stat per day + 'stat_gain' => 1, // stat points per session + ], + // Combat system configuration 'combat' => [ 'base_damage' => 5,