MCPcopy Create free account
hub / github.com/TurningWheel/Barony / statGetPER

Function statGetPER

src/entity.cpp:9400–9556  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9398}
9399
9400Sint32 statGetPER(Stat* entitystats, Entity* my)
9401{
9402 Sint32 PER;
9403
9404 if ( !entitystats )
9405 {
9406 return 0;
9407 }
9408
9409 PER = entitystats->PER;
9410
9411 bool cursedItemIsBuff = false;
9412 bool shapeshifted = false;
9413 if ( my && my->behavior == &actPlayer )
9414 {
9415 cursedItemIsBuff = shouldInvertEquipmentBeatitude(entitystats);
9416 if ( my->effectShapeshift != NOTHING )
9417 {
9418 shapeshifted = true;
9419 if ( my->effectShapeshift == SPIDER )
9420 {
9421 int bonusPER = 5;
9422 PER += bonusPER;
9423 if ( PER >= 0 )
9424 {
9425 PER *= 1.33;
9426 }
9427 }
9428 else if ( my->effectShapeshift == CREATURE_IMP )
9429 {
9430 int bonusPER = 3;
9431 PER += bonusPER;
9432 if ( PER >= 0 )
9433 {
9434 PER *= 1.25;
9435 }
9436 }
9437 else if ( my->effectShapeshift == RAT )
9438 {
9439 int bonusPER = 3;
9440 PER += bonusPER;
9441 if ( PER >= 0 )
9442 {
9443 PER *= 1.25;
9444 }
9445 }
9446 }
9447 }
9448
9449 if ( svFlags & SV_FLAG_HUNGER )
9450 {
9451 if ( entitystats->type != AUTOMATON )
9452 {
9453 if ( entitystats->HUNGER <= getEntityHungerInterval(-1, my, entitystats, HUNGER_INTERVAL_STARVING) )
9454 {
9455 PER--;
9456 }
9457 }

Callers 15

actPlayerFunction · 0.85
actArrowFunction · 0.85
formatItemIconMethod · 0.85
formatItemDetailsMethod · 0.85
glBeginCameraFunction · 0.85
actThrownFunction · 0.85
handleMainMenuFunction · 0.85
applyLockpickMethod · 0.85
getPERMethod · 0.85
attackMethod · 0.85

Calls 3

getEntityHungerIntervalFunction · 0.85

Tested by

no test coverage detected