1 //////////////////////////////////////////////////////////////////////////////// 2 // Copyright (C) 2004-2010 by The Allacrost Project 3 // All Rights Reserved 4 // 5 // This code is licensed under the GNU GPL version 2. It is free software 6 // and you may modify it and/or redistribute it under the terms of this license. 7 // See http://www.gnu.org/copyleft/gpl.html for details. 8 //////////////////////////////////////////////////////////////////////////////// 9 10 /** **************************************************************************** 11 *** \file global_actors.h 12 *** \author Tyler Olsen, roots@allacrost.org 13 *** \brief Header file for global game actors 14 *** 15 *** This file contains the implementation of "actors", which are living entities 16 *** in the game. Actors consist of playable characters and enemies in the game 17 *** that may participate in battles. Actors do not include NPCs found in towns or 18 *** other adversaries with which the player does not to battle with. This file 19 *** also contains classes that are closely related to the implementation of actors 20 *** such as attack targets and attack points. 21 *** ***************************************************************************/ 22 23 #ifndef __GLOBAL_ACTORS_HEADER__ 24 #define __GLOBAL_ACTORS_HEADER__ 25 26 #include "defs.h" 27 #include "utils.h" 28 29 #include "video.h" 30 31 #include "global_utils.h" 32 33 namespace hoa_global { 34 35 /** **************************************************************************** 36 *** \brief Represents the points of attack present on an actor 37 *** 38 *** An attack point is a location where an actor may be attacked. It is <b>not</b> a numerical 39 *** quantity. Actors typically have multiple attack points, each with their own resistances and 40 *** weaknesses. For example, the number of attack points on all characters is four and they 41 *** are located on the head, torso, arms, and legs. Each attack points may have certain weaknesses 42 *** or resistances. 43 *** ***************************************************************************/ 44 class GlobalAttackPoint { 45 public: 46 //! \param actor_owner A pointer to the GlobalActor owner of this attack point 47 GlobalAttackPoint(GlobalActor* owner); 48 ~GlobalAttackPoint()49 ~GlobalAttackPoint() 50 { _actor_owner = NULL; } 51 52 /** \brief Reads in the attack point's data from a script file 53 *** \param script A reference to the open script file where to retrieve the data from 54 *** \return True upon success, false upon failure. 55 *** 56 *** There are two requirements for using this function. First, the script file must already 57 *** be opened for reading permissions. Second, the table which contains the attack point data 58 *** must be opened <b>prior</b> to making this function call. This function will not close the 59 *** table containing the attack point when it finishes loading the data, so the calling routine 60 *** must remember to close the table after this call is made. 61 **/ 62 bool LoadData(hoa_script::ReadScriptDescriptor& script); 63 64 /** \brief Determines the total physical and metaphysical defense of the attack point 65 *** \param equipped_armor A pointer to the armor equipped on the attack point, or NULL if no armor is equipped 66 *** 67 *** This method uses the owning GlobalActor's base defense stats, the attack point's defense modifiers stats, 68 *** and the properties of the equipped armor to calculate the attack point's total physical and metaphysical defense. 69 *** This method should be called whenever the actor's base defense stats or equipped armor on this point changes. 70 **/ 71 void CalculateTotalDefense(const GlobalArmor* equipped_armor); 72 73 /** \brief Determines the total evade rating of the attack point 74 *** 75 *** This method uses the owning GlobalActor's base evade rating and the attack point's evade modifiers stats to 76 *** calculate the attack point's total evade rating. This method should be called whenever the actor's base defense 77 *** rating changes. 78 **/ 79 void CalculateTotalEvade(); 80 81 //! \name Class Member Access Functions 82 //@{ GetName()83 hoa_utils::ustring& GetName() 84 { return _name; } 85 GetActorOwner()86 GlobalActor* GetActorOwner() const 87 { return _actor_owner; } 88 GetXPosition()89 uint16 GetXPosition() const 90 { return _x_position; } 91 GetYPosition()92 uint16 GetYPosition() const 93 { return _y_position; } 94 GetFortitudeModifier()95 float GetFortitudeModifier() const 96 { return _fortitude_modifier; } 97 GetProtectionModifier()98 float GetProtectionModifier() const 99 { return _protection_modifier; } 100 GetEvadeModifier()101 float GetEvadeModifier() const 102 { return _evade_modifier; } 103 GetTotalPhysicalDefense()104 uint16 GetTotalPhysicalDefense() const 105 { return _total_physical_defense; } 106 GetTotalMetaphysicalDefense()107 uint16 GetTotalMetaphysicalDefense() const 108 { return _total_metaphysical_defense; } 109 GetTotalEvadeRating()110 float GetTotalEvadeRating() const 111 { return _total_evade_rating; } 112 113 //! \note Use this method with extreme caution. It does not update defense/evade totals or any other members SetActorOwner(GlobalActor * new_owner)114 void SetActorOwner(GlobalActor* new_owner) 115 { _actor_owner = new_owner; } 116 //@} 117 118 private: 119 /** \brief The name of the attack point as is displayed on the screen 120 *** Usually, this is simply the name of a body part such as "head" or "tail". More elaborate names 121 *** may be chosen for special foes and bosses, however. 122 **/ 123 hoa_utils::ustring _name; 124 125 //! \brief A pointer to the actor which "owns" this attack point (i.e., the attack point is a location on the actor) 126 GlobalActor* _actor_owner; 127 128 /** \brief The position of the physical attack point relative to the actor's battle sprite 129 *** These members treat the bottom left corner of the sprite as the origin (0, 0) and increase in the 130 *** right and upwards directions. The combination of these two members point to the center pinpoint 131 *** location of the attack point. The units of these two members are in number of pixels. 132 **/ 133 uint16 _x_position, _y_position; 134 135 /** \brief The defense and evasion percentage modifiers for this attack point 136 *** 137 *** These are called "modifiers" because they modify the value of fortitude, protection, and evade ratings of the 138 *** actor. They represent percentage change from the base stat. So for example, a fortitude modifer that is 0.25f 139 *** increases the fortitude of the attack point by 25%. If the base protection rating was 10 and the protection 140 *** modifier was -0.30f, the resulting protection for the attack point would be: 10 + (10 * -0.30f) = 7. 141 *** 142 *** The lower bound for each modifier is -1.0f (-100%), which will result in a value of zero for that stat. No 143 *** actor stats can be negative so even if the modifier drops below -1.0f, the resulting value will still be zero. 144 *** There is no theoretical upper bound, but it is usually advised to keep it under 1.0f (100%). 145 **/ 146 //@{ 147 float _fortitude_modifier; 148 float _protection_modifier; 149 float _evade_modifier; 150 //@} 151 152 /** \brief The cumunalative defense and evade stats for this attack point 153 *** These totals include the actor's base stat, the percentage modifier for the attack point, and the stats of any 154 *** armor that is equipped on the attack point. 155 **/ 156 //@{ 157 uint16 _total_physical_defense; 158 uint16 _total_metaphysical_defense; 159 float _total_evade_rating; 160 //@} 161 162 /** \brief A vector containing all status effects that may be triggered by attacking the point 163 *** This vector contains only the status effects that have a non-zero chance of affecting their target. Therefore, 164 *** it is very possible that this vector may be empty. The first element in the pair is a floating point value from 0.0 165 *** to 1.0 that indicates the likelihood of success that should the attack point be successfully attacked by an opponent, 166 *** the status effect becomes triggered. Note that this likelihood does not take into account that the target may have a 167 *** particular defense or immunity against the status effect. 168 **/ 169 // TODO: Add status and elemental effects to attack points 170 // std::vector<std::pair<float, GlobalStatusEffect*> > _status_weaknesses; 171 }; // class GlobalAttackPoint 172 173 174 /** **************************************************************************** 175 *** \brief Represents an actor that can participate in battles 176 *** 177 *** This is an abstract parent class that both playable characters and enemies 178 *** inherit from in order to provide a consistent interface to the statistics 179 *** that characters and enemies share. 180 *** ***************************************************************************/ 181 class GlobalActor { 182 public: 183 GlobalActor(); 184 185 virtual ~GlobalActor(); 186 187 GlobalActor(const GlobalActor& copy); 188 189 GlobalActor& operator=(const GlobalActor& copy); 190 191 /** \brief Equips a new weapon on the actor 192 *** \param weapon The new weapon to equip on the actor 193 *** \return A pointer to the weapon that was previouslly equipped, or NULL if no weapon was equipped. 194 *** 195 *** This function will also automatically re-calculate all attack ratings, elemental, and status bonuses. 196 **/ 197 GlobalWeapon* EquipWeapon(GlobalWeapon* weapon); 198 199 /** \brief Equips a new armor on the actor 200 *** \param armor The piece of armor to equip 201 *** \param index The index into the _armor_equippd vector where to equip the armor 202 *** \return A pointer to the armor that was previously equipped, or NULL if no armor was equipped 203 *** 204 *** This function will also automatically re-calculate all defense ratings, elemental, and status bonuses 205 *** for the attack point that the armor was equipped on. If the index argument is invalid (out-of-bounds), 206 *** the function will return the armor argument. 207 **/ 208 GlobalArmor* EquipArmor(GlobalArmor* armor, uint32 index); 209 210 /** \brief Adds a new skill to the actor's skill set 211 *** \param skill_id The id number of the skill to add 212 *** 213 *** No skill may be added more than once. If this case is detected or an error occurs when trying 214 *** to load the skill data, it will not be added. 215 **/ 216 virtual void AddSkill(uint32 skill_id) = 0; 217 218 /** \brief Determines if the actor is "alive" and able to perform actions 219 *** \return True if the character has a non-zero amount of hit points 220 **/ IsAlive()221 bool IsAlive() const 222 { return (_hit_points != 0); } 223 224 /** \name Class member get functions 225 *** Some of these functions take an index argument to retrieve a particular 226 *** attack point stat or piece of armor. If an invalid index is given, a zero 227 *** or NULL value will be returned. 228 **/ 229 //@{ GetID()230 uint32 GetID() const 231 { return _id; } 232 GetName()233 hoa_utils::ustring& GetName() 234 { return _name; } 235 GetFilename()236 std::string& GetFilename() 237 { return _filename; } 238 GetHitPoints()239 uint32 GetHitPoints() const 240 { return _hit_points; } 241 GetMaxHitPoints()242 uint32 GetMaxHitPoints() const 243 { return _max_hit_points; } 244 GetSkillPoints()245 uint32 GetSkillPoints() const 246 { return _skill_points; } 247 GetMaxSkillPoints()248 uint32 GetMaxSkillPoints() const 249 { return _max_skill_points; } 250 GetExperienceLevel()251 uint32 GetExperienceLevel() const 252 { return _experience_level; } 253 GetExperiencePoints()254 uint32 GetExperiencePoints() const 255 { return _experience_points; } 256 GetStrength()257 uint32 GetStrength() const 258 { return _strength; } 259 GetVigor()260 uint32 GetVigor() const 261 { return _vigor; } 262 GetFortitude()263 uint32 GetFortitude() const 264 { return _fortitude; } 265 GetProtection()266 uint32 GetProtection() const 267 { return _protection; } 268 GetAgility()269 uint32 GetAgility() const 270 { return _agility; } 271 GetEvade()272 float GetEvade() const 273 { return _evade; } 274 GetTotalPhysicalAttack()275 uint32 GetTotalPhysicalAttack() const 276 { return _total_physical_attack; } 277 GetTotalMetaphysicalAttack()278 uint32 GetTotalMetaphysicalAttack() const 279 { return _total_metaphysical_attack; } 280 281 uint32 GetTotalPhysicalDefense(uint32 index) const; 282 283 uint32 GetTotalMetaphysicalDefense(uint32 index) const; 284 285 float GetTotalEvadeRating(uint32 index) const; 286 GetWeaponEquipped()287 GlobalWeapon* GetWeaponEquipped() const 288 { return _weapon_equipped; } 289 GetArmorEquipped()290 const std::vector<GlobalArmor*>& GetArmorEquipped() 291 { return _armor_equipped; } 292 293 GlobalArmor* GetArmorEquipped(uint32 index) const; 294 GetAttackPoints()295 const std::vector<GlobalAttackPoint*>& GetAttackPoints() 296 { return _attack_points; } 297 298 GlobalAttackPoint* GetAttackPoint(uint32 index) const; 299 GetSkills()300 const std::map<uint32, GlobalSkill*>& GetSkills() 301 { return _skills; } 302 303 /** \brief Retrieves a pointer to a skill with a specific id 304 *** \param skill_id The unique ID of the skill to find and return 305 *** \return A pointer to the skill if it is found, or NULL if the skill was not found 306 **/ 307 GlobalSkill* GetSkill(uint32 skill_id) const; 308 309 //! \brief An alternative GetSkill call that takes a skill pointer as an argument 310 GlobalSkill* GetSkill(const GlobalSkill* skill) const; 311 312 // TODO: elemental and status effects not yet available in game 313 // std::vector<GlobalElementalEffect*>& GetElementalAttackBonuses() 314 // { return _elemental_attack_bonuses; } 315 // 316 // std::vector<std::pair<float, GlobalStatusEffect*> >& GetStatusAttackBonuses() 317 // { return _status_attack_bonuses; } 318 // 319 // std::vector<GlobalElementalEffect*>& GetElementalDefenseBonuses() 320 // { return _elemental_defense_bonuses; } 321 // 322 // std::vector<std::pair<float, GlobalStatusEffect*> >& GetStatusDefenseBonuses() 323 // { return _status_defense_bonuses; } 324 //@} 325 326 /** \name Class member set functions 327 *** Normally you should not need to directly set the value of these members, but rather add or subtract 328 *** an amount from the current value of the member. Total attack, defense, and evade ratings are 329 *** re-calculated when an appropriately related stat is changed. 330 **/ 331 //@{ SetExperienceLevel(uint32 xp_level)332 void SetExperienceLevel(uint32 xp_level) 333 { _experience_level = xp_level; } 334 SetExperiencePoints(uint32 xp_points)335 void SetExperiencePoints(uint32 xp_points) 336 { _experience_points = xp_points; } 337 SetHitPoints(uint32 hp)338 void SetHitPoints(uint32 hp) 339 { if (hp > _max_hit_points) _hit_points = _max_hit_points; else _hit_points = hp; } 340 SetMaxHitPoints(uint32 hp)341 void SetMaxHitPoints(uint32 hp) 342 { _max_hit_points = hp; if (_hit_points > _max_hit_points) _hit_points = _max_hit_points; } 343 SetSkillPoints(uint32 sp)344 void SetSkillPoints(uint32 sp) 345 { if (sp > _max_skill_points) _skill_points = _max_skill_points; else _skill_points = sp; } 346 SetMaxSkillPoints(uint32 sp)347 void SetMaxSkillPoints(uint32 sp) 348 { _max_skill_points = sp; if (_skill_points > _max_skill_points) _skill_points = _max_skill_points; } 349 SetStrength(uint32 st)350 void SetStrength(uint32 st) 351 { _strength = st; _CalculateAttackRatings(); } 352 SetVigor(uint32 vi)353 void SetVigor(uint32 vi) 354 { _vigor = vi; _CalculateAttackRatings(); } 355 SetFortitude(uint32 fo)356 void SetFortitude(uint32 fo) 357 { _fortitude = fo; _CalculateDefenseRatings(); } 358 SetProtection(uint32 pr)359 void SetProtection(uint32 pr) 360 { _protection = pr; _CalculateDefenseRatings(); } 361 SetAgility(uint32 ag)362 void SetAgility(uint32 ag) 363 { _agility = ag; } 364 SetEvade(float ev)365 void SetEvade(float ev) 366 { _evade = ev; _CalculateEvadeRatings(); } 367 //@} 368 369 /** \name Class member add and subtract functions 370 *** These methods provide a means to easily add or subtract amounts off of certain stats, such 371 *** as hit points or stength. Total attack, defense, or evade ratings are re-calculated when 372 *** an appropriately related stat is changed. Corner cases are checked to prevent overflow conditions 373 *** and other invalid values, such as current hit points exceeded maximum hit points. 374 *** 375 *** \note When making changes to the maximum hit points or skill points, you should also consider 376 *** making the same addition or subtraction to the current hit points / skill points. Modifying the 377 *** maximum values will not modify the current values unless the change causes the new maximum to 378 *** exceed the current values. 379 **/ 380 //@{ 381 void AddHitPoints(uint32 amount); 382 383 void SubtractHitPoints(uint32 amount); 384 385 void AddMaxHitPoints(uint32 amount); 386 387 //! \note The number of hit points will be decreased if they are greater than the new maximum 388 void SubtractMaxHitPoints(uint32 amount); 389 390 void AddSkillPoints(uint32 amount); 391 392 void SubtractSkillPoints(uint32 amount); 393 394 void AddMaxSkillPoints(uint32 amount); 395 396 //! \note The number of skill points will be decreased if they are greater than the new maximum 397 void SubtractMaxSkillPoints(uint32 amount); 398 399 void AddStrength(uint32 amount); 400 401 void SubtractStrength(uint32 amount); 402 403 void AddVigor(uint32 amount); 404 405 void SubtractVigor(uint32 amount); 406 407 void AddFortitude(uint32 amount); 408 409 void SubtractFortitude(uint32 amount); 410 411 void AddProtection(uint32 amount); 412 413 void SubtractProtection(uint32 amount); 414 415 void AddAgility(uint32 amount); 416 417 void SubtractAgility(uint32 amount); 418 419 void AddEvade(float amount); 420 421 void SubtractEvade(float amount); 422 //@} 423 424 protected: 425 //! \brief An identification number to represent the actor 426 uint32 _id; 427 428 //! \brief The name of the actor as it will be displayed on the screen 429 hoa_utils::ustring _name; 430 431 //! \brief The filename base used to look up an actors image files and other data 432 std::string _filename; 433 434 //! \name Base Actor Statistics 435 //@{ 436 //! \brief The current experience level of the actor 437 uint32 _experience_level; 438 439 //! \brief The number of experience points the actor has earned 440 uint32 _experience_points; 441 442 //! \brief The current number of hit points that the actor has 443 uint32 _hit_points; 444 445 //! \brief The maximum number of hit points that the actor may have 446 uint32 _max_hit_points; 447 448 //! \brief The current number of skill points that the actor has 449 uint32 _skill_points; 450 451 //! \brief The maximum number of skill points that the actor may have 452 uint32 _max_skill_points; 453 454 //! \brief Used to determine the actor's physical attack rating 455 uint32 _strength; 456 457 //! \brief Used to determine the actor's metaphysical attack rating 458 uint32 _vigor; 459 460 //! \brief Used to determine the actor's physical defense rating 461 uint32 _fortitude; 462 463 //! \brief Used to determine the actor's metaphysical defense rating 464 uint32 _protection; 465 466 //! \brief Used to calculate the time it takes to recover stamina in battles 467 uint32 _agility; 468 469 //! \brief The attack evade percentage of the actor, ranged from 0.0 to 1.0 470 float _evade; 471 //@} 472 473 //! \brief The sum of the character's strength and their weapon's physical attack 474 uint32 _total_physical_attack; 475 476 //! \brief The sum of the character's vigor and their weapon's metaphysical attack 477 uint32 _total_metaphysical_attack; 478 479 /** \brief The attack points that are located on the actor 480 *** \note All actors must have at least one attack point. 481 **/ 482 std::vector<GlobalAttackPoint*> _attack_points; 483 484 /** \brief The weapon that the actor has equipped 485 *** \note If no weapon is equipped, this member will be equal to NULL. 486 *** 487 *** Actors are not required to have weapons equipped, and indeed most enemies will probably not have any 488 *** weapons explicitly equipped. The various bonuses to attack ratings, elemental attacks, and status 489 *** attacks are automatically added to the appropriate members of this class when the weapon is equipped, 490 *** and likewise those bonuses are removed when the weapon is unequipped. 491 **/ 492 GlobalWeapon* _weapon_equipped; 493 494 /** \brief The various armors that the actor has equipped 495 *** \note The size of this vector will always be equal to the number of attack points on the actor. 496 *** 497 *** Actors are not required to have armor of any sort equipped. Note that the defense bonuses that 498 *** are afforded by the armors are not directly applied to the character's defense ratings, but rather to 499 *** the defense ratings of their attack points. However the elemental and status bonuses of the armor are 500 *** applied to the character as a whole. The armor must be equipped on one of the actor's attack points to 501 *** really afford any kind of defensive bonus. 502 **/ 503 std::vector<GlobalArmor*> _armor_equipped; 504 505 /** \brief A map containing all skills that the actor can use 506 *** Unlike with characters, there is no need to hold the various types of skills in seperate containers 507 *** for enemies. An enemy must have <b>at least</b> one skill in order to do anything useful in battle. 508 **/ 509 std::map<uint32, GlobalSkill*> _skills; 510 511 /** \brief The elemental effects added to the actor's attack 512 *** Actors may carry various elemental attack bonuses, or they may carry none. These bonuses include 513 *** those that are brought upon by the weapon that the character may have equipped. 514 **/ 515 // std::vector<GlobalElementalEffect*> _elemental_attack_bonuses; 516 517 /** \brief The status effects added to the actor's attack 518 *** Actors may carry various status attack bonuses, or they may carry none. These bonuses include 519 *** those that are brought upon by the weapon that the character may have equipped. The first member 520 *** in the pair is the likelihood (between 0.0 and 1.0) that the actor has of inflicting that status 521 *** effect upon a targeted foe. 522 **/ 523 // std::vector<std::pair<float, GlobalStatusEffect*> > _status_attack_bonuses; 524 525 /** \brief The elemental effects added to the actor's defense 526 *** Actors may carry various elemental defense bonuses, or they may carry none. These bonuses include 527 *** those that are brought upon by all of the armors that the character may have equipped. 528 **/ 529 // std::vector<GlobalElementalEffect*> _elemental_defense_bonuses; 530 531 /** \brief The status effects added to the actor's defense 532 *** Actors may carry various status defense bonuses, or they may carry none. These bonuses include 533 *** those that are brought upon by the armors that the character may have equipped. The first member 534 *** in the pair is the reduction in the likelihood (between 0.0 and 1.0) that the actor has of 535 *** repelling an attack with a status effect. 536 **/ 537 // std::vector<std::pair<float, GlobalStatusEffect*> > _status_defense_bonuses; 538 539 // ---------- Private methods 540 541 /** \brief Calculates an actor's physical and metaphysical attack ratings 542 *** This function sums the actor's strength/vigor with their weapon's attack ratings 543 *** and places the result in total physical/metaphysical attack members 544 **/ 545 void _CalculateAttackRatings(); 546 547 //! \brief Calculates the physical and metaphysical defense ratings for each attack point 548 void _CalculateDefenseRatings(); 549 550 //! \brief Calculates the evade rating for each attack point 551 void _CalculateEvadeRatings(); 552 }; // class GlobalActor 553 554 555 /** **************************************************************************** 556 *** \brief A container class for tracking the growth of a character 557 *** 558 *** This class is essentially an extension of the GlobalCharacter class. The purpose 559 *** of this class is to manage and monitor the character's growth stats. It provide 560 *** an interface for external code to determine when and what growth occurs in a 561 *** character's stats. Growth may occur whenever a character gains additional experience 562 *** points. Growth does occur even when the character has not reached a new experience 563 *** level, as Allacrost allows for a gradual growth in stats over time with a 564 *** larger spike in growth after achieving a new experience level. 565 *** 566 *** The advised procedure for determining and processing character growth is as follows. 567 *** -# If the return value of GlobalCharacter::AddExperiencePoints is true, growth 568 *** has occured and should be processed. 569 *** -# Call GlobalCharacter::GetGrowth() to retrieve a pointer to this object 570 *** -# Call IsExperienceLevel() to determine whether the type growth is a new 571 *** experience level, or simply gradual growth. 572 *** -# If the growth type is gradual, call the various Growth() methods and 573 *** report any non-zero values to the player. Then call AcknoledgeGrowth() 574 *** -# Otherwise if the growth type is a new level, report growth plus any skills 575 *** learned and call AcknoledgeGrowth() (*see note) 576 *** 577 *** \note When an experience level is gained, after the call to AcknowledgeGrowth() 578 *** there may be new growth available (because the character gained multiple 579 *** experience levels or met the requirements for additional gradual growth for 580 *** the new experience level to gain). Thus, you should strongly consider calling 581 *** the IsGrowthDetected() method after AcknowledgeGrowth() to report any further 582 *** character growth that occured after the character reached a new level. 583 *** 584 *** \todo This entire class' operation and its interaction with the GlobalCharacter 585 *** class needs to be examined and improved where needed. Also examine the use of 586 *** the DetermineGrowth() function in the Lua file dat/actors/characters.lua 587 *** ***************************************************************************/ 588 class GlobalCharacterGrowth { 589 friend class GameGlobal; 590 friend class GlobalCharacter; 591 friend void hoa_defs::BindGlobalsToLua(); 592 593 public: 594 GlobalCharacterGrowth(GlobalCharacter* owner); 595 596 ~GlobalCharacterGrowth(); 597 598 /** \brief Processes any growth that has occured by modifier the character's stats 599 *** If an experience level is gained, this function will open up the script file that contains 600 *** the character's definition and get new growth stats for the next experience level. 601 **/ 602 void AcknowledgeGrowth(); 603 604 //! \name Class member access functions 605 //@{ IsExperienceLevelGained()606 bool IsExperienceLevelGained() const 607 { return _experience_level_gained; } 608 IsGrowthDetected()609 bool IsGrowthDetected() const 610 { return _growth_detected; } 611 GetHitPointsGrowth()612 uint32 GetHitPointsGrowth() const 613 { return _hit_points_growth; } 614 GetSkillPointsGrowth()615 uint32 GetSkillPointsGrowth() const 616 { return _skill_points_growth; } 617 GetStrengthGrowth()618 uint32 GetStrengthGrowth() const 619 { return _strength_growth; } 620 GetVigorGrowth()621 uint32 GetVigorGrowth() const 622 { return _vigor_growth; } 623 GetFortitudeGrowth()624 uint32 GetFortitudeGrowth() const 625 { return _fortitude_growth; } 626 GetProtectionGrowth()627 uint32 GetProtectionGrowth() const 628 { return _protection_growth; } 629 GetAgilityGrowth()630 uint32 GetAgilityGrowth() const 631 { return _agility_growth; } 632 GetEvadeGrowth()633 float GetEvadeGrowth() const 634 { return _evade_growth; } 635 GetSkillsLearned()636 std::vector<GlobalSkill*>* GetSkillsLearned() 637 { return &_skills_learned; } 638 //@} 639 640 private: 641 //! \brief A pointer to the character which this growth is managing 642 GlobalCharacter* _character_owner; 643 644 //! \brief Set to true when it is detected that a new experience level has been reached 645 bool _experience_level_gained; 646 647 //! \brief Set to true when it is detected that sufficient experience for at least one stat to grow has been reached 648 bool _growth_detected; 649 650 //! \brief The experience points required to reach the next experience level 651 uint32 _experience_for_next_level; 652 653 //! \brief The experience points that were required to reach the previous experience level 654 uint32 _experience_for_last_level; 655 656 /** \brief The amount of growth that should be added to each of the character's stats 657 *** These members are incremented by the _UpdateGrowth() function, which detects when a character 658 *** has enough experience points to meet a growth requirement. They are all cleared to zero after 659 *** a call to AcknowledgeGrowth() 660 *** 661 *** \note These members are given read/write access in Lua so that Lua may use them to hold new 662 *** growth amounts when a character reaches a new level. Refer to the function DetermineGrowth(character) 663 *** defined in dat/actors/characters.lua 664 **/ 665 //@{ 666 uint32 _hit_points_growth; 667 uint32 _skill_points_growth; 668 uint32 _strength_growth; 669 uint32 _vigor_growth; 670 uint32 _fortitude_growth; 671 uint32 _protection_growth; 672 uint32 _agility_growth; 673 float _evade_growth; 674 //@} 675 676 /** \brief The periodic growth of the stats as a function of experience points 677 *** The purpose of these containers is to support the gradual growth of characters. 678 *** The first member in each pair is the experience points required for that growth 679 *** to occur, while the second member is the value of the growth. Each entry in the 680 *** deques are ordered from lowest (front) to highest (back) XP requirements. The 681 *** final entry in each deque should be the growth for when the next experience 682 *** level is reached. Note that these structures do not need to contain any entries 683 *** (ie, a stat does not need to grow on every level). 684 *** 685 *** These containers are emptied when a new experience level occurs, and are also 686 *** re-constructed after the experience level gain has been acknowledged. 687 **/ 688 //@{ 689 std::deque<std::pair<uint32, uint32> > _hit_points_periodic_growth; 690 std::deque<std::pair<uint32, uint32> > _skill_points_periodic_growth; 691 std::deque<std::pair<uint32, uint32> > _strength_periodic_growth; 692 std::deque<std::pair<uint32, uint32> > _vigor_periodic_growth; 693 std::deque<std::pair<uint32, uint32> > _fortitude_periodic_growth; 694 std::deque<std::pair<uint32, uint32> > _protection_periodic_growth; 695 std::deque<std::pair<uint32, uint32> > _agility_periodic_growth; 696 std::deque<std::pair<uint32, float> > _evade_periodic_growth; 697 //@} 698 699 /** \brief Contains any and all skills that are to be learned when the next experience level is reached 700 *** These are automatically added to the character by this class after the new experience level growth has been 701 *** acknowledged. 702 **/ 703 std::vector<GlobalSkill*> _skills_learned; 704 705 /** \brief Adds a new skill for the character to learn at the next experience level gained 706 *** \param skill_id The ID number of the skill to add 707 *** \note This function is bound to and invoked by Lua to add all of the skills to be learned 708 **/ 709 void _AddSkill(uint32 skill_id); 710 711 /** \brief Examines if any growth has occured as a result of the character's experience points 712 *** This is called by GlobalCharacter whenever the character's experience points change. If any growth is 713 *** detected, the _growth_detected member is set and the various growth members of the class are incremented 714 *** by the growth amount. 715 **/ 716 void _CheckForGrowth(); 717 718 /** \brief Constructs the numerous periodic growth deques when growth stats for a new level are loaded in 719 *** After new growth stats have been loaded in for a level, this function takes those values, breaks them 720 *** apart, and spreads out their growth periodically. 50% of the growth is saved for when the character 721 *** reaches a new level, while the other 50% are rewarded as the character's experience grows to values 722 *** in between the previous experience level marker and the next. 723 *** 724 *** \note The growth members should contain the total growth stats when this function is called. These 725 *** members will be set back to zero by the time the function returns as their values will be split up 726 *** and placed in numerous entries in the periodic_growth deques. All periodic_growth deques should be 727 *** empty when this function is called. 728 **/ 729 void _ConstructPeriodicGrowth(); 730 731 /** \brief An algorithm that computes how many experience points are needed to reach the next level 732 *** This algorithm is a function of the current experience level and the experience points that 733 *** were required to reach the current level. This function modifies the _experience_for_next_level 734 *** and _experience_for_last_level members. 735 **/ 736 void _DetermineNextLevelExperience(); 737 }; // class GlobalCharacterGrowth 738 739 740 /** **************************************************************************** 741 *** \brief Represents a playable game character 742 *** 743 *** This calls represents playable game characters that join the party and can 744 *** participate in battles. It does not cover NPCs or any other form of character. 745 *** All characters have four attack points on the head, torso, arms, and legs and 746 *** armor may also be equipped to cover all four of these points. This class 747 *** additionally retains references to loaded images of the character in various 748 *** formats such as sprites and portraits. 749 *** 750 *** \todo Examine relationship between this class and GlobalCharacterGrowth class 751 *** (Look at this class' constructor). The friend declaration may not be needed 752 *** and the interaction between these two classe may be improved. 753 *** 754 *** \todo This class needs a better organized set of containers for its images. 755 *** The current containers and accessor methods are considered temporary. 756 *** ***************************************************************************/ 757 class GlobalCharacter : public GlobalActor { 758 friend class GlobalCharacterGrowth; 759 760 public: 761 /** \brief Constructs a new character from its definition in a script file 762 *** \param id The integer ID of the character to create 763 *** \param initial If true, the character's stats, equipment, and skills are set 764 *** to the character's initial status 765 *** \note If initial is set to false, the character's stats, equipment, and skills 766 *** must be set by external code, otherwise they will remain 0/NULL/empty. 767 **/ 768 GlobalCharacter(uint32 id, bool initial = true); 769 ~GlobalCharacter()770 virtual ~GlobalCharacter() 771 {} 772 EquipHeadArmor(GlobalArmor * armor)773 GlobalArmor* EquipHeadArmor(GlobalArmor* armor) 774 { return EquipArmor(armor, GLOBAL_POSITION_HEAD); } 775 EquipTorsoArmor(GlobalArmor * armor)776 GlobalArmor* EquipTorsoArmor(GlobalArmor* armor) 777 { return EquipArmor(armor, GLOBAL_POSITION_TORSO); } 778 EquipArmArmor(GlobalArmor * armor)779 GlobalArmor* EquipArmArmor(GlobalArmor* armor) 780 { return EquipArmor(armor, GLOBAL_POSITION_ARMS); } 781 EquipLegArmor(GlobalArmor * armor)782 GlobalArmor* EquipLegArmor(GlobalArmor* armor) 783 { return EquipArmor(armor, GLOBAL_POSITION_LEGS); } 784 785 /** \brief Adds experience points to the character 786 *** \param xp The amount of experience points to add 787 *** \return True if the new experience points triggered character growth 788 **/ 789 bool AddExperiencePoints(uint32 xp); 790 791 //! \brief Adds a new skill to the character, inherited from GlobalActor 792 void AddSkill(uint32 skill_id); 793 794 //! \name Public Member Access Functions 795 //@{ GetExperienceForNextLevel()796 uint32 GetExperienceForNextLevel() const 797 { return _growth._experience_for_next_level; } 798 GetGrowth()799 GlobalCharacterGrowth* GetGrowth() 800 { return &_growth; } 801 GetHeadArmorEquipped()802 GlobalArmor* GetHeadArmorEquipped() 803 { return _armor_equipped[GLOBAL_POSITION_HEAD]; } 804 GetTorsoArmorEquipped()805 GlobalArmor* GetTorsoArmorEquipped() 806 { return _armor_equipped[GLOBAL_POSITION_TORSO]; } 807 GetArmArmorEquipped()808 GlobalArmor* GetArmArmorEquipped() 809 { return _armor_equipped[GLOBAL_POSITION_ARMS]; } 810 GetLegArmorEquipped()811 GlobalArmor* GetLegArmorEquipped() 812 { return _armor_equipped[GLOBAL_POSITION_LEGS]; } 813 GetAttackSkills()814 std::vector<GlobalSkill*>* GetAttackSkills() 815 { return &_attack_skills; } 816 GetDefenseSkills()817 std::vector<GlobalSkill*>* GetDefenseSkills() 818 { return &_defense_skills; } 819 GetSupportSkills()820 std::vector<GlobalSkill*>* GetSupportSkills() 821 { return &_support_skills; } 822 //@} 823 824 // TEMP: image accessor functions 825 //@{ GetStandardSpriteFrames()826 std::vector<hoa_video::StillImage>* GetStandardSpriteFrames() 827 { return &_map_frames_standard; } 828 AddBattleAnimation(const std::string & name,hoa_video::AnimatedImage anim)829 void AddBattleAnimation(const std::string & name, hoa_video::AnimatedImage anim) 830 { _battle_animation[name] = anim; } 831 RetrieveBattleAnimation(const std::string & name)832 hoa_video::AnimatedImage* RetrieveBattleAnimation(const std::string & name) 833 { return &_battle_animation[name]; } 834 GetBattlePortraits()835 std::vector<hoa_video::StillImage>* GetBattlePortraits() 836 { return &_battle_portraits; } 837 //@} 838 839 protected: 840 /** \brief Sortable skill containers 841 *** Skills are divided into three types: attack, defense, and support. There is really no functional 842 *** distinguishment between the various skill types, they just serve an organizational means and are 843 *** used to identify a skill's general purpose/use. Characters keep their skills in these seperate 844 *** containers because they are presented in this way to the player. 845 **/ 846 //@{ 847 std::vector<GlobalSkill*> _attack_skills; 848 std::vector<GlobalSkill*> _defense_skills; 849 std::vector<GlobalSkill*> _support_skills; 850 //@} 851 852 /** \brief A manager object for monitoring the character's growth 853 *** This object contains information such as what is required for the next level experience level to be reached, 854 *** the amount that each stat will grow by on the next level, whether any new skills will be learned, etc. It 855 *** is updated whenever the character's experience points are changed. 856 **/ 857 GlobalCharacterGrowth _growth; 858 859 /** \name Character Images 860 *** \note Although many of the names of these members would imply that they are only used in one particular 861 *** mode of operation (map, battle, etc.), these members may be freely used by different game modes for 862 *** which they were not specifically designed for. The names are simply meant to indicate the primary game 863 *** mode where the images are intended to be used. 864 **/ 865 //@{ 866 /** \brief The standard frame images for the character's map sprite. 867 *** This container holds the standard frames for the character's map sprite, which include standing and 868 *** walking frames. This set includes 24 frames in total, 6 each for the down, up, left, and right 869 *** orientations. 870 **/ 871 std::vector<hoa_video::StillImage> _map_frames_standard; 872 873 /** \brief The character's standard map portrait image 874 *** The standard map portrait is ususally used in dialogues, but may also be used in other modes where 875 *** appropriate. The size of the map portrait is 200x200 pixels. 876 **/ 877 hoa_video::StillImage _map_portrait_standard; 878 879 /** \brief The frame images for the character's battle sprite. 880 *** This map container contains various animated images for the character's battle sprites. The key to the 881 *** map is a simple string which describes the animation, such as "idle". 882 **/ 883 std::map<std::string, hoa_video::AnimatedImage> _battle_animation; 884 885 /** \brief The frame images for the character's battle portrait 886 *** Each character has 5 battle portraits which represent the character's health with damage levels of 0%, 887 *** 25%, 50%, 75%, and 100% (this is also the order in which the frames are stored, starting with the 0% 888 *** frame at index 0). Thus, the size of this vector is always five elements. Each portait is 100x100 889 *** pixels in size. 890 **/ 891 std::vector<hoa_video::StillImage> _battle_portraits; 892 893 /** \brief The character's full-body portrait image for use in menu mode 894 *** This image is a detailed, full-scale portait of the character and is intended for use in menu mode. 895 *** The size of the image is 150x350 pixels. 896 **/ 897 hoa_video::StillImage _menu_portrait; 898 //@} 899 }; // class GlobalCharacter : public GlobalActor 900 901 902 /** **************************************************************************** 903 *** \brief Representation of enemies that fight in battles 904 *** 905 *** Allacrost handles enemies a little different than most RPGs. Instead of an 906 *** enemy always having the same statistics for health, strength, etc., enemies 907 *** are more closely matched to the player's experience levels and abilities. 908 *** In terms of the operation of this class, an enemy starts at level 0 with 909 *** various base statistics and is then grown to match a level close to the 910 *** current level of the player's characters, before it actually appears on 911 *** the field of battle. Furthermore, the enemy is grown using gaussian random 912 *** values to provide an element of uncertainty and to make the enemies that the 913 *** player encounters less static. 914 *** ***************************************************************************/ 915 class GlobalEnemy : public GlobalActor { 916 public: 917 GlobalEnemy(uint32 id); 918 ~GlobalEnemy()919 virtual ~GlobalEnemy() 920 {} 921 922 /** \brief Initializes the enemy and prepares it for battle 923 *** \param xp_level The experience level to set the enemy to 924 *** 925 *** This function sets the enemy's experience level, grows its stats to match this 926 *** level, and adds any skills that the enemy should be capable of using at the 927 *** level. Call this function once only, because after the enemy has skills enabled 928 *** it will not be able to re-initialize. If you need to initialize the enemy once 929 *** more, you'll have to create a brand new GlobalEnemy object and initialize that 930 *** instead. 931 **/ 932 void Initialize(uint32 xp_level); 933 934 /** \brief Enables the enemy to be able to use a specific skill 935 *** \param skill_id The integer ID of the skill to add to the enemy 936 *** 937 *** This method should be called only <b>after</b> the Initialize() method has been invoked. The 938 *** purpose of this method is to allow non-standard skills to be used by enemies under certain 939 *** circumstances. For example, in scripted battle sequences where an enemy may become stronger 940 *** and gain access to new skills after certain criteria are met. Normally you would want to define 941 *** any skills that you wish an enemy to be able to use within their Lua definition file. 942 **/ 943 void AddSkill(uint32 skill_id); 944 945 /** \brief Uses random variables to calculate which objects, if any, the enemy dropped 946 *** \param objects A reference to a vector to hold the GlobalObject pointers 947 *** 948 *** The objects vector is cleared immediately once this function is called so make sure 949 *** that it does not hold anything meaningful. Any objects which are added to this 950 *** vector are created with new GlobalObject() and it becomes the callee's repsonsibility 951 *** to manage this memory and delete those objects when they are no longer needed. 952 **/ 953 void DetermineDroppedObjects(std::vector<GlobalObject*>& objects); 954 955 //! \name Class member access functions 956 //@{ GetDrunesDropped()957 uint32 GetDrunesDropped() const 958 { return _drunes_dropped; } 959 GetSpriteWidth()960 uint32 GetSpriteWidth() const 961 { return _sprite_width; } 962 GetSpriteHeight()963 uint32 GetSpriteHeight() const 964 { return _sprite_height; } 965 GetBattleSpriteFrames()966 std::vector<hoa_video::StillImage>* GetBattleSpriteFrames() 967 { return &_battle_sprite_frames; } 968 //@} 969 970 protected: 971 /** \name Growth Statistics 972 *** \brief The average increase for statistics between experience levels is stored by these members 973 *** 974 *** Note that even though the normal statistics members are integers, these are floating point values. This 975 *** is so because it allows us a finer granularity of control over how much a particular statistic grows 976 *** with time. 977 **/ 978 //@{ 979 float _growth_hit_points; 980 float _growth_skill_points; 981 float _growth_experience_points; 982 float _growth_strength; 983 float _growth_vigor; 984 float _growth_fortitude; 985 float _growth_protection; 986 float _growth_agility; 987 float _growth_evade; 988 float _growth_drunes; 989 //@} 990 991 //! \brief The amount of drunes that the enemy will drop 992 uint32 _drunes_dropped; 993 994 //! \brief The dimensions of the enemy's battle sprite in pixels 995 uint32 _sprite_width, _sprite_height; 996 997 /** \brief Dropped object containers 998 *** These three vectors are all of the same size. _dropped_objects contains the IDs of the objects that the enemy 999 *** may drop. _dropped_chance contains a value from 0.0f to 1.0f that determines the probability of the 1000 *** enemy dropping that object. And finally _dropped_level_required contains the minimum experience level 1001 *** that the enemy must be at in order to drop this object at all. 1002 **/ 1003 //@{ 1004 std::vector<uint32> _dropped_objects; 1005 std::vector<float> _dropped_chance; 1006 std::vector<uint32> _dropped_level_required; 1007 //@} 1008 1009 /** \brief Contains all of the possible skills that the enemy may possess 1010 *** Enemies learn a variety of skills and some of these skills they may only use at higher experience 1011 *** levels. The skills referenced within this container list all possible skills that an enemy can 1012 *** learn to use. The map key is the id for the skill while the value for each key is the minimum 1013 *** experience level that the enemy is required to meet in order to learn and thus be able to use the 1014 *** skill. The Initialize() function examines this containers and populates the GlobalActor _skills 1015 *** container with the skills that the enemy is allowed to use at its current experience level. 1016 **/ 1017 std::map<uint32, uint32> _skill_set; 1018 1019 /** \brief The battle sprite frame images for the enemy 1020 *** Each enemy has four frames representing damage levels of 0%, 33%, 66%, and 100%. This vector thus 1021 *** always has a size of four holding each of these image frames. The first element contains the 0% 1022 *** damage frame, the second element contains the 33% damage frame, and so on. 1023 **/ 1024 std::vector<hoa_video::StillImage> _battle_sprite_frames; 1025 }; // class GlobalEnemy : public GlobalActor 1026 1027 1028 /** **************************************************************************** 1029 *** \brief Represents a party of actors 1030 *** 1031 *** This class is a container for a group or "party" of actors. A party is a type 1032 *** of target for items and skills. The GameGlobal class also organizes characters 1033 *** into parties for convienence. Note that an actor may be either an enemy or 1034 *** a character, but you should avoid creating parties that contain both characters 1035 *** and enemies, as it can lead to conflicts. For example, a character and enemy which 1036 *** enemy which have the same ID value). 1037 *** 1038 *** Parties may or may not allow duplicate actors (a duplicate actor is defined 1039 *** as an actor that has the same _id member as another actor in the party). 1040 *** This property is determined in the GlobalParty constructor 1041 *** 1042 *** \note When this class is destroyed, the actors contained within the class are 1043 *** <i>not</i> destroyed. Only the references to those actors through this class object 1044 *** are lost. 1045 *** 1046 *** \note All methods which perform an operation by using an actor ID are 1047 *** <b>only</b> valid to use if the party does not allow duplicates. 1048 *** ***************************************************************************/ 1049 class GlobalParty { 1050 public: 1051 //! \param allow_duplicates Determines whether or not the party allows duplicate actors to be added (default value == false) 1052 GlobalParty(bool allow_duplicates = false) : _allow_duplicates(allow_duplicates)1053 _allow_duplicates(allow_duplicates) {} 1054 ~GlobalParty()1055 ~GlobalParty() 1056 {} 1057 1058 // ---------- Actor addition, removal, and retrieval methods 1059 1060 /** \brief Adds an actor to the party 1061 *** \param actor A pointer to the actor to add to the party 1062 *** \param index The index where the actor should be inserted. If negative, actor is added to the end 1063 *** \note The actor will not be added if it is already in the party and duplicates are not allowed 1064 **/ 1065 void AddActor(GlobalActor* actor, int32 index = -1); 1066 1067 /** \brief Removes an actor from the party 1068 *** \param index The index of the actor in the party to remove 1069 *** \return A pointer to the actor that was removed, or NULL if the index provided was invalid 1070 **/ 1071 GlobalActor* RemoveActorAtIndex(uint32 index); 1072 1073 /** \brief Removes an actor from the party 1074 *** \param id The id value of the actor to remove 1075 *** \return A pointer to the actor that was removed, or NULL if the actor was not found in the party 1076 **/ 1077 GlobalActor* RemoveActorByID(uint32 id); 1078 1079 /** \brief Clears the party of all actors 1080 *** \note This function does not return the actor pointers, so if you wish to get the 1081 *** GlobalActors make sure you do so prior to invoking this call. 1082 **/ RemoveAllActors()1083 void RemoveAllActors() 1084 { _actors.clear(); } 1085 1086 /** \brief Retrieves a poitner to the actor in the party at a specified index 1087 *** \param index The index where the actor may be found in the party 1088 *** \return A pointer to the actor at the specified index, or NULL if the index argument was invalid 1089 **/ 1090 GlobalActor* GetActorAtIndex(uint32 index) const; 1091 1092 /** \brief Retrieves a poitner to the actor in the party with the spefified id 1093 *** \param id The id of the actor to return 1094 *** \return A pointer to the actor with the requested ID, or NULL if the actor was not found 1095 **/ 1096 GlobalActor* GetActorByID(uint32 id) const; 1097 1098 // ---------- Actor swap and replacement methods 1099 1100 /** \brief Swaps the location of two actors in the party by their indeces 1101 *** \param first_index The index of the first actor to swap 1102 *** \param second_index The index of the second actor to swap 1103 **/ 1104 void SwapActorsByIndex(uint32 first_index, uint32 second_index); 1105 1106 /** \brief Swaps the location of two actors in the party by looking up their IDs 1107 *** \param first_id The id of the first actor to swap 1108 *** \param second_id The id of the second actor to swap 1109 **/ 1110 void SwapActorsByID(uint32 first_id, uint32 second_id); 1111 1112 /** \brief Replaces an actor in the party at a specified index with a new actor 1113 *** \param index The index of the actor to be replaced 1114 *** \param new_actor A pointer to the actor that will replace the existing actor 1115 *** \return A pointer to the replaced actor, or NULL if the operation did not take place 1116 **/ 1117 GlobalActor* ReplaceActorByIndex(uint32 index, GlobalActor* new_actor); 1118 1119 /** \brief Replaces an actor in the party with the specified id with a new actor 1120 *** \param id The id of the actor to be replaced 1121 *** \param new_actor A pointer to the actor that will replace the existing actor 1122 *** \return A pointer to the replaced actor, or NULL if the operation did not take place 1123 **/ 1124 GlobalActor* ReplaceActorByID(uint32 id, GlobalActor* new_actor); 1125 1126 // ---------- Other methods 1127 1128 /** \brief Computes the average experience level of all actors in the party 1129 *** \return A float representing the average experience level (0.0f if party is empty) 1130 **/ 1131 float AverageExperienceLevel() const; 1132 1133 /** \brief Adds a certain amount of hit points to all actors in the party 1134 *** \param hp The number of health points to add 1135 **/ 1136 void AddHitPoints(uint32 hp); 1137 1138 //! \name Class member accessor methods 1139 //@{ IsAllowDuplicates()1140 bool IsAllowDuplicates() const 1141 { return _allow_duplicates; } 1142 IsPartyEmpty()1143 bool IsPartyEmpty() const 1144 { return (_actors.size() == 0); } 1145 GetPartySize()1146 uint32 GetPartySize() const 1147 { return _actors.size(); } 1148 GetAllActors()1149 const std::vector<GlobalActor*>& GetAllActors() const 1150 { return _actors; } 1151 //@} 1152 1153 private: 1154 /** \brief Actors are allowed to be inserted into the party multiple times when this member is true 1155 *** \note The value of this member is set in the class constructor and can not be changed at a later time 1156 **/ 1157 bool _allow_duplicates; 1158 1159 /** \brief A container of actors that are in this party 1160 *** The GlobalActor objects pointed to by the elements in this vector are not managed by this class. Therefore 1161 *** one needs to be careful that if any of the GlobalActor objects are destroyed outside the context of this 1162 *** class, the actor should be removed from this container immediately to avoid a possible segmentation fault. 1163 **/ 1164 std::vector<GlobalActor*> _actors; 1165 }; // class GlobalActorParty 1166 1167 } // namespace hoa_global 1168 1169 #endif // __GLOBAL_ACTORS_HEADER__ 1170