void CSStats::applyHPRegen( CStats& component ) { Stat* health = component.getStat( Stat::SID_Health ); if( health ) { Stat* hpRegen = component.getStat( Stat::SID_HPRegen ); if( hpRegen ) { health->change( hpRegen->max ); } } }
void EntityAction::handleStat( Entity& entity ) { CStats* cStats = entity.get<CStats>(); if( !cStats ) { return; } Stat* health = cStats->getStat( Stat::SID_Health ); if( !health ) { return; } if( stat == EAStat_Damage ) { // Temp, min-max should be randomized in RNG if( health->change( -maxValue ) ) { // Temp, should be replaced by some message MSG_SYSTEM.send( c_msgEnemyDied, entity ); } } else if( stat == EAStat_Heal ) { health->change( maxValue ); } }