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

Method getModifiedProficiency

src/stat.cpp:66–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65int Stat::maxEquipmentBonusToSkill = 25;
66Sint32 Stat::getModifiedProficiency(int skill) const
67{
68 if ( !(skill >= 0 && skill < NUMPROFICIENCIES) )
69 {
70 return 0;
71 }
72
73 Sint32 base = std::min(100, std::max(0, PROFICIENCIES[skill]));
74 Sint32 equipmentBonus = 0;
75
76 bool cursedItemIsBuff = false;
77 bool isPlayer = false;
78 for ( int i = 0; i < MAXPLAYERS; ++i )
79 {
80 if ( this == stats[i] )
81 {
82 isPlayer = true;
83 break;
84 }
85 }
86 if ( isPlayer )
87 {
88 cursedItemIsBuff = shouldInvertEquipmentBeatitude(this);
89 }
90
91 if ( mask )
92 {
93 if ( mask->type == MASK_HAZARD_GOGGLES && skill == PRO_ALCHEMY )
94 {
95 if ( mask->beatitude >= 0 || cursedItemIsBuff )
96 {
97 equipmentBonus += std::min(maxEquipmentBonusToSkill, (1 + abs(mask->beatitude)) * 10);
98 }
99 else
100 {
101 equipmentBonus -= abs(mask->beatitude) * 10;
102 }
103 }
104 else if ( mask->type == MASK_GOLDEN && skill == PRO_TRADING )
105 {
106 if ( mask->beatitude >= 0 || cursedItemIsBuff )
107 {
108 equipmentBonus += std::min(maxEquipmentBonusToSkill, (1 + abs(mask->beatitude)) * 10);
109 }
110 else
111 {
112 equipmentBonus -= 999;
113 }
114 }
115 else if ( (mask->type == MASK_STEEL_VISOR || mask->type == MASK_CRYSTAL_VISOR)
116 && (skill == PRO_SWORD || skill == PRO_AXE || skill == PRO_POLEARM || skill == PRO_MACE) )
117 {
118 if ( mask->beatitude >= 0 || cursedItemIsBuff )
119 {
120 equipmentBonus += std::min(maxEquipmentBonusToSkill, (1 + abs(mask->beatitude)) * 5);
121 }
122 else
123 {

Callers 15

skillCapstoneUnlockedFunction · 0.80
handlePlayerMovementMethod · 0.80
actPlayerFunction · 0.80
jewelItemRecruitFunction · 0.80
isItemSellableToShopFunction · 0.80
actHudWeaponFunction · 0.80
actArrowFunction · 0.80
getSpellIconTextMethod · 0.80
formatItemIconMethod · 0.80
formatItemDetailsMethod · 0.80

Calls 1

Tested by

no test coverage detected