@@ -1765,20 +1765,42 @@ public int GetFeatGainLevel(NwFeat feat)
17651765 /// Gets the remaining uses available for the specified feat.
17661766 /// </summary>
17671767 /// <param name="feat">The feat to query.</param>
1768- /// <returns>The amount of remaining uses.</returns>
1769- public byte GetFeatRemainingUses ( NwFeat feat )
1768+ /// <returns>The amount of remaining uses. If the feat has unlimited uses, returns int.MaxValue. </returns>
1769+ public int GetFeatRemainingUses ( NwFeat feat )
17701770 {
1771- return Creature . m_pStats . GetFeatRemainingUses ( feat . Id ) ;
1771+ const int featUsePerDayUnlimited = 100 ;
1772+
1773+ CNWSCreatureStats ? creatureStats = creature . m_pStats ;
1774+ ushort sourceFeat = creature . m_pStats . GetHighestLevelOfFeat ( feat . Id ) ;
1775+
1776+ int retVal = 0 ;
1777+ if ( sourceFeat != ushort . MaxValue && creatureStats . HasFeat ( sourceFeat ) . ToBool ( ) )
1778+ {
1779+ retVal = creatureStats . GetFeatRemainingUses ( sourceFeat ) ;
1780+ }
1781+
1782+ return retVal == featUsePerDayUnlimited ? int . MaxValue : retVal ;
17721783 }
17731784
17741785 /// <summary>
17751786 /// Gets the max/total amount of times the specified feat can be used.
17761787 /// </summary>
17771788 /// <param name="feat">The feat to query.</param>
1778- /// <returns>The amount of remaining uses.</returns>
1779- public byte GetFeatTotalUses ( NwFeat feat )
1789+ /// <returns>The total feat uses. If the feat has unlimited uses, returns int.MaxValue .</returns>
1790+ public int GetFeatTotalUses ( NwFeat feat )
17801791 {
1781- return Creature . m_pStats . GetFeatTotalUses ( feat . Id ) ;
1792+ const int featUsePerDayUnlimited = 100 ;
1793+
1794+ CNWSCreatureStats ? creatureStats = creature . m_pStats ;
1795+ ushort sourceFeat = creature . m_pStats . GetHighestLevelOfFeat ( feat . Id ) ;
1796+
1797+ int retVal = 0 ;
1798+ if ( sourceFeat != ushort . MaxValue && creatureStats . HasFeat ( sourceFeat ) . ToBool ( ) )
1799+ {
1800+ retVal = creatureStats . GetFeatTotalUses ( sourceFeat ) ;
1801+ }
1802+
1803+ return retVal == featUsePerDayUnlimited ? int . MaxValue : retVal ;
17821804 }
17831805
17841806 /// <summary>
0 commit comments