DynRPG v0.32 Unofficial
Plugin SDK
Public Member Functions | Public Attributes | List of all members
RPG::Battler Class Reference

Used for entities participating in battle, i.e. actors and monsters. More...

#include <Battler.h>

Inheritance diagram for RPG::Battler:
RPG::Actor RPG::Monster

Public Member Functions

std::string getName ()
 Returns the name of the actor or monster.
 
int getMaxHp ()
 Returns the maximal HP.
 
int getMaxMp ()
 Returns the maximal MP.
 
int getAttack ()
 Returns the attack value.
 
int getDefense ()
 Returns the defense value.
 
int getIntelligence ()
 Returns the intelligence value.
 
int getAgility ()
 Returns the agility value.
 
void setRow (Row newRow)
 Sets the current row.
 
void damagePopup (int number, int color)
 Shows a damage popup with a number.
 
void damagePopup (std::string text)
 Shows a damage popup with a small text.
 
bool isMonster ()
 Checks whether the battler is a monster or an actor.
 
void flash (int r, int g, int b, int intensity, int duration)
 Flashes a battler in a certain color.
 
bool executeAction (bool skipPluginHandlers=false)
 Executes the action of a battler (highly experimental!)
 
int getAttributeResist (int id)
 Built-in RM2k3 function that returns the actual damage multiplier for when the battler would be hit with a certain attribute (considers the (Elemental) Resistance of equipment (max. one step towards dmgE) and the "Reduce / Increase Resistance" of skill effects)
 
int getAttackPower (RPG::Battler *target)
 Built-in RM2k3 function that returns the strength of an attack (not the final attack value) Rough formula (a lot still not taken into account): if (critical hit) atk*3, else if (charge up) atk*2.
 
int getSkillPower (int skillId, RPG::Battler *target)
 Built-in RM2k3 function that returns the strength of a skill on a certain target, however, it's before the miss probability based on agility and statuses is calculated.
 

Public Attributes

int id
 One-based ID of the battler.
 
bool notHidden
 false if the battler is currently hidden (but not dead)
 
Actionaction
 Current action of the battler.
 
int hp
 Current HP.
 
int mp
 Current MP.
 
int attackDiff
 Difference from the default attack value.
 
int defenseDiff
 Difference from the default defense value.
 
int intelligenceDiff
 Difference from the default intelligence value.
 
int agilityDiff
 Difference from the default agility value.
 
DArray< short, 1 > attributes
 Array for a battler's attributes.
 
DArray< short, 1 > conditions
 Turns elapsed in a certain condition (see details)
 
bool isCharging
 Is the battler (monster) currently using the "Charge Up" action.
 
int atbValue
 Current value of the ATB bar (0 to 300000 - see details)
 
bool mirrored
 true if the battler's image is mirrored
 
int frameCounter
 Internally used.
 
int animationId
 ID of the battle graphic pose (see details)
 
int x
 Current X coordinate (centered)
 
int y
 Current Y coordinate (centered)
 
int originX
 Origin X coordinate (used when an actor moves to attack)
 
int originY
 Origin Y coordinate (used when an actor moves to attack)
 
int destinationX
 Destination X coordinate (used when an actor moves to attack)
 
int destinationY
 Destination Y coordinate (used when an actor moves to attack)
 
Row rowAlt
 Internally used, I do not understand the difference from row yet.
 
Row row
 Current row (no visible effect on monsters)
 
int damagePopupTimer
 Frames left until damage popup has finished (zero: no damage popup active)
 
ImagedamageImage
 Pointer to the image of the damage pointer.
 
int flashR
 Red value for flashing the battler (0 to 31)
 
int flashG
 Green value for flashing the battler (0 to 31)
 
int flashB
 Blue value for flashing the battler (0 to 31)
 
double flashIntensity
 Intensity for flashing the battler (0 to 31 - will decrease until flashing is done)
 
int flashTimer
 Frames left until flashing the battler finished (zero: no flashing active)
 
int shakeStrength
 If the battler is being shaken, the strength of the shake.
 
int shakeSpeed
 If the battler is being shaken, the speed of the shake.
 
int shakeOffsetX
 If the battler is being shaken, the amount of pixels? to shake the battler left/right.
 
int shakeOffsetY
 If the battler is being shaken, the amount of pixels? to shake the battler up/down.
 
int shakeTimer
 Frames left until shaking the battler finished (zero: no shaking active)
 
int turnsTaken
 Turns taken by this battler.
 
ActionType actionType
 Whether the action is short, or long (skill is being cast or item is being used)
 
ActionStatus actionStatus
 Status of the current action.
 
int jobClassId
 The job class ID. -1 if it's the database default.
 
int displayedConditions [5]
 Conditions which will be displayed in the info window (see details)
 

Detailed Description

Used for entities participating in battle, i.e. actors and monsters.

Even though this is the base class of both RPG::Actor and RPG::Monster, some members only apply to one of them.

See also
RPG::Row
RPG::ActionStatus
RPG::Actor
RPG::Monster

Member Function Documentation

◆ damagePopup() [1/2]

void RPG::Battler::damagePopup ( int number,
int color )

Shows a damage popup with a number.

This function will make a number pop up on a battler.

Parameters
numberThe number to show
colorColor to use (0 to 19)
See also
damagePopup(std::string)

◆ damagePopup() [2/2]

void RPG::Battler::damagePopup ( std::string text)

Shows a damage popup with a small text.

This function will make a small text pop up on a battler.

Parameters
textText to show
Note
It is not possible to show string popups with a color other than 0.
See also
damagePopup(int, int)

◆ executeAction()

bool RPG::Battler::executeAction ( bool skipPluginHandlers = false)

Executes the action of a battler (highly experimental!)

This function can be used to execute an action. You need to set the content of the action object before.

Parameters
skipPluginHandlersIf true, no onDoBattlerAction and onBattlerActionDone handlers will be called for this action.
Returns
true if the action was successfully executed, otherwise false (in this case try again next frame)
Warning
This is a highly experimental function! During testing, it has repeatedly caused strange errors and crashes when executed under the wrong conditions or to the wrong time! It's probably not safe to use it for anything else than experiments, to be honest.
See also
RPG::Action

◆ flash()

void RPG::Battler::flash ( int r,
int g,
int b,
int intensity,
int duration )

Flashes a battler in a certain color.

Parameters
rRed value (0 to 31)
gGreen value (0 to 31)
bBlue value (0 to 31)
intensityIntensity of the flash (0 to 33.5)
durationDuration in frames

◆ getAgility()

int RPG::Battler::getAgility ( )

Returns the agility value.

Returns
Agility value

◆ getAttack()

int RPG::Battler::getAttack ( )

Returns the attack value.

Returns
Attack value

◆ getAttackPower()

int RPG::Battler::getAttackPower ( RPG::Battler * target)

Built-in RM2k3 function that returns the strength of an attack (not the final attack value) Rough formula (a lot still not taken into account): if (critical hit) atk*3, else if (charge up) atk*2.

Parameters
targetthe target Battler of the attack
Returns
The damage value (again, not final!)

◆ getAttributeResist()

int RPG::Battler::getAttributeResist ( int id)

Built-in RM2k3 function that returns the actual damage multiplier for when the battler would be hit with a certain attribute (considers the (Elemental) Resistance of equipment (max. one step towards dmgE) and the "Reduce / Increase Resistance" of skill effects)

Parameters
idthe attribute to get the multiplier from
Returns
Damage multiplier in percent

◆ getDefense()

int RPG::Battler::getDefense ( )

Returns the defense value.

Returns
Defense value

◆ getIntelligence()

int RPG::Battler::getIntelligence ( )

Returns the intelligence value.

Returns
Intelligence value

◆ getMaxHp()

int RPG::Battler::getMaxHp ( )

Returns the maximal HP.

Returns
Maximal HP value

◆ getMaxMp()

int RPG::Battler::getMaxMp ( )

Returns the maximal MP.

Returns
Maximal MP value

◆ getName()

std::string RPG::Battler::getName ( )

Returns the name of the actor or monster.

Returns
The name

◆ getSkillPower()

int RPG::Battler::getSkillPower ( int skillId,
RPG::Battler * target )

Built-in RM2k3 function that returns the strength of a skill on a certain target, however, it's before the miss probability based on agility and statuses is calculated.

Parameters
skillIdthe id of the skill
targetthe target Battler of the attack
Returns
The damage value (again, not final!)

◆ isMonster()

bool RPG::Battler::isMonster ( )

Checks whether the battler is a monster or an actor.

Returns
true if the battler is a monster, false if it is an actor

◆ setRow()

void RPG::Battler::setRow ( Row newRow)

Sets the current row.

Parameters
newRowNew row
Note
This function has no visible effect on monsters

Member Data Documentation

◆ animationId

int RPG::Battler::animationId

ID of the battle graphic pose (see details)

This member specifies which battle graphic pose is displayed. Look into the "Animations 2" tab of the database to find out what the different values mean (e.g. 6 means "Taking damage").

Note
This member has no meaning to monsters. The ID of the current battler pose (for Actors)

◆ atbValue

int RPG::Battler::atbValue

Current value of the ATB bar (0 to 300000 - see details)

Internally, the ATB bar can have a value between 0 and 300000 where 0 means empty and 300000 means full. If you set a battler's ATB value to a value greater than or equal to 300000, this will trigger his next action (in case of a monster) or open the action window (in case of an actor).

◆ conditions

DArray<short, 1> RPG::Battler::conditions

Turns elapsed in a certain condition (see details)

This is an array which has as much possible members as there are conditions in the database. The values tell you how many turns the battler has taken while being affected by a certain conditions. If a value is zero, the particular condition does not affect this battler.

For example, if conditions[2] were 4, this battler would have been infected by poison (by default, condition #2 is poison) for 4 turns. If it were zero, the battler would not be poisoned at the moment.

Warning
If you remove all conditions from a hero in battle, make sure that the animationId is not 9, otherwise the RPG Maker will try to show the animation for condition #0 which doesn't exist. This would result in an error stating that an "Event script referenced a condition that does not exist". Use a failsafe like this (0 stands for the idle animation):
if(battler->animationId == 9) battler->animationId = 0;
Map *& map
The current map environment (camera, events, etc.)

◆ displayedConditions

int RPG::Battler::displayedConditions[5]

Conditions which will be displayed in the info window (see details)

At target selection, there will be an info window displayed if the target is affected by a condition. The info has five columns for condition names. This array contains the database IDs of the conditions which are displayed in this window. The content of this array will be reset on several occasions. You can change this array in your onDrawBattleStatusWindow handler.

Note
Conditions in the array are arranged from highest priority (0) to lowest (4).

◆ flashIntensity

double RPG::Battler::flashIntensity

Intensity for flashing the battler (0 to 31 - will decrease until flashing is done)

Note
Values over 31 will cause the palette to go crazy. Of course you can also use this as an intentional effect.

◆ id

int RPG::Battler::id

One-based ID of the battler.

For actors this value is the database ID, for monsters it is the party member ID plus one (e.g. RPG::monsters[3]->id should always be 4).

If you want to get the database ID of a monster, you have to use RPG::Monster::databaseId.


The documentation for this class was generated from the following file: