1
0
Fork 0
spacetac/src/core/effects/BaseEffect.ts

76 lines
1.9 KiB
TypeScript
Raw Normal View History

/// <reference path="../diffs/BaseBattleDiff.ts" />
2017-09-24 22:23:22 +00:00
module TK.SpaceTac {
/**
* Base class for effects of actions that can be applied on ships
*
* Effects will generate diffs to modify the battle state
*/
export class BaseEffect extends RObject {
// Identifier code for the type of effect
code: string
constructor(code: string) {
super();
this.code = code;
}
2015-01-28 00:00:00 +00:00
/**
* Get the list of diffs needed to activate this effect on a ship
*/
getOnDiffs(ship: Ship, source: Ship | Drone): BaseBattleDiff[] {
return [];
}
/**
* Get the list of diffs needed to remove this effect on a ship
*/
2017-11-29 22:03:58 +00:00
getOffDiffs(ship: Ship): BaseBattleDiff[] {
return [];
}
/**
* Get the list of diffs to apply when this effect is active on a ship beginning its turn
*/
getTurnStartDiffs(ship: Ship): BaseBattleDiff[] {
return [];
}
/**
* Get the list of diffs to apply when this effect is active on a ship ending its turn
*/
getTurnEndDiffs(ship: Ship): BaseBattleDiff[] {
return [];
2015-01-28 00:00:00 +00:00
}
2018-03-29 22:57:53 +00:00
/**
* Return true if the effect is internal and should not be displayed to the players
*/
isInternal(): boolean {
return false;
}
/**
* Return true if the effect is beneficial to the ship, false if it's a drawback
*/
isBeneficial(): boolean {
return false;
}
2018-03-29 22:57:53 +00:00
/**
* Get a full code, that can be used to identify this effect (for example: "attrlimit-aprecovery")
*/
getFullCode(): string {
return this.code;
}
2018-03-29 22:57:53 +00:00
/**
* Return a human readable description
*/
getDescription(): string {
return "unknown effect";
}
}
}