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

Method updateEventsInMainLoop

src/mod_tools.cpp:17094–17258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17092}
17093
17094void Compendium_t::Events_t::updateEventsInMainLoop(const int playernum)
17095{
17096 if ( !(players[playernum] && players[playernum]->entity && stats[playernum]) )
17097 {
17098 return;
17099 }
17100
17101 if ( ticks % TICKS_PER_SECOND == 25 )
17102 {
17103 auto entity = players[playernum]->entity;
17104 auto myStats = stats[playernum];
17105 {
17106 real_t resistance = 100.0 * Entity::getDamageTableMultiplier(entity, *myStats, DAMAGE_TABLE_MAGIC);
17107 resistance = -(resistance - 100.0);
17108 eventUpdateCodex(playernum, CPDM_RES_MAX, "res", (int)resistance);
17109 eventUpdateCodex(playernum, CPDM_CLASS_RES_MAX, "res", (int)resistance);
17110 }
17111
17112 {
17113 {
17114 Sint32 value = statGetSTR(myStats, entity);
17115 value -= myStats->STR;
17116 if ( value > 0 )
17117 {
17118 Compendium_t::Events_t::eventUpdateCodex(playernum, Compendium_t::CPDM_STAT_MAX, "str", value);
17119 }
17120 }
17121 {
17122 Sint32 value = statGetDEX(myStats, entity);
17123 value -= myStats->DEX;
17124 if ( value > 0 )
17125 {
17126 Compendium_t::Events_t::eventUpdateCodex(playernum, Compendium_t::CPDM_STAT_MAX, "dex", value);
17127 }
17128 }
17129 {
17130 Sint32 value = statGetCON(myStats, entity);
17131 value -= myStats->CON;
17132 if ( value > 0 )
17133 {
17134 Compendium_t::Events_t::eventUpdateCodex(playernum, Compendium_t::CPDM_STAT_MAX, "con", value);
17135 }
17136 }
17137 {
17138 Sint32 value = statGetINT(myStats, entity);
17139 value -= myStats->INT;
17140 if ( value > 0 )
17141 {
17142 Compendium_t::Events_t::eventUpdateCodex(playernum, Compendium_t::CPDM_STAT_MAX, "int", value);
17143 }
17144 }
17145 {
17146 Sint32 value = statGetPER(myStats, entity);
17147 value -= myStats->PER;
17148 if ( value > 0 )
17149 {
17150 Compendium_t::Events_t::eventUpdateCodex(playernum, Compendium_t::CPDM_STAT_MAX, "per", value);
17151 }

Callers

nothing calls this directly

Calls 14

statGetSTRFunction · 0.85
statGetDEXFunction · 0.85
statGetCONFunction · 0.85
statGetINTFunction · 0.85
statGetPERFunction · 0.85
statGetCHRFunction · 0.85
ACFunction · 0.85
getSpellFromIDFunction · 0.85
itemIsEquippedFunction · 0.85
selectedSpellMethod · 0.80

Tested by

no test coverage detected