MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / adjustStats

Method adjustStats

src/Savegame/BattleUnit.cpp:2585–2596  ·  view source on GitHub ↗

* common function to adjust a unit's stats according to difficulty setting. * @param diff difficulty level (for stat adjustement). */

Source from the content-addressed store, hash-verified

2583 * @param diff difficulty level (for stat adjustement).
2584 */
2585void BattleUnit::adjustStats(const int diff)
2586{
2587 // adjust the unit's stats according to the difficulty level.
2588 _stats.tu += 4 * diff * _stats.tu / 100;
2589 _stats.stamina += 4 * diff * _stats.stamina / 100;
2590 _stats.reactions += 6 * diff * _stats.reactions / 100;
2591 _stats.firing = (_stats.firing + 6 * diff * _stats.firing / 100) / (diff > 0 ? 1 : 2);
2592 _stats.strength += 2 * diff * _stats.strength / 100;
2593 _stats.melee += 4 * diff * _stats.melee / 100;
2594 _stats.psiSkill += 4 * diff * _stats.psiSkill / 100;
2595 _stats.psiStrength += 4 * diff * _stats.psiStrength / 100;
2596}
2597
2598/**
2599 * did this unit already take fire damage this turn?

Callers 1

loadMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected