Commit old stashed changes

This commit is contained in:
Xavion3 2025-01-28 14:54:57 +11:00
parent 2593d0206c
commit 885fac7d18
16 changed files with 439 additions and 35 deletions

View File

@ -0,0 +1,158 @@
{ "frames": {
"unknown": {
"frame": { "x": 0, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"bug": {
"frame": { "x": 18, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"dark": {
"frame": { "x": 36, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"dragon": {
"frame": { "x": 54, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"electric": {
"frame": { "x": 72, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fairy": {
"frame": { "x": 0, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fighting": {
"frame": { "x": 18, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fire": {
"frame": { "x": 36, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"flying": {
"frame": { "x": 54, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ghost": {
"frame": { "x": 72, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"grass": {
"frame": { "x": 0, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ground": {
"frame": { "x": 18, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ice": {
"frame": { "x": 36, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"normal": {
"frame": { "x": 54, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"poison": {
"frame": { "x": 72, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"psychic": {
"frame": { "x": 0, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"rock": {
"frame": { "x": 18, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"steel": {
"frame": { "x": 36, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"water": {
"frame": { "x": 54, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"stellar": {
"frame": { "x": 72, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
}
},
"meta": {
"app": "https://www.aseprite.org/",
"version": "1.3.7-dev",
"image": "button_tera.png",
"format": "RGBA8888",
"size": { "w": 90, "h": 84 },
"scale": "1",
"frameTags": [
],
"layers": [
{ "name": "Sprite Sheet", "opacity": 255, "blendMode": "normal" }
],
"slices": [
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,158 @@
{ "frames": {
"unknown": {
"frame": { "x": 0, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"bug": {
"frame": { "x": 18, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"dark": {
"frame": { "x": 36, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"dragon": {
"frame": { "x": 54, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"electric": {
"frame": { "x": 72, "y": 0, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fairy": {
"frame": { "x": 0, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fighting": {
"frame": { "x": 18, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"fire": {
"frame": { "x": 36, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"flying": {
"frame": { "x": 54, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ghost": {
"frame": { "x": 72, "y": 21, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"grass": {
"frame": { "x": 0, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ground": {
"frame": { "x": 18, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"ice": {
"frame": { "x": 36, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"normal": {
"frame": { "x": 54, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"poison": {
"frame": { "x": 72, "y": 42, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"psychic": {
"frame": { "x": 0, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"rock": {
"frame": { "x": 18, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"steel": {
"frame": { "x": 36, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"water": {
"frame": { "x": 54, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
},
"stellar": {
"frame": { "x": 72, "y": 63, "w": 18, "h": 21 },
"rotated": false,
"trimmed": true,
"spriteSourceSize": { "x": 1, "y": 1, "w": 18, "h": 21 },
"sourceSize": { "w": 20, "h": 23 }
}
},
"meta": {
"app": "https://www.aseprite.org/",
"version": "1.3.7-dev",
"image": "button_tera.png",
"format": "RGBA8888",
"size": { "w": 90, "h": 84 },
"scale": "1",
"frameTags": [
],
"layers": [
{ "name": "Sprite Sheet", "opacity": 255, "blendMode": "normal" }
],
"slices": [
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -68,6 +68,7 @@ export interface TurnCommand {
targets?: BattlerIndex[]; targets?: BattlerIndex[];
skip?: boolean; skip?: boolean;
args?: any[]; args?: any[];
preturnCommands?: Command[];
} }
export interface FaintLogEntry { export interface FaintLogEntry {

View File

@ -1307,7 +1307,7 @@ export class PokemonTypeChangeAbAttr extends PreAttackAbAttr {
applyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean { applyPreAttack(pokemon: Pokemon, passive: boolean, simulated: boolean, defender: Pokemon, move: Move, args: any[]): boolean {
if ( if (
!pokemon.isTerastallized() && !pokemon.isTerastallized &&
move.id !== Moves.STRUGGLE && move.id !== Moves.STRUGGLE &&
/** /**
* Skip moves that call other moves because these moves generate a following move that will trigger this ability attribute * Skip moves that call other moves because these moves generate a following move that will trigger this ability attribute
@ -6194,7 +6194,7 @@ export function initAbilities() {
.attr(UnswappableAbilityAbAttr) .attr(UnswappableAbilityAbAttr)
.attr(NoTransformAbilityAbAttr) .attr(NoTransformAbilityAbAttr)
.attr(NoFusionAbilityAbAttr) .attr(NoFusionAbilityAbAttr)
.condition((pokemon) => !pokemon.isTerastallized()), .condition((pokemon) => !pokemon.isTerastallized),
new Ability(Abilities.QUICK_DRAW, 8) new Ability(Abilities.QUICK_DRAW, 8)
.attr(BypassSpeedChanceAbAttr, 30), .attr(BypassSpeedChanceAbAttr, 30),
new Ability(Abilities.UNSEEN_FIST, 8) new Ability(Abilities.UNSEEN_FIST, 8)

View File

@ -2493,7 +2493,7 @@ export class TarShotTag extends BattlerTag {
* @returns whether the tag is applied * @returns whether the tag is applied
*/ */
override canAdd(pokemon: Pokemon): boolean { override canAdd(pokemon: Pokemon): boolean {
return !pokemon.isTerastallized(); return !pokemon.isTerastallized;
} }
override onAdd(pokemon: Pokemon): void { override onAdd(pokemon: Pokemon): void {

View File

@ -4558,7 +4558,7 @@ export class TeraMoveCategoryAttr extends VariableMoveCategoryAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const category = (args[0] as Utils.NumberHolder); const category = (args[0] as Utils.NumberHolder);
if (user.isTerastallized() && user.getEffectiveStat(Stat.ATK, target, move) > user.getEffectiveStat(Stat.SPATK, target, move)) { if (user.isTerastallized && user.getEffectiveStat(Stat.ATK, target, move) > user.getEffectiveStat(Stat.SPATK, target, move)) {
category.value = MoveCategory.PHYSICAL; category.value = MoveCategory.PHYSICAL;
return true; return true;
} }
@ -4585,7 +4585,7 @@ export class TeraBlastPowerAttr extends VariablePowerAttr {
*/ */
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const power = args[0] as Utils.NumberHolder; const power = args[0] as Utils.NumberHolder;
if (user.isTerastallized() && user.getTeraType() === Type.STELLAR) { if (user.isTerastallized && user.getTeraType() === Type.STELLAR) {
power.value = 100; power.value = 100;
return true; return true;
} }
@ -4932,7 +4932,7 @@ export class TeraBlastTypeAttr extends VariableMoveTypeAttr {
return false; return false;
} }
if (user.isTerastallized()) { if (user.isTerastallized) {
moveType.value = user.getTeraType(); // changes move type to tera type moveType.value = user.getTeraType(); // changes move type to tera type
return true; return true;
} }
@ -6267,7 +6267,7 @@ export class RemoveTypeAttr extends MoveEffectAttr {
return false; return false;
} }
if (user.isTerastallized() && user.getTeraType() === this.removedType) { // active tera types cannot be removed if (user.isTerastallized && user.getTeraType() === this.removedType) { // active tera types cannot be removed
return false; return false;
} }
@ -6447,7 +6447,7 @@ export class ChangeTypeAttr extends MoveEffectAttr {
} }
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => !target.isTerastallized() && !target.hasAbility(Abilities.MULTITYPE) && !target.hasAbility(Abilities.RKS_SYSTEM) && !(target.getTypes().length === 1 && target.getTypes()[0] === this.type); return (user, target, move) => !target.isTerastallized && !target.hasAbility(Abilities.MULTITYPE) && !target.hasAbility(Abilities.RKS_SYSTEM) && !(target.getTypes().length === 1 && target.getTypes()[0] === this.type);
} }
} }
@ -6470,7 +6470,7 @@ export class AddTypeAttr extends MoveEffectAttr {
} }
getCondition(): MoveConditionFunc { getCondition(): MoveConditionFunc {
return (user, target, move) => !target.isTerastallized() && !target.getTypes().includes(this.type); return (user, target, move) => !target.isTerastallized && !target.getTypes().includes(this.type);
} }
} }
@ -10887,7 +10887,7 @@ export function initMoves() {
.attr(TeraMoveCategoryAttr) .attr(TeraMoveCategoryAttr)
.attr(TeraBlastTypeAttr) .attr(TeraBlastTypeAttr)
.attr(TeraBlastPowerAttr) .attr(TeraBlastPowerAttr)
.attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1, true, { condition: (user, target, move) => user.isTerastallized() && user.isOfType(Type.STELLAR) }) .attr(StatStageChangeAttr, [ Stat.ATK, Stat.SPATK ], -1, true, { condition: (user, target, move) => user.isTerastallized && user.isOfType(Type.STELLAR) })
.partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */ .partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */
new SelfStatusMove(Moves.SILK_TRAP, Type.BUG, -1, 10, -1, 4, 9) new SelfStatusMove(Moves.SILK_TRAP, Type.BUG, -1, 10, -1, 4, 9)
.attr(ProtectAttr, BattlerTagType.SILK_TRAP) .attr(ProtectAttr, BattlerTagType.SILK_TRAP)
@ -11084,7 +11084,7 @@ export function initMoves() {
new AttackMove(Moves.TERA_STARSTORM, Type.NORMAL, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9) new AttackMove(Moves.TERA_STARSTORM, Type.NORMAL, MoveCategory.SPECIAL, 120, 100, 5, -1, 0, 9)
.attr(TeraMoveCategoryAttr) .attr(TeraMoveCategoryAttr)
.attr(TeraStarstormTypeAttr) .attr(TeraStarstormTypeAttr)
.attr(VariableTargetAttr, (user, target, move) => (user.hasFusionSpecies(Species.TERAPAGOS) || user.species.speciesId === Species.TERAPAGOS) && user.isTerastallized() ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER) .attr(VariableTargetAttr, (user, target, move) => (user.hasFusionSpecies(Species.TERAPAGOS) || user.species.speciesId === Species.TERAPAGOS) && user.isTerastallized ? MoveTarget.ALL_NEAR_ENEMIES : MoveTarget.NEAR_OTHER)
.partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */ .partial(), /** Does not ignore abilities that affect stats, relevant in determining the move's category {@see TeraMoveCategoryAttr} */
new AttackMove(Moves.FICKLE_BEAM, Type.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9) new AttackMove(Moves.FICKLE_BEAM, Type.DRAGON, MoveCategory.SPECIAL, 80, 100, 5, 30, 0, 9)
.attr(PreMoveMessageAttr, doublePowerChanceMessageFunc) .attr(PreMoveMessageAttr, doublePowerChanceMessageFunc)

View File

@ -131,6 +131,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public pokerus: boolean; public pokerus: boolean;
public switchOutStatus: boolean; public switchOutStatus: boolean;
public evoCounter: integer; public evoCounter: integer;
public teraType: Type;
public isTerastallized: boolean;
public fusionSpecies: PokemonSpecies | null; public fusionSpecies: PokemonSpecies | null;
public fusionFormIndex: integer; public fusionFormIndex: integer;
@ -239,6 +241,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
this.fusionCustomPokemonData = dataSource.fusionCustomPokemonData; this.fusionCustomPokemonData = dataSource.fusionCustomPokemonData;
this.usedTMs = dataSource.usedTMs ?? []; this.usedTMs = dataSource.usedTMs ?? [];
this.customPokemonData = new CustomPokemonData(dataSource.customPokemonData); this.customPokemonData = new CustomPokemonData(dataSource.customPokemonData);
this.teraType = dataSource.teraType;
this.isTerastallized = dataSource.isTerastallized;
} else { } else {
this.id = Utils.randSeedInt(4294967296); this.id = Utils.randSeedInt(4294967296);
this.ivs = ivs || Utils.getIvsFromId(this.id); this.ivs = ivs || Utils.getIvsFromId(this.id);
@ -287,6 +291,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0); this.luck = (this.shiny ? this.variant + 1 : 0) + (this.fusionShiny ? this.fusionVariant + 1 : 0);
this.fusionLuck = this.luck; this.fusionLuck = this.luck;
this.teraType = Utils.randSeedItem(this.getTypes(false, false, true));
this.isTerastallized = false;
} }
this.generateName(); this.generateName();
@ -1246,9 +1253,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
public getTypes(includeTeraType = false, forDefend: boolean = false, ignoreOverride: boolean = false): Type[] { public getTypes(includeTeraType = false, forDefend: boolean = false, ignoreOverride: boolean = false): Type[] {
const types: Type[] = []; const types: Type[] = [];
if (includeTeraType) { if (includeTeraType && this.isTerastallized) {
const teraType = this.getTeraType(); const teraType = this.getTeraType();
if (teraType !== Type.UNKNOWN) { if (teraType !== Type.UNKNOWN && !(forDefend && teraType === Type.STELLAR)) { // Stellar tera uses its original types defensively
types.push(teraType); types.push(teraType);
if (forDefend) { if (forDefend) {
return types; return types;
@ -1557,22 +1564,20 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
/** /**
* @returns the pokemon's current tera {@linkcode Type}, or `Type.UNKNOWN` if the pokemon is not terastallized * @returns the pokemon's current tera {@linkcode Type}, or `Type.UNKNOWN` if the pokemon is not terastallized
*/ */
public getTeraType(): Type { getTeraType(): Type {
// I don't think this should be possible anymore, please report if you encounter this. --NightKev return this.teraType;
if (globalScene === undefined) { // this.scene can be undefined for a fainted mon in doubles
console.warn("Pokemon.getTeraType(): Global scene is not defined!"); if (this.scene !== undefined) {
const teraModifier = globalScene.findModifier(m => m instanceof TerastallizeModifier
&& m.pokemonId === this.id && !!m.getBattlesLeft(), this.isPlayer()) as TerastallizeModifier;
// return teraType
if (teraModifier) {
return teraModifier.teraType;
}
}
// if scene is undefined, or if teraModifier is considered false, then return unknown type
return Type.UNKNOWN; return Type.UNKNOWN;
} }
const teraModifier = globalScene.findModifier(m =>
m instanceof TerastallizeModifier
&& m.pokemonId === this.id
&& m.getBattlesLeft() > 0, this.isPlayer()) as TerastallizeModifier;
return teraModifier?.teraType ?? Type.UNKNOWN;
}
public isTerastallized(): boolean {
return this.getTeraType() !== Type.UNKNOWN;
}
public isGrounded(): boolean { public isGrounded(): boolean {
return !!this.getTag(GroundedTag) || (!this.isOfType(Type.FLYING, true, true) && !this.hasAbility(Abilities.LEVITATE) && !this.getTag(BattlerTagType.FLOATING) && !this.getTag(SemiInvulnerableTag)); return !!this.getTag(GroundedTag) || (!this.isOfType(Type.FLYING, true, true) && !this.hasAbility(Abilities.LEVITATE) && !this.getTag(BattlerTagType.FLOATING) && !this.getTag(SemiInvulnerableTag));
@ -1713,7 +1718,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
*/ */
getAttackTypeEffectiveness(moveType: Type, source?: Pokemon, ignoreStrongWinds: boolean = false, simulated: boolean = true, move?: Move): TypeDamageMultiplier { getAttackTypeEffectiveness(moveType: Type, source?: Pokemon, ignoreStrongWinds: boolean = false, simulated: boolean = true, move?: Move): TypeDamageMultiplier {
if (moveType === Type.STELLAR) { if (moveType === Type.STELLAR) {
return this.isTerastallized() ? 2 : 1; return this.isTerastallized ? 2 : 1;
} }
const types = this.getTypes(true, true); const types = this.getTypes(true, true);
const arena = globalScene.arena; const arena = globalScene.arena;
@ -3780,6 +3785,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
resetBattleData(): void { resetBattleData(): void {
this.battleData = new PokemonBattleData(); this.battleData = new PokemonBattleData();
this.isTerastallized = true;
} }
resetBattleSummonData(): void { resetBattleSummonData(): void {

View File

@ -103,6 +103,7 @@ export class LoadingScene extends SceneBase {
this.loadImage("icon_tera", "ui"); this.loadImage("icon_tera", "ui");
this.loadImage("type_tera", "ui"); this.loadImage("type_tera", "ui");
this.loadAtlas("type_bgs", "ui"); this.loadAtlas("type_bgs", "ui");
this.loadAtlas("button_tera", "ui");
this.loadImage("dawn_icon_fg", "ui"); this.loadImage("dawn_icon_fg", "ui");
this.loadImage("dawn_icon_mg", "ui"); this.loadImage("dawn_icon_mg", "ui");

View File

@ -119,6 +119,8 @@ export class CommandPhase extends FieldPhase {
switch (command) { switch (command) {
case Command.FIGHT: case Command.FIGHT:
case Command.TERA:
console.log("Fight From Command", command);
let useStruggle = false; let useStruggle = false;
const turnMove: TurnMove | undefined = (args.length === 2 ? (args[1] as TurnMove) : undefined); const turnMove: TurnMove | undefined = (args.length === 2 ? (args[1] as TurnMove) : undefined);
if (cursor === -1 || if (cursor === -1 ||

34
src/phases/tera-phase.ts Normal file
View File

@ -0,0 +1,34 @@
import type Pokemon from "#app/field/pokemon";
import { getPokemonNameWithAffix } from "#app/messages";
import { BattlePhase } from "./battle-phase";
import i18next from "i18next";
import { globalScene } from "#app/global-scene";
import { Type } from "#app/enums/type";
export class TeraPhase extends BattlePhase {
public pokemon: Pokemon;
constructor(pokemon: Pokemon) {
super();
this.pokemon = pokemon;
}
start() {
super.start();
console.log(this.pokemon.name, "terastallized to", Type[this.pokemon.teraType].toString()); // TODO: Improve log
globalScene.queueMessage(getPokemonNameWithAffix(this.pokemon) + " terrastallized into a " + i18next.t(`pokemonInfo:Type.${Type[this.pokemon.teraType]}`) + " type!"); // TODO: Localize this
// this.scene.unshiftPhase(new CommonAnimPhase(this.scene, this.pokemon.getBattlerIndex(), undefined, CommonAnim.???));
this.end();
}
end() {
this.pokemon.isTerastallized = true;
super.end();
}
}

View File

@ -13,6 +13,7 @@ import type { Biome } from "#enums/biome";
import { Moves } from "#enums/moves"; import { Moves } from "#enums/moves";
import type { Species } from "#enums/species"; import type { Species } from "#enums/species";
import { CustomPokemonData } from "#app/data/custom-pokemon-data"; import { CustomPokemonData } from "#app/data/custom-pokemon-data";
import type { Type } from "#app/enums/type";
export default class PokemonData { export default class PokemonData {
public id: integer; public id: integer;
@ -45,6 +46,8 @@ export default class PokemonData {
public pokerus: boolean; public pokerus: boolean;
public usedTMs: Moves[]; public usedTMs: Moves[];
public evoCounter: integer; public evoCounter: integer;
public teraType: Type;
public isTerastallized: boolean;
public fusionSpecies: Species; public fusionSpecies: Species;
public fusionFormIndex: integer; public fusionFormIndex: integer;
@ -103,6 +106,8 @@ export default class PokemonData {
this.evoCounter = source.evoCounter ?? 0; this.evoCounter = source.evoCounter ?? 0;
} }
this.pokerus = !!source.pokerus; this.pokerus = !!source.pokerus;
this.teraType = (source.teraType || 0) as Type;
this.isTerastallized = source.isTerastallized || false;
this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies; this.fusionSpecies = sourcePokemon ? sourcePokemon.fusionSpecies?.speciesId : source.fusionSpecies;
this.fusionFormIndex = source.fusionFormIndex; this.fusionFormIndex = source.fusionFormIndex;

View File

@ -7,18 +7,22 @@ import { Button } from "#enums/buttons";
import { getPokemonNameWithAffix } from "#app/messages"; import { getPokemonNameWithAffix } from "#app/messages";
import { CommandPhase } from "#app/phases/command-phase"; import { CommandPhase } from "#app/phases/command-phase";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import { TerastallizeAccessModifier } from "#app/modifier/modifier";
export enum Command { export enum Command {
FIGHT = 0, FIGHT = 0,
BALL, BALL,
POKEMON, POKEMON,
RUN RUN,
TERA
} }
export default class CommandUiHandler extends UiHandler { export default class CommandUiHandler extends UiHandler {
private commandsContainer: Phaser.GameObjects.Container; private commandsContainer: Phaser.GameObjects.Container;
private cursorObj: Phaser.GameObjects.Image | null; private cursorObj: Phaser.GameObjects.Image | null;
private teraButton: Phaser.GameObjects.Sprite;
protected fieldIndex: integer = 0; protected fieldIndex: integer = 0;
protected cursor2: integer = 0; protected cursor2: integer = 0;
@ -40,6 +44,12 @@ export default class CommandUiHandler extends UiHandler {
this.commandsContainer.setVisible(false); this.commandsContainer.setVisible(false);
ui.add(this.commandsContainer); ui.add(this.commandsContainer);
this.teraButton = globalScene.add.sprite(-35, 15, "button_tera");
this.teraButton.setName("terrastallize-button");
this.teraButton.setScale(1.8);
this.teraButton.setFrame("fire");
this.commandsContainer.add(this.teraButton);
for (let c = 0; c < commands.length; c++) { for (let c = 0; c < commands.length; c++) {
const commandText = addTextObject(c % 2 === 0 ? 0 : 55.8, c < 2 ? 0 : 16, commands[c], TextStyle.WINDOW); const commandText = addTextObject(c % 2 === 0 ? 0 : 55.8, c < 2 ? 0 : 16, commands[c], TextStyle.WINDOW);
commandText.setName(commands[c]); commandText.setName(commands[c]);
@ -62,6 +72,18 @@ export default class CommandUiHandler extends UiHandler {
commandPhase = globalScene.getStandbyPhase() as CommandPhase; commandPhase = globalScene.getStandbyPhase() as CommandPhase;
} }
if (this.canTera()) {
this.teraButton.setFrame(globalScene.getField()[this.fieldIndex].getTeraType().toString().toLowerCase());
} else {
this.teraButton.setVisible(false);
}
if (this.canTera()) {
this.teraButton.setFrame(globalScene.getField()[this.fieldIndex].getTeraType().toString().toLowerCase());
} else {
this.teraButton.setVisible(false);
}
const messageHandler = this.getUi().getMessageHandler(); const messageHandler = this.getUi().getMessageHandler();
messageHandler.bg.setVisible(true); messageHandler.bg.setVisible(true);
messageHandler.commandWindow.setVisible(true); messageHandler.commandWindow.setVisible(true);
@ -108,6 +130,13 @@ export default class CommandUiHandler extends UiHandler {
(globalScene.getCurrentPhase() as CommandPhase).handleCommand(Command.RUN, 0); (globalScene.getCurrentPhase() as CommandPhase).handleCommand(Command.RUN, 0);
success = true; success = true;
break; break;
case Command.TERA:
if ((globalScene.getCurrentPhase() as CommandPhase).checkFightOverride()) {
return true;
}
ui.setMode(Mode.FIGHT, (globalScene.getCurrentPhase() as CommandPhase).getFieldIndex(), Command.TERA);
success = true;
break;
} }
} else { } else {
(globalScene.getCurrentPhase() as CommandPhase).cancel(); (globalScene.getCurrentPhase() as CommandPhase).cancel();
@ -115,23 +144,27 @@ export default class CommandUiHandler extends UiHandler {
} else { } else {
switch (button) { switch (button) {
case Button.UP: case Button.UP:
if (cursor >= 2) { if (cursor === Command.POKEMON || cursor === Command.RUN) {
success = this.setCursor(cursor - 2); success = this.setCursor(cursor - 2);
} }
break; break;
case Button.DOWN: case Button.DOWN:
if (cursor < 2) { if (cursor === Command.FIGHT || cursor === Command.BALL) {
success = this.setCursor(cursor + 2); success = this.setCursor(cursor + 2);
} }
break; break;
case Button.LEFT: case Button.LEFT:
if (cursor % 2 === 1) { if (cursor === Command.BALL || cursor === Command.RUN) {
success = this.setCursor(cursor - 1); success = this.setCursor(cursor - 1);
} else if ((cursor === Command.FIGHT || cursor === Command.POKEMON) && this.canTera()) {
success = this.setCursor(Command.TERA);
} }
break; break;
case Button.RIGHT: case Button.RIGHT:
if (cursor % 2 === 0) { if (cursor === Command.FIGHT || cursor === Command.POKEMON) {
success = this.setCursor(cursor + 1); success = this.setCursor(cursor + 1);
} else if (cursor === Command.TERA) {
success = this.setCursor(Command.FIGHT);
} }
break; break;
} }
@ -144,6 +177,10 @@ export default class CommandUiHandler extends UiHandler {
return success; return success;
} }
canTera(): boolean {
return !!globalScene.getModifiers(TerastallizeAccessModifier).length;
}
getCursor(): integer { getCursor(): integer {
return !this.fieldIndex ? this.cursor : this.cursor2; return !this.fieldIndex ? this.cursor : this.cursor2;
} }

View File

@ -33,6 +33,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
private moveInfoOverlay : MoveInfoOverlay; private moveInfoOverlay : MoveInfoOverlay;
protected fieldIndex: integer = 0; protected fieldIndex: integer = 0;
protected fromCommand: integer = Command.FIGHT;
protected cursor2: integer = 0; protected cursor2: integer = 0;
constructor() { constructor() {
@ -114,6 +115,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
super.show(args); super.show(args);
this.fieldIndex = args.length ? args[0] as integer : 0; this.fieldIndex = args.length ? args[0] as integer : 0;
this.fromCommand = args.length > 1 ? args[1] as integer : Command.FIGHT;
const messageHandler = this.getUi().getMessageHandler(); const messageHandler = this.getUi().getMessageHandler();
messageHandler.bg.setVisible(false); messageHandler.bg.setVisible(false);
@ -140,7 +142,7 @@ export default class FightUiHandler extends UiHandler implements InfoToggle {
if (button === Button.CANCEL || button === Button.ACTION) { if (button === Button.CANCEL || button === Button.ACTION) {
if (button === Button.ACTION) { if (button === Button.ACTION) {
if ((globalScene.getCurrentPhase() as CommandPhase).handleCommand(Command.FIGHT, cursor, false)) { if ((globalScene.getCurrentPhase() as CommandPhase).handleCommand(this.fromCommand, cursor, false)) {
success = true; success = true;
} else { } else {
ui.playError(); ui.playError();

View File

@ -775,7 +775,7 @@ export default class SummaryUiHandler extends UiHandler {
if (types.length > 1) { if (types.length > 1) {
profileContainer.add(getTypeIcon(1, types[1])); profileContainer.add(getTypeIcon(1, types[1]));
} }
if (this.pokemon?.isTerastallized()) { if (this.pokemon?.isTerastallized) {
profileContainer.add(getTypeIcon(types.length, this.pokemon.getTeraType(), true)); profileContainer.add(getTypeIcon(types.length, this.pokemon.getTeraType(), true));
} }