fix: address final review findings — nerve consume ordering, character init, seeder costs, dead column
- Consume nerve before energy in CrimeService so energy is never lost when nerve is insufficient - Initialize nerve/max_nerve from config in CharacterController::store (same pattern as energy/health) - Add nerve_cost to all CrimeSeeder entries proportional to difficulty (1-5 range) - Remove nerve_regen_at from Character $fillable/$casts/@property — column exists but is not yet wired up Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
439f6740c0
commit
3e6a84503d
@@ -37,16 +37,16 @@ class CrimeService
|
||||
throw new \Exception('Character cannot perform actions right now.');
|
||||
}
|
||||
|
||||
// Consume nerve first so energy is never deducted if nerve is insufficient
|
||||
if (!$this->nerveService->consume($character, $crime->nerve_cost)) {
|
||||
throw new \Exception('Not enough nerve to attempt this crime.');
|
||||
}
|
||||
|
||||
// Consume energy
|
||||
if (!$this->energyService->consume($character, $crime->energy_cost, 'crime')) {
|
||||
throw new \Exception('Not enough energy to attempt this crime.');
|
||||
}
|
||||
|
||||
// Consume nerve
|
||||
if (!$this->nerveService->consume($character, $crime->nerve_cost)) {
|
||||
throw new \Exception('Not enough nerve to attempt this crime.');
|
||||
}
|
||||
|
||||
// Calculate success rate
|
||||
$successRate = $crime->calculateSuccessRate($character);
|
||||
$isSuccess = random_int(0, 9999) / 10000 <= $successRate;
|
||||
|
||||
Reference in New Issue
Block a user