2024-02-13 23:42:11 +00:00
import BattleScene from "./battle-scene" ;
2024-02-14 15:44:55 +00:00
import AwaitableUiHandler from "./ui/awaitable-ui-handler" ;
import { Mode } from "./ui/ui" ;
2024-02-13 23:42:11 +00:00
export enum Tutorial {
Intro = "INTRO" ,
2024-02-14 15:44:55 +00:00
Access_Menu = "ACCESS_MENU" ,
2024-02-13 23:42:11 +00:00
Menu = "MENU" ,
Starter_Select = "STARTER_SELECT" ,
2024-04-02 02:50:00 +00:00
Pokerus = "POKERUS" ,
2024-02-13 23:42:11 +00:00
Select_Item = "SELECT_ITEM" ,
2024-02-14 15:44:55 +00:00
Egg_Gacha = "EGG_GACHA"
2024-02-13 23:42:11 +00:00
}
const tutorialHandlers = {
[ Tutorial . Intro ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
scene . ui . showText ( ` Welcome to PokéRogue! This is a battle-focused Pokémon fangame with roguelite elements.
$This game is not monetized and we claim no ownership of Pokémon nor of the copyrighted assets used .
2024-03-28 02:40:10 +00:00
$The game is a work in progress , but fully playable . \ nFor bug reports , please use the Discord community .
$If the game runs slowly , please ensure 'Hardware Acceleration' is turned on in your browser settings . ` , null, () => resolve(), null, true);
2024-02-13 23:42:11 +00:00
} ) ;
} ,
2024-02-14 15:44:55 +00:00
[ Tutorial . Access_Menu ] : ( scene : BattleScene ) = > {
2024-02-13 23:42:11 +00:00
return new Promise < void > ( resolve = > {
if ( scene . enableTouchControls )
return resolve ( ) ;
2024-02-14 15:44:55 +00:00
scene . showFieldOverlay ( 1000 ) . then ( ( ) = > scene . ui . showText ( ` To access the menu, press M or Escape while awaiting input. \ nThe menu contains settings and various features. ` , null , ( ) = > scene . hideFieldOverlay ( 1000 ) . then ( ( ) = > resolve ( ) ) , null , true ) ) ;
} ) ;
} ,
[ Tutorial . Menu ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
scene . gameData . saveTutorialFlag ( Tutorial . Access_Menu , true ) ;
scene . ui . showText ( ` From this menu you can access the settings.
$From the settings you can change game speed , window style , and other options .
$There are also various other features here , so be sure to check them all ! ` , null, () => scene.ui.showText('', null, () => resolve()), null, true);
2024-02-13 23:42:11 +00:00
} ) ;
} ,
[ Tutorial . Starter_Select ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
2024-02-14 15:44:55 +00:00
scene . ui . showText ( ` From this screen, you can select your starters. \ nThese are your initial party members.
$Each starter has a value . Your party can have up to \ n6 members as long as the total does not exceed 10 .
$You can also select gender , ability , and form depending on \ nthe variants you ' ve caught or hatched .
$The IVs for a species are also the best of every one you 've\ncaught or hatched, so try to get lots of the same species!`, null, () => scene.ui.showText(' ' , null , ( ) = > resolve ( ) ) , null , true ) ;
} ) ;
} ,
2024-04-02 02:50:00 +00:00
[ Tutorial . Pokerus ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
scene . ui . showText ( ` A daily random 3 selectable starters have a purple border.
$If you see a starter you own with one of these , \ ntry adding it to your party . Be sure to check its summary ! ` , null, () => scene.ui.showText('', null, () => resolve()), null, true);
} ) ;
} ,
2024-02-14 15:44:55 +00:00
[ Tutorial . Select_Item ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
scene . ui . setModeWithoutClear ( Mode . MESSAGE ) . then ( ( ) = > {
scene . ui . showText ( ` After every battle, you are given a choice of 3 random items. \ nYou may only pick one.
$These range from consumables , to Pokémon held items , to passive permanent items .
$Most non - consumable item effects will stack in various ways .
$Some items will only show up if they can be used , such as evolution items .
2024-03-05 04:59:15 +00:00
$You can also transfer held items between Pokémon using the transfer option .
2024-02-14 15:44:55 +00:00
$The transfer option will appear in the bottom right once you have obtained a held item .
$You may purchase consumable items with money , and a larger variety will be available the further you get .
$Be sure to buy these before you pick your random item , as it will progress to the next battle once you do . ` , null, () => scene.ui.showText('', null, () => scene.ui.setModeWithoutClear(Mode.MODIFIER_SELECT).then(() => resolve())), null, true);
} ) ;
} ) ;
} ,
[ Tutorial . Egg_Gacha ] : ( scene : BattleScene ) = > {
return new Promise < void > ( resolve = > {
scene . ui . showText ( ` From this screen, you can redeem your vouchers for \ nPokémon eggs.
$Eggs have to be hatched and get closer to hatching after \ nevery battle . Rarer eggs take longer to hatch .
$Hatched Pokémon also won ' t be added to your party , they will \ nbe added to your starters .
$Pokémon hatched from eggs generally have better IVs than \ nwild Pokémon .
$Some Pokémon can only even be obtained from eggs .
$There are 3 different machines to pull from with different \ nbonuses , so pick the one that suits you best ! ` , null, () => scene.ui.showText('', null, () => resolve()), null, true);
2024-02-13 23:42:11 +00:00
} ) ;
} ,
} ;
export function handleTutorial ( scene : BattleScene , tutorial : Tutorial ) : Promise < boolean > {
return new Promise < boolean > ( resolve = > {
if ( ! scene . enableTutorials )
return resolve ( false ) ;
if ( scene . gameData . getTutorialFlags ( ) [ tutorial ] )
return resolve ( false ) ;
2024-02-14 15:44:55 +00:00
const handler = scene . ui . getHandler ( ) ;
if ( handler instanceof AwaitableUiHandler )
handler . tutorialActive = true ;
2024-02-13 23:42:11 +00:00
tutorialHandlers [ tutorial ] ( scene ) . then ( ( ) = > {
scene . gameData . saveTutorialFlag ( tutorial , true ) ;
2024-02-14 15:44:55 +00:00
if ( handler instanceof AwaitableUiHandler )
handler . tutorialActive = false ;
2024-02-13 23:42:11 +00:00
resolve ( true ) ;
} ) ;
} ) ;
}