| 279 | } |
| 280 | |
| 281 | public inflictDamage(damage: number, reason: QuestEntityDamageReason): void{ |
| 282 | // We save the damage reason |
| 283 | this.lastDamageReason = reason; |
| 284 | |
| 285 | // If we're destructible, we get the damage |
| 286 | if(this.destructible){ |
| 287 | // If we're not a turtle |
| 288 | if(this.turtle == false) |
| 289 | this.setHp(this.getHp()-damage); |
| 290 | // Else, we're a turtle |
| 291 | else |
| 292 | this.setHp(this.getHp()-Math.ceil(damage/2)); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | public isOutOfArea(): boolean{ |
| 297 | // If the entity if too much out of the area, we return true |