File size: 774 Bytes
4ee4376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import tile from './tile';
import * as CONST from '../../constants';

export default class water extends tile {
  constructor (options) {
    options.type = CONST.T_WATER;
    options.layerDepth = CONST.DEPTH_WATER;
    super(options);
  }

  check () {
    if (!super.check()) return false;

    if (![270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290].includes(this.id)) return false;

    if (this.cell.water.type == CONST.TERRAIN_DRY) return false;

    return true;
  }

  position () {
    this.x = this.cell.position.topLeft.x;
    this.y = this.cell.position.topLeft.y - this.cell.position.seaLevel;
  }

  create () {
    if (this.cell.water.type == CONST.TERRAIN_WATERFALL)
      this.depthAdjustment++;

    super.create();
  }
}