MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getCreatureSpeed

Method getCreatureSpeed

source/traps/TrapDoor.cpp:423–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423double 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
447void TrapDoor::exportToStream(std::ostream& os) const
448{

Callers

nothing calls this directly

Calls 5

isAlliedSeatMethod · 0.80
isActionInListMethod · 0.80
isActivatedMethod · 0.45
getSeatMethod · 0.45

Tested by

no test coverage detected