In-code to json convert - Only for Endru and Alexander

Post Reply
Stratego (dev)
Site Admin
Posts: 13144
Joined: Fri Apr 25, 2014 9:28 pm

In-code to json convert - Only for Endru and Alexander

Post by Stratego (dev) » Sat Apr 18, 2020 5:39 am

for Alexander's and Endru's eyes only (as only in AOS/AOF we have/had in coded units)

0. "trn" values in json
Some numerical attribute names can have a "trn" pairs that is a "string" representation of eg. a unit type id, it is only for better readibility of json
eg:
in code "requires" array of integers is addressed "trnRequires" array of strings in json.


1. In-code Effect to effect json
use this help on converting an effect to an effect json




The effect definition part:

// ed = Game.consts.new EffectDef(EFFECT_CAST_POISON_WEAPON, R.string.EFFECT_CAST_POISON_WEAPON, //first goes to effectNameString, second is not needed in json
// Unit.NO_UNIT, Unit.NO_UNIT, //first is trnActionUnitID second is trnActionUnitIDForCaster
// 0, //button texture
// PreparedSpritesLoader.SPRITE_SPELL_ACTION_POISONED_WEAPON, //projectile sprite
// PreparedTexturesLoader.TEXTURE_SPELL_ACTION_POISONED_WEAPON, //action texture
// 1f, 0, //first is chancePercent second is lastsTurnNr
// EeffectBehaviours.EFFECT_SPELL, //goes to effectBehaviour
// EeffectTargets.HIMSELF, //goes to effectTargets
// EFFECT_ENCHANT_POISONED_WEAPON, //goes to trnEffectDefIDRelated
// 0 //spell range modifier
// );
// ed.cooldownTurnNr = 6; //goes to cooldownTurnNr
// ed.requires = new ArrayList<Integer>();
// ed.requires.add(//"type"-s that is required (eg. other techonolgies) to have/build this one
// Units.TECH_ORC_POISONED_WEAPONS //goes to trnRequires
// );

The priority part:
Const.setPri(EFFECT_CAST_POISON_WEAPON, 200); // this goes to priority

The unit id part:
public static final int EFFECT_CAST_POISON_WEAPON = 150; // this goes to effectDefID

User avatar
Alexander82
Posts: 7969
Joined: Thu Feb 26, 2015 8:18 pm

Re: In-code to json convert - Only for Endru and Alexander

Post by Alexander82 » Sat Apr 18, 2020 9:59 am

thanks!
Age of Fantasy design leader

Post Reply

Return to “Unit Design”