aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MobEffect.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.World/MobEffect.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
Project modernization (#630)
* Fixed boats falling and a TP glitch #266 * Replaced every C-style cast with C++ ones * Replaced every C-style cast with C++ ones * Fixed boats falling and a TP glitch #266 * Updated NULL to nullptr and fixing some type issues * Modernized and fixed a few bugs - Replaced most instances of `NULL` with `nullptr`. - Replaced most `shared_ptr(new ...)` with `make_shared`. - Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances. * Fixing more conflicts * Replace int loops with size_t and start work on overrides
Diffstat (limited to 'Minecraft.World/MobEffect.cpp')
-rw-r--r--Minecraft.World/MobEffect.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/Minecraft.World/MobEffect.cpp b/Minecraft.World/MobEffect.cpp
index 92f8c9d0..4ded9c41 100644
--- a/Minecraft.World/MobEffect.cpp
+++ b/Minecraft.World/MobEffect.cpp
@@ -46,7 +46,7 @@ MobEffect *MobEffect::reserved_31;
void MobEffect::staticCtor()
{
- voidEffect = NULL;
+ voidEffect = nullptr;
movementSpeed = (new MobEffect(1, false, eMinecraftColour_Effect_MovementSpeed)) ->setDescriptionId(IDS_POTION_MOVESPEED) ->setPostfixDescriptionId(IDS_POTION_MOVESPEED_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Speed)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESPEED, 0.2f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //setIcon(0, 0);
movementSlowdown = (new MobEffect(2, true, eMinecraftColour_Effect_MovementSlowDown)) ->setDescriptionId(IDS_POTION_MOVESLOWDOWN) ->setPostfixDescriptionId(IDS_POTION_MOVESLOWDOWN_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Slowness)->addAttributeModifier(SharedMonsterAttributes::MOVEMENT_SPEED, eModifierId_POTION_MOVESLOWDOWN, -0.15f, AttributeModifier::OPERATION_MULTIPLY_TOTAL); //->setIcon(1, 0);
digSpeed = (new MobEffect(3, false, eMinecraftColour_Effect_DigSpeed)) ->setDescriptionId(IDS_POTION_DIGSPEED) ->setPostfixDescriptionId(IDS_POTION_DIGSPEED_POSTFIX)->setDurationModifier(1.5)->setIcon(MobEffect::e_MobEffectIcon_Haste); //->setIcon(2, 0);
@@ -70,14 +70,14 @@ void MobEffect::staticCtor()
healthBoost = (new HealthBoostMobEffect(21, false, eMinecraftColour_Effect_HealthBoost)) ->setDescriptionId(IDS_POTION_HEALTHBOOST) ->setPostfixDescriptionId(IDS_POTION_HEALTHBOOST_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_HealthBoost)->addAttributeModifier(SharedMonsterAttributes::MAX_HEALTH, eModifierId_POTION_HEALTHBOOST, 4, AttributeModifier::OPERATION_ADDITION);
absorption = (new AbsoptionMobEffect(22, false, eMinecraftColour_Effect_Absoprtion)) ->setDescriptionId(IDS_POTION_ABSORPTION) ->setPostfixDescriptionId(IDS_POTION_ABSORPTION_POSTFIX)->setIcon(MobEffect::e_MobEffectIcon_Absorption);
saturation = (new InstantenousMobEffect(23, false, eMinecraftColour_Effect_Saturation)) ->setDescriptionId(IDS_POTION_SATURATION) ->setPostfixDescriptionId(IDS_POTION_SATURATION_POSTFIX);
- reserved_24 = NULL;
- reserved_25 = NULL;
- reserved_26 = NULL;
- reserved_27 = NULL;
- reserved_28 = NULL;
- reserved_29 = NULL;
- reserved_30 = NULL;
- reserved_31 = NULL;
+ reserved_24 = nullptr;
+ reserved_25 = nullptr;
+ reserved_26 = nullptr;
+ reserved_27 = nullptr;
+ reserved_28 = nullptr;
+ reserved_29 = nullptr;
+ reserved_30 = nullptr;
+ reserved_31 = nullptr;
}
MobEffect::MobEffect(int id, bool isHarmful, eMinecraftColour color) : id(id), _isHarmful(isHarmful), color(color)
@@ -173,13 +173,13 @@ void MobEffect::applyInstantenousEffect(shared_ptr<LivingEntity> source, shared_
{
if ((id == heal->id && !mob->isInvertedHealAndHarm()) || (id == harm->id && mob->isInvertedHealAndHarm()))
{
- int amount = (int) (scale * (double) (4 << amplification) + .5);
+ int amount = static_cast<int>(scale * (double)(4 << amplification) + .5);
mob->heal(amount);
}
else if ((id == harm->id && !mob->isInvertedHealAndHarm()) || (id == heal->id && mob->isInvertedHealAndHarm()))
{
- int amount = (int) (scale * (double) (6 << amplification) + .5);
- if (source == NULL)
+ int amount = static_cast<int>(scale * (double)(6 << amplification) + .5);
+ if (source == nullptr)
{
mob->hurt(DamageSource::magic, amount);
}
@@ -359,7 +359,7 @@ void MobEffect::removeAttributeModifiers(shared_ptr<LivingEntity> entity, BaseAt
{
AttributeInstance *attribute = attributes->getInstance(it.first);
- if (attribute != NULL)
+ if (attribute != nullptr)
{
attribute->removeModifier(it.second);
}
@@ -372,7 +372,7 @@ void MobEffect::addAttributeModifiers(shared_ptr<LivingEntity> entity, BaseAttri
{
AttributeInstance *attribute = attributes->getInstance(it.first);
- if (attribute != NULL)
+ if (attribute != nullptr)
{
AttributeModifier *original = it.second;
attribute->removeModifier(original);