Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

JSON guide

Cyrielle edited this page Jan 18, 2020 · 14 revisions

The game uses the JSON format to store its data. Here is explained how it works for each object. The fields in italic are optional.

OpMon

The OpMons are stored in opmon.json. Here is an example of the format:

{
    "HP":65,
    "atk":60,
    "atkSpe":30,
    "def":58,
    "defSpe":52,
    "spe":33,
    "evolution":{
      "level":28,
      "species":7,
      "type":"level"
    },
    "evs":[
      6
    ],
    "opDex":4,
    "types":[
      6,
      -1
    ],
    "captureRate":45,
    "curve":1000000,
    "expGiven":93,
    "height":0.5,
    "weight":20.0
}

Warning : the JSON file has been generated automatically the first time, to spare some time. The fields are not in this order, but JSON works anyway, no matter the order. This example has been sorted to make it more understandable.

Field list

  • HP : The HP base stat (Integer)
  • atk : The attack base stat (Integer)
  • atkSpe : The special attack base stat (Integer)
  • def : The defense base stat (Integer)
  • defSpe : The special defense base stat (Integer)
  • spe : The Speed base stat (Integer)
  • evolution : Evolution data (Evolution)
  • evs : The given EVs when the OpMon is defeated (Array of stats)
  • opDex : The OpDex number of the OpMon. It determines the OpMon's name too, searches in the key opmon.name.X where X is the opDex value. If you want to add an OpMon, don't forget to add its name in the keys files. (Integer)
  • types : The two types of the OpMon (Two types in an array)
  • captureRate : The OpMon's capture rate. If it's low, the OpMon will be hard to capture, and vice versa (Integer)
  • curve : The EXP the OpMon will have at level 100 (Standard max EXP)
  • expGiven : The base EXP the OpMon will give when defeated (Integer)
  • height : The OpMon's height (Floating)
  • weight : The OpMon's weight (Floating)

Attacks

Warning: Attacks is a translation of "Attaques" in french, which is the official translation for the Pokémon "moves". The term "Attack" will soon be changed for "Move".

The moves are stored in attacks.json. Here is an example of the format:

 {
     "id" : "Tackle",
     "power" : 50,
     "type" : 9,
     "accuracy" : 100,
     "special" : false,
     "status" : false,
     "criticalRate" : 16,
     "neverFails" : false,
     "ppMax" : 35,
     "priority" : 0,
     "effects" : [
         {
             "null" : true
         },
         {
             "null" : true
         },
         {
             "null" : true
         }
     ],
     "animationOrder" : [18],
     "opMovementsAtk" : [
         {
             "translation" : {
                 "mode" : [ 1, 1 ],
                 "formulas" : [ [ 3, -6, 1, -5, 0, 30 ], [ 3, 6, 1, -5, 0, -30 ] ]
             },
             "time" : 10
         }
     ],
     "opMovementsDef" : [
         {
             "translation" : {
                 "mode" : [ 1, 1 ],
                 "formulas" : [ [ 3, 6, 1, -5, 0, -30 ], [ 3, -6, 1, -5, 0, 30 ] ]
             },
             "time" : 10
         }

     ],
     "animations" : ["default"]
 },

Field list

  • id : The identifier of the move. It is used to identify it in the code, but also to get its name in the different languages. (String)
  • power : The power of the move (Integer)
  • type : The type of the attack (Type)
  • accuracy : The accuracy of the move (Integer)
  • special : true if it's a special move, false otherwise (Boolean)
  • status : true if it's a status move (If it doesn't directly damages the opponent), false otherwise (Boolean)
  • criticalRate : The odds of getting a critical hit (1 out of the input) (Integer)
  • neverFails : true if the move never fails (Boolean)
  • ppMax : The maximum PP of the move (Integer)
  • priority : The level of priority of the move (Integer)
  • effects : An array of 3 effects. Respectively the effect before the damages, the effect after the damages, and the effect if the move fails. (Effect)
  • animationOrder : The order in which the animations will occur (TurnActionType)
  • opMovementsAtk : An array of sprite animations for the player's OpMon using the move. (Array of Sprite animations)
  • opMovementsDef : An array of sprite animations for the opponent's OpMon using the move. (Array of Sprite animations)
  • animations : An array of strings identifying the different screen animations present in the code (Screen animation)

Special

Evolution

There is several types of evolutions. Every Evolution has the "type" field, which can be filled with the type name.

Type : "no"

"evolution":{
      "level":-1,
      "species":-1,
      "type":"no"
}

The type "no" means no evolution. "level" and "species" must stay to -1.

Type : "level"

"evolution":{
      "level":28,
      "species":7,
      "type":"level"
}
  • level : The level at which the OpMon evolves (Number)
  • species : The opDex number of the species in which the OpMon evolves (Number)

Stats

Each stat is associated to a number, according to the enumeration in src/opmon/model/objects/Enums.hpp :

enum class Stats : int {
            ATK = 6,
            DEF = 1,
            ATKSPE = 2,
            DEFSPE = 3,
            SPE = 4,
            HP = 5,
            ACC = 7,
            EVA = 8,
            NOTHING = 0
};

There isn't EVs for accuracy, evasion and nothing, so putting these values will result in an undefined behavior.

Types

Each type is associated to a number, according to the enumeration in src/opmon/model/objects/Enums.hpp

enum class Type : int {
            LIQUID = 3,
            BURNING = 6,
            VEGETAL = 10,
            ELECTRON = 4,
            MENTAL = 12,
            BAD = 16,
            DRAGON = 2,
            FIGHT = 1,
            MINERAL = 13,
            GROUND = 14,
            NEUTRAL = 9,
            MAGIC = 5,
            GHOST = 15,
            TOXIC = 11,
            METAL = 0,
            BUG = 8,
            SKY = 17,
            COLD = 7,
            NOTHING = -1
};

Nothing isn't really a type, so putting this value will result in an undefined behavior.

Standard max EXP

There is different possible values for max EXP, each one corresponding to a different curve of EXP (Bulbapedia link).

  • 800,000 : Quick EXP curve
  • 1,000,000 : Normal EXP curve
  • 1,059,860 : Parabolic EXP curve
  • 1,250,000 : Slow EXP curve
  • 600,000 : Erratic EXP curve
  • 1,640,000 : Fluctuating EXP curve If some another value is entered, the default curve will be the normal one.

Effect

Exemple of effect

{
"null" : false,
"type" : "ChangeStatEffect",
"data" : {
    "target" : 1,
    "stat" : 6,
    "coef" : -1
}
}

Represents an effect present in the code. If "null" is true, the code ignores the object and assumes there is no effect. Else, there can be different types of effects that must be present into the code, identified by "type". Each effect takes different arguments in "data".

Current list of effects :

ChangeStatEffect

  • target : The target of the effect change. If 0, the target is OpMon using the move. If 1, it is the OpMon taking the move. (Integer)
  • stat : The stat modified by the effect (Stat)
  • coef : The coefficient of modification of the stat. It can be from -6 (The stat decreases 6 times) to 6 (The stat increases 6 times). (Integer between -6 and 6)

TurnActionType

The enumeration TurnActionType contains a lot of things in the code. Normally, for the animations, you'll only have to use two:

enum class TurnActionType : unsigned int {
[...]
ANIMATION = 17,
OPANIM = 18,
[...]
};

Note: If you want to break the game and use others, see Turn.hpp

  • ANIMATION: A screen animation will be played.
  • OPANIM: A sprite animation will be played. The animations are taken from first to last initialized in the JSON file. Exemple (The texts between parenthesis are comments, [...] replaces some code describing animations):
"opMovementAtk" : [
{[...]}, (OpAnim 1)
{[...]}, (OpAnim 2)
{[...]}, (OpAnim 3)
],
"opMovementDef" : [[...]], (The same number of animations here)
"animations" : ["sanim1","sanim2"]

In this exemple, if "animationOrder" : [18, 17, 18, 17, 18], the order of animations will be OpAnim 1 - sanim1 - OpAnim 2 - sanim2 - OpAnim 3. Warning: Putting more values in "animationOrder" than the number of animations will result in an undefined behavior.

Clone this wiki locally