| 421 | } |
| 422 | |
| 423 | double TrapDoor::getCreatureSpeed(const Creature* creature, Tile* tile) const |
| 424 | { |
| 425 | const TrapTileData* trapTileData = static_cast<const TrapTileData*>(mTileData.at(tile)); |
| 426 | if (!trapTileData->isActivated()) |
| 427 | return tile->getCreatureSpeedDefault(creature); |
| 428 | |
| 429 | if(!mIsLockedState) |
| 430 | return tile->getCreatureSpeedDefault(creature); |
| 431 | |
| 432 | // Enemy units can go through doors. We need that otherwise, they won't be able to |
| 433 | // get to the door. But in any case, if they are not fighting, we let them go. If |
| 434 | // they are fighting, we don't |
| 435 | if(getSeat()->isAlliedSeat(creature->getSeat())) |
| 436 | return 0.0; |
| 437 | |
| 438 | if(creature->isActionInList(CreatureActionType::fight) || |
| 439 | creature->isActionInList(CreatureActionType::flee)) |
| 440 | { |
| 441 | return 0.0; |
| 442 | } |
| 443 | |
| 444 | return tile->getCreatureSpeedDefault(creature); |
| 445 | } |
| 446 | |
| 447 | void TrapDoor::exportToStream(std::ostream& os) const |
| 448 | { |
nothing calls this directly
no test coverage detected