| 194 | } |
| 195 | |
| 196 | float Player::getSpellCooldownSmoothTime(SpellType spellType) const |
| 197 | { |
| 198 | uint32_t spellIndex = static_cast<uint32_t>(spellType); |
| 199 | if(spellIndex >= mSpellsCooldown.size()) |
| 200 | { |
| 201 | OD_LOG_ERR("seatId=" + Helper::toString(getId()) + ", spellType=" + SpellManager::getSpellNameFromSpellType(spellType)); |
| 202 | return 0; |
| 203 | } |
| 204 | |
| 205 | const PlayerSpellData& cooldown = mSpellsCooldown.at(spellIndex); |
| 206 | uint32_t cooldownTurns = cooldown.mCooldownNbTurnPending; |
| 207 | if(cooldownTurns <= 0) |
| 208 | return 0.0f; |
| 209 | |
| 210 | float cooldownTime = static_cast<float>(cooldownTurns - 1) / ODApplication::turnsPerSecond; |
| 211 | cooldownTime += cooldown.mCooldownTimePendingTurn; |
| 212 | |
| 213 | return cooldownTime; |
| 214 | } |
| 215 | |
| 216 | void Player::decreaseSpellCooldowns() |
| 217 | { |
no test coverage detected