TypeScript data/graphics.js

This commit is contained in:
Guangcong Luo 2018-05-18 17:05:04 -05:00
parent 3adb93c70c
commit 4e7f998afa
12 changed files with 3786 additions and 4864 deletions

View File

@ -13,7 +13,7 @@
["@babel/plugin-transform-block-scoping", {"throwIfClosureRequired": true}],
["@babel/plugin-transform-classes", {"loose": true}],
["@babel/plugin-transform-computed-properties", {"loose": true}],
"@babel/plugin-transform-destructuring",
["@babel/plugin-transform-destructuring", {"loose": true, "useBuiltIns": true}],
["@babel/plugin-transform-for-of", {"assumeArray": true}],
"@babel/plugin-transform-literals",
"@babel/plugin-transform-parameters",

View File

@ -1,9 +1,10 @@
data/*
!data/graphics.js
node_modules/
/js/lib/
/js/battle.js
/js/battledata.js
/js/battle-dex.js
/js/battle-dex-data.js
/js/lib/
/js/battle-animations-moves.js
/js/battle-animations.js

3
.gitignore vendored
View File

@ -4,7 +4,6 @@
/index.php
/index.html
/data/*
!/data/graphics.js
!/data/learnsets-g6.js
node_modules/
eslint-cache/
@ -18,3 +17,5 @@ package-lock.json
/js/battledata.js
/js/battle-dex.js
/js/battle-dex-data.js
/js/battle-animations-moves.js
/js/battle-animations.js

View File

@ -47,6 +47,12 @@ fs.writeFileSync(
fs.readFileSync('src/battle-dex-misc.js')
);
fs.writeFileSync(
'data/graphics.js',
fs.readFileSync('js/battle-animations.js') + '\n\n' +
fs.readFileSync('js/battle-animations-moves.js')
);
/*********************************************************
* Update cachebuster and News
*********************************************************/

View File

@ -1,6 +1,6 @@
{
"name": "pokemon-showdown-client",
"version": "0.11.0",
"version": "0.11.2",
"author": "Guangcong Luo <guangcongluo@gmail.com> (http://guangcongluo.com)",
"homepage": "https://pokemonshowdown.com",
"license": "AGPL-3.0",
@ -9,8 +9,8 @@
"url": "https://github.com/Zarel/Pokemon-Showdown-Client.git"
},
"scripts": {
"test": "eslint --config=.eslintrc.js --cache --cache-file=eslint-cache/base js/ data/graphics.js && eslint --config=build-tools/.eslintrc.js --cache --cache-file=eslint-cache/build build-tools/update build-tools/build-indexes",
"fix": "eslint --config=.eslintrc.js --fix js/ data/graphics.js && eslint --config=build-tools/.eslintrc.js --fix build-tools/update build-tools/build-indexes",
"test": "eslint --config=.eslintrc.js --cache --cache-file=eslint-cache/base js/ && eslint --config=build-tools/.eslintrc.js --cache --cache-file=eslint-cache/build build-tools/update build-tools/build-indexes",
"fix": "eslint --config=.eslintrc.js --fix js/ && eslint --config=build-tools/.eslintrc.js --fix build-tools/update build-tools/build-indexes",
"testcafe": "build-tools/build-indexes && testcafe chrome test/"
},
"dependencies": {

File diff suppressed because it is too large Load Diff

3162
src/battle-animations.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,10 @@
* Larger data has their own files in data/, so this is just for small
* miscellaneous data that doesn't need its own file.
*
* Licensing note: PS's client has complicated licensing:
* - The client as a whole is AGPLv3
* - The battle replay/animation engine (battle-*.ts) by itself is MIT
*
* @author Guangcong Luo <guangcongluo@gmail.com>
* @license MIT
*/

View File

@ -12,6 +12,10 @@
* - a parseText function (for converting chat text to HTML),
* cross-compiled from the server
*
* Licensing note: PS's client has complicated licensing:
* - The client as a whole is AGPLv3
* - The battle replay/animation engine (battle-*.ts) by itself is MIT
*
* @author Guangcong Luo <guangcongluo@gmail.com>
* @license MIT
*/

View File

@ -8,6 +8,10 @@
* code shared between the replay viewer and the client usually ends up
* here.
*
* Licensing note: PS's client has complicated licensing:
* - The client as a whole is AGPLv3
* - The battle replay/animation engine (battle-*.ts) by itself is MIT
*
* @author Guangcong Luo <guangcongluo@gmail.com>
* @license MIT
*/

View File

@ -3,8 +3,12 @@
*
* This is the main file for handling battle animations
*
* Licensing note: PS's client has complicated licensing:
* - The client as a whole is AGPLv3
* - The battle replay/animation engine (battle-*.ts) by itself is MIT
*
* @author Guangcong Luo <guangcongluo@gmail.com>
* @license AGPLv3
* @license MIT
*/
// par: -webkit-filter: sepia(100%) hue-rotate(373deg) saturate(592%);
@ -908,33 +912,33 @@ class Sprite {
if (!this.elem) return;
this.elem.attr('src', sp.url);
this.elem.css(battle.pos({
x: self.x,
y: self.y,
z: self.z,
x: this.x,
y: this.y,
z: this.z,
opacity: 1
}, sp));
return;
}
if (isCustomAnim) {
if (speciesid === 'kyogreprimal') {
BattleOtherAnims.primalalpha.anim(battle, [self]);
BattleOtherAnims.primalalpha.anim(battle, [this]);
doCry = true;
} else if (speciesid === 'groudonprimal') {
BattleOtherAnims.primalomega.anim(battle, [self]);
BattleOtherAnims.primalomega.anim(battle, [this]);
doCry = true;
} else if (speciesid === 'necrozmaultra') {
BattleOtherAnims.ultraburst.anim(battle, [self]);
BattleOtherAnims.ultraburst.anim(battle, [this]);
doCry = true;
} else if (speciesid === 'zygardecomplete') {
BattleOtherAnims.powerconstruct.anim(battle, [self]);
BattleOtherAnims.powerconstruct.anim(battle, [this]);
} else if (speciesid === 'wishiwashischool' || speciesid === 'greninjaash') {
BattleOtherAnims.schoolingin.anim(battle, [self]);
BattleOtherAnims.schoolingin.anim(battle, [this]);
} else if (speciesid === 'wishiwashi') {
BattleOtherAnims.schoolingout.anim(battle, [self]);
BattleOtherAnims.schoolingout.anim(battle, [this]);
} else if (speciesid === 'mimikyubusted' || speciesid === 'mimikyubustedtotem') {
// standard animation
} else {
BattleOtherAnims.megaevo.anim(battle, [self]);
BattleOtherAnims.megaevo.anim(battle, [this]);
doCry = true;
}
}
@ -952,9 +956,9 @@ class Sprite {
}
this.elem.attr('src', sp.url);
this.elem.animate(battle.pos({
x: self.x,
y: self.y,
z: self.z,
x: this.x,
y: this.y,
z: this.z,
opacity: 1
}, sp), 300);
});
@ -1069,7 +1073,7 @@ class Sprite {
this.subElem.delay(300);
this.duringMove = false;
this.elem.add(this.subElem).promise().done(() => {
if (!self.subElem || !self.elem) return;
if (!this.subElem || !this.elem) return;
this.selfAnim({time: 300});
this.subElem.animate(this.battle.pos({
x: this.x,
@ -3617,8 +3621,10 @@ class Battle {
} else if (move.name.slice(0, 2) === 'Z-') {
moveName = moveName.slice(2);
move = Tools.getMove(moveName);
for (let item in window.BattleItems) {
if (BattleItems[item].zMoveType === move.type) pokemon.item = item;
if (window.BattleItems) {
for (let item in BattleItems) {
if (BattleItems[item].zMoveType === move.type) pokemon.item = item;
}
}
}
let pp = (target && target.side !== pokemon.side && toId(target.ability) === 'pressure' ? 2 : 1);

16
src/globals.d.ts vendored
View File

@ -18,14 +18,14 @@ declare var BattleItems: any;
declare var BattleAliases: any;
declare var BattleFormats: any;
declare var BattleStatuses: any;
declare var BattleMoveAnims: any;
declare var BattleStatusAnims: any;
declare var BattleOtherAnims: any;
declare var BattleBackdrops: any;
declare var BattleBackdropsThree: any;
declare var BattleBackdropsFour: any;
declare var BattleBackdropsFive: any;
declare var BattleEffects: any;
// declare var BattleMoveAnims: any;
// declare var BattleStatusAnims: any;
// declare var BattleOtherAnims: any;
// declare var BattleBackdrops: any;
// declare var BattleBackdropsThree: any;
// declare var BattleBackdropsFour: any;
// declare var BattleBackdropsFive: any;
// declare var BattleEffects: any;
declare var BattlePokemonSprites: any;
declare var BattlePokemonSpritesBW: any;