# RPG::Enemy

## Superclass

* [Object](/rgss-reference-manual/standard-library/built-in-classes/object.md)

## Attributes

### id

The enemy ID.

### name

The enemy name.

### battler\_name

The enemy's battler graphic file name.

### battler\_hue

The adjustment value for the battler graphic's hue (0..360).

### maxhp

The enemy's max HP.

### maxsp

The enemy's max SP.

### str

The enemy's strength.

### dex

The enemy's dexterity.

### agi

The enemy's agility.

### int

The enemy's intelligence.

### atk

The enemy's attack power.

### pdef

The enemy's physical defense rating.

### mdef

The enemy's magic defense rating.

### eva

The enemy's evasion rating.

### animation1\_id

The battle animation ID.

### animation2\_id

The target animation ID.

### element\_ranks

Level of elemental effectiveness. 1-dimensional array using element IDs as subscripts ([Table](/rgss-reference-manual/game-library/rgss-built-in-classes/table.md)), with 6 levels (0: A, 1: B, 2: C, 3: D, 4: E, 5: F).

### state\_ranks

Level of status effectiveness. 1-dimensional array using status IDs as subscripts ([Table](/rgss-reference-manual/game-library/rgss-built-in-classes/table.md)), with 6 levels (0: A, 1: B, 2: C, 3: D, 4: E, 5: F).

### actions

The enemy's actions. An [RPG::Enemy::Action](/rgss-reference-manual/game-library/rpgxp-data-structures/rpg-enemy-action.md) array.

### exp

The enemy's experience.

### gold

The enemy's gold.

### item\_id

The ID of the item used as treasure.

### weapon\_id

The ID of the weapon used as treasure.

### armor\_id

The ID of the armor used as treasure.

### treasure\_prob

The probability of treasure being left behind.

## Inner Class

* [RPG::Enemy::Action](/rgss-reference-manual/game-library/rpgxp-data-structures/rpg-enemy-action.md)

## Definition

```ruby
module RPG
  class Enemy
    def initialize
      @id = 0
      @name = ""
      @battler_name = ""
      @battler_hue = 0
      @maxhp = 500
      @maxsp = 500
      @str = 50
      @dex = 50
      @agi = 50
      @int = 50
      @atk = 100
      @pdef = 100
      @mdef = 100
      @eva = 0
      @animation1_id = 0
      @animation2_id = 0
      @element_ranks = Table.new(1)
      @state_ranks = Table.new(1)
      @actions = [RPG::Enemy::Action.new]
      @exp = 0
      @gold = 0
      @item_id = 0
      @weapon_id = 0
      @armor_id = 0
      @treasure_prob = 100
    end
    attr_accessor :id
    attr_accessor :name
    attr_accessor :battler_name
    attr_accessor :battler_hue
    attr_accessor :maxhp
    attr_accessor :maxsp
    attr_accessor :str
    attr_accessor :dex
    attr_accessor :agi
    attr_accessor :int
    attr_accessor :atk
    attr_accessor :pdef
    attr_accessor :mdef
    attr_accessor :eva
    attr_accessor :animation1_id
    attr_accessor :animation2_id
    attr_accessor :element_ranks
    attr_accessor :state_ranks
    attr_accessor :actions
    attr_accessor :exp
    attr_accessor :gold
    attr_accessor :item_id
    attr_accessor :weapon_id
    attr_accessor :armor_id
    attr_accessor :treasure_prob
  end
end
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://enls.gitbook.io/rgss-reference-manual/game-library/rpgxp-data-structures/rpg-enemy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
