Class in reactor_objects_battlers.js

Game_Enemy

54 functions in 5 groups · hide internal

Actors and their stats.

Familiar territory. Game_Enemy keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.

Quick Reference

Setup & Creation 5

initialize() Sets up a new instance.
initMembers() Initializes the members.
setup() Setup.
makeDropItems() Makes the drop items.
makeActions() Makes the actions.

Getting Information 6

index() Index.
paramPlus() The param plus value.
paramBase() The param base value.
maxTp() Max TP is per-enemy rather than the flat 100 every battler used to get.
itemObject() Item object.
name() Name.

Checks (True / False) 5

isEnemy() Whether it is enemy.
isBattleMember() Whether it is battle member.
isSpriteVisible() Whether it is sprite visible.
isLetterEmpty() Whether it is letter empty.
isActionValid() Whether it is action valid.

Actions 13

equipSlots() Equip slots.
changeEquip() Puts item (a weapon or armor of the slot's type, or null to empty it) in a slot.
dropItemRate() Drop item rate.
setLetter() Sets the letter.
setPlural() Sets the plural.
performActionStart() Plays the action start effect.
performAction() Plays the action effect.
performActionEnd() Plays the action end effect.
performDamage() Plays the damage effect.
playCollapseSe() Play this enemy's collapse sound: the one chosen beside its Collapse Effect in the editor, or the engine's ow…
performCollapse() Plays the collapse effect.
selectAction() Selects the action.
selectAllActions() Selects the all actions.

Other 25

rrRoll() The database's ranges (Enemies: Stat Variance %, an EXP or Gold maximum), rolled once per enemy and kept, so…
rrEquipOn() Enemy equipment (Database > Enemies > Equipment...), off unless Database > Reactor Features turns it on.
rrEquipSource() Where an enemy's rows come from the first time they are read: the rows authored on its database entry, or its…
rrEquipRows() Rr equip rows.
rrEquipItem() A row's item, or null when the row is empty, the entry no longer exists, or the entry is no longer of the slo…
equips() One entry per slot, null where the slot is empty, as Game_Actor.equips.
weapons() Weapons.
armors() Armors.
rrWeaponAnimationId() The animation an equipped weapon gives this enemy's attack, or 0.
friendsUnit() Friends unit.
opponentsUnit() Opponents unit.
enemyId() Enemy id.
enemy() Enemy.
traitObjects() Trait objects.
exp() Exp.
gold() Gold.
rrDropCount() How many of a drop fall: the database's quantity range (rrQtyMin to rrQtyMax on the drop slot), or the 1 RPG…
screenX() Screen x.
screenY() Screen y.
battlerName() Battler name.
battlerHue() Battler hue.
originalName() Original name.
transform() Transform.
meetsCondition() Meets condition.
rrActionPatterns() The action patterns this enemy chooses from: the ones authored on its database entry.

Setup & Creation

initialize

method source
Game_Enemy.prototype.initialize(enemyId, x, y)

Sets up a new instance. (Same as the RPG Maker MZ method of this name.)

initMembers

method source
Game_Enemy.prototype.initMembers()

Initializes the members. (Same as the RPG Maker MZ method of this name.)

setup

method source
Game_Enemy.prototype.setup(enemyId, x, y)

Setup. (Same as the RPG Maker MZ method of this name.)

makeDropItems

method source
Game_Enemy.prototype.makeDropItems()

Makes the drop items. (Same as the RPG Maker MZ method of this name.)

makeActions

method source
Game_Enemy.prototype.makeActions()

Makes the actions. (Same as the RPG Maker MZ method of this name.)

Getting Information

index

method source
Game_Enemy.prototype.index()

Index. (Same as the RPG Maker MZ method of this name.)

paramPlus

method source
Game_Enemy.prototype.paramPlus(paramId)

The param plus value. (Same as the RPG Maker MZ method of this name.)

paramBase

method source
Game_Enemy.prototype.paramBase(paramId)

The param base value. (Same as the RPG Maker MZ method of this name.)

maxTp

method source
Game_Enemy.prototype.maxTp()

Max TP is per-enemy rather than the flat 100 every battler used to get.

Details

Max TP is per-enemy rather than the flat 100 every battler used to get. It is not part of params -- that array is indexed by paramId and has exactly eight entries -- so it sits beside exp and gold as its own field, and an enemy that has never been given one is left to whatever Game_BattlerBase.prototype.maxTp says, which is the 100 it always was. That fallback is looked up rather than inlined so a plugin that replaces maxTp still governs every enemy the database has not spoken for.

itemObject

method source
Game_Enemy.prototype.itemObject(kind, dataId)

Item object. (Same as the RPG Maker MZ method of this name.)

name

method source
Game_Enemy.prototype.name()

Name. (Same as the RPG Maker MZ method of this name.)

Checks (True / False)

isEnemy

method source
Game_Enemy.prototype.isEnemy()

Whether it is enemy. (Same as the RPG Maker MZ method of this name.)

isBattleMember

method source
Game_Enemy.prototype.isBattleMember()

Whether it is battle member. (Same as the RPG Maker MZ method of this name.)

isSpriteVisible

method source
Game_Enemy.prototype.isSpriteVisible()

Whether it is sprite visible. (Same as the RPG Maker MZ method of this name.)

isLetterEmpty

method source
Game_Enemy.prototype.isLetterEmpty()

Whether it is letter empty. (Same as the RPG Maker MZ method of this name.)

isActionValid

method source
Game_Enemy.prototype.isActionValid(action)

Whether it is action valid. (Same as the RPG Maker MZ method of this name.)

Actions

equipSlots

method source
Game_Enemy.prototype.equipSlots()

Equip slots. (Same as the RPG Maker MZ method of this name.)

changeEquip

method source
Game_Enemy.prototype.changeEquip(slotIndex, item)

Puts item (a weapon or armor of the slot's type, or null to empty it) in a slot.

Details

Puts item (a weapon or armor of the slot's type, or null to empty it) in a slot. Nothing moves to or from the party's inventory. Refreshing clamps HP and MP to the new maximums without healing or reviving. Returns whether the slot changed hands; anything invalid leaves the enemy as it was.

dropItemRate

method source
Game_Enemy.prototype.dropItemRate()

Drop item rate. (Same as the RPG Maker MZ method of this name.)

setLetter

method source
Game_Enemy.prototype.setLetter(letter)

Sets the letter. (Same as the RPG Maker MZ method of this name.)

setPlural

method source
Game_Enemy.prototype.setPlural(plural)

Sets the plural. (Same as the RPG Maker MZ method of this name.)

performActionStart

method source
Game_Enemy.prototype.performActionStart(action)

Plays the action start effect. (Same as the RPG Maker MZ method of this name.)

performAction

method source
Game_Enemy.prototype.performAction(action)

Plays the action effect. (Same as the RPG Maker MZ method of this name.)

performActionEnd

method source
Game_Enemy.prototype.performActionEnd()

Plays the action end effect. (Same as the RPG Maker MZ method of this name.)

performDamage

method source
Game_Enemy.prototype.performDamage()

Plays the damage effect. (Same as the RPG Maker MZ method of this name.)

playCollapseSe

method source
Game_Enemy.prototype.playCollapseSe(fallback)

Play this enemy's collapse sound: the one chosen beside its Collapse Effect in the editor, or the engine's own.

Details

Play this enemy's collapse sound: the one chosen beside its Collapse Effect in the editor, or the engine's own.

The choice lives in BattlePresentation.json under enemies[id].collapseSe, beside the other per-enemy presentation settings, because a trait is three numbers and has nowhere to keep a filename. A chosen sound is played for every collapse kind, Instant included, which has none of its own.

@param
fallback ?Function The engine's sound for this kind, if any.

performCollapse

method source
Game_Enemy.prototype.performCollapse()

Plays the collapse effect. (Same as the RPG Maker MZ method of this name.)

selectAction

method source
Game_Enemy.prototype.selectAction(actionList, ratingZero)

Selects the action. (Same as the RPG Maker MZ method of this name.)

selectAllActions

method source
Game_Enemy.prototype.selectAllActions(actionList)

Selects the all actions. (Same as the RPG Maker MZ method of this name.)

Other

rrRoll

method source
Game_Enemy.prototype.rrRoll()

The database's ranges (Enemies: Stat Variance %, an EXP or Gold maximum), rolled once per enemy and kept, so its stats hold still through the battle.

Details

The database's ranges (Enemies: Stat Variance %, an EXP or Gold maximum), rolled once per enemy and kept, so its stats hold still through the battle. Rolled again when the enemy becomes another one (Transform). An enemy with none of these fields gets null and behaves exactly as in RPG Maker MZ, as does every enemy while Database > Reactor Features has Enemy Ranges off.

rrEquipOn

method source
Game_Enemy.prototype.rrEquipOn()

Enemy equipment (Database > Enemies > Equipment...), off unless Database > Reactor Features turns it on.

Details

Enemy equipment (Database > Enemies > Equipment...), off unless Database > Reactor Features turns it on. Each enemy keeps a plain copy of its authored rows, tagged with the enemy it was read from: a change made in battle stays on this one enemy and is saved with it, a Transform to another enemy reads that enemy's rows, and an enemy from an older save reads its rows on first use. Off, every enemy has an empty list and the authored rows stay unread. An enemy with no authored list has one empty slot per equipment type.

rrEquipSource

method source
Game_Enemy.prototype.rrEquipSource()

Where an enemy's rows come from the first time they are read: the rows authored on its database entry, or its default slots when it has none.

Details

Where an enemy's rows come from the first time they are read: the rows authored on its database entry, or its default slots when it has none. A plugin that equips enemies from somewhere else replaces this one method and returns { etypeId, kind, itemId } rows; rrEquipRows copies them, so the list returned here is never changed.

rrEquipRows

method source
Game_Enemy.prototype.rrEquipRows()

Rr equip rows. (Same as the RPG Maker MZ method of this name.)

rrEquipItem

method source
Game_Enemy.prototype.rrEquipItem(row)

A row's item, or null when the row is empty, the entry no longer exists, or the entry is no longer of the slot's equipment type.

equips

method source
Game_Enemy.prototype.equips()

One entry per slot, null where the slot is empty, as Game_Actor.equips.

weapons

method source
Game_Enemy.prototype.weapons()

Weapons. (Same as the RPG Maker MZ method of this name.)

armors

method source
Game_Enemy.prototype.armors()

Armors. (Same as the RPG Maker MZ method of this name.)

rrWeaponAnimationId

method source
Game_Enemy.prototype.rrWeaponAnimationId()

The animation an equipped weapon gives this enemy's attack, or 0.

Details

The animation an equipped weapon gives this enemy's attack, or 0. A plugin with its own idea of an enemy's attack animation replaces this.

friendsUnit

method source
Game_Enemy.prototype.friendsUnit()

Friends unit. (Same as the RPG Maker MZ method of this name.)

opponentsUnit

method source
Game_Enemy.prototype.opponentsUnit()

Opponents unit. (Same as the RPG Maker MZ method of this name.)

enemyId

method source
Game_Enemy.prototype.enemyId()

Enemy id. (Same as the RPG Maker MZ method of this name.)

enemy

method source
Game_Enemy.prototype.enemy()

Enemy. (Same as the RPG Maker MZ method of this name.)

traitObjects

method source
Game_Enemy.prototype.traitObjects()

Trait objects. (Same as the RPG Maker MZ method of this name.)

exp

method source
Game_Enemy.prototype.exp()

Exp. (Same as the RPG Maker MZ method of this name.)

gold

method source
Game_Enemy.prototype.gold()

Gold. (Same as the RPG Maker MZ method of this name.)

rrDropCount

method source
Game_Enemy.prototype.rrDropCount(di)

How many of a drop fall: the database's quantity range (rrQtyMin to rrQtyMax on the drop slot), or the 1 RPG Maker MZ always drops (also with Enemy Ranges off in Database > Reactor Features).

screenX

method source
Game_Enemy.prototype.screenX()

Screen x. (Same as the RPG Maker MZ method of this name.)

screenY

method source
Game_Enemy.prototype.screenY()

Screen y. (Same as the RPG Maker MZ method of this name.)

battlerName

method source
Game_Enemy.prototype.battlerName()

Battler name. (Same as the RPG Maker MZ method of this name.)

battlerHue

method source
Game_Enemy.prototype.battlerHue()

Battler hue. (Same as the RPG Maker MZ method of this name.)

originalName

method source
Game_Enemy.prototype.originalName()

Original name. (Same as the RPG Maker MZ method of this name.)

transform

method source
Game_Enemy.prototype.transform(enemyId)

Transform. (Same as the RPG Maker MZ method of this name.)

meetsCondition

method source
Game_Enemy.prototype.meetsCondition(action)

Meets condition. (Same as the RPG Maker MZ method of this name.)

rrActionPatterns

method source
Game_Enemy.prototype.rrActionPatterns()

The action patterns this enemy chooses from: the ones authored on its database entry.

Details

The action patterns this enemy chooses from: the ones authored on its database entry. Every battle mode reads them through here, so a plugin that gives an enemy other patterns replaces this one method. Return a list of { skillId, rating, conditionType, conditionParam1, conditionParam2 } and leave the database entry's own list as it is.