Class: SceneBattle

SceneBattle

A scene for battling

new SceneBattle (troopID, canGameOver, canEscape, battleMap, transitionStart, transitionEnd, transitionStartColor, transitionEndColor)

Name Type Description
troopID number Current troop ID that the allies are fighting
canGameOver boolean Indicate if there is a win/lose node or not
canEscape boolean Indicate if the player can escape this battle
battleMap SystemBattleMap The system battle map
transitionStart MapTransitionKind The kind of transition for the battle start
transitionEnd MapTransitionKind The kind of transition for the battle end
transitionStartColor SystemColor The system color for start transition
transitionEndColor SystemColor The system color for end transition
Properties:
Name Type Argument Default Description
SceneBattle.TRANSITION_ZOOM_TIME number <optional>
500 The time in milliseconds for zooming in transition
SceneBattle.TRANSITION_COLOR_VALUE number <optional>
0.1 The color value for transition
SceneBattle.TRANSITION_COLOR_END_WAIT number <optional>
600 The transition color to wait at the end
SceneBattle.TIME_END_WAIT number <optional>
1000 The time in milliseconds to wait at the end of the battle
SceneBattle.TIME_PROGRESSION_XP number <optional>
3000 The time in milliseconds for progression xp
SceneBattle.TIME_LINEAR_MUSIC_END number <optional>
500 The linear music end time in milliseconds
SceneBattle.TIME_LINEAR_MUSIC_START number <optional>
500 The linear music start time in milliseconds
SceneBattle.TIME_ACTION_ANIMATION number <optional>
2000 The time in milliseconds for action animation
SceneBattle.CAMERA_TICK number <optional>
0.05 The camera tick
SceneBattle.CAMERA_OFFSET number <optional>
3 The camera small move offset in pixels
SceneBattle.START_CAMERA_DISTANCE number <optional>
10 The start camera distance
SceneBattle.WINDOW_PROFILE_WIDTH number <optional>
300 The window profile width
SceneBattle.WINDOW_PROFILE_HEIGHT number <optional>
100 The window profile height
SceneBattle.COMMANDS_NUMBER number <optional>
6 The max commands number
SceneBattle.WINDOW_COMMANDS_WIDTH number <optional>
150 The window commands width
SceneBattle.WINDOW_COMMANDS_SELECT_X number <optional>
25 The window commands select x
SceneBattle.WINDOW_COMMANDS_SELECT_Y number <optional>
100 The window commands select y
SceneBattle.WINDOW_COMMANDS_SELECT_WIDTH number <optional>
200 The window commands select width
SceneBattle.WINDOW_DESCRIPTIONS_X number <optional>
385 The window descriptions x
SceneBattle.WINDOW_DESCRIPTIONS_Y number <optional>
100 The window descriptions y
SceneBattle.WINDOW_DESCRIPTIONS_WIDTH number <optional>
360 The window descriptions width
SceneBattle.WINDOW_DESCRIPTIONS_HEIGHT number <optional>
200 The window descriptions height
SceneBattle.WINDOW_EXPERIENCE_X number <optional>
10 The window experience x
SceneBattle.WINDOW_EXPERIENCE_Y number <optional>
80 The window experience y
SceneBattle.WINDOW_EXPERIENCE_WIDTH number <optional>
300 The window experience width
SceneBattle.WINDOW_EXPERIENCE_HEIGHT number <optional>
90 The window experience height
SceneBattle.WINDOW_STATS_X number <optional>
250 The window stats x
SceneBattle.WINDOW_STATS_Y number <optional>
90 The window stats y
SceneBattle.WINDOW_STATS_WIDTH number <optional>
380 The window stats width
SceneBattle.WINDOW_STATS_HEIGHT number <optional>
200 The window stats height
troopID number Current troop ID that the allies are fighting
canGameOver boolean Indicate if there is a win/lose node or not
canEscape boolean Indicate if the player can escape this battle
transitionStart MapTransitionKind The kind of transition for the battle start
transitionEnd MapTransitionKind The kind of transition for the battle end
transitionStartColor SystemColor The system color for start transition
transitionEndColor SystemColor The system color for end transition
transitionColor boolean Indicate if the transition is by color
transitionColorAlpha number The alpha transition color value
step number Main step of the battle
subStep number Sub step of the battle (used for menus or other sub-steps)
sceneMap SceneMap The scene map where the battle was run
sceneMapCameraDistance number The scene map camera distance
actionDoNothing SystemMonsterAction A system monster action reprensenting action doing nothing
cameraStep number The camera step (for moving)
cameraTick number The camera tick
cameraOffset number The camera offset
cameraON boolean Indicate if the transition is camera zoom
cameraDistance number The camera distance
transitionZoom boolean Indicate when to zoom in or out
loadingStep boolean Indicate if there is a loading step
winning boolean Indicate if the battle is won
kindSelection CharacterKind Indicating which group is currently selected
selectedUserIndex number Index of the selected user
selectedTargetIndex number Index of the selected target
battleCommandKind EffectSpecialActionKind The current battle command kind
targets Array.<Battler> List of all the current targets
damages Array.<any> Informations about damages
battlers Array.<Array.<Battler>> Battlers of all the allies / enemies
graphicPlayers Array.<Object> The graphics used for user and target(s)
time number A chronometer for several steps of battle
turn number The turn number
windowTopInformations WindowBox The window on top that shows specific informations
windowUserInformations WindowBox The window on bot that shows user characteristics informations
windowTargetInformations WindowBox The window on bot that shows target characteristics informations
windowChoicesBattleCommands WindowChoices The window for battle commands
windowChoicesSkills WindowChoices The window choices for skills
windowSkillDescription WindowBox The window description for selected skill
windowChoicesItems WindowChoices The window choices for items
windowItemDescription WindowBox The window description for selected item
windowExperienceProgression WindowBox The window experience progression
windowStatisticProgression WindowBox The window statistic progression
attackingGroup CharacterKind Indicating which group is currently attacking
userTarget boolean Indicate if the user is a target
all boolean Indicate if the targets are all the enemies
listSkills Array.<GraphicSkill> The graphics list for each skill
listItems Array.<GraphicItem> The graphics list for each item
transitionEnded boolean Indicate if the transition ended
effects Array.<SystemEffect> The current weapon / skill system effects
frameUser number The frame user
frameTarget number The frame target
userAnimation SystemAnimation The system animation for user
targetAnimation SystemAnimation The system animation for target
user Battler The user battler
currentEffectIndex number The current effect index
timeEnemyAttack number A chronometer for enemy attack
action SystemMonsterAction The current system action
attackSkill SystemSkill The system skill
finishedXP boolean Indicate if the xp progression is finished
priorityIndex number The priority index
windowLoots WindowBox The window box for loots
xp number The total xp
currencies Object The total currencies
loots Array.<Object> The total loots
lootsNumber number The total loots number
graphicRewardTop GraphicRewardsTop The graphic reward on top

Extends

Methods

initializeStep0 ()

Initialize step

initializeAlliesBattlers ()

Initialize allies battlers

initializeEnemiesBattlers ()

Initialize enemies battlers

initializeInformations ()

Initialize informations (boxes)

initializeWindowCommands ()

Initialize window commands

initializeWindowsEnd ()

Initialize windows end

initializeMusics ()

Initialize musics

updateStep0 ()

Update the battle

updateTransitionStartFade ()

Update transtion start fade

updateTransitionStartZoom ()

Update transition start zoom

onKeyPressedStep0 (key)

Handle key pressed
Name Type Description
key number The key ID

onKeyReleasedStep0 (key)

Handle key released
Name Type Description
key number The key ID

onKeyPressedRepeatStep0 (key)

Handle key repeat pressed
Name Type Description
key number The key ID

onKeyPressedAndRepeatStep0 (key)

Handle key pressed and repeat
Name Type Description
key number The key ID

drawHUDStep0 ()

Draw the battle HUD

initializeStep1 ()

Initialize step

registerLastCommandIndex ()

Register the last command index and offset in the user

registerLastSkillIndex ()

Register the laster skill index and offset in the user

registerLastItemIndex ()

Register the last item index and offset in the user

selectTarget (targetKind)

Select a target
Name Type Description
targetKind TargetKind The target kind

selectFirstIndex (kind, index)

Select the first index according to target kind
Name Type Description
kind TargetKind The target kind
index number The index (last registered)

indexArrowUp ()number

Get the index of the array after going up
Returns:
Type Description
number

indexArrowDown ()number

Get the index of the array after going down
Returns:
Type Description
number

moveArrow ()

Move the arrow

selectedUserTargetIndex ()number

Get the index of the target
Returns:
Type Description
number

onAllySelected ()

When an ally is selected

onAllyUnselected ()

When an ally is unselected

onCommandSelected (key)

When a command is selected
Name Type Description
key number The key pressed ID

onTargetsSelected ()

When targets are selected

onTargetsUnselected ()

When targets are unselected

updateStep1 ()

Update the battle

onKeyPressedStep1 (key)

Handle key pressed
Name Type Description
key number The key ID

onKeyReleasedStep1 (key)

Handle key released
Name Type Description
key number The key ID

onKeyPressedRepeatStep1 (key)

Handle key repeat pressed
Name Type Description
key number The key ID

onKeyPressedAndRepeatStep1 (key)

Handle key pressed and repeat
Name Type Description
key number The key ID

drawHUDStep1 ()

Draw the battle HUD

initializeStep2 ()

Initialize step
Get the animation efect condition kind
Returns:
Type Description
AnimationEffectConditionKind

updateStep2 ()

Update the battle

onKeyPressedStep2 (key)

Handle key pressed
Name Type Description
key number The key ID

onKeyReleasedStep2 (key)

Handle key released
Name Type Description
key number The key ID

onKeyPressedRepeatStep2 (key)

Handle key repeat pressed
Name Type Description
key number The key ID

onKeyPressedAndRepeatStep2 (key)

Handle key pressed and repeat
Name Type Description
key number The key ID

drawHUDStep2 ()

Draw the battle HUD

initializeStep3 ()

Initialize step

defineAction ()

Define the action to do

defineTargets ()

Define the targets

updateStep3 ()

Update the battle

onKeyPressedStep3 (key)

Handle key pressed
Name Type Description
key number The key ID

onKeyReleasedStep3 (key)

Handle key released
Name Type Description
key number The key ID

onKeyPressedRepeatStep3 (key)

Handle key repeat pressed
Name Type Description
key number The key ID

onKeyPressedAndRepeatStep3 (key)

Handle key pressed and repeat
Name Type Description
key number The key ID

drawHUDStep3 ()

Draw the battle HUD

initializeStep4 ()

Initialize step

prepareRewards ()

Prepare the rewards (xp, currencies, loots)

updateTeamXP ()

Update the team progression xp

pauseTeamXP ()

Pause the team progression xp

unpauseTeamXP ()

Unpause the team progression xp

playMapMusic ()

Play map music

prepareEndTransition ()

Prepare the end transition

updateStep4 ()

Update the battle

onKeyPressedStep4 (key)

Handle key pressed
Name Type Description
key number The key ID

onKeyReleasedStep4 (key)

Handle key released
Name Type Description
key number The key ID

onKeyPressedRepeatStep4 (key)

Handle key repeat pressed
Name Type Description
key number The key ID

onKeyPressedAndRepeatStep4 (key)

Handle key pressed and repeat
Name Type Description
key number The key ID

drawHUDStep4 ()

Draw the battle HUD

initializeCamera ()

Initialize and correct some camera settings for the battle start

activeGroup ()

Make the attacking group all actives

isDefined (kind, index, target)boolean

Check if a player is defined (active and not dead)
Name Type Description
kind CharacterKind Kind of player
index number Index in the group
target boolean Indicate if the player is a target
Returns:
Type Description
boolean

isEndTurn ()boolean

Check if all the heroes or enemies are inactive
Returns:
Type Description
boolean

isGroupDead (group)boolean

Check if all the heroes or enemies are dead
Name Type Description
group CharacterKind Kind of player
Returns:
Type Description
boolean

isWin ()boolean

Check if all the enemies are dead
Returns:
Type Description
boolean

isLose ()boolean

Check if all the heroes are dead
Returns:
Type Description
boolean

gameOver ()

Transition to game over scene

win ()

Win the battle

endBattle ()

Win the battle

changeStep (i)

Change the step of the battle
Name Type Description
i number Step of the battle

initialize ()

Initialize the current step

update () overrides

Update battle according to step

moveStandardCamera ()

Do camera standard moves

onKeyPressed (key) overrides

Handle battle key pressed according to step
Name Type Description
key number The key ID

onKeyReleased (key) overrides

Handle battle key released according to step
Name Type Description
key number The key ID

onKeyPressedRepeat (key) overrides

Handle battle key pressed repeat according to step
Name Type Description
key number The key ID

onKeyPressedAndRepeat (key) overrides

Handle battle key pressed and repeat according to step
Name Type Description
key number The key ID

draw3D () overrides

Draw the battle 3D scene

drawHUD () overrides

Draw the battle HUD according to step

load () async inherited overrides

Load async stuff

updateInterpreters () inherited overrides

Update all the reactions interpreters

updateParallelCommands () inherited overrides

Update all the parallel commands

addReaction (sender, reaction, object, state, parameters, event, moving) inherited overrides

Add a reaction in the interpreter list
Name Type Description
sender MapObject The sender of this reaction
reaction SystemReaction The reaction to add
object MapObject The object reacting
state number The state ID
parameters Array.<SystemParameter> All the parameters coming with this reaction
event Array.<number> The time events values
moving boolean Indicate if command is a moving one

close () inherited overrides

Close the scene