49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
/** A timed effect. The engine runs due events in (fire_at, id) order. */
|
|
class GameEvent extends Model
|
|
{
|
|
public const BUILD_ORDER_FINISHED = 'build_order.finished';
|
|
|
|
public const BARBARIAN_GROWS = 'barbarian.grows';
|
|
|
|
public const RECRUIT_FINISHED = 'recruit.finished';
|
|
|
|
public const LEVY_ENDS = 'levy.ends';
|
|
|
|
public const FOOD_RUNS_OUT = 'food.runs_out';
|
|
|
|
public const DESERTION = 'starvation.desertion';
|
|
|
|
// subject_id is the movement; village_id the village it arrives at.
|
|
public const MOVEMENT_ARRIVES = 'movement.arrives';
|
|
|
|
// The target starts to see an incoming group; only pushes the change.
|
|
public const MOVEMENT_SPOTTED = 'movement.spotted';
|
|
|
|
// The owner calls support back: village_id is the host, subject_id the support's home village.
|
|
public const SUPPORT_RECALLED = 'support.recalled';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $dateFormat = 'Y-m-d H:i:s.v';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'fire_at' => 'immutable_datetime',
|
|
'processed_at' => 'immutable_datetime',
|
|
];
|
|
}
|
|
|
|
public function village(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Village::class);
|
|
}
|
|
}
|