Skip to content

Commit

Permalink
Merge pull request #1 from SphereUO/feature/modval
Browse files Browse the repository at this point in the history
Migrate ModAr and ModAc to ModVal
  • Loading branch information
raydienull authored Nov 18, 2023
2 parents 1f4b01d + 4229503 commit f98ad97
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
14 changes: 9 additions & 5 deletions src/game/CObjBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ CObjBase::CObjBase( bool fItem ) // PROFILE_TIME_QTY is unused, CObjBase is not

m_attackBase = m_attackRange = 0;
m_defenseBase = m_defenseRange = 0;
m_ModAr = 0;
_iModVal = 0;

m_wHue = HUE_DEFAULT;
m_ModMaxWeight = 0;
Expand Down Expand Up @@ -1458,7 +1458,9 @@ bool CObjBase::r_WriteVal( lpctstr ptcKey, CSString &sVal, CTextConsole * pSrc,
break;
case OC_MODAR:
case OC_MODAC:
sVal.FormatVal( m_ModAr );
DEBUG_ERR(( "ModAr and ModAc are deprecated. Use ModVal \n"));
case OC_MODVAL:
sVal.FormatVal( _iModVal );
break;
case OC_NAME:
sVal = GetName();
Expand Down Expand Up @@ -1880,8 +1882,10 @@ bool CObjBase::r_LoadVal( CScript & s )
break;
case OC_MODAR:
case OC_MODAC:
DEBUG_ERR(( "ModAr and ModAc are deprecated. Use ModVal \n"));
case OC_MODVAL:
{
m_ModAr = s.GetArgVal();
_iModVal = s.GetArgVal();
CChar * pChar = dynamic_cast <CChar*>(GetTopLevelObj());
if ( pChar )
{
Expand Down Expand Up @@ -1980,8 +1984,8 @@ void CObjBase::r_Write( CScript & s )
s.WriteKeyVal( "TIMESTAMP", GetTimeStamp());
if ( const CCSpawn* pSpawn = GetSpawn() )
s.WriteKeyHex("SPAWNITEM", pSpawn->GetLink()->GetUID().GetObjUID());
if ( m_ModAr )
s.WriteKeyVal("MODAR", m_ModAr);
if ( _iModVal )
s.WriteKeyVal("MODVAL", _iModVal);
if ( m_ModMaxWeight )
s.WriteKeyVal("MODMAXWEIGHT", m_ModMaxWeight);

Expand Down
2 changes: 1 addition & 1 deletion src/game/CObjBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ public: virtual bool IsDeleted() const override;

public:
// Some global object variables
int m_ModAr;
int _iModVal;

#define SU_UPDATE_HITS 0x01 // update hits to others
#define SU_UPDATE_MODE 0x02 // update mode to all
Expand Down
2 changes: 1 addition & 1 deletion src/game/chars/CCharFight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ int CChar::CalcArmorDefense() const
iDefenseTotal += sm_ArmorLayers[i].m_iCoverage * ArmorRegionMax[i];
}

return maximum(( iDefenseTotal / 100 ) + m_ModAr, 0);
return maximum(( iDefenseTotal / 100 ) + _iModVal, 0);
}

int CChar::CalcPercentArmorDefense(LAYER_TYPE layer) //static
Expand Down
2 changes: 1 addition & 1 deletion src/game/clients/CClientMsg_AOSTooltip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void CClient::AOSTooltip_addDefaultItemData(CItem * pItem)
PUSH_BACK_TOOLTIP(pItem, new CClientTooltip(1017383)); // poisoned

PUSH_BACK_TOOLTIP(pItem, t = new CClientTooltip(1061168)); // weapon damage ~1_val~ - ~2_val~
t->FormatArgs("%d\t%d", pItem->m_attackBase + pItem->m_ModAr, pItem->Weapon_GetAttack(true));
t->FormatArgs("%d\t%d", pItem->m_attackBase + pItem->_iModVal, pItem->Weapon_GetAttack(true));

PUSH_BACK_TOOLTIP(pItem, t = new CClientTooltip(1061167)); // weapon speed ~1_val~
t->FormatArgs("%hhu", pItem->GetSpeed());
Expand Down
4 changes: 2 additions & 2 deletions src/game/items/CItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4751,7 +4751,7 @@ int CItem::Armor_GetDefense() const
if ( ! IsTypeArmor())
return 0;

int iVal = m_defenseBase + m_ModAr;
int iVal = m_defenseBase + _iModVal;
if ( IsSetOF(OF_ScaleDamageByDurability) && m_itArmor.m_wHitsMax > 0 && m_itArmor.m_dwHitsCur < m_itArmor.m_wHitsMax )
{
int iRepairPercent = 50 + ((50 * m_itArmor.m_dwHitsCur) / m_itArmor.m_wHitsMax);
Expand All @@ -4772,7 +4772,7 @@ int CItem::Weapon_GetAttack(bool fGetRange) const
if ( ! IsTypeWeapon()) // anything can act as a weapon.
return 1;

int iVal = m_attackBase + m_ModAr;
int iVal = m_attackBase + _iModVal;
if ( fGetRange )
iVal += m_attackRange;

Expand Down
1 change: 1 addition & 0 deletions src/tables/CObjBase_props.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ ADD(ISWEAPON, "ISWEAPON")
ADD(MAP, "MAP")
ADD(MODAC, "MODAC")
ADD(MODAR, "MODAR")
ADD(MODVAL, "MODVAL")
ADD(MODMAXWEIGHT, "MODMAXWEIGHT")
ADD(NAME, "NAME")
ADD(NAMELOC, "NAMELOC")
Expand Down

0 comments on commit f98ad97

Please sign in to comment.