Merge branch 'main' into move/stockpile

pull/410/head^2
Marek Sison 2024-05-06 23:39:51 +08:00
commit 43d46c07bf
7 changed files with 64 additions and 13 deletions

View File

@ -146,14 +146,14 @@
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 3,
"h": 3
"w": 66,
"h": 55
},
"frame": {
"x": 132,
"y": 0,
"w": 3,
"h": 3
"x": 0,
"y": 112,
"w": 66,
"h": 55
}
},
{

View File

@ -3453,7 +3453,8 @@ export function initAbilities() {
.attr(UncopiableAbilityAbAttr)
.attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr),
.attr(NoFusionAbilityAbAttr)
.condition((pokemon) => !pokemon.isTerastallized()),
new Ability(Abilities.QUICK_DRAW, 8)
.unimplemented(),
new Ability(Abilities.UNSEEN_FIST, 8)

View File

@ -2526,6 +2526,27 @@ export class HiddenPowerTypeAttr extends VariableMoveTypeAttr {
}
}
export class MatchUserTypeAttr extends VariableMoveTypeAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const type = (args[0] as Utils.IntegerHolder);
const userTypes = user.getTypes(true);
if(userTypes.includes(Type.STELLAR)) { // will not change to stellar type
const nonTeraTypes = user.getTypes();
type.value = nonTeraTypes[0];
return true;
}
else if (userTypes.length > 0) {
type.value = userTypes[0];
return true;
}
else
return false;
}
}
export class VariableMoveTypeMultiplierAttr extends MoveAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
return false;
@ -5980,7 +6001,7 @@ export function initMoves() {
.unimplemented(),
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
.danceMove()
.partial(),
.attr(MatchUserTypeAttr),
new AttackMove(Moves.CORE_ENFORCER, Type.DRAGON, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 7)
.target(MoveTarget.ALL_NEAR_ENEMIES)
.partial(),

View File

@ -778,9 +778,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
types.splice(flyingIndex, 1);
}
if (!types.length)
if (!types.length) // become UNKNOWN if no types are present
types.push(Type.UNKNOWN);
if (types.length > 1 && types.includes(Type.UNKNOWN)) { // remove UNKNOWN if other types are present
const index = types.indexOf(Type.UNKNOWN);
if (index !== -1) {
types.splice(index, 1);
}
}
return types;
}

View File

@ -23,7 +23,7 @@ export const battle: SimpleTranslationEntries = {
"attackHitsCount": `Touché {{count}} fois !`,
"expGain": "{{pokemonName}} gagne\n{{exp}} Points dExp !",
"levelUp": "{{pokemonName}} monte au\nN. {{level}} !",
"learnMove": "{{pokemonName}} apprend \n{{moveName}} !",
"learnMove": "{{pokemonName}} apprend\n{{moveName}} !",
"learnMovePrompt": "{{pokemonName}} veut apprendre\n{{moveName}}.",
"learnMoveLimitReached": "Cependant, {{pokemonName}} connait\ndéjà quatre capacités.",
"learnMoveReplaceQuestion": "Voulez-vous oublier une capacité\net la remplacer par {{moveName}} ?",
@ -33,7 +33,7 @@ export const battle: SimpleTranslationEntries = {
"learnMoveForgetSuccess": "{{pokemonName}} oublie comment\nutiliser {{moveName}}.",
"levelCapUp": "La limite de niveau\na été augmentée à {{levelCap}} !",
"moveNotImplemented": "{{moveName}} nest pas encore implémenté et ne peut pas être sélectionné.",
"moveNoPP": "There's no PP left for\nthis move!",
"moveNoPP": "Il ny a plus de PP pour\ncette capacité !",
"moveDisabled": "{{moveName}} est sous entrave !",
"noPokeballForce": "Une force mystérieuse\nempêche lutilisation des Poké Balls.",
"noPokeballTrainer": "Le Dresseur détourne la Ball\nVoler, cest mal !",

View File

@ -1,5 +1,5 @@
import { expect, describe, it } from "vitest";
import { randomString } from "./utils";
import { randomString, padInt } from "./utils";
import Phaser from "phaser";
@ -19,4 +19,26 @@ describe("utils", () => {
expect(str1).toBe(str2);
});
});
describe("padInt", () => {
it("should return a string", () => {
const result = padInt(1, 10);
expect(typeof result).toBe('string');
});
it("should return a padded result with default padWith", () => {
const result = padInt(1, 3);
expect(result).toBe('001');
});
it("should return a padded result using a custom padWith", () => {
const result = padInt(1, 10, 'yes')
expect(result).toBe('yesyesyes1');
});
it("should return inputted value when zero length is entered", () => {
const result = padInt(1, 0);
expect(result).toBe('1')
})
});
});