EventType

From Asgard
Jump to: navigation, search

Data Members

-typeName: string

Type of event (i.e. "ATTACK", "BLACK", "WHITE")

-name: string

Name of EventType (i.e. "fire1", "ice1", "poison")

-afflictions: (name: string, remove: bool)[]

List of status afflictions.

-elementals: (name: string, basedmg: int, error: float)[]

List of tuples. The tuples consist of an elemental name, i.e. "fire", a value for base damage (i.e. -250), and an error (i.e. +/- 0.25). Formula: hpChange = computeBaseError(computeMgkDmg(basedmg,exec.getWisdom/Will()),error) * (1 - target.getElemModifier()).

-mpCost: int

Amount of mp used for EventType.

Methods

EventType(xml_tree: xmlDoc)

Creates an EventType based off an xml document. Uses XPath to query the document.
Note: this replaces old eventtype constructor

+getTypeName(): string

+setTypeName(tn: string): void

+getName(): string

+setName(name: string): void

+getAfflictions(): (name: string, remove: bool)[]

+setAfflictions(aff: (name: string, remove: bool)[]): void

+getElementals(): (name: string, chance: mod)[]

+setElementals(elem: (name: string, chance: mod)[]): void

+detTransactions(exct: Fighter, targets: Fighter[]): Transaction[]

Runs algorithm/formula for event type name. No Fighter data is actually modified in these routines. Generates a Transaction list to be processed by Event.execute(). Event.execute() will execute each Transaction which will in turn actually modify the Fighter data.
Please also note that this method may generate Transaction for multiple targets.
This method will implement the following event type typeNames: ATTACK, BLACK, and WHITE.

-computeBaseError(base: int, error: float): int

Computes a "net" damage by multiplying base and error from elemental, subtracting and adding the base by that product (thus creating a range of integers), and generating a random number from that range.

-computeHM(cdex: int, cagl: int): int

Computes whether or not the executor of an ATTACK hits or misses his target by directly comparing the executor's current dexterity (cdex) to his target's current agility (cagl). If he makes a hit, computes (and returns) the number of hits based on various ranges of current dexterity.

See Also