Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int64_t Creature::getStepDuration() const
- {
- if (isRemoved()) {
- return 0;
- }
- uint32_t calculatedStepSpeed;
- uint32_t groundSpeed;
- int32_t stepSpeed = getStepSpeed();
- if (stepSpeed > -Creature::speedB) {
- calculatedStepSpeed = floor((Creature::speedA * log((stepSpeed / 2) + Creature::speedB) + Creature::speedC) + 0.5);
- if (calculatedStepSpeed <= 0) {
- calculatedStepSpeed = 1;
- }
- } else {
- calculatedStepSpeed = 1;
- }
- Item* ground = _tile->getGround();
- if (ground) {
- groundSpeed = Item::items[ground->getID()].speed;
- if (groundSpeed == 0) {
- groundSpeed = 150;
- }
- } else {
- groundSpeed = 150;
- }
- double duration = std::floor(1000 * groundSpeed / calculatedStepSpeed);
- int64_t stepDuration = std::ceil(duration / 50) * 50;
- const Monster* monster = getMonster();
- if (monster && monster->isTargetNearby() && !monster->isFleeing() && !monster->getMaster()) {
- stepDuration *= 2;
- }
- return stepDuration;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement