Professional Documents
Culture Documents
Simulator
Simulator
(Air Lock and Klutz negates every event for the corresponding effect, so don't need
to be marked)
[BeforeTurn]
for every move:
[ModifyPriority]
move's [BeforeTurn]
useMove() {
[ModifyMove] (A)
if no targets:
display "But there was no target..." and exit useMove()
moveHit() - once for each hit of multi-hit move, and also once
for secondary hits {
move's [TryHit], [TryHitSide] or [TryHitField] (A)
if hit:
[TryHit] (A)
-> 0 => skip to SelfHit (used for Substitute)
-> null => exit moveHit()
-> false => display "But it failed!" and exit
moveHit()
[Immunity] (A)
-> null => exit moveHit()
-> false => display "It had no effect!" and exit moveHit()
move animation
getDamage() {
move's [BasePower]
[BasePower] (A)
move's [Damage]
if critical hit:
[CriticalHit] (A)
}
damage() {
[Damage] (A,U)
-> false => exit damage()
damage
}
heal() {
[Heal] (A)
-> false => exit heal()
heal
}
status() (U) {
[Status] (A)
-> false => exit status()
status change
status's [Start] (A)
-> false => restore previous status and exit status()
[AfterStatus]
}
effect() (U) {
if effect already exists:
effect's [Restart] (A)
otherwise:
effect change
effect's [Start] (A)
-> false => remove effect and exit effect()
}
recoil() {
call damage()
}
drain() {
call heal()
}
if hit:
[SelfHit] (A)
if secondary hit:
[SecondarySelfHit] (A)
if hit:
if secondary roll succeeds:
secondary() (S,U) {
call moveHit()
}
}
[AfterMoveSecondary] (S,U)
[AfterMoveSecondarySelf] (S)
[AfterMove]
}
pp deducted
}
runFaint() {
[Faint]
}
residual() {
for every effect:
if duration = 0:
effect's [End]
remove effect
otherwise:
effect's [Residual]
}
[Update]
}
These are not part of the main loop, and are only called from inside an event.
(For instance, eatItem() is usually called from within the Update event of a berry,
and weather() is called
from the Residual event of a weather condition)
eatItem() {
[UseItem] (A)
-> false => exit EatItem()
[EatItem] (A)
-> false => exit EatItem()
item's [Eat]
remove item from pokemon
}
useItem() {
[UseItem] (A)
-> false => exit UseItem()
remove item from pokemon
}
takeItem() {
[TakeItem] (A)
-> false => exit TakeItem()
remove item from pokemon
}
setItem() {
set item
item's [Start]
}
setAbility() {
set ability
ability's [Start]
}
weather() {
[Weather]
}