![]() |
Botcraft 1.21.4
|
#include <EntityAttribute.hpp>
Classes | |
struct | Modifier |
Public Types | |
enum class | Type : char { Unknown = -1 , Armor , ArmorToughness , AttackDamage , AttackKnockback , AttackSpeed , PlayerBlockBreakSpeed , PlayerBlockInteractionRange , BurningTime , ExplosionKnockbackResistance , PlayerEntityInteractionRange , FallDamageMultiplier , FlyingSpeed , FollowRange , Gravity , JumpStrength , KnockbackResistance , Luck , MaxAbsorption , MaxHealth , PlayerMiningEfficiency , MovementEfficiency , MovementSpeed , OxygenBonus , SafeFallDistance , Scale , PlayerSneakingSpeed , ZombieSpawnReinforcementsChance , StepHeight , PlayerSubmergedMiningSpeed , PlayerSweepingDamageRatio , TemptRange , WaterMovementEfficiency , NUM_ENTITY_ATTRIBUTES } |
using | ModifierKey = std::string |
Public Member Functions | |
EntityAttribute (const Type type_, const double base_value_) | |
EntityAttribute ()=delete | |
void | SetBaseValue (const double new_value) |
void | ClearModifiers () |
void | RemoveModifier (const ModifierKey &key) |
void | SetModifier (const ModifierKey &key, const Modifier &modifier) |
Type | GetType () const |
double | GetBaseValue () const |
const std::map< ModifierKey, Modifier > & | GetModifiers () const |
double | GetValue () const |
std::optional< Modifier > | GetModifier (const ModifierKey &key) |
Private Member Functions | |
void | UpdateValue () const |
Private Attributes | |
Type | type |
double | base_value |
double | current_value |
bool | up_to_date |
std::map< ModifierKey, Modifier > | modifiers |
Definition at line 12 of file EntityAttribute.hpp.
using Botcraft::EntityAttribute::ModifierKey = std::string |
Definition at line 18 of file EntityAttribute.hpp.
|
strong |
Definition at line 21 of file EntityAttribute.hpp.
Botcraft::EntityAttribute::EntityAttribute | ( | const Type | type_, |
const double | base_value_ | ||
) |
Definition at line 6 of file EntityAttribute.cpp.
References base_value, current_value, type, and up_to_date.
|
delete |
void Botcraft::EntityAttribute::ClearModifiers | ( | ) |
Definition at line 24 of file EntityAttribute.cpp.
References modifiers, and up_to_date.
double Botcraft::EntityAttribute::GetBaseValue | ( | ) | const |
Definition at line 47 of file EntityAttribute.cpp.
References base_value.
std::optional< EntityAttribute::Modifier > Botcraft::EntityAttribute::GetModifier | ( | const ModifierKey & | key | ) |
Definition at line 66 of file EntityAttribute.cpp.
References modifiers.
const std::map< EntityAttribute::ModifierKey, EntityAttribute::Modifier > & Botcraft::EntityAttribute::GetModifiers | ( | ) | const |
Definition at line 52 of file EntityAttribute.cpp.
References modifiers.
EntityAttribute::Type Botcraft::EntityAttribute::GetType | ( | ) | const |
Definition at line 42 of file EntityAttribute.cpp.
References type.
Referenced by Botcraft::LivingEntity::AddAttribute().
double Botcraft::EntityAttribute::GetValue | ( | ) | const |
Definition at line 57 of file EntityAttribute.cpp.
References current_value, up_to_date, and UpdateValue().
void Botcraft::EntityAttribute::RemoveModifier | ( | const ModifierKey & | key | ) |
Definition at line 30 of file EntityAttribute.cpp.
References modifiers, and up_to_date.
void Botcraft::EntityAttribute::SetBaseValue | ( | const double | new_value | ) |
Definition at line 14 of file EntityAttribute.cpp.
References base_value, and up_to_date.
void Botcraft::EntityAttribute::SetModifier | ( | const ModifierKey & | key, |
const Modifier & | modifier | ||
) |
Definition at line 36 of file EntityAttribute.cpp.
References modifiers, and up_to_date.
Referenced by Botcraft::EntityManager::Handle().
|
private |
Definition at line 269 of file EntityAttribute.cpp.
References Botcraft::EntityAttribute::Modifier::Add, Armor, ArmorToughness, AttackDamage, AttackKnockback, AttackSpeed, base_value, BurningTime, current_value, ExplosionKnockbackResistance, FallDamageMultiplier, FlyingSpeed, FollowRange, Gravity, JumpStrength, KnockbackResistance, Luck, MaxAbsorption, MaxHealth, modifiers, MovementEfficiency, MovementSpeed, Botcraft::EntityAttribute::Modifier::MultiplyBase, Botcraft::EntityAttribute::Modifier::MultiplyTotal, OxygenBonus, PlayerBlockBreakSpeed, PlayerBlockInteractionRange, PlayerEntityInteractionRange, PlayerMiningEfficiency, PlayerSneakingSpeed, PlayerSubmergedMiningSpeed, PlayerSweepingDamageRatio, SafeFallDistance, Scale, StepHeight, TemptRange, type, up_to_date, WaterMovementEfficiency, and ZombieSpawnReinforcementsChance.
Referenced by GetValue().
|
private |
Definition at line 124 of file EntityAttribute.hpp.
Referenced by EntityAttribute(), GetBaseValue(), SetBaseValue(), and UpdateValue().
|
mutableprivate |
Definition at line 125 of file EntityAttribute.hpp.
Referenced by EntityAttribute(), GetValue(), and UpdateValue().
|
private |
Definition at line 127 of file EntityAttribute.hpp.
Referenced by ClearModifiers(), GetModifier(), GetModifiers(), RemoveModifier(), SetModifier(), and UpdateValue().
|
private |
Definition at line 123 of file EntityAttribute.hpp.
Referenced by EntityAttribute(), GetType(), and UpdateValue().
|
mutableprivate |
Definition at line 126 of file EntityAttribute.hpp.
Referenced by ClearModifiers(), EntityAttribute(), GetValue(), RemoveModifier(), SetBaseValue(), SetModifier(), and UpdateValue().