first commit

This commit is contained in:
Doar Mihai
2026-06-27 14:38:18 +03:00
commit 96d317480b
165 changed files with 20061 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace App\Enums;
enum AttackResult: string
{
case WIN = 'win';
case LOSE = 'lose';
case DRAW = 'draw';
case ESCAPE = 'escape';
/**
* Get all result values as an array
*/
public static function values(): array
{
return array_column(self::cases(), 'value');
}
/**
* Get the display name for a result
*/
public function label(): string
{
return match($this) {
self::WIN => 'Victory',
self::LOSE => 'Defeat',
self::DRAW => 'Draw',
self::ESCAPE => 'Escaped',
};
}
/**
* Check if the attacker won
*/
public function attackerWon(): bool
{
return $this === self::WIN;
}
/**
* Check if the defender won (attacker lost)
*/
public function defenderWon(): bool
{
return $this === self::LOSE;
}
/**
* Get the experience reward for this result (for attacker)
*/
public function experienceReward(): int
{
return match($this) {
self::WIN => 200,
self::LOSE => 50,
self::DRAW => 100,
self::ESCAPE => 25,
};
}
/**
* Get the money reward for this result (for attacker)
*/
public function moneyReward(): int
{
return match($this) {
self::WIN => 500,
self::LOSE => 0,
self::DRAW => 100,
self::ESCAPE => 0,
};
}
}
+53
View File
@@ -0,0 +1,53 @@
<?php
namespace App\Enums;
enum CharacterStatus: string
{
case ACTIVE = 'active';
case IN_HOSPITAL = 'in_hospital';
case IN_JAIL = 'in_jail';
case DEAD = 'dead';
/**
* Get all status values as an array
*/
public static function values(): array
{
return array_column(self::cases(), 'value');
}
/**
* Get the display name for a status
*/
public function label(): string
{
return match($this) {
self::ACTIVE => 'Active',
self::IN_HOSPITAL => 'In Hospital',
self::IN_JAIL => 'In Jail',
self::DEAD => 'Dead',
};
}
/**
* Check if character can perform actions
*/
public function canAct(): bool
{
return $this === self::ACTIVE;
}
/**
* Get the color class for the status badge
*/
public function color(): string
{
return match($this) {
self::ACTIVE => 'bg-green-500',
self::IN_HOSPITAL => 'bg-red-500',
self::IN_JAIL => 'bg-yellow-500',
self::DEAD => 'bg-gray-500',
};
}
}
+71
View File
@@ -0,0 +1,71 @@
<?php
namespace App\Enums;
enum CrimeDifficulty: string
{
case EASY = 'easy';
case MEDIUM = 'medium';
case HARD = 'hard';
case VERY_HARD = 'very_hard';
/**
* Get all difficulty values as an array
*/
public static function values(): array
{
return array_column(self::cases(), 'value');
}
/**
* Get the display name for a difficulty
*/
public function label(): string
{
return match($this) {
self::EASY => 'Easy',
self::MEDIUM => 'Medium',
self::HARD => 'Hard',
self::VERY_HARD => 'Very Hard',
};
}
/**
* Get the success rate modifier for this difficulty
*/
public function successModifier(): float
{
return match($this) {
self::EASY => 0.20, // +20% success rate
self::MEDIUM => 0.00, // Base success rate
self::HARD => -0.20, // -20% success rate
self::VERY_HARD => -0.40,// -40% success rate
};
}
/**
* Get the reward multiplier for this difficulty
*/
public function rewardMultiplier(): float
{
return match($this) {
self::EASY => 0.5,
self::MEDIUM => 1.0,
self::HARD => 2.0,
self::VERY_HARD => 3.0,
};
}
/**
* Get the color class for the difficulty badge
*/
public function color(): string
{
return match($this) {
self::EASY => 'bg-green-500',
self::MEDIUM => 'bg-yellow-500',
self::HARD => 'bg-orange-500',
self::VERY_HARD => 'bg-red-500',
};
}
}
+50
View File
@@ -0,0 +1,50 @@
<?php
namespace App\Enums;
enum ItemType: string
{
case WEAPON = 'weapon';
case ARMOR = 'armor';
case CONSUMABLE = 'consumable';
case MISC = 'misc';
case CURRENCY = 'currency';
/**
* Get all item type values as an array
*/
public static function values(): array
{
return array_column(self::cases(), 'value');
}
/**
* Get the display name for an item type
*/
public function label(): string
{
return match($this) {
self::WEAPON => 'Weapon',
self::ARMOR => 'Armor',
self::CONSUMABLE => 'Consumable',
self::MISC => 'Miscellaneous',
self::CURRENCY => 'Currency',
};
}
/**
* Check if this item type can be equipped
*/
public function canEquip(): bool
{
return in_array($this, [self::WEAPON, self::ARMOR]);
}
/**
* Check if this item type can be used/consumed
*/
public function canUse(): bool
{
return $this === self::CONSUMABLE;
}
}