Replaced Gulp with shenanigans-manager@0.2 (#528)

* Used shenanigans-manager@0.2 instead of Gulp

* 'shenanigans-manager'

* 'Bump-patch-version'

* webpack.config.js

* shenanigans-manager@0.2.7

* Added exclude to tslint.json options

* no_tests
This commit is contained in:
Josh Goldberg
2017-12-29 08:23:12 -08:00
committed by GitHub
parent 969ac10fe5
commit 235b4d7173
155 changed files with 25951 additions and 35404 deletions
+11 -8
View File
@@ -1,15 +1,18 @@
dist/**
docs/generated/**
lib/**
test/*.ts
test/index.html
test/utils/MochaLoader.ts
dist/
docs/generated/
test/
node_modules/
*.css
*.d.ts
*.js*
!./*.js
!*.json
!gulpfile.js
*.html
node_modules/
Maps.test.ts
npm-debug.log
debug.log
# Local development typically uses npm install --link
# Package lock files aren't updated by linked installs
package-lock.json
yarn.lock
+2 -1
View File
@@ -1,3 +1,4 @@
node_modules/
test/**/*
test/
*.test.*
npm-debug.log
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-recommended-scss"
}
+2 -2
View File
@@ -1,8 +1,8 @@
language: node_js
node_js:
- "node"
- "7"
- "5"
script:
node_modules/gulp/bin/gulp.js
npm run verify
+5 -1
View File
@@ -1,3 +1,7 @@
{
"typescript.tsdk": "node_modules\\typescript\\lib"
"editor.tabSize": 4,
"editor.trimAutoWhitespace": true,
"tslint.alwaysShowRuleFailuresAsWarnings": true,
"tslint.autoFixOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
+30 -2
View File
@@ -1,5 +1,6 @@
<!-- {{Top}} -->
# FullScreenPokemon
[![Greenkeeper badge](https://badges.greenkeeper.io/FullScreenShenanigans/FullScreenPokemon.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/FullScreenShenanigans/FullScreenPokemon.svg?branch=master)](https://travis-ci.org/FullScreenShenanigans/FullScreenPokemon)
[![NPM version](https://badge.fury.io/js/fullscreenpokemon.svg)](http://badge.fury.io/js/fullscreenpokemon)
@@ -35,7 +36,34 @@ document.body.appendChild(fsp.canvas);
<!-- {{Development}} -->
## Development
See [Documentation/Development](https://github.com/FullScreenShenanigans/Documentation).
```
git clone https://github.com/FullScreenShenanigans/FullScreenPokemon
cd FullScreenPokemon
npm run setup
npm run verify
```
After setting up and building locally, open `src/index.html` to launch.
* `npm run setup` creates a few auto-generated setup files locally.
* `npm run verify` builds, lints, and runs tests.
### Building
```shell
npm run watch
```
Source files are written under `src/` in TypeScript and compile in-place to JavaScript files.
`npm run watch` will directly run the TypeScript compiler on source files in watch mode.
Use it in the background while developing to keep the compiled files up-to-date.
### Running Tests
```shell
npm run test
```
Test files are alongside source files under `src/` and named `*.test.ts?`.
Whenever you add, remove, or rename a `*.test.ts?` file under `src/`, re-run `npm run test:setup` to regenerate the list of static test files in `test/index.html`.
You can open that file in a browser to debug through the tests.
`npm run test` will run that setup and execute tests using [Puppeteer](https://github.com/GoogleChrome/puppeteer).
<!-- {{/Development}} -->
+1 -1
View File
@@ -57,7 +57,7 @@ const options: IWildPokemonSchema[] = [
remaining: FSP.constants.moves.Ember.pp,
uses: FSP.constants.moves.Ember.pp
}],
rate: .25
rate: 0.25
},
{
title: "Squirtle".split(""),
-1
View File
@@ -1 +0,0 @@
require("gulp-shenanigans").initialize(require("gulp"));
-9315
View File
File diff suppressed because it is too large Load Diff
+125 -74
View File
@@ -1,75 +1,126 @@
{
"name": "fullscreenpokemon",
"description": "A free HTML5 remake of the original Pokemon, expanded for modern browsing.",
"version": "0.6.0",
"author": {
"name": "Josh Goldberg",
"email": "joshuakgoldberg@outlook.com"
},
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/FullScreenPokemon.git"
},
"bugs": {
"url": "https://github.com/FullScreenShenanigans/FullScreenPokemon/issues"
},
"license": "MIT",
"dependencies": {
"areaspawnr": "0.6.X",
"audioplayr": "0.6.X",
"battlemovr": "0.6.X",
"changelinr": "0.6.X",
"devicelayr": "0.6.X",
"eightbittr": "0.6.9",
"flagswappr": "0.6.X",
"fpsanalyzr": "0.6.X",
"gamesrunnr": "0.6.X",
"gamestartr": "0.6.9",
"groupholdr": "0.6.X",
"inputwritr": "0.6.X",
"itemsholdr": "0.6.X",
"mapscreatr": "0.6.X",
"mapscreenr": "0.6.X",
"menugraphr": "0.6.X",
"modattachr": "0.6.X",
"numbermakr": "0.6.X",
"objectmakr": "0.6.X",
"pixeldrawr": "0.6.X",
"pixelrendr": "0.6.X",
"quadskeepr": "0.6.X",
"sceneplayr": "0.6.X",
"stateholdr": "0.6.X",
"stringfilr": "0.6.X",
"thinghittr": "0.6.X",
"timehandlr": "0.6.X",
"touchpassr": "0.6.X",
"userwrappr": "^0.6.5",
"worldseedr": "0.6.X"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-shenanigans": "^0.6.21"
},
"scripts": {
"gulp": "gulp",
"test": "gulp test"
},
"shenanigans": {
"name": "FullScreenPokemon",
"web": {
"drivingObject": "FSP",
"sections": {
"credits": [
"Full Screen Pokemon was made possible first and foremost by Nintendo, who originally created Pokemon and has since maintained the series.",
"It would also not have been possible without the dedicated efforts of the Pokemon fan community over the past two decades, in particular <a href=\"http://bulbapedia.bulbagarden.net/\">Bulbapedia</a>."
],
"explanation": [
"Full Screen Pokemon is a free HTML5 remake of Nintendo's original Pokemon.",
"It includes the original two generations, a random map generator, a <!-- social --> level editor, and over a dozen custom mods."
],
"legal": "Pokemon and all associated games and media are property of Nintendo and/or Nintendo of America Inc., and are protected by United States and international copyright, trademark and other intellectual property laws."
},
"url": "fullscreenpokemon.com"
}
}
}
"author": {
"email": "joshuakgoldberg@outlook.com",
"name": "Josh Goldberg"
},
"browser": "./src/index.js",
"bugs": {
"url": "https://github.com/FullScreenShenanigans/FullScreenPokemon/issues"
},
"dependencies": {
"areaspawnr": "^0.7.0",
"audioplayr": "^0.7.0",
"battlemovr": "^0.7.1",
"changelinr": "^0.7.0",
"devicelayr": "^0.7.0",
"eightbittr": "^0.7.0",
"flagswappr": "^0.7.1",
"fpsanalyzr": "^0.7.0",
"gamesrunnr": "^0.7.0",
"gamestartr": "^0.7.0",
"groupholdr": "^0.7.0",
"inputwritr": "^0.7.0",
"itemsholdr": "^0.7.0",
"mapscreatr": "^0.7.0",
"mapscreenr": "^0.7.0",
"menugraphr": "^0.7.0",
"modattachr": "^0.7.1",
"numbermakr": "^0.7.0",
"objectmakr": "^0.7.0",
"pixeldrawr": "^0.7.0",
"pixelrendr": "^0.7.0",
"quadskeepr": "^0.7.0",
"sceneplayr": "^0.7.0",
"stateholdr": "^0.7.0",
"stringfilr": "^0.7.0",
"thinghittr": "^0.7.0",
"timehandlr": "^0.7.0",
"touchpassr": "^0.7.0",
"userwrappr": "^0.7.0"
},
"description": "A free HTML5 remake of the original Pokemon, expanded for modern browsing.",
"devDependencies": {
"@types/chai": "^4.0.4",
"@types/lolex": "^1.5.32",
"@types/mocha": "^2.2.44",
"@types/react": "^16.0.31",
"@types/react-dom": "^16.0.3",
"@types/sinon": "^4.0.0",
"@types/sinon-chai": "^2.7.29",
"chai": "^4.1.2",
"glob": "^7.1.2",
"lolex": "^2.3.0",
"mkdirp": "^0.5.1",
"mocha": "^4.0.1",
"mocha-headless-chrome": "^1.7.1",
"node-sass": "^4.7.2",
"requirejs": "^2.3.5",
"run-for-every-file": "^1.1.0",
"shenanigans-manager": "^0.2.7",
"sinon": "^4.1.2",
"sinon-chai": "^2.14.0",
"stylelint": "^8.4.0",
"stylelint-config-recommended-scss": "^3.0.0",
"stylelint-scss": "^2.2.0",
"tslint": "5.8.0",
"tsutils": "^2.14.0",
"typedoc": "^0.9.0",
"typescript": "^2.6.2",
"webpack": "^3.10.0"
},
"license": "MIT",
"name": "fullscreenpokemon",
"repository": {
"type": "git",
"url": "ssh://git@github.com:FullScreenShenanigans/FullScreenPokemon.git"
},
"scripts": {
"dist": "npm run dist:webpack",
"dist:webpack": "webpack",
"docs": "npm run docs:typedoc",
"docs:typedoc": "typedoc src/ --exclude **/*.d.ts --ignoreCompilerErrors --out docs/generated",
"gulp": "gulp",
"init": "npm install && npm run setup && npm run verify",
"setup": "npm run setup:copy && npm run setup:package && npm run setup:readme",
"setup:copy": "npm run setup:copy:default && npm run setup:copy:web",
"setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/default/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\" --only-files",
"setup:copy:web": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/web/\" --file \"**/*\" --run \"mustache package.json {{src-file}} {{file}}\" --dest \".\"",
"setup:package": "shenanigans-manager hydrate-package-json",
"setup:readme": "shenanigans-manager hydrate-readme",
"src": "npm run src:tsc && npm run src:tslint && npm run src:scss && npm run src:stylelint",
"src:scss": "node-sass --recursive src --output src",
"src:stylelint": "stylelint src/**/*.scss",
"src:tsc": "tsc -p .",
"src:tslint": "tslint -c tslint.json -e ./node_modules/**/*.ts* -p tsconfig.json -t stylish",
"test": "npm run test:setup && npm run test:run",
"test:run": "mocha-headless-chrome --file test/index.html",
"test:setup": "npm run test:setup:dir && npm run test:setup:copy && npm run test:setup:html && npm run test:setup:tsc",
"test:setup:copy": "npm run test:setup:copy:default",
"test:setup:copy:default": "run-for-every-file --dot --src \"node_modules/shenanigans-manager/setup/test/\" --file \"**/*\" --run \"mustache package.json {{src-file}} ./test/{{file}}\" --dest \".\" --only-files",
"test:setup:dir": "mkdirp test",
"test:setup:html": "shenanigans-manager generate-test-html",
"test:setup:tsc": "tsc -p test",
"verify": "npm run src && npm run test && npm run dist && npm run docs",
"watch": "tsc -p . -w"
},
"shenanigans": {
"name": "FullScreenPokemon",
"web": {
"drivingObject": "FSP",
"sections": {
"credits": [
"Full Screen Pokemon was made possible first and foremost by Nintendo, who originally created Pokemon and has since maintained the series.",
"It would also not have been possible without the dedicated efforts of the Pokemon fan community over the past two decades, in particular <a href=\"http://bulbapedia.bulbagarden.net/\">Bulbapedia</a>."
],
"explanation": [
"Full Screen Pokemon is a free HTML5 remake of Nintendo's original Pokemon.",
"It includes the original two generations, a random map generator, a <!-- social --> level editor, and over a dozen custom mods."
],
"legal": "Pokemon and all associated games and media are property of Nintendo and/or Nintendo of America Inc., and are protected by United States and international copyright, trademark and other intellectual property laws."
},
"url": "fullscreenpokemon.com"
}
},
"types": "./src/index.d.ts",
"version": "0.7.1"
}
+11 -17
View File
@@ -1,16 +1,10 @@
import { BattleMovr } from "battlemovr/lib/BattleMovr";
import { IBattleMovr } from "battlemovr/lib/IBattleMovr";
import { FlagSwappr } from "flagswappr/lib/FlagSwappr";
import { IFlagSwappr } from "flagswappr/lib/IFlagSwappr";
import { BattleMovr, IBattleMovr } from "battlemovr";
import { FlagSwappr, IFlagSwappr } from "flagswappr";
import { GameStartr, IGameStartrSettings } from "gamestartr";
import { IMenuGraphr } from "menugraphr/lib/IMenuGraphr";
import { MenuGraphr } from "menugraphr/lib/MenuGraphr";
import { IScenePlayr } from "sceneplayr/lib/IScenePlayr";
import { ScenePlayr } from "sceneplayr/lib/ScenePlayr";
import { IStateHoldr } from "stateholdr/lib/IStateHoldr";
import { StateHoldr } from "stateholdr/lib/StateHoldr";
import { IUserWrappr } from "userwrappr/lib/IUserWrappr";
import { UserWrappr } from "userwrappr/lib/UserWrappr";
import { IMenuGraphr, MenuGraphr } from "menugraphr";
import { IScenePlayr, ScenePlayr } from "sceneplayr";
import { IStateHoldr, StateHoldr } from "stateholdr";
import { IUserWrappr, UserWrappr } from "userwrappr";
import { Actions } from "./components/Actions";
import { Battles } from "./components/Battles";
@@ -281,7 +275,7 @@ export class FullScreenPokemon extends GameStartr {
this.groupHolder.getGroup("Solid") as IThing[],
this.groupHolder.getGroup("Scenery") as IThing[],
this.groupHolder.getGroup("Character") as IThing[],
this.groupHolder.getGroup("Text") as IThing[]
this.groupHolder.getGroup("Text") as IThing[],
]);
this.gameplay.gameStart();
@@ -296,7 +290,7 @@ export class FullScreenPokemon extends GameStartr {
protected createModuleSettings(settings: IFullScreenPokemonSettings): IModuleSettings {
return {
...new ModuleSettingsGenerator().generate(this),
...settings.moduleSettings
...settings.moduleSettings,
} as IModuleSettings;
}
@@ -326,7 +320,7 @@ export class FullScreenPokemon extends GameStartr {
protected createMenuGrapher(moduleSettings: IModuleSettings, _settings: IFullScreenPokemonSettings): IMenuGraphr {
return new MenuGraphr({
gameStarter: this,
...moduleSettings.menus
...moduleSettings.menus,
});
}
@@ -338,7 +332,7 @@ export class FullScreenPokemon extends GameStartr {
protected createScenePlayer(moduleSettings: IModuleSettings, _settings: IFullScreenPokemonSettings): IScenePlayr {
return new ScenePlayr({
scope: this.cutscenes,
...moduleSettings.scenes
...moduleSettings.scenes,
});
}
@@ -350,7 +344,7 @@ export class FullScreenPokemon extends GameStartr {
protected createStateHolder(moduleSettings: IModuleSettings, _settings: IFullScreenPokemonSettings): IStateHoldr {
return new StateHoldr({
itemsHolder: this.itemsHolder,
...moduleSettings.state
...moduleSettings.state,
});
}
}
+30 -30
View File
@@ -1,6 +1,6 @@
import { Component } from "eightbittr";
import { IMenuDialogRaw } from "menugraphr/lib/IMenuGraphr";
import { ITimeEvent } from "timehandlr/lib/ITimeHandlr";
import { IMenuDialogRaw } from "menugraphr";
import { ITimeEvent } from "timehandlr";
import { FullScreenPokemon } from "../FullScreenPokemon";
import { Following } from "./actions/Following";
@@ -18,7 +18,7 @@ import { IDialog, IDialogOptions } from "./Menus";
import {
IAreaGate, IAreaSpawner, ICharacter, IDetector, IEnemy, IGymDetector, IHMCharacter,
IMenuTriggerer, IPlayer, ISightDetector, IThemeDetector, IThing, ITransporter,
ITransportSchema
ITransportSchema,
} from "./Things";
/**
@@ -43,7 +43,7 @@ export interface IColorFadeSettings {
/**
* A callback for when the animation completes.
*/
callback?: () => void;
callback?(): void;
}
/**
@@ -97,8 +97,8 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.things.names.sightDetector,
{
direction: thing.direction,
width: thing.sight * 8
}
width: thing.sight * 8,
},
]) as ISightDetector;
thing.sightDetector.viewer = thing;
this.animatePositionSightDetector(thing);
@@ -245,7 +245,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
groupType?: string): [IThing, IThing, IThing, IThing] {
const things: IThing[] = [];
for (let i: number = 0; i < 4; i += 1) {
for (let i = 0; i < 4; i += 1) {
things.push(this.gameStarter.things.add([title, settings]));
}
@@ -407,12 +407,12 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
public animateFadeToColor(settings: IColorFadeSettings = {}): IThing {
const color: string = settings.color || "White";
const callback: ((...args: any[]) => void) | undefined = settings.callback;
const change: number = settings.change || .33;
const change: number = settings.change || 0.33;
const speed: number = settings.speed || 4;
const blank: IThing = this.gameStarter.objectMaker.make<IThing>(color + this.gameStarter.things.names.square, {
width: this.gameStarter.mapScreener.width,
height: this.gameStarter.mapScreener.height,
opacity: 0
opacity: 0,
});
this.gameStarter.things.add(blank);
@@ -442,12 +442,12 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
public animateFadeFromColor(settings: IColorFadeSettings = {}, ...args: any[]): IThing {
const color: string = settings.color || "White";
const callback: ((...args: any[]) => void) | undefined = settings.callback;
const change: number = settings.change || .33;
const change: number = settings.change || 0.33;
const speed: number = settings.speed || 4;
const blank: IThing = this.gameStarter.objectMaker.make<IThing>(color + this.gameStarter.things.names.square, {
width: this.gameStarter.mapScreener.width,
height: this.gameStarter.mapScreener.height,
opacity: 1
opacity: 1,
});
this.gameStarter.things.add(blank);
@@ -577,7 +577,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
if (other.gift) {
this.gameStarter.menuGrapher.createMenu("GeneralText", {
deleteOnFinish: true
deleteOnFinish: true,
});
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText",
@@ -657,7 +657,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
(callbackDialog as IDialog).cutscene!,
{
player: thing,
tirggerer: other
tirggerer: other,
});
}
}
@@ -665,7 +665,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
return (): void => {
this.gameStarter.menuGrapher.deleteMenu("Yes/No");
this.gameStarter.menuGrapher.createMenu("GeneralText", {
"deleteOnFinish": true
deleteOnFinish: true,
});
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText", words, callback);
@@ -678,20 +678,20 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.menuGrapher.createMenu("Yes/No", {
position: {
offset: {
left: 28
}
}
left: 28,
},
},
});
this.gameStarter.menuGrapher.addMenuList("Yes/No", {
options: [
{
text: "YES",
callback: generateCallback(options.Yes)
callback: generateCallback(options.Yes),
},
{
text: "NO",
callback: generateCallback(options.No)
}]
callback: generateCallback(options.No),
}],
});
this.gameStarter.menuGrapher.setActiveMenu("Yes/No");
}
@@ -724,7 +724,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
if (other.cutscene) {
this.gameStarter.scenePlayer.startCutscene(other.cutscene, {
player: thing,
triggerer: other
triggerer: other,
});
}
@@ -765,7 +765,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.scenePlayer.startCutscene(other.cutscene!, {
player: thing,
triggerer: other
triggerer: other,
});
}
@@ -815,7 +815,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
thing,
[
...other.pushSteps,
complete
complete,
]);
} else {
complete();
@@ -846,7 +846,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.scenePlayer.startCutscene("TrainerSpotted", {
player: thing,
sightDetector: other,
triggerer: other.viewer
triggerer: other.viewer,
});
}
@@ -890,7 +890,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
this.animateFadeToColor({
callback,
color: "Black"
color: "Black",
});
}
@@ -910,7 +910,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
const leader: string = other.leader;
const dialog: string[] = [
`${gym.toUpperCase()}\n %%%%%%%POKEMON%%%%%%% GYM \n LEADER: ${leader.toUpperCase()}`,
"WINNING TRAINERS: %%%%%%%RIVAL%%%%%%%"
"WINNING TRAINERS: %%%%%%%RIVAL%%%%%%%",
];
if (this.gameStarter.itemsHolder.getItem("badges")[leader]) {
@@ -1116,8 +1116,8 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
return;
}
let xvel: number = 0;
let yvel: number = 0;
let xvel = 0;
let yvel = 0;
switch (player.direction) {
case 0:
@@ -1145,7 +1145,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
1,
8);
for (let i: number = 0; i < boulder.bordering.length; i += 1) {
for (let i = 0; i < boulder.bordering.length; i += 1) {
boulder.bordering[i] = undefined;
}
}
@@ -1167,7 +1167,7 @@ export class Actions<TGameStartr extends FullScreenPokemon> extends Component<TG
player.bordering[player.direction] = undefined;
this.gameStarter.graphics.addClass(player, "surfing");
console.log("Should start walking");
// this.animateCharacterStartWalking(player, player.direction, [1]);
// This.animateCharacterStartWalking(player, player.direction, [1]);
player.surfing = true;
}
}
+11 -12
View File
@@ -1,7 +1,6 @@
import { IActor, IStatistic, IStatistics } from "battlemovr/lib/Actors";
import { IOnBattleComplete } from "battlemovr/lib/Animations";
import { IBattleInfo as IBattleInfoBase } from "battlemovr/lib/Battles";
import { ITeamBase, ITeamDescriptor, IUnderEachTeam, Team } from "battlemovr/lib/Teams";
import {
IActor, IBattleInfo as IBattleInfoBase, IOnBattleComplete, IStatistic, IStatistics, ITeamBase, ITeamDescriptor, IUnderEachTeam, Team,
} from "battlemovr";
import { Component } from "eightbittr";
import { FullScreenPokemon } from "../FullScreenPokemon";
@@ -371,36 +370,36 @@ export class Battles<TGameStartr extends FullScreenPokemon> extends Component<TG
{},
{
...this.gameStarter.constants.battles.texts.defaultBattleTexts,
...partialBattleOptions.texts
...partialBattleOptions.texts,
});
const teams: IUnderEachTeam<ITeamDescriptor> = {
opponent: {
actors: [],
selector: "opponent"
selector: "opponent",
},
player: {
actors: this.gameStarter.itemsHolder.getItem("PokemonInParty") as IPokemon[],
leader: {
nickname: this.gameStarter.itemsHolder.getItem("name"),
title: "PlayerBack".split("")
title: "PlayerBack".split(""),
},
selector: "player"
}
selector: "player",
},
};
if (partialBattleOptions.teams) {
if (partialBattleOptions.teams.opponent) {
teams.opponent = {
...teams.opponent,
...partialBattleOptions.teams.opponent
...partialBattleOptions.teams.opponent,
} as ITeamDescriptor;
}
if (partialBattleOptions.teams.player) {
teams.player = {
...teams.player,
...partialBattleOptions.teams.player
...partialBattleOptions.teams.player,
};
}
}
@@ -410,7 +409,7 @@ export class Battles<TGameStartr extends FullScreenPokemon> extends Component<TG
fleeAttempts: 0,
teams,
texts,
theme: "Battle Trainer"
theme: "Battle Trainer",
} as IBattleOptions;
}
}
+62
View File
@@ -0,0 +1,62 @@
import { expect } from "chai";
import { stubBlankGame } from "../fakes.test";
import { ICharacter } from "./Things";
describe("Collisions", () => {
describe("isCharacterTouchingCharacter", () => {
const stubCharacterType: [string, any] = ["Lady", {
width: 8,
height: 12,
}];
it("returns true when characters are touching", (): void => {
// Arrange
const fsp = stubBlankGame();
const isCharacterTouchingCharacter = fsp.collisions.generateIsCharacterTouchingCharacter();
const a = fsp.things.add<ICharacter>(stubCharacterType);
const b = fsp.things.add<ICharacter>(stubCharacterType);
fsp.physics.setTop(b, a.bottom);
// Act
const touching: boolean = isCharacterTouchingCharacter(a, b);
// Assert
expect(touching).to.be.equal(true);
});
it("returns false when characters aren't touching", (): void => {
// Arrange
const fsp = stubBlankGame();
const isCharacterTouchingCharacter = fsp.collisions.generateIsCharacterTouchingCharacter();
const a = fsp.things.add<ICharacter>(stubCharacterType);
const b = fsp.things.add<ICharacter>(stubCharacterType);
fsp.physics.setTop(b, a.bottom + 28);
// Act
const touching: boolean = isCharacterTouchingCharacter(a, b);
// Assert
expect(touching).to.be.equal(false);
});
it("returns false when a character is following another", (): void => {
// Arrange
const fsp = stubBlankGame();
const isCharacterTouchingCharacter = fsp.collisions.generateIsCharacterTouchingCharacter();
const a = fsp.things.add<ICharacter>(stubCharacterType);
const b = fsp.things.add<ICharacter>(stubCharacterType);
fsp.physics.setTop(b, a.bottom);
fsp.actions.following.startFollowing(b, a);
// Act
const touching: boolean = isCharacterTouchingCharacter(a, b);
// Assert
expect(touching).to.be.equal(false);
});
});
});
+14 -14
View File
@@ -1,5 +1,5 @@
import { Component } from "eightbittr";
import { IMenuDialogRaw } from "menugraphr/lib/IMenuGraphr";
import { IMenuDialogRaw } from "menugraphr";
import { FullScreenPokemon } from "../FullScreenPokemon";
import { Direction } from "./Constants";
@@ -225,8 +225,8 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
if (other.cutscene) {
this.gameStarter.scenePlayer.startCutscene(other.cutscene, {
thing: thing,
triggerer: other
thing,
triggerer: other,
});
}
@@ -248,13 +248,13 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
if (!this.gameStarter.menuGrapher.getActiveMenu()) {
this.gameStarter.menuGrapher.createMenu("GeneralText", {
deleteOnFinish: !other.dialogOptions
deleteOnFinish: !other.dialogOptions,
});
this.gameStarter.menuGrapher.setActiveMenu("GeneralText");
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText",
dialog,
(): void => this.gameStarter.actions.animateCharacterDialogFinish(thing, other)
(): void => this.gameStarter.actions.animateCharacterDialogFinish(thing, other),
);
}
@@ -280,15 +280,15 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText",
[
"%%%%%%%PLAYER%%%%%%% found " + other.item + "!"
"%%%%%%%PLAYER%%%%%%% found " + other.item + "!",
],
(): void => {
this.gameStarter.menuGrapher.deleteActiveMenu();
this.gameStarter.physics.killNormal(other);
this.gameStarter.stateHolder.addChange(
other.id, "alive", false
other.id, "alive", false,
);
}
},
);
this.gameStarter.menuGrapher.setActiveMenu("GeneralText");
@@ -302,7 +302,7 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
this.gameStarter.scenePlayer.startCutscene(other.cutscene, {
player: thing,
triggerer: other
triggerer: other,
});
if (other.routine) {
this.gameStarter.scenePlayer.playRoutine(other.routine);
@@ -329,18 +329,18 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
case "yes/no":
this.gameStarter.menuGrapher.createMenu("Yes/No", {
killOnB: ["GeneralText"]
killOnB: ["GeneralText"],
});
this.gameStarter.menuGrapher.addMenuList("Yes/No", {
options: [
{
text: "YES",
callback: (): void => console.log("What do, yes?")
callback: (): void => console.log("What do, yes?"),
},
{
text: "NO",
callback: (): void => console.log("What do, no?")
}]
callback: (): void => console.log("What do, no?"),
}],
});
this.gameStarter.menuGrapher.setActiveMenu("Yes/No");
break;
@@ -415,7 +415,7 @@ export class Collisions<TGameStartr extends FullScreenPokemon> extends Component
this.gameStarter.actions.walking.startWalkingOnPath(thing, [{
blocks: 2,
direction: thing.direction
direction: thing.direction,
}]);
thing.surfing = false;
this.gameStarter.graphics.removeClass(thing, "surfing");
+6 -6
View File
@@ -36,7 +36,7 @@ export enum Direction {
Top = 0,
Right = 1,
Bottom = 2,
Left = 3
Left = 3,
}
/**
@@ -45,7 +45,7 @@ export enum Direction {
export enum PokedexListingStatus {
Unknown = 0,
Caught = 1,
Seen = 2
Seen = 2,
}
/**
@@ -103,7 +103,7 @@ export class Constants<TGameStartr extends FullScreenPokemon> extends Component<
"F", "O", "X", "[", "/",
"G", "P", "Y", "]", ".",
"H", "Q", "Z", "Poke", ",",
"I", "R", " ", "Mon", "ED"
"I", "R", " ", "Mon", "ED",
];
/**
@@ -118,7 +118,7 @@ export class Constants<TGameStartr extends FullScreenPokemon> extends Component<
"f", "o", "x", "[", "/",
"g", "p", "y", "]", ".",
"h", "q", "z", "Poke", ",",
"i", "r", " ", "Mon", "ED"
"i", "r", " ", "Mon", "ED",
];
/**
@@ -132,7 +132,7 @@ export class Constants<TGameStartr extends FullScreenPokemon> extends Component<
Bottom: "Top",
bottom: "top",
Left: "Right",
left: "right"
left: "right",
};
/**
@@ -142,7 +142,7 @@ export class Constants<TGameStartr extends FullScreenPokemon> extends Component<
top: Direction.Top,
right: Direction.Right,
bottom: Direction.Bottom,
left: Direction.Left
left: Direction.Left,
};
/**
+83
View File
@@ -0,0 +1,83 @@
import { expect } from "chai";
import { stubBlankGame } from "../fakes.test";
import { IPokemon } from "./Battles";
import { IPokemonEvolution, IPokemonEvolutionByLevel } from "./constants/Pokemon";
describe("Equations", () => {
describe("levelup", () => {
it("evolves a Pokemon at exactly its level requirement", (): void => {
// Arrange
const fsp = stubBlankGame();
const pokemonTitle: string[] = "CHARMANDER".split("");
const evolutions: IPokemonEvolution[] = fsp.constants.pokemon.byName[pokemonTitle.join("")].evolutions!;
const pokemonLevel: number = (evolutions[0].requirements[0] as IPokemonEvolutionByLevel).level - 1;
// Act
const pokemon: IPokemon = fsp.equations.newPokemon({
level: pokemonLevel,
title: pokemonTitle,
});
fsp.experience.levelup(pokemon);
// Assert
expect(pokemon.title.toString()).to.be.equal("CHARMELEON".split("").toString());
});
it("evolves a Pokemon that exceeds its level requirement", (): void => {
// Arrange
const fsp = stubBlankGame();
const pokemonTitle: string[] = "CHARMANDER".split("");
const evolutions: IPokemonEvolution[] = fsp.constants.pokemon.byName[pokemonTitle.join("")].evolutions!;
const pokemonLevel: number = (evolutions[0].requirements[0] as IPokemonEvolutionByLevel).level + 1;
// Act
const pokemon: IPokemon = fsp.equations.newPokemon({
level: pokemonLevel,
title: pokemonTitle,
});
fsp.experience.levelup(pokemon);
// Assert
expect(pokemon.title.toString()).to.be.equal("CHARMELEON".split("").toString());
});
it("does not evolve a Pokemon that has not yet reached its level requirement", (): void => {
// Arrange
const fsp = stubBlankGame();
const pokemonTitle: string[] = "CHARMANDER".split("");
const evolutions: IPokemonEvolution[] = fsp.constants.pokemon.byName[pokemonTitle.join("")].evolutions!;
const pokemonLevel: number = (evolutions[0].requirements[0] as IPokemonEvolutionByLevel).level - 2;
// Act
const pokemon: IPokemon = fsp.equations.newPokemon({
level: pokemonLevel,
title: pokemonTitle,
});
fsp.experience.levelup(pokemon);
// Assert
expect(pokemon.title.toString()).to.be.equal("CHARMANDER".split("").toString());
});
});
describe("newPokemon", () => {
const pokemonTitle: string[] = "CHARMANDER".split("");
it("gives a new Pokemon a provided item", (): void => {
// Arrange
const fsp = stubBlankGame();
const chosenItem = "Potion".split("");
// Act
const pokemon = fsp.equations.newPokemon({
level: 1,
title: pokemonTitle,
item: chosenItem,
});
// Assert
expect(pokemon.item).to.deep.equal(chosenItem);
});
});
});
+12 -12
View File
@@ -1,4 +1,4 @@
import { IMove, IStatistic } from "battlemovr/lib/Actors";
import { IMove, IStatistic } from "battlemovr";
import { Component } from "eightbittr";
import { FullScreenPokemon } from "../FullScreenPokemon";
@@ -33,7 +33,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
* @returns The average level of the Pokemon.
*/
public averageLevel(pokemon: IPokemon[]): number {
let average: number = 0;
let average = 0;
for (const actor of pokemon) {
average += actor.level;
@@ -47,7 +47,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
* @returns The average level from among the schemas.
*/
public averageLevelWildPokemon(options: IWildPokemonSchema[]): number {
let average: number = 0;
let average = 0;
for (const wildPokemon of options) {
if (wildPokemon.level) {
@@ -59,7 +59,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
throw new Error("Wild Pokemon must have wither .level of .levels defined.");
}
let levelAverage: number = 0;
let levelAverage = 0;
for (const level of wildPokemon.levels) {
levelAverage += level * (1 / wildPokemon.levels.length);
@@ -79,7 +79,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
*/
public chooseRandomWildPokemon(options: IWildPokemonSchema[]): IWildPokemonSchema {
const choice: number = this.gameStarter.numberMaker.random();
let sum: number = 0;
let sum = 0;
for (const option of options) {
sum += option.rate!;
@@ -120,7 +120,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
nickname: chosenInfo.title,
statistics: this.newPokemonStatistics(chosenInfo.title, chosenInfo.level || 1, ev, iv),
title: chosenInfo.title,
types: this.gameStarter.constants.pokemon.byName[chosenInfo.title.join("")].types
types: this.gameStarter.constants.pokemon.byName[chosenInfo.title.join("")].types,
};
}
@@ -172,7 +172,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
newMove = {
title: move.move,
remaining: this.gameStarter.constants.moves.byName[move.move].PP,
uses: this.gameStarter.constants.moves.byName[move.move].PP
uses: this.gameStarter.constants.moves.byName[move.move].PP,
};
output.push(newMove);
@@ -194,7 +194,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
defense: this.gameStarter.numberMaker.randomIntWithin(0, 15),
health: 0,
speed: this.gameStarter.numberMaker.randomIntWithin(0, 15),
special: this.gameStarter.numberMaker.randomIntWithin(0, 15)
special: this.gameStarter.numberMaker.randomIntWithin(0, 15),
};
}
@@ -209,7 +209,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
defense: 0,
health: 0,
speed: 0,
special: 0
special: 0,
};
}
@@ -230,7 +230,7 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
return {
current: normal,
normal
normal,
};
}
@@ -430,14 +430,14 @@ export class Equations<TGameStartr extends FullScreenPokemon> extends Component<
const a: number = opponent.category === "Trainer" ? 1.5 : 1;
// b is the base experience yield of the fainted Pokemon's species
const b: number = 64; // (Bulbasaur) Todo: add this in
const b = 64; // (Bulbasaur) Todo: add this in
// lf is the level of the fainted Pokemon
const lf: number = opponent.selectedActor.level;
// s is equal to (in Gen I), if Exp. All is not in the player's Bag...
// Todo: Account for modifies like Exp. All
const s: number = 1;
const s = 1;
// t is equal to 1 if the winning Pokemon's curent owner is its OT, or 1.5 if the Pokemon was gained in a domestic trade
const t: number = player.selectedActor.traded ? 1.5 : 1;
+9 -21
View File
@@ -4,7 +4,7 @@ import { FullScreenPokemon } from "../FullScreenPokemon";
import { IPokemon } from "./Battles";
import {
IPokemonEvolution, IPokemonEvolutionByItem, IPokemonEvolutionByLevel,
IPokemonEvolutionByStats, IPokemonEvolutionByTrade, IPokemonEvolutionRequirement
IPokemonEvolutionByStats, IPokemonEvolutionByTrade, IPokemonEvolutionRequirement,
} from "./constants/Pokemon";
/**
@@ -70,14 +70,7 @@ export interface IRequirementHandlers {
/**
* Handler that takes in a pokemon and the requirements for its evolution, and outputs if it is eligible to evolve.
*/
export interface IRequirementHandler {
/**
* Outputs true if the input pokemon is ready to evolve, and false otherwise.
*
* @param args Arguments for this evolution check.
*/
(args: IRequirementHandlerArgs<IEvolutionModifier, IPokemonEvolutionRequirement>): boolean;
}
export type IRequirementHandler = (args: IRequirementHandlerArgs<IEvolutionModifier, IPokemonEvolutionRequirement>) => boolean;
/**
* Handles logic related to Pokemon evolution.
@@ -87,9 +80,8 @@ export class Evolution<TGameStartr extends FullScreenPokemon> extends Component<
* Holds evolution requirement checks, keyed by the method of evolution.
*/
private readonly requirementHandlers: IRequirementHandlers = {
level: (args: IRequirementHandlerArgs<IEvolutionModifier, IPokemonEvolutionByLevel>): boolean => {
return args.pokemon.level >= args.requirement.level;
},
level: (args: IRequirementHandlerArgs<IEvolutionModifier, IPokemonEvolutionByLevel>): boolean =>
args.pokemon.level >= args.requirement.level,
item: (args: IRequirementHandlerArgs<IItemModifier, IPokemonEvolutionByItem>): boolean => {
if (args.modifier) {
return args.requirement.item === args.modifier.item.join("");
@@ -104,14 +96,10 @@ export class Evolution<TGameStartr extends FullScreenPokemon> extends Component<
// Trading is not implemented yet (Issue #440)
return false;
},
happiness: (): boolean => {
// currently no happiness value of a Pokemon (Issue #439)
return false;
},
time: (): boolean => {
// Time of day does not seem to be implemented yet (#441)
return false;
},
// No happiness value of a Pokemon yet (Issue #439)
happiness: (): boolean => false,
// Time of day does not seem to be implemented yet (#441)
time: (): boolean => false,
stats: (args: IRequirementHandlerArgs<IEvolutionModifier, IPokemonEvolutionByStats>): boolean => {
const difference: number =
args.pokemon.statistics[args.requirement.greaterStat].normal
@@ -121,7 +109,7 @@ export class Evolution<TGameStartr extends FullScreenPokemon> extends Component<
}
return difference > 0;
}
},
};
/**
+6 -6
View File
@@ -28,12 +28,12 @@ export class Fishing<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.menuGrapher.createMenu("GeneralText", {
deleteOnFinish: true,
ignoreA: true,
ignoreB: true
ignoreB: true,
});
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText",
[
"%%%%%%%PLAYER%%%%%%% used " + rod.title + "!"
"%%%%%%%PLAYER%%%%%%% used " + rod.title + "!",
]);
this.gameStarter.menuGrapher.setActiveMenu("GeneralText");
@@ -50,7 +50,7 @@ export class Fishing<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.actions.animateExclamation(player);
this.gameStarter.fishing.playerLandedFish(player, rod);
},
180
180,
);
}
@@ -70,12 +70,12 @@ export class Fishing<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.timeHandler.addEvent(
(): void => {
this.gameStarter.menuGrapher.createMenu("GeneralText", {
deleteOnFinish: true
deleteOnFinish: true,
});
this.gameStarter.menuGrapher.addMenuDialog(
"GeneralText",
[
"Oh! \n It's a bite!"
"Oh! \n It's a bite!",
],
(): void => {
console.log("Should start battle with", chosenPokemon);
@@ -94,7 +94,7 @@ export class Fishing<TGameStartr extends FullScreenPokemon> extends Component<TG
this.gameStarter.graphics.removeClass(player, "fishing");
this.gameStarter.physics.setWidth(player, 8, true);
},
140
140,
);
}

Some files were not shown because too many files have changed in this diff Show More