예제 #1
0
파일: CSStats.cpp 프로젝트: Smeky/TestTD
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 );
        }
    }
}
예제 #2
0
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 );
    }
}