Add DNA splicers and Pokemon fusing

This commit is contained in:
Flashfyre committed 2023-11-04 00:32:12 -04:00
1 parent 0ad1a9d25a
commit e07339e3eb
22 files changed
+879 -485

No files matched your search

+2 -1
View File
@@ -271,7 +271,8 @@ export default class BattleInfo extends Phaser.GameObjects.Container {
ratio = 0;
instant = true;
}
let duration = this.visible && !instant ? ((levelExp - this.lastLevelExp) / relLevelExp) * 1650 : 0;
const durationMultiplier = Phaser.Tweens.Builders.GetEaseFunction('Sine.easeIn')(1 - (Math.max(this.lastLevel - 100, 0) / 150));
let duration = this.visible && !instant ? (((levelExp - this.lastLevelExp) / relLevelExp) * 1650) * durationMultiplier : 0;
if (duration)
(this.scene as BattleScene).playSound('exp');
this.scene.tweens.add({
+26 -4
View File
@@ -21,6 +21,7 @@ export enum PartyUiMode {
MOVE_MODIFIER,
TM_MODIFIER,
MODIFIER_TRANSFER,
SPLICE,
RELEASE
}
@@ -31,6 +32,7 @@ export enum PartyOption {
APPLY,
TEACH,
TRANSFER,
SPLICE,
SUMMARY,
RELEASE,
MOVE_1,
@@ -41,6 +43,7 @@ export enum PartyOption {
export type PartySelectCallback = (cursor: integer, option: PartyOption) => void;
export type PartyModifierTransferSelectCallback = (fromCursor: integer, index: integer, toCursor?: integer) => void;
export type PartyModifierSpliceSelectCallback = (fromCursor: integer, toCursor?: integer) => void;
export type PokemonSelectFilter = (pokemon: PlayerPokemon) => string;
export type PokemonModifierTransferSelectFilter = (pokemon: PlayerPokemon, modifier: PokemonHeldItemModifier) => string;
export type PokemonMoveSelectFilter = (pokemonMove: PokemonMove) => string;
@@ -200,9 +203,9 @@ export default class PartyUiHandler extends MessageUiHandler {
} else if ((option !== PartyOption.SUMMARY && option !== PartyOption.RELEASE && option !== PartyOption.CANCEL)
|| (option === PartyOption.RELEASE && this.partyUiMode === PartyUiMode.RELEASE)) {
let filterResult: string;
if (option !== PartyOption.TRANSFER) {
if (option !== PartyOption.TRANSFER && option !== PartyOption.SPLICE) {
filterResult = (this.selectFilter as PokemonSelectFilter)(pokemon);
if (filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER)
if (option === PartyOption.TRANSFER && filterResult === null && this.partyUiMode === PartyUiMode.MOVE_MODIFIER)
filterResult = this.moveSelectFilter(pokemon.moveset[this.optionsCursor]);
} else {
const itemModifiers = this.scene.findModifiers(m => m instanceof PokemonHeldItemModifier
@@ -210,11 +213,19 @@ export default class PartyUiHandler extends MessageUiHandler {
filterResult = (this.selectFilter as PokemonModifierTransferSelectFilter)(pokemon, itemModifiers[this.transferOptionCursor]);
}
if (filterResult === null) {
this.clearOptions();
if (this.partyUiMode !== PartyUiMode.SPLICE)
this.clearOptions();
if (this.selectCallback) {
if (option === PartyOption.TRANSFER) {
(this.selectCallback as PartyModifierTransferSelectCallback)(this.transferCursor, this.transferOptionCursor, this.cursor);
this.clearTransfer();
} else if (this.partyUiMode === PartyUiMode.SPLICE) {
if (option === PartyOption.SPLICE) {
(this.selectCallback as PartyModifierSpliceSelectCallback)(this.transferCursor, this.cursor);
this.clearTransfer();
} else
this.startTransfer();
this.clearOptions();
} else if (option === PartyOption.RELEASE)
this.doRelease(this.cursor);
else {
@@ -276,7 +287,7 @@ export default class PartyUiHandler extends MessageUiHandler {
this.processInput(Button.CANCEL);
return;
} else if (button === Button.CANCEL) {
if (this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER && this.transferMode) {
if ((this.partyUiMode === PartyUiMode.MODIFIER_TRANSFER || this.partyUiMode === PartyUiMode.SPLICE) && this.transferMode) {
this.clearTransfer();
ui.playSelect();
} else if (this.partyUiMode !== PartyUiMode.FAINT_SWITCH) {
@@ -404,6 +415,10 @@ export default class PartyUiHandler extends MessageUiHandler {
if (!this.transferMode)
optionsMessage = 'Select a held item to transfer.';
break;
case PartyUiMode.SPLICE:
if (!this.transferMode)
optionsMessage = 'Select another Pokémon to splice.';
break;
}
this.showText(optionsMessage, 0);
@@ -441,6 +456,13 @@ export default class PartyUiHandler extends MessageUiHandler {
case PartyUiMode.MODIFIER_TRANSFER:
this.options.push(PartyOption.TRANSFER);
break;
case PartyUiMode.SPLICE:
if (this.transferMode) {
if (this.cursor !== this.transferCursor)
this.options.push(PartyOption.SPLICE);
} else
this.options.push(PartyOption.APPLY);
break;
case PartyUiMode.RELEASE:
this.options.push(PartyOption.RELEASE);
break;
+17 -7
View File
@@ -100,19 +100,19 @@ export default class SummaryUiHandler extends UiHandler {
this.pokemonSprite = this.scene.add.sprite(56, -106, `pkmn__sub`);
this.summaryContainer.add(this.pokemonSprite);
this.nameText = addTextObject(this.scene, 6, -39, '', TextStyle.SUMMARY);
this.nameText.setOrigin(0, 1);
this.nameText = addTextObject(this.scene, 6, -54, '', TextStyle.SUMMARY);
this.nameText.setOrigin(0, 0);
this.summaryContainer.add(this.nameText);
this.pokeball = this.scene.add.sprite(6, -23, 'pb');
this.pokeball = this.scene.add.sprite(6, -19, 'pb');
this.pokeball.setOrigin(0, 1);
this.summaryContainer.add(this.pokeball);
this.levelText = addTextObject(this.scene, 36, -22, '', TextStyle.SUMMARY);
this.levelText = addTextObject(this.scene, 36, -18, '', TextStyle.SUMMARY);
this.levelText.setOrigin(0, 1);
this.summaryContainer.add(this.levelText);
this.genderText = addTextObject(this.scene, 96, -22, '', TextStyle.SUMMARY);
this.genderText = addTextObject(this.scene, 96, -18, '', TextStyle.SUMMARY);
this.genderText.setOrigin(0, 1);
this.summaryContainer.add(this.genderText);
@@ -199,7 +199,17 @@ export default class SummaryUiHandler extends UiHandler {
this.pokemonSprite.play(this.pokemon.getSpriteKey(true));
this.pokemon.cry();
this.nameText.setText(this.pokemon.name);
let nameLabel = this.pokemon.name;
if (this.pokemon.fusionSpecies)
nameLabel += `/\n ${this.pokemon.fusionSpecies.name}`;
this.nameText.setText(nameLabel);
this.nameText.setFontSize(`${!this.pokemon.fusionSpecies ? '96px' : '72px'}`);
const nameShadowSize = !this.pokemon.fusionSpecies ? 6 : 4.5;
this.nameText.setShadowOffset(nameShadowSize, nameShadowSize);
this.nameText.setLineSpacing(!this.pokemon.fusionSpecies ? 5 : 0);
this.pokeball.setFrame(getPokeballAtlasKey(this.pokemon.pokeball));
this.levelText.setText(this.pokemon.level.toString());
this.genderText.setText(getGenderSymbol(this.pokemon.getGender(true)));
@@ -478,7 +488,7 @@ export default class SummaryUiHandler extends UiHandler {
if (this.pokemon.species.type2)
profileContainer.add(getTypeIcon(1, this.pokemon.species.type2));
const ability = abilities[this.pokemon.species.getAbility(this.pokemon.abilityIndex)];
const ability = this.pokemon.getAbility();
const abilityNameText = addTextObject(this.scene, 7, 66, ability.name, TextStyle.SUMMARY);
abilityNameText.setOrigin(0, 1);
-1
View File
@@ -101,7 +101,6 @@ export function getTextColor(textStyle: TextStyle, shadow?: boolean) {
}
export function getModifierTierTextTint(tier: integer): integer {
console.log(tier);
switch (tier) {
case 0: // ModifierTier.COMMON:
return 0xffffff;