dao::CCCreature
class
Derives from dao::CCObject.
A creature: a party member, or anyone else who fights, talks or walks.
Declared in dao/Objects.h.
Functions
BodyBag()
ObjectId BodyBag() const
Returns the creature’s body bag, the placeable it leaves behind when it dies.
The same as GetCreatureBodyBag.
CombatantType()
std::int32_t CombatantType() const
Returns the creature’s combatant type, the same as GetCombatantType.
CombatState()
std::int32_t CombatState() const
Returns the creature’s combat state, the same as GetCombatState.
Health()
std::optional<float> Health() const
Returns the creature’s current health, or nullopt if it has no stats.
Level()
std::optional<float> Level() const
Returns the creature’s level, or nullopt if it has no stats.
ManaStamina()
std::optional<float> ManaStamina() const
Returns the creature’s current mana or stamina, or nullopt if it has no stats.
MaxHealth()
std::optional<float> MaxHealth() const
Returns the creature’s maximum health, or nullopt if it has no stats.
MaxManaStamina()
std::optional<float> MaxManaStamina() const
Returns the creature’s maximum mana or stamina, or nullopt if it has no stats.
Package()
std::int32_t Package() const
Returns the creature’s package, the same as GetPackage.
PackageAI()
std::int32_t PackageAI() const
Returns the creature’s AI package, the same as GetPackageAI.
PortraitImage()
std::wstring PortraitImage() const
Returns the URL of the most recently rendered portrait without rendering again, or an empty string if there is none.
Property()
std::optional<float> Property(script::PropertyAttribute property, script::PropertyValue value=script::PropertyValue::Total) const
Returns an attribute. The same as Property with the attribute’s id.
Property()
std::optional<float> Property(script::PropertySimple property, script::PropertyValue value=script::PropertyValue::Total) const
Returns a simple property. The same as Property with the property’s id.
Property()
std::optional<float> Property(std::int32_t property, script::PropertyValue value=script::PropertyValue::Total) const
Returns a creature property by its PROPERTY_* id, such as an attribute, health, mana or stamina, level, experience or speed.
It reads the creature’s stats directly, so you can call it off the game thread.
| Parameter | |
|---|---|
property |
the PROPERTY_* id |
value |
which value to read: the total, the base, the current value or the modifier |
Returns the value, or nullopt if the creature has no stats
ReleasePortrait()
void ReleasePortrait()
Frees the creature’s portrait renderer and the copy of the creature it draws, as the game’s own screens do when they close.
The next RenderPortrait creates a new renderer. Does nothing if there is no renderer. Unload the image from any movie showing it first. Not yet tested in the game.
RenderPortrait()
std::wstring RenderPortrait()
Renders the creature’s portrait the same way the party’s portraits are rendered.
It works for any creature. The first call creates a portrait renderer for the creature, and every call renders the portrait again. Call it on the game thread, for example from a frame callback. Rendering is not cheap, so render once per change, not every frame. ReleasePortrait frees the renderer.
Returns the URL a Flash movie loads the image from, “img://portrait_\<tag\>\<counter\>”, with loadMovie or in an image control; empty if the engine made no portrait
SetCombatState()
void SetCombatState(std::int32_t state)
Sets the creature’s combat state, the same as the scripts’ SetCombatState.
Not yet tested in the game.
SetProperty()
bool SetProperty(std::int32_t property, float amount, script::PropertyValue value) const
Sets a creature property, the same as the scripts’ SetCreatureProperty.
Not yet tested in the game.
| Parameter | |
|---|---|
property |
the PROPERTY_* id |
amount |
the new value |
value |
which value to set. Total and Base both set the base value |
Returns false if the creature has no stats
Stats()
void * Stats() const
Returns the creature’s stats, the engine’s CCCreatureStats object, or null if it has none.
dao/Abilities.h reads ability cooldowns from it.
TreasureCategory()
std::int32_t TreasureCategory() const
Returns the creature’s treasure category, the same as GetCreatureTreasureCategory.
Fields
| Field | Type | |
|---|---|---|
kPortraitName |
std::size_t = 0xD4C |
the image’s name, in the renderer |
kPortraitRenderer |
std::size_t = 0x78C |
offset of the portrait renderer |
kStats |
std::size_t = 0x7D0 |
offset of the stats pointer |