Merge branch 'pr/166'

This commit is contained in:
Chacolay 2024-04-29 10:55:04 -04:00
commit 58e9edd014
3 changed files with 31 additions and 3 deletions

View File

@ -2296,6 +2296,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;
@ -5574,7 +5595,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

@ -543,4 +543,4 @@ export function getTypeRgb(type: Type): [ integer, integer, integer ] {
default:
return [ 0, 0, 0 ];
}
}
}

View File

@ -755,9 +755,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;
}