diff options
Diffstat (limited to 'src/Entities')
-rw-r--r-- | src/Entities/Entity.cpp | 10 | ||||
-rw-r--r-- | src/Entities/Entity.h | 2 | ||||
-rw-r--r-- | src/Entities/EntityEffect.cpp | 10 | ||||
-rw-r--r-- | src/Entities/FireChargeEntity.cpp | 2 | ||||
-rw-r--r-- | src/Entities/LeashKnot.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp | 7 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 2 | ||||
-rw-r--r-- | src/Entities/Player.h | 4 |
8 files changed, 23 insertions, 16 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 7e374d9ba..4f35315f7 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -579,7 +579,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) int cEntity::GetRawDamageAgainst(const cEntity & a_Receiver) { // Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items - // Ref: http://minecraft.gamepedia.com/Damage#Dealing_damage as of 2012_12_20 + // Ref: https://minecraft.gamepedia.com/Damage#Dealing_damage as of 2012_12_20 switch (this->GetEquippedWeapon().m_ItemType) { case E_ITEM_WOODEN_SWORD: return 4; @@ -625,7 +625,7 @@ void cEntity::ApplyArmorDamage(int DamageBlocked) bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType) { - // Ref.: http://minecraft.gamepedia.com/Armor#Effects as of 2012_12_20 + // Ref.: https://minecraft.gamepedia.com/Armor#Effects as of 2012_12_20 switch (a_DamageType) { case dtOnFire: @@ -718,7 +718,7 @@ int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_Dama } // Add up all armor points: - // Ref.: http://minecraft.gamepedia.com/Armor#Defense_points + // Ref.: https://minecraft.gamepedia.com/Armor#Defense_points int ArmorValue = 0; int Toughness = 0; switch (GetEquippedHelmet().m_ItemType) @@ -755,7 +755,7 @@ int cEntity::GetArmorCoverAgainst(const cEntity * a_Attacker, eDamageType a_Dama } // TODO: Special armor cases, such as wool, saddles, dog's collar - // Ref.: http://minecraft.gamepedia.com/Armor#Mob_armor as of 2012_12_20 + // Ref.: https://minecraft.gamepedia.com/Armor#Mob_armor as of 2012_12_20 double Reduction = std::max(ArmorValue / 5.0, ArmorValue - a_Damage / (2 + Toughness / 4.0)); return static_cast<int>(a_Damage * std::min(20.0, Reduction) / 25.0); @@ -1712,7 +1712,7 @@ void cEntity::DoSetSpeed(double a_SpeedX, double a_SpeedY, double a_SpeedZ) void cEntity::HandleAir(void) { - // Ref.: http://www.minecraftwiki.net/wiki/Chunk_format + // Ref.: https://minecraft.gamepedia.com/Chunk_format // See if the entity is /submerged/ water (block above is water) // Get the type of block the entity is standing in: diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index db147f3fc..ace2eb6d7 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -580,7 +580,7 @@ protected: /** Stores the air drag that is applied to the entity every tick, measured in speed ratio per tick Acts as air friction and slows down flight Will be interpolated if the server tick rate varies - Data: http://minecraft.gamepedia.com/Entity#Motion_of_entities */ + Data: https://minecraft.gamepedia.com/Entity#Motion_of_entities */ float m_AirDrag; Vector3d m_LastPosition; diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index cc9aaca5a..0ae50be80 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -23,7 +23,7 @@ cEntityEffect::eType cEntityEffect::GetPotionEffectType(short a_ItemDamage) { // Lowest four bits // Potion effect bits are different from entity effect values - // For reference: http://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits + // For reference: https://minecraft.gamepedia.com/Data_values#.22Potion_effect.22_bits switch (a_ItemDamage & 0x0f) { case 0x01: return cEntityEffect::effRegeneration; @@ -112,9 +112,9 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage) SplashCoeff = IsPotionDrinkable(a_ItemDamage) ? 1 : 0.75; // Ref.: - // http://minecraft.gamepedia.com/Data_values#.22Tier.22_bit - // http://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit - // http://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit + // https://minecraft.gamepedia.com/Data_values#.22Tier.22_bit + // https://minecraft.gamepedia.com/Data_values#.22Extended_duration.22_bit + // https://minecraft.gamepedia.com/Data_values#.22Splash_potion.22_bit return static_cast<int>(base * TierCoeff * ExtCoeff * SplashCoeff); } @@ -126,7 +126,7 @@ int cEntityEffect::GetPotionEffectDuration(short a_ItemDamage) bool cEntityEffect::IsPotionDrinkable(short a_ItemDamage) { // Drinkable potion if 13th lowest bit is set - // Ref.: http://minecraft.gamepedia.com/Potions#Data_value_table + // Ref.: https://minecraft.gamepedia.com/Potions#Data_value_table return ((a_ItemDamage & 0x2000) != 0); } diff --git a/src/Entities/FireChargeEntity.cpp b/src/Entities/FireChargeEntity.cpp index 56ce9ef3f..83c1f3c76 100644 --- a/src/Entities/FireChargeEntity.cpp +++ b/src/Entities/FireChargeEntity.cpp @@ -50,7 +50,7 @@ void cFireChargeEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_Hi if (!a_EntityHit.IsFireproof()) { - // TODO Damage Entity with 5 damage(from http://minecraft.gamepedia.com/Blaze#Blaze_fireball) + // TODO Damage Entity with 5 damage(from https://minecraft.gamepedia.com/Blaze#Blaze_fireball) a_EntityHit.StartBurning(5 * 20); // 5 seconds of burning } } diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp index 52bb1b4b3..a86dc9d53 100644 --- a/src/Entities/LeashKnot.cpp +++ b/src/Entities/LeashKnot.cpp @@ -83,7 +83,7 @@ void cLeashKnot::TiePlayersLeashedMobs(cPlayer & a_Player, bool a_ShouldBroadCas // All conditions met, unleash from player and leash to fence PotentialLeashed->Unleash(false, false); - PotentialLeashed->LeashTo(m_Knot, m_ShouldBroadcast); + PotentialLeashed->LeashTo(*m_Knot, m_ShouldBroadcast); return false; } } LookForLeashedsCallback(this, &a_Player, a_ShouldBroadCast); diff --git a/src/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index a0095a8a4..233cdfa85 100644 --- a/src/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp @@ -197,6 +197,13 @@ void cPawn::AddEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, s } a_Duration = static_cast<int>(a_Duration * a_DistanceModifier); + // If we already have the effect, we have to deactivate it or else it will act cumulatively + auto ExistingEffect = m_EntityEffects.find(a_EffectType); + if (ExistingEffect != m_EntityEffects.end()) + { + ExistingEffect->second->OnDeactivate(*this); + } + auto Res = m_EntityEffects.emplace(a_EffectType, cEntityEffect::CreateEntityEffect(a_EffectType, a_Duration, a_Intensity, a_DistanceModifier)); m_World->BroadcastEntityEffect(*this, a_EffectType, a_Intensity, static_cast<short>(a_Duration)); cEntityEffect * Effect = Res.first->second.get(); diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 3b0994726..60da8c758 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2372,7 +2372,7 @@ void cPlayer::TickBurning(cChunk & a_Chunk) void cPlayer::HandleFood(void) { - // Ref.: http://minecraft.gamepedia.com/Hunger + // Ref.: https://minecraft.gamepedia.com/Hunger if (IsGameModeCreative() || IsGameModeSpectator()) { diff --git a/src/Entities/Player.h b/src/Entities/Player.h index 8c21c25d6..5b0aa84a8 100644 --- a/src/Entities/Player.h +++ b/src/Entities/Player.h @@ -97,12 +97,12 @@ public: float GetXpPercentage(void); /** Calculates the amount of XP needed for a given level - Ref: http://minecraft.gamepedia.com/XP + Ref: https://minecraft.gamepedia.com/XP */ static int XpForLevel(int a_Level); /** Inverse of XpForLevel - Ref: http://minecraft.gamepedia.com/XP + Ref: https://minecraft.gamepedia.com/XP values are as per this with pre-calculations */ static int CalcLevelFromXp(int a_CurrentXp); |