| 2037 | } |
| 2038 | |
| 2039 | void Creature::useAttack(CreatureSkillData& skillData, GameEntity& entityAttack, |
| 2040 | Tile& tileAttack, bool ko, bool notifyPlayerIfHit) |
| 2041 | { |
| 2042 | // Turn to face the entity we are attacking and set the animation state to Attack. |
| 2043 | const Ogre::Vector3& pos = getPosition(); |
| 2044 | Ogre::Vector3 walkDirection(tileAttack.getX() - pos.x, tileAttack.getY() - pos.y, 0); |
| 2045 | walkDirection.normalise(); |
| 2046 | setAnimationState(EntityAnimation::attack_anim, false, walkDirection, true); |
| 2047 | fireCreatureSound(CreatureSound::Attack); |
| 2048 | setNbTurnsWithoutBattle(0); |
| 2049 | |
| 2050 | // Calculate how much damage we do. |
| 2051 | Tile* myTile = getPositionTile(); |
| 2052 | float range = Pathfinding::distanceTile(*myTile, tileAttack); |
| 2053 | |
| 2054 | // We use the skill |
| 2055 | skillData.mSkill->tryUseFight(*getGameMap(), this, range, |
| 2056 | &entityAttack, &tileAttack, ko, notifyPlayerIfHit); |
| 2057 | skillData.mWarmup = skillData.mSkill->getWarmupNbTurns(); |
| 2058 | skillData.mCooldown = skillData.mSkill->getCooldownNbTurns(); |
| 2059 | |
| 2060 | // Fighting is tiring |
| 2061 | decreaseWakefulness(0.5); |
| 2062 | // but gives experience |
| 2063 | receiveExp(1.5); |
| 2064 | } |
| 2065 | |
| 2066 | bool Creature::isActionInList(CreatureActionType action) const |
| 2067 | { |
no test coverage detected