Skip to content

Commit

Permalink
Revert "Moved Leech Props"
Browse files Browse the repository at this point in the history
This reverts commit 41c7ee4.
  • Loading branch information
DragonSlayer62 committed Jan 17, 2025
1 parent 41c7ee4 commit 6583a51
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 99 deletions.
96 changes: 95 additions & 1 deletion source/cBaseObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ const SI16 DEFBASE_KILLS = 0;
const UI16 DEFBASE_RESIST = 0;
const bool DEFBASE_NAMEREQUESTACTIVE = 0;
const ExpansionRuleset DEFBASE_ORIGIN = ER_UO;
const SI16 DEFBASE_HEALTHLEECH = 0;
const SI16 DEFBASE_STAMINALEECH = 0;
const SI16 DEFBASE_MANALEECH = 0;

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject constructor
Expand All @@ -110,7 +113,8 @@ loDamage( DEFBASE_LODAMAGE ), weight( DEFBASE_WEIGHT ),
mana( DEFBASE_MANA ), stamina( DEFBASE_STAMINA ), scriptTrig( DEFBASE_SCPTRIG ), st2( DEFBASE_STR2 ), dx2( DEFBASE_DEX2 ),
in2( DEFBASE_INT2 ), FilePosition( DEFBASE_FP ),
poisoned( DEFBASE_POISONED ), carve( DEFBASE_CARVE ), oldLocX( 0 ), oldLocY( 0 ), oldLocZ( 0 ), oldTargLocX( 0 ), oldTargLocY( 0 ),
fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN )
fame( DEFBASE_FAME ), karma( DEFBASE_KARMA ), kills( DEFBASE_KILLS ), subRegion( DEFBASE_SUBREGION ), nameRequestActive( DEFBASE_NAMEREQUESTACTIVE ), origin( DEFBASE_ORIGIN ),
healthLeech( DEFBASE_HEALTHLEECH ), staminaLeech( DEFBASE_STAMINALEECH ), manaLeech( DEFBASE_MANALEECH )
{
multis = nullptr;
tempMulti = INVALIDSERIAL;
Expand Down Expand Up @@ -1631,6 +1635,66 @@ void CBaseObject::SetIntelligence2( SI16 nVal )
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetHealthLeech()
//| CBaseObject::SetHealthLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Health Leech
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetHealthLeech( void ) const
{
return healthLeech;
}
void CBaseObject::SetHealthLeech( SI16 nVal )
{
healthLeech = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetStaminaLeech()
//| CBaseObject::SetStaminaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Stamina Leech
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetStaminaLeech( void ) const
{
return staminaLeech;
}
void CBaseObject::SetStaminaLeech( SI16 nVal )
{
staminaLeech = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::GetManaLeech()
//| CBaseObject::SetManaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Mana Leech
//o------------------------------------------------------------------------------------------------o
SI16 CBaseObject::GetManaLeech( void ) const
{
return manaLeech;
}
void CBaseObject::SetManaLeech( SI16 nVal )
{
manaLeech = nVal;

if( CanBeObjType( OT_ITEM ))
{
( static_cast<CItem *>( this ))->UpdateRegion();
}
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::IncStrength()
//o------------------------------------------------------------------------------------------------o
Expand Down Expand Up @@ -1661,6 +1725,36 @@ void CBaseObject::IncIntelligence( SI16 toInc )
SetIntelligence( intelligence + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::IncHealthLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Health Leech Points value
//o------------------------------------------------------------------------------------------------o
void CBaseObject::IncHealthLeech( SI16 toInc )
{
SetHealthLeech( healthLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::IncStaminaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Stamina Leech Points value
//o------------------------------------------------------------------------------------------------o
void CBaseObject::IncStaminaLeech( SI16 toInc )
{
SetStaminaLeech( staminaLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::IncManaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Mana Leech Points value
//o------------------------------------------------------------------------------------------------o
void CBaseObject::IncManaLeech( SI16 toInc )
{
SetManaLeech( manaLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CBaseObject::DumpFooter()
//o------------------------------------------------------------------------------------------------o
Expand Down
16 changes: 16 additions & 0 deletions source/cBaseObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ class CBaseObject
SI32 weight;
SI16 mana;
SI16 stamina;
SI16 healthLeech;
SI16 staminaLeech;
SI16 manaLeech;
UI16 scriptTrig;
SI16 st2;
SI16 dx2;
Expand Down Expand Up @@ -256,6 +259,19 @@ class CBaseObject
void IncDexterity( SI16 toInc = 1 );
void IncIntelligence( SI16 toInc = 1 );

SI16 GetHealthLeech( void ) const;
virtual void SetHealthLeech( SI16 nVal );

SI16 GetStaminaLeech( void ) const;
virtual void SetStaminaLeech( SI16 nVal );

SI16 GetManaLeech( void ) const;
virtual void SetManaLeech( SI16 nVal );

void IncHealthLeech( SI16 toInc = 1 );
void IncStaminaLeech( SI16 toInc = 1 );
void IncManaLeech( SI16 toInc = 1 );

virtual void PostLoadProcessing( void );
virtual bool LoadRemnants( void ) = 0;

Expand Down
83 changes: 1 addition & 82 deletions source/cItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ const UI16 DEFITEM_MAXUSES = 0;
const UI16 DEFITEM_REGIONNUM = 255;
const UI16 DEFITEM_TEMPLASTTRADED = 0;
const SI08 DEFITEM_STEALABLE = 1;
const SI16 DEFITEM_HEALTHLEECH = 0;
const SI16 DEFITEM_STAMINALEECH = 0;
const SI16 DEFITEM_MANALEECH = 0;

//o------------------------------------------------------------------------------------------------o
//| Function - CItem()
Expand All @@ -110,7 +107,7 @@ spd( DEFITEM_SPEED ), maxHp( DEFITEM_MAXHP ), amount( DEFITEM_AMOUNT ),
layer( DEFITEM_LAYER ), type( DEFITEM_TYPE ), offspell( DEFITEM_OFFSPELL ), entryMadeFrom( DEFITEM_ENTRYMADEFROM ),
creator( DEFITEM_CREATOR ), gridLoc( DEFITEM_GRIDLOC ), weightMax( DEFITEM_WEIGHTMAX ), baseWeight( DEFITEM_BASEWEIGHT ), maxItems( DEFITEM_MAXITEMS ),
maxRange( DEFITEM_MAXRANGE ), baseRange( DEFITEM_BASERANGE ), maxUses( DEFITEM_MAXUSES ), usesLeft( DEFITEM_USESLEFT ), regionNum( DEFITEM_REGIONNUM ),
tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE ), healthLeech( DEFITEM_HEALTHLEECH ), staminaLeech( DEFITEM_STAMINALEECH ), manaLeech( DEFITEM_MANALEECH )
tempLastTraded( DEFITEM_TEMPLASTTRADED ), stealable( DEFITEM_STEALABLE )
{
spells[0] = spells[1] = spells[2] = 0;
value[0] = value[1] = value[2] = 0;
Expand Down Expand Up @@ -545,54 +542,6 @@ auto CItem::SetSpawnerList( bool newValue ) -> void
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetHealthLeech()
//| CItem::SetHealthLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Health Leech
//o------------------------------------------------------------------------------------------------o
SI16 CItem::GetHealthLeech( void ) const
{
return healthLeech;
}
void CItem::SetHealthLeech( SI16 nVal )
{
healthLeech = nVal;
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetStaminaLeech()
//| CItem::SetStaminaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Stamina Leech
//o------------------------------------------------------------------------------------------------o
SI16 CItem::GetStaminaLeech( void ) const
{
return staminaLeech;
}
void CItem::SetStaminaLeech( SI16 nVal )
{
staminaLeech = nVal;
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetManaLeech()
//| CItem::SetManaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Gets/Sets the Mana Leech
//o------------------------------------------------------------------------------------------------o
SI16 CItem::GetManaLeech( void ) const
{
return manaLeech;
}
void CItem::SetManaLeech( SI16 nVal )
{
manaLeech = nVal;
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetName2()
//| CItem::SetName2()
Expand Down Expand Up @@ -1391,36 +1340,6 @@ auto CItem::SetWeightMax( SI32 newValue ) -> void
UpdateRegion();
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::IncHealthLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Health Leech Points value
//o------------------------------------------------------------------------------------------------o
void CItem::IncHealthLeech( SI16 toInc )
{
SetHealthLeech( healthLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::IncStaminaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Stamina Leech Points value
//o------------------------------------------------------------------------------------------------o
void CItem::IncStaminaLeech( SI16 toInc )
{
SetStaminaLeech( staminaLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::IncManaLeech()
//o------------------------------------------------------------------------------------------------o
//| Purpose - Increments the object's Mana Leech Points value
//o------------------------------------------------------------------------------------------------o
void CItem::IncManaLeech( SI16 toInc )
{
SetManaLeech( manaLeech + toInc );
}

//o------------------------------------------------------------------------------------------------o
//| Function - CItem::GetBaseWeight()
//| CItem::SetBaseWeight()
Expand Down
16 changes: 0 additions & 16 deletions source/cItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ class CItem : public CBaseObject
TIMERVAL decayTime;
UI08 spd; // The speed of the weapon
UI16 maxHp; // Max number of hit points an item can have.
SI16 healthLeech;
SI16 staminaLeech;
SI16 manaLeech;
UI16 amount; // Amount of items in pile
ItemLayers layer; // Layer if equipped on paperdoll
ItemTypes type; // For things that do special things on doubleclicking
Expand Down Expand Up @@ -169,19 +166,6 @@ class CItem : public CBaseObject

auto InDungeon() -> bool;

virtual SI16 GetHealthLeech( void ) const;
virtual void SetHealthLeech( SI16 nVal );

virtual SI16 GetStaminaLeech( void ) const;
virtual void SetStaminaLeech( SI16 nVal );

virtual SI16 GetManaLeech( void ) const;
virtual void SetManaLeech( SI16 nVal );

void IncHealthLeech( SI16 toInc = 1 );
void IncStaminaLeech( SI16 toInc = 1 );
void IncManaLeech( SI16 toInc = 1 );

auto GetLayer() const -> ItemLayers;
auto SetLayer( ItemLayers newValue ) -> void;

Expand Down

0 comments on commit 6583a51

Please sign in to comment.