CannedText =
  bw:
    en:
      MOVE_MISS: "$p avoided the attack!"
      MOVE_FAIL: "But it failed!"
      SUPER_EFFECTIVE: "It's super effective!"
      NOT_VERY_EFFECTIVE: "It's not very effective..."
      CRITICAL_HIT: "A critical hit!"
      GOT_HIT: "$p took $1% damage!"
      DRAIN: "$p had its energy drained!"
      ABSORB: "$p absorbed some HP!"
      NO_TARGET: "But there was no target..."
      RECOIL: "$p was hit by recoil!"
      IMMUNITY: "But it doesn't affect $p..."
      FLINCH: "$p flinched!"
      IS_CONFUSED: "$p is confused!"
      CONFUSION_START: "$p became confused!"
      CONFUSION_END: "$p snapped out of confusion!"
      CONFUSION_HURT_SELF: "$p hurt itself in confusion!"
      FATIGUE: "$p became confused due to fatigue!"
      NO_MOVES_LEFT: "$p has no moves left!"
      NO_PP_LEFT: "But there was no PP left for the move!"
      SUN_START:  "The sunlight turned harsh!"
      RAIN_START: "It started to rain!"
      SAND_START: "A sandstorm kicked up!"
      HAIL_START: "It started to hail!"
      SUN_END:  "The sunlight faded."
      RAIN_END: "The rain stopped."
      SAND_END: "The sandstorm subsided."
      HAIL_END: "The hail stopped."
      SAND_CONTINUE: "The sandstorm rages."
      HAIL_CONTINUE: "The hail crashes down."
      SAND_HURT: "$p is buffeted by the sandstorm!"
      HAIL_HURT: "$p is buffeted by the hail!"
      DISABLE_START: "$p's $m was disabled!"
      DISABLE_CONTINUE: "$p's $m is disabled!"
      DISABLE_END: "$p is no longer disabled!"
      YAWN_BEGIN: "$p grew drowsy!"
      TAUNT_START: "$p fell for the taunt!"
      TAUNT_PREVENT: "$p can't use $m after the taunt!"
      TAUNT_END: "$p's taunt wore off!"
      WISH_END: "$1's wish came true!"
      PERISH_SONG_START: "All Pokemon hearing the song will faint in three turns!"
      PERISH_SONG_CONTINUE: "$p's perish count fell to $1!"
      TAILWIND_END: "The tailwind petered out!"
      ENCORE_END: "$p's Encore ended!"
      TORMENT_START: "$p was subjected to Torment!"
      SPIKES_START: "Spikes were scattered all around $ts's feet!"
      SPIKES_HURT: "$p is hurt by the spikes!"
      SPIKES_END: "The spikes disappeared from around $ts's feet!"
      STEALTH_ROCK_START: "Pointed stones float in the air around $ts!"
      STEALTH_ROCK_HURT: "Pointed stones dug into $p!"
      STEALTH_ROCK_END: "The pointed stones disappeared from around $ts!"
      TOXIC_SPIKES_START: "Poison spikes were scattered all around $ts's feet!"
      TOXIC_SPIKES_END: "The poison spikes disappeared from around $ts's feet!"
      TRAP_HURT: "$p is hurt by $m!"
      LEECH_SEED_START: "$p was seeded!"
      LEECH_SEED_HURT: "$p's health is sapped by Leech Seed!"
      PROTECT_CONTINUE: "$p protected itself!"
      DESTINY_BOND_START: "$p is trying to take its foe down with it!"
      DESTINY_BOND_CONTINUE: "$p took its attacker down with it!"
      SUBSTITUTE_START: "$p put in a substitute!"
      SUBSTITUTE_EXISTS: "$p already has a substitute!"
      SUBSTITUTE_WEAK: "It was too weak to make a substitute!"
      SUBSTITUTE_END: "$p's substitute faded!"
      SUBSTITUTE_HURT: "The substitute took damage for $p!"
      BOUNCE_MOVE: "$p bounced the $m back!"
      TRICK_ROOM_START: "$p twisted the dimensions!"
      TRICK_ROOM_END: "The twisted dimensions returned to normal!"
      PARALYZE_START: '$p was paralyzed!'
      FREEZE_START: '$p was frozen!'
      POISON_START: '$p was poisoned!'
      TOXIC_START: '$p was badly poisoned!'
      SLEEP_START: '$p fell asleep!'
      BURN_START: '$p was burned!'
      PARALYZE_CONTINUE: '$p is fully paralyzed!'
      FREEZE_CONTINUE: "$p is frozen solid!"
      POISON_CONTINUE: "$p was hurt by poison!"
      SLEEP_CONTINUE: "$p is fast asleep."
      BURN_CONTINUE: "$p was hurt by its burn!"
      RECOVER_HP: "$p's HP was restored."
      TRICK_START: "$p switched items with its target!"
      TRICK_END: "$p obtained one $i!"
      THIEF_START: "$p stole $p's $i!"
      RESET_STATS: "$p's stat changes were removed!"
      RESET_ALL_STATS: "All stat changes were eliminated!"
      JUMP_KICK_MISS: "$p kept going and crashed!"
      FREE_FROM: "$p was freed from $1!"
      TRANSFORM: '$p transformed!'
      TRANSFORM_INTO: '$p transformed into $p!'
      TRANSFORM_TYPE: "$p transformed into the $y type!"
      ACQUIRE_ABILITY: "$p acquired $a!"
      REFLECT_START: "Reflect raised $ts's defense!"
      LIGHT_SCREEN_START: "Light Screen raised $ts's special defense!"
      REFLECT_END: "$ts's Reflect wore off!"
      LIGHT_SCREEN_END: "$ts's Light Screen wore off!"
      STICKY_WEB_START: "A sticky web has been laid out beneath $ts's feet!"
      STICKY_WEB_CONTINUE: "$p was caught in a sticky web!"
      STICKY_WEB_END: "The sticky web has disappeared from beneath $ts's feet!"
      RATING_UPDATE: "$t's rating: $1 -> $2"
      KNOCK_OFF: "$p knocked off $p's $i!"
      PAIN_SPLIT: "The battlers shared their pain!"
      PAY_DAY: "Coins were scattered everywhere!"
      PSYCH_UP: "$p copied $p's stat changes!"
      MENTAL_HERB: "$p used its Mental Herb to come back to its senses!"
      WHITE_HERB: "$p restored its status using its White Herb!"
      RED_CARD: "$p held up its Red Card against $p!"
      EJECT_BUTTON: "$p is switched out with the Eject Button!"
      HANG_ON: "$p hung on using its $i!"
      MOVE_FIRST: "$p's $i let it move first!"
      SAFEGUARD_START: "$t's team became cloaked in a mystical veil!"
      SAFEGUARD_END: "$t's Safeguard wore off!"
      ITEM_RESTORE: "$p restored a little HP using its $i!"
      ITEM_WEAKEN: "The $i weakened the damage to $p!"
      POKEMON_HURT_BY_ITEM: "$p is hurt by $p's $i!"
      ITEM_SELF_HURT: "$p is hurt by its $i!"
      POKEMON_HURT: "$p is hurt!"
      BERRY_RESTORE: "$p restored its health using its $i!"
      BERRY_RAISE_STAT: "The $i raised $p's $1!"
      GEM_BOOST: "The $i strengthened $m's power!"
      ENDURE: "$p endured the hit!"
      ANCHOR: "$p anchors itself!"
      AVOID_ALLIES: "$p avoids attacks by its ally Pokemon!"
      TRACE: "It traced the foe's $a!"
      TRUANT: "$p is loafing around!"
      WEATHER_DISABLED: "The effects of weather disappeared."
      MOLD_BREAKER: "$p breaks the mold!"
      TERAVOLT: "$p is radiating a bursting aura!"
      TURBOBLAZE: "$p is radiating a blazing aura!"
      ANTICIPATION: "$p shuddered!"
      BAD_DREAMS: "$p is tormented!"
      COLOR_CHANGE: "$p's Color Change made it the $1 type!"
      FLASH_FIRE: "The power of $p's Fire-type moves rose!"
      FOREWARN: "It was alerted to $p's $m!"
      FRISK: "$p frisked its target and found one $i!"
      HARVEST: "$p harvested one $i!"
      PRESSURE: "$p is exerting its pressure!"
      MUMMY: "$p's ability became Mummy!"
      PICKPOCKET: "$p stole $p's $i!"
      SLOW_START_START: "$p can't get it going!"
      SLOW_START_END: "$p finally got its act together!"
      WITHDREW: "$t withdrew $p!"
      SENT_OUT: "$t sent out $p!"
      SWAP_ABILITY: "$p swapped Abilities with its target!"
      TELEKINESIS_START: "$p was hurled into the air!"
      TELEKINESIS_END: "$p was freed from the telekinesis!"
      HEAL_BLOCK_START: "$p was prevented from healing!"
      HEAL_BLOCK_END: "$p's Heal Block wore off!"
      HEAL_BLOCK_PREVENT: "$p can't use $m because of Heal Block!"
      HEAL_BLOCK_TRY_HEAL: "$p was prevented from healing due to Heal Block!"
      HEAL_BLOCK_FAIL: "But it failed to affect $p!"
      FOUND_ITEM: "$p found one $i!"
      MOON_START: "$p's Noctem darkened the sky!"
      MOON_END: "The sky brightened again."
      MOON_CONTINUE: "The sky is dark."
      LIVEWIRE_START: "A wire was set at the feet of the foe"
      LIVEWIRE_END: "$p absorbed the Livewire!"
      LIVEWIRE_HURT: "$p was shocked by the Livewire!"
      LIVEWIRE_MISS: "$p avoided the Livewire!"
      FIRE_ROCK_START: "Molten rocks float in the air around $ts!"
      FIRE_ROCK_HURT: "$p is hurt by molten rocks!"
      FIRE_ROCK_END: "The molten rocks disappeared from around $ts!"
      ILLUSION_BROKE: "The foes $p broke it's illusion!"

cannedMap = {}
cannedMapReverse = {}
allTexts = []
counter = 0

cannedTextNames = []
for generationName, generation of CannedText
  for language, cannedTexts of generation
    for cannedTextName in Object.keys(cannedTexts)
      if cannedTextName not in cannedTextNames
        cannedTextNames.push(cannedTextName)

# Sort canned text, so that the integers are consistent everywhere.
cannedTextNames.sort()

for cannedTextName, i in cannedTextNames
  counter = (i + 1)
  cannedMap[cannedTextName] = counter
  cannedMapReverse[counter] = cannedTextName

this.CannedText = cannedMap
this.CannedMap = CannedText
this.CannedMapReverse = cannedMapReverse
