Fighter

From Asgard
(Redirected from Fighters)
Jump to: navigation, search

Data Members

-name: string

Name of the fighter. Let's keep it down to 15 characters.

-jobType: string

Name of the Fighter's job type.

-playable: boolean

Whether the user gets to decide a fighter's course of action or not.

-timeOfMove: int

Time that the Fighter gets to move next.

-stat: Statistic[]

List of stats for a fighter, i.e. HP, MP, EXP ...

-equiption: Equiption

All armor and weapons on the fighter's person.

-status: Status[]

Statuses that are afflicting this Fighter. Statuses are not saved in the data files (at the moment). Generally, rpgs don't save statuses after battle. This should be talked about in the future.

-elemMod: [elemName: string, modifier: float]

A tuple-list. Each tuple contains the name of the element and how it modifies the base change. If the element is not in this list, modifier is assumed to be 0 (no modification).

-statusMod: [statusName: string, chance: float]

A tuple-list. Each tuple contains the name of the status and what it's chance of being afflicted is. If the status is not in this list, chance is assumed to be 100% (=1.0, always inflicts).

Methods

Fighter(binary: string optional, f_xml_tree: xmlDoc optional)

  • If "binary" specified:
Uses unpack() to instantiate the Fighter object based off a string of binary data.
Note that it needs a job class xml tree to populate job class related stat members.
  • If "binary" is "":
Uses XPath queries to instantiate the Fighter object based off a given XML document tree.
Note that it needs a job class xml tree to populate job class related stat members.

+toBinaryString(): string

Uses pack() to convert the Fighter object into a binary string (for possible writing).

+getName(): string

Gets name of fighter.

+setName(name:string): void

Sets name of fighter.

+getJobType(): string

Get the job type of the Fighter

+setJobType(jobType: string): void

Set the job type of the fighter.

+getTimeOfMove(): int

Gets fighter's time of move.

+setTimeOfMove(tmv:int): void

Sets fighter's time of move.

+getEquiption(): Equiption

Gets fighter's equiption.

+setEquiption(eq:Equiption): void

Sets fighter's equiption.

+getPlayable(): boolean

Is the fighter playable?

+setPlayable(plyable:boolean): void

Sets playability of fighter.

+getAttack(): int

Computes attack statistic, taking into account all modifiers.

+getDefense(): int

Computes defense statistic, taking into account all modifiers.

+getEvade(): int

Computes evade statistic, taking into account all modifiers.

+makeEvent(enemy:Party, hero:Party, currentTime:int, controller:ConsoleController): Event

If the fighter is ready to move and can move (when the current time is the time of the player's next move). Calls Status.genPerTurn().
There are two cases:
Case #1: Fighter is playable.
An Event selection menu is displayed, and an event type is selected from the user through
ConsoleController.
Case #2: Fighter is not playable.
A random enemy (alive) from the enemy party is selected. Next, an EventType is selected (at random). This is the very simple AI for enemies at the moment.
(at the moment "Attack" is the only type) from the list returned from getEventTypes(). Finally
an event is constructed and returned.
If they've moved, calls Status.genPerTurnOnMove().
If an event is generated, the timeOfMove variable needs to be changed based on the speed stat.
Returns the None object if the fighter is not ready to move or if the fighter is dead.

+isAlive(): boolean

Returns true if hp is greater than 0, false otherwise.

+getEventTypes(): string[]

Returns a list of strings that corresponde to EventTypes that can be executed by a Fighter.

+receiveExp(amount:long): void

Increments experience, uses fighter.job to determine stat increases on level up. This is called by Party.giveExp(). Feel free to be creative.

+getElemModifier(elemental: string): float

Retrieves this information currently just from elemMod. If the elemental name specified is found in the elemMod, and return the associated modifier. The modifier is a float x where -2.0 <= x <= 2.0. If x is negative, elemental effects hurt (remove hp). If x is positive, they cure (add hp). Some Elementals may be innate to the Fighter, others might come from armor (armor portion not yet implemented).

+getStatusModifier(status: string): float

Retrieves the status name specified, and return the associated modifier. The modifier is a float x where 0 <= x <= 1.0. If x is 0, Fighter is immune to stat. If x > 0, it represents the chance of being afflicted with a stat. Some Status defenses may be innate to Fighter, others might come from armor (armor portion not yet implemented).

+getStatus(): string[]

+setStatus(status_list: string[]): void

+addStatus(status: string): void

Adds a Status to the status list. Also executes the entrance transactions for that Status

+removeStatus(status: string): void

Removes a status from the status list. Calls Status.genExit().

+getStat(name: string): Statistic

Get a Statistic object by it's name.

+getAllStats(): Statistic[]

+setAllStats(stats: Statistic[]): void

See Also