1
0
Fork 0
spacetac/src/core/events/BaseLogEvent.ts

41 lines
1.2 KiB
TypeScript
Raw Normal View History

2017-02-09 00:00:35 +00:00
module TS.SpaceTac {
2014-12-31 00:00:00 +00:00
// Base class for a BattleLog event
export class BaseLogEvent {
2014-12-31 00:00:00 +00:00
// Code of the event (its type)
code: string;
// The ship causing the event (the one whose turn it is to play)
2017-03-09 17:11:00 +00:00
ship: Ship | null;
2014-12-31 00:00:00 +00:00
// Target of the event
2017-03-09 17:11:00 +00:00
target: Target | null;
2014-12-31 00:00:00 +00:00
// Boolean at true if the event is used to set initial battle conditions
initial = false;
2017-03-09 17:11:00 +00:00
constructor(code: string, ship: Ship | null = null, target: Target | null = null) {
2014-12-31 00:00:00 +00:00
this.code = code;
this.ship = ship;
this.target = target;
}
}
2017-03-09 17:11:00 +00:00
// Base class for a BattleLog event linked to a ship
export class BaseLogShipEvent extends BaseLogEvent {
ship: Ship;
constructor(code: string, ship: Ship, target: Target | null = null) {
super(code, ship, target);
}
}
// Base class for a BattleLog event linked to a ship, and with a target
export class BaseLogShipTargetEvent extends BaseLogShipEvent {
target: Target;
constructor(code: string, ship: Ship, target: Target) {
super(code, ship, target);
}
}
2015-01-07 00:00:00 +00:00
}