mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-12 19:32:17 +02:00
Merge branch 'pagefaultgames:main' into Explosion-testing
This commit is contained in:
commit
cbcf7acf55
@ -2440,6 +2440,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 {
|
export class VariableMoveTypeMultiplierAttr extends MoveAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
return false;
|
return false;
|
||||||
@ -5812,7 +5833,7 @@ export function initMoves() {
|
|||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
|
new AttackMove(Moves.REVELATION_DANCE, Type.NORMAL, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7)
|
||||||
.danceMove()
|
.danceMove()
|
||||||
.partial(),
|
.attr(MatchUserTypeAttr),
|
||||||
new AttackMove(Moves.CORE_ENFORCER, Type.DRAGON, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 7)
|
new AttackMove(Moves.CORE_ENFORCER, Type.DRAGON, MoveCategory.SPECIAL, 100, 100, 10, -1, 0, 7)
|
||||||
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
.target(MoveTarget.ALL_NEAR_ENEMIES)
|
||||||
.partial(),
|
.partial(),
|
||||||
|
@ -778,9 +778,16 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
types.splice(flyingIndex, 1);
|
types.splice(flyingIndex, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!types.length)
|
if (!types.length) // become UNKNOWN if no types are present
|
||||||
types.push(Type.UNKNOWN);
|
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;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { expect, describe, it } from "vitest";
|
import { expect, describe, it } from "vitest";
|
||||||
import { randomString } from "./utils";
|
import { randomString, padInt } from "./utils";
|
||||||
|
|
||||||
import Phaser from "phaser";
|
import Phaser from "phaser";
|
||||||
|
|
||||||
@ -19,4 +19,26 @@ describe("utils", () => {
|
|||||||
expect(str1).toBe(str2);
|
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')
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user