Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fix some medkit behaviour
apply "soldiersRevived" when using stimulants
don't apply "soldiersRevived" multiple times
when healing wounds on unconscious units and waking them up
exit the screen if an unconscious unit has had
all wounds healed and was woken up in the process
Loading branch information
Showing
2 changed files
with
15 additions
and
4 deletions .
+14
−4
src/Battlescape/MedikitState.cpp
+1
−0
src/Battlescape/MedikitState.h
@@ -119,7 +119,7 @@ MedikitButton::MedikitButton(int y) : InteractiveSurface(30, 20, 190, y)
* @param targetUnit The wounded unit.
* @param action The healing action.
*/
MedikitState::MedikitState (BattleUnit *targetUnit, BattleAction *action) : _targetUnit(targetUnit), _action(action)
MedikitState::MedikitState (BattleUnit *targetUnit, BattleAction *action) : _targetUnit(targetUnit), _action(action), _revivedTarget( false )
{
if (Options::maximizeInfoScreens)
{
@@ -228,11 +228,20 @@ void MedikitState::onHealClick(Action *)
_medikitView->updateSelectedPart ();
_medikitView->invalidate ();
update ();
if (_targetUnit->getStatus () == STATUS_UNCONSCIOUS && _targetUnit->getStunlevel () < _targetUnit->getHealth () && _targetUnit->getHealth () > 0 )
{
_targetUnit->setTimeUnits (0 );
_action->actor ->getStatistics ()->revivedSoldier ++;
if (!_revivedTarget)
{
_targetUnit->setTimeUnits (0 );
_action->actor ->getStatistics ()->revivedSoldier ++;
_revivedTarget = true ;
}
// if the unit has revived and has no more wounds, we quit this screen automatically
if (_targetUnit->getFatalWounds () == 0 )
{
onEndClick (0 );
}
}
_unit->getStatistics ()->woundsHealed ++;
}
@@ -266,6 +275,7 @@ void MedikitState::onStimulantClick(Action *)
if (_targetUnit->getStatus () == STATUS_UNCONSCIOUS && _targetUnit->getStunlevel () < _targetUnit->getHealth () && _targetUnit->getHealth () > 0 )
{
_targetUnit->setTimeUnits (0 );
_action->actor ->getStatistics ()->revivedSoldier ++;
onEndClick (0 );
}
}
@@ -42,6 +42,7 @@ class MedikitState : public State
BattleItem *_item;
BattleAction *_action;
int _tu;
bool _revivedTarget;
// / Handler for the end button.
void onEndClick (Action *action);
// / Handler for the heal button.
Toggle all file notes