2017-11-14 00:07:06 +00:00
|
|
|
/// <reference path="BaseBattleDiff.ts"/>
|
|
|
|
|
|
|
|
module TK.SpaceTac {
|
|
|
|
/**
|
|
|
|
* A drone is deployed by a ship
|
|
|
|
*/
|
|
|
|
export class DroneDeployedDiff extends BaseBattleShipDiff {
|
|
|
|
// Drone object
|
|
|
|
drone: Drone
|
|
|
|
|
2017-11-29 22:03:58 +00:00
|
|
|
constructor(drone: Drone) {
|
2017-11-14 00:07:06 +00:00
|
|
|
super(drone.owner);
|
|
|
|
|
|
|
|
this.drone = drone;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected applyOnShip(ship: Ship, battle: Battle): void {
|
|
|
|
battle.addDrone(this.drone);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getReverse(): BaseBattleDiff {
|
2017-11-29 22:03:58 +00:00
|
|
|
return new DroneRecalledDiff(this.drone);
|
2017-11-14 00:07:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-11-29 22:03:58 +00:00
|
|
|
* A drone is recalled
|
2017-11-14 00:07:06 +00:00
|
|
|
*/
|
2017-11-29 22:03:58 +00:00
|
|
|
export class DroneRecalledDiff extends BaseBattleShipDiff {
|
2017-11-14 00:07:06 +00:00
|
|
|
// Drone object
|
|
|
|
drone: Drone
|
|
|
|
|
2017-11-29 22:03:58 +00:00
|
|
|
constructor(drone: Drone) {
|
2017-11-14 00:07:06 +00:00
|
|
|
super(drone.owner);
|
|
|
|
|
|
|
|
this.drone = drone;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected applyOnShip(ship: Ship, battle: Battle): void {
|
|
|
|
battle.removeDrone(this.drone);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected getReverse(): BaseBattleDiff {
|
2017-11-29 22:03:58 +00:00
|
|
|
return new DroneDeployedDiff(this.drone);
|
2017-11-14 00:07:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|