User Tools

Site Tools


code:pawn

Pawn

A pawns is an entity that can fight into an arena (player, sidekick, enemies, etc). It is a resource and must be placed in the Resource folder.

It contains several scripts:

PawnBehavior

The pawn behavior is the main script of every pawn as it is the one containing an update method. All the other scripts only contains data.

Properties

  • CharacterId : only used for pawns controlled by the player. It is a unique id that must be set. It can be ignored for pawn controlled by AI.
  • State : This is the initial state for the pawn. Usually it is “Idle”.
  • Attack Description : The attack to execute when the “Attack” option is chosen for the pawn. This is a description in a statistics point of view. The animations and effects to play are decided by the Pawn Action script.
  • Attack Anchor Radius : This is the radius of a imaginary sphere containg the mesh. It is used to compute the displacmeent of a pawn when doing a close range attack so two pawns never penetrate each other.
  • Animation State : For each state, you must specify an animation to play with an animation trigger and an animation state name. This means that the pawn as to have a Animator with a animation graph. If no animation is necessary for a given state, leave blank.

PawnStatistics

This scripts contains the statistics of the pawn used to compute the damages of attacks and the defense when being attacked.

Properties

  • Pawn Name : Move to pawn UI. This is the name of the pawn as shown in the enemy list and pawn state UI.
  • Atk : Attack points used to compute damages.
  • Def : Defense points used to compute damages.
  • Max HP : Maximum health points.
  • HP : Current health points.
  • Max MP : Maximum magic points.
  • MP : Current magic points.
  • MGAtk : Magic attack points to compute damages of magic attack.
  • MGDef : Magic defense points used to compute the damages of magic attack.
  • Priority : Priority in turn history.
  • Priority Increase : How much the priority increase very turn.
  • Is Controlled By Player : Flag indicating if this pawn has to be controlled by the player or the AI.
  • Equipped Weapon : The weapon currently equipped.

Formula

To compute the damages done with a physical attack :
DMG = (Atk * DamageFactor) + (WAtk + Ran(-WAtkR, WAtkR)) - Def
with:

  • Atk : Atk of the offensive pawn
  • DamageFactor : Damage Factor of the offensive pawn's physical attack.
  • WAtk : Weapon Atk
  • WAtkR : Critical of the weapon
  • Def : Def of the defensive pawn.

Pawn UI

Contains the ui information. Not much for now since it only contains a sprite to show in the turn history.

Pawn Actions

Stores the descriptions of all the actions available during a fight. This is where you choose what animations to play to move, how much to move, etc. This is a visual description of the actions.

  • Default Attack : This is the description for the default physical attack.
  • Default Magic : This is the description for the default magic attack.
  • Default Item : This is the description for the default item use.
  • Override Magic : For all magic attack, the default magic description will be used. If you need a specific description for a given magic, this is where you add it.

The descriptions are Action Runner. They contain information about what the pawn has to do in order to make an action. This is only visual. It does not involve anything about the statistics of an attack or the consequence of using an item. Action Runner contains :

  • Anim Trig Run State : Name of the trigger to start an run animation.
  • Anim Trig Attack State : Name of the trigger to start the attack animation.
  • Anim State Attack Name : Name of the state of the attack animation.
  • Speed : Speed of the pawn when it is running.
  • Attack Distance : Distance form the enemy. The pawn will run to the enemy until he is “Attack Distance” unit away from the enemy and then start the attack animation. To compute the exact distance, you need to take into account the PawnBehavior.AttackAnchorRadius. So in the end, the real distance between two pawns P1 and P2 is their initial distance minus the Attack Distance minus both attack anchor radius.

TODO

Some reorganizations of all those information could be done:

  • In Pawn Statistics IsControlledByPlayer should be private. The game should decide what pawns are playable or not.
code/pawn.txt · Last modified: 2015/09/06 11:59 by 82.247.193.95