hoa_global::GlobalEnemy Class Reference

Represents those enemies that fight in battles. More...

#include <global_actors.h>

Inheritance diagram for hoa_global::GlobalEnemy:

Inheritance graph
[legend]
Collaboration diagram for hoa_global::GlobalEnemy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AddSkill (uint32 skill_id)
 Enables the enemy to be able to use a new skill.
void DetermineDroppedObjects (std::vector< GlobalObject * > &objects)
 Uses random variables to calculate which objects, if any, the enemy dropped.
 GlobalEnemy (uint32 id)
void Initialize (uint32 xp_level)
 Initializes the enemy and prepares it for battle.
bool IsCharacter ()
 A purely virtual function used for actor type identification.
 ~GlobalEnemy ()
Class member access functions
std::vector< hoa_video::StillImage > * GetBattleSpriteFrames ()
uint32 GetDrunesDropped () const
uint32 GetSpriteHeight () const
uint32 GetSpriteWidth () const

Protected Attributes

std::vector< hoa_video::StillImage_battle_sprite_frames
 The battle sprite frames for the enemy Each enemy has four frames representing damage levels of 0%, 33%, 66%, and 100%. Thus, this vector always has four elements contained within it, where the 0th element is 0% damage, the 1st element is 33% damage, etc. This vector is used to load the multi-image containing the four sprite frames.
uint32 _drunes_dropped
 The amount of drunes that the enemy drops.
std::map< uint32, uint32_skill_set
 Contains all of the possible skills that the enemy may possess The map key is the id for the skill that the enemy may know. The value for each key is the experience level that the enemy is required to be at in order to effectively learn the skill. The elements in this map are added to the enemy's _skill vector of GlobalSkills when the Initialize() function is called, and as long as the enemy meets the level requirements for adding the skill.
uint32 _sprite_height
uint32 _sprite_width
 The dimensions of the enemy's battle sprite in pixels.
std::vector< float > _dropped_chance
std::vector< uint32_dropped_level_required
std::vector< uint32_dropped_objects
 Dropped object vectors These three vectors are all of the same size. _dropped_objects contains the object IDs that the enemy may drop. _dropped_chance contains a value from 0.0f to 1.0f that determines the probability of the enemy dropping that object. And finally _dropped_level_required contains the minimum experience level that the enemy must be at in order to drop this object at all.
Growth Statistics
The average increase for statistics between experience levels is stored by these members

Note that even though the normal statistics members are integers, these are floating point values. This is so because it allows us a finer granularity of control over how much a particular statistic grows with time.

float _growth_agility
float _growth_drunes
float _growth_evade
float _growth_experience_points
float _growth_fortitude
float _growth_hit_points
float _growth_protection
float _growth_skill_points
float _growth_strength
float _growth_vigor

Detailed Description

Represents those enemies that fight in battles.

****************************************************************************

Allacrost handles enemies a little different than most RPGs. Instead of an enemy always having the same statistics for health, strength, etc., enemies are more closely matched to the player's experience levels and abilities. In terms of the operation of this class, an enemy starts at level 0 with various base statistics and is then grown to match a level close to the current level of the player's characters, before it actually appears on the field of battle. Furthermore, the enemy is grown using gaussian random values to provide an element of uncertainty and to make the enemies that the player encounters more unique and less static.

Definition at line 963 of file global_actors.h.


Constructor & Destructor Documentation

hoa_global::GlobalEnemy::GlobalEnemy ( uint32  id  ) 

Definition at line 839 of file global_actors.cpp.

References hoa_global::GlobalActor::_agility, hoa_global::GlobalActor::_armor_equipped, hoa_global::GlobalActor::_attack_points, _battle_sprite_frames, _dropped_chance, _dropped_level_required, _dropped_objects, _drunes_dropped, hoa_global::GlobalActor::_evade, hoa_global::GlobalActor::_experience_level, hoa_global::GlobalActor::_experience_points, hoa_global::GlobalActor::_filename, hoa_global::GlobalActor::_fortitude, _growth_agility, _growth_drunes, _growth_evade, _growth_experience_points, _growth_fortitude, _growth_hit_points, _growth_protection, _growth_skill_points, _growth_strength, _growth_vigor, hoa_global::GlobalActor::_hit_points, hoa_global::GlobalActor::_id, hoa_global::GlobalActor::_max_hit_points, hoa_global::GlobalActor::_max_skill_points, hoa_global::GlobalActor::_name, hoa_global::GlobalActor::_protection, hoa_global::GlobalActor::_skill_points, _skill_set, _sprite_height, _sprite_width, hoa_global::GlobalActor::_strength, hoa_global::GlobalActor::_vigor, hoa_global::GlobalActor::_weapon_equipped, hoa_script::ReadScriptDescriptor::CloseFile(), hoa_script::ReadScriptDescriptor::CloseTable(), hoa_script::ScriptDescriptor::GetErrorMessages(), hoa_script::ReadScriptDescriptor::GetTableSize(), hoa_global::GLOBAL_DEBUG, hoa_script::ScriptDescriptor::IsErrorDetected(), hoa_video::GameVideo::LoadMultiImageFromNumberElements(), hoa_utils::MakeUnicodeString(), hoa_script::ReadScriptDescriptor::OpenFile(), hoa_script::ReadScriptDescriptor::OpenTable(), hoa_script::ReadScriptDescriptor::ReadFloat(), hoa_script::ReadScriptDescriptor::ReadInt(), hoa_script::ReadScriptDescriptor::ReadString(), hoa_script::ReadScriptDescriptor::ReadTableKeys(), hoa_script::ReadScriptDescriptor::ReadUInt(), and hoa_video::VideoManager.

Here is the call graph for this function:

hoa_global::GlobalEnemy::~GlobalEnemy (  ) 

Definition at line 966 of file global_actors.cpp.


Member Function Documentation

void hoa_global::GlobalEnemy::AddSkill ( uint32  skill_id  )  [virtual]

Enables the enemy to be able to use a new skill.

Parameters:
skill_id The integer ID of the skill to add to the enemy If the enemy already knows the skill to be added, it will not be added again and a warning message will be printed.
Note:
Skills should only be added after the enemy has been initialized

Implements hoa_global::GlobalActor.

Definition at line 972 of file global_actors.cpp.

References hoa_global::GlobalActor::_skills, hoa_global::GlobalSkill::GetID(), and hoa_global::GLOBAL_DEBUG.

Referenced by Initialize().

Here is the call graph for this function:

void hoa_global::GlobalEnemy::DetermineDroppedObjects ( std::vector< GlobalObject * > &  objects  ) 

Uses random variables to calculate which objects, if any, the enemy dropped.

Parameters:
objects A reference to a vector to hold the GlobalObject pointers
The objects vector is cleared immediately once this function is called so make sure that it does not hold anything meaningful. Any objects which are added to this vector are created with new GlobalObject(), so the object should be deleted or its pointer passed to the GlobalManager to later delete.

std::vector<hoa_video::StillImage>* hoa_global::GlobalEnemy::GetBattleSpriteFrames (  )  [inline]

Definition at line 1013 of file global_actors.h.

References _battle_sprite_frames.

Referenced by hoa_battle::private_battle::BattleEnemyActor::DrawSprite().

uint32 hoa_global::GlobalEnemy::GetDrunesDropped (  )  const [inline]

Definition at line 1010 of file global_actors.h.

References _drunes_dropped.

Referenced by hoa_battle::BattleMode::_TallyRewards().

uint32 hoa_global::GlobalEnemy::GetSpriteHeight (  )  const [inline]

Definition at line 1004 of file global_actors.h.

References _sprite_height.

Referenced by hoa_battle::_TEMPIsA1Smaller().

uint32 hoa_global::GlobalEnemy::GetSpriteWidth (  )  const [inline]

Definition at line 1007 of file global_actors.h.

References _sprite_width.

void hoa_global::GlobalEnemy::Initialize ( uint32  xp_level  ) 

Initializes the enemy and prepares it for battle.

Parameters:
xp_level The experience level to set the enemy to
This function sets the enemy's experience level, grows its stats to match this level, and adds any skills that the enemy should be capable of using at the level. Call this function once only, because after the enemy has skills enabled it will not be able to re-initialize. If you need to initialize the enemy once more, you'll have to create a brand new GlobalEnemy object and initialize that instead.

Definition at line 999 of file global_actors.cpp.

References hoa_global::GlobalActor::_agility, _drunes_dropped, hoa_global::GlobalActor::_evade, hoa_global::GlobalActor::_experience_level, hoa_global::GlobalActor::_experience_points, hoa_global::GlobalActor::_fortitude, _growth_agility, _growth_drunes, _growth_evade, _growth_experience_points, _growth_fortitude, _growth_hit_points, _growth_protection, _growth_skill_points, _growth_strength, _growth_vigor, hoa_global::GlobalActor::_hit_points, hoa_global::GlobalActor::_max_hit_points, hoa_global::GlobalActor::_max_skill_points, hoa_global::GlobalActor::_protection, hoa_global::GlobalActor::_skill_points, _skill_set, hoa_global::GlobalActor::_skills, hoa_global::GlobalActor::_strength, hoa_global::GlobalActor::_vigor, AddSkill(), hoa_utils::GaussianRandomValue(), and hoa_global::GLOBAL_DEBUG.

Referenced by hoa_battle::BattleMode::AddEnemy().

Here is the call graph for this function:

bool hoa_global::GlobalEnemy::IsCharacter (  )  [inline, virtual]

A purely virtual function used for actor type identification.

Returns:
True if the actor is a character, false if it is an enemy
This function is implemented primarily because GlobalActor requires at least one purely virtual function to be an abstract class. FIX ME Obsolete. Moved to BattleActor and now called IsEnemy().

Implements hoa_global::GlobalActor.

Definition at line 969 of file global_actors.h.


Member Data Documentation

std::vector<hoa_video::StillImage> hoa_global::GlobalEnemy::_battle_sprite_frames [protected]

The battle sprite frames for the enemy Each enemy has four frames representing damage levels of 0%, 33%, 66%, and 100%. Thus, this vector always has four elements contained within it, where the 0th element is 0% damage, the 1st element is 33% damage, etc. This vector is used to load the multi-image containing the four sprite frames.

Definition at line 1070 of file global_actors.h.

Referenced by GetBattleSpriteFrames(), and GlobalEnemy().

std::vector<float> hoa_global::GlobalEnemy::_dropped_chance [protected]

Definition at line 1052 of file global_actors.h.

Referenced by GlobalEnemy().

std::vector<uint32> hoa_global::GlobalEnemy::_dropped_level_required [protected]

Definition at line 1053 of file global_actors.h.

Referenced by GlobalEnemy().

std::vector<uint32> hoa_global::GlobalEnemy::_dropped_objects [protected]

Dropped object vectors These three vectors are all of the same size. _dropped_objects contains the object IDs that the enemy may drop. _dropped_chance contains a value from 0.0f to 1.0f that determines the probability of the enemy dropping that object. And finally _dropped_level_required contains the minimum experience level that the enemy must be at in order to drop this object at all.

Definition at line 1051 of file global_actors.h.

Referenced by GlobalEnemy().

uint32 hoa_global::GlobalEnemy::_drunes_dropped [protected]

The amount of drunes that the enemy drops.

Definition at line 1042 of file global_actors.h.

Referenced by GetDrunesDropped(), GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_agility [protected]

Definition at line 1036 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_drunes [protected]

Definition at line 1038 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_evade [protected]

Definition at line 1037 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_experience_points [protected]

Definition at line 1031 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_fortitude [protected]

Definition at line 1034 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_hit_points [protected]

Definition at line 1029 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_protection [protected]

Definition at line 1035 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_skill_points [protected]

Definition at line 1030 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_strength [protected]

Definition at line 1032 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

float hoa_global::GlobalEnemy::_growth_vigor [protected]

Definition at line 1033 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

std::map<uint32, uint32> hoa_global::GlobalEnemy::_skill_set [protected]

Contains all of the possible skills that the enemy may possess The map key is the id for the skill that the enemy may know. The value for each key is the experience level that the enemy is required to be at in order to effectively learn the skill. The elements in this map are added to the enemy's _skill vector of GlobalSkills when the Initialize() function is called, and as long as the enemy meets the level requirements for adding the skill.

Definition at line 1063 of file global_actors.h.

Referenced by GlobalEnemy(), and Initialize().

uint32 hoa_global::GlobalEnemy::_sprite_height [protected]

Definition at line 1019 of file global_actors.h.

Referenced by GetSpriteHeight(), and GlobalEnemy().

uint32 hoa_global::GlobalEnemy::_sprite_width [protected]

The dimensions of the enemy's battle sprite in pixels.

Definition at line 1019 of file global_actors.h.

Referenced by GetSpriteWidth(), and GlobalEnemy().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:14:19 2007 for Hero of Allacrost by  doxygen 1.5.1