Skip to content

Commit

Permalink
Fix Merge Conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
xsn34kzx committed Aug 29, 2024
2 parents b782cc1 + c112abb commit 747e088
Show file tree
Hide file tree
Showing 185 changed files with 4,105 additions and 22,402 deletions.
4,209 changes: 2,115 additions & 2,094 deletions public/images/items.json

Large diffs are not rendered by default.

Binary file modified public/images/items.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/pokemon/exp/back/shiny/745-midnight.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/trainer/guzma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/trainer/rose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions public/images/trainer/skull_grunt_f.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"image": "skull_grunt_f.png",
"format": "RGBA8888",
"size": {
"w": 69,
"h": 69
"w": 74,
"h": 74
},
"scale": 1,
"frames": [
Expand All @@ -14,20 +14,20 @@
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 80,
"h": 80
"w": 31,
"h": 74
},
"spriteSourceSize": {
"x": 27,
"y": 9,
"w": 29,
"h": 69
"x": 0,
"y": 0,
"w": 31,
"h": 74
},
"frame": {
"x": 0,
"y": 0,
"w": 29,
"h": 69
"w": 31,
"h": 74
}
}
]
Expand All @@ -36,6 +36,6 @@
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:2e44c39efe8e78ec75d9119731b9b1cb:4923b5197ea74a9ed0b861e2408f595b:9035f560a0ab0d45bcc084aba7172990$"
"smartupdate": "$TexturePacker:SmartUpdate:71a1f5b1981674c6e81163ac8ea576c3:a5e612d58e5f0a1489e111212baea09d:dd369353af16e4c5eb6547e129dfac18$"
}
}
Binary file modified public/images/trainer/skull_grunt_f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 11 additions & 11 deletions public/images/trainer/skull_grunt_m.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"image": "skull_grunt_m.png",
"format": "RGBA8888",
"size": {
"w": 67,
"h": 67
"w": 72,
"h": 72
},
"scale": 1,
"frames": [
Expand All @@ -14,20 +14,20 @@
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 80,
"h": 80
"w": 51,
"h": 72
},
"spriteSourceSize": {
"x": 28,
"y": 11,
"w": 26,
"h": 67
"x": 0,
"y": 0,
"w": 51,
"h": 72
},
"frame": {
"x": 0,
"y": 0,
"w": 26,
"h": 67
"w": 51,
"h": 72
}
}
]
Expand All @@ -36,6 +36,6 @@
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:688a83ff13a77c6923f038db8c7e5e84:d0ece3ab82602eb0c5003bacc26dbd9f:1ff10b395daf6ebfa377680a6404f816$"
"smartupdate": "$TexturePacker:SmartUpdate:4deb2a68e4d168bb1a40cb5d190a7d1f:be3d7b29f4b544ba51cf907691fef51d:df57ca2c9bf5f80d930306e15a851d4d$"
}
}
Binary file modified public/images/trainer/skull_grunt_m.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ export interface UserInfo {
lastSessionSlot: integer;
discordId: string;
googleId: string;
hasAdminRole: boolean;
}

export let loggedInUser: UserInfo | null = null;
// This is a random string that is used to identify the client session - unique per session (tab or window) so that the game will only save on the one that the server is expecting
export const clientSessionId = Utils.randomString(32);

export function initLoggedInUser(): void {
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: ""};
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false };
}

export function updateUserInfo(): Promise<[boolean, integer]> {
return new Promise<[boolean, integer]>(resolve => {
if (bypassLogin) {
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "" };
loggedInUser = { username: "Guest", lastSessionSlot: -1, discordId: "", googleId: "", hasAdminRole: false};
let lastSessionSlot = -1;
for (let s = 0; s < 5; s++) {
if (localStorage.getItem(`sessionData${s ? s : ""}_${loggedInUser.username}`)) {
Expand Down
9 changes: 4 additions & 5 deletions src/battle-scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -844,14 +844,13 @@ export default class BattleScene extends SceneBase {
if (Overrides.OPP_SPECIES_OVERRIDE) {
species = getPokemonSpecies(Overrides.OPP_SPECIES_OVERRIDE);
}
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);

if (Overrides.OPP_LEVEL_OVERRIDE !== 0) {
pokemon.level = Overrides.OPP_LEVEL_OVERRIDE;
level = Overrides.OPP_LEVEL_OVERRIDE;
}

if (Overrides.OPP_GENDER_OVERRIDE !== null) {
pokemon.gender = Overrides.OPP_GENDER_OVERRIDE;
}
const pokemon = new EnemyPokemon(this, species, level, trainerSlot, boss, dataSource);

overrideModifiers(this, false);
overrideHeldItems(this, pokemon, false);
if (boss && !dataSource) {
Expand Down
65 changes: 61 additions & 4 deletions src/data/challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ export enum ChallengeType {
* @see {@link Challenge.applyFixedBattle}
*/
FIXED_BATTLES,
/**
* Modifies the effectiveness of Type matchups in battle
* @see {@linkcode Challenge.applyTypeEffectiveness}
*/
TYPE_EFFECTIVENESS,
/**
* Modifies what level the AI pokemon are. UNIMPLEMENTED.
*/
Expand Down Expand Up @@ -327,6 +332,15 @@ export abstract class Challenge {
return false;
}

/**
* An apply function for TYPE_EFFECTIVENESS challenges. Derived classes should alter this.
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @returns Whether this function did anything.
*/
applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean {
return false;
}

/**
* An apply function for AI_LEVEL challenges. Derived classes should alter this.
* @param level {@link Utils.IntegerHolder} The generated level.
Expand Down Expand Up @@ -651,10 +665,7 @@ export class FreshStartChallenge extends Challenge {
return true;
}

/**
* @overrides
*/
getDifficulty(): number {
override getDifficulty(): number {
return 0;
}

Expand All @@ -666,6 +677,38 @@ export class FreshStartChallenge extends Challenge {
}
}

/**
* Implements an inverse battle challenge.
*/
export class InverseBattleChallenge extends Challenge {
constructor() {
super(Challenges.INVERSE_BATTLE, 1);
}

static loadChallenge(source: InverseBattleChallenge | any): InverseBattleChallenge {
const newChallenge = new InverseBattleChallenge();
newChallenge.value = source.value;
newChallenge.severity = source.severity;
return newChallenge;
}

override getDifficulty(): number {
return 0;
}

applyTypeEffectiveness(effectiveness: Utils.NumberHolder): boolean {
if (effectiveness.value < 1) {
effectiveness.value = 2;
return true;
} else if (effectiveness.value > 1) {
effectiveness.value = 0.5;
return true;
}

return false;
}
}

/**
* Lowers the amount of starter points available.
*/
Expand Down Expand Up @@ -785,6 +828,14 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.FIXED_BATTLES, waveIndex: Number, battleConfig: FixedBattleConfig): boolean;
/**
* Apply all challenges that modify type effectiveness.
* @param gameMode {@linkcode GameMode} The current gameMode
* @param challengeType {@linkcode ChallengeType} ChallengeType.TYPE_EFFECTIVENESS
* @param effectiveness {@linkcode Utils.NumberHolder} The current effectiveness of the move.
* @returns True if any challenge was successfully applied.
*/
export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType.TYPE_EFFECTIVENESS, effectiveness: Utils.NumberHolder): boolean;
/**
* Apply all challenges that modify what level AI are.
* @param gameMode {@link GameMode} The current gameMode
Expand Down Expand Up @@ -866,6 +917,9 @@ export function applyChallenges(gameMode: GameMode, challengeType: ChallengeType
case ChallengeType.FIXED_BATTLES:
ret ||= c.applyFixedBattle(args[0], args[1]);
break;
case ChallengeType.TYPE_EFFECTIVENESS:
ret ||= c.applyTypeEffectiveness(args[0]);
break;
case ChallengeType.AI_LEVEL:
ret ||= c.applyLevelChange(args[0], args[1], args[2], args[3]);
break;
Expand Down Expand Up @@ -907,6 +961,8 @@ export function copyChallenge(source: Challenge | any): Challenge {
return LowerStarterPointsChallenge.loadChallenge(source);
case Challenges.FRESH_START:
return FreshStartChallenge.loadChallenge(source);
case Challenges.INVERSE_BATTLE:
return InverseBattleChallenge.loadChallenge(source);
}
throw new Error("Unknown challenge copied");
}
Expand All @@ -918,5 +974,6 @@ export function initChallenges() {
new SingleGenerationChallenge(),
new SingleTypeChallenge(),
new FreshStartChallenge(),
new InverseBattleChallenge(),
);
}
50 changes: 43 additions & 7 deletions src/data/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./
import { EncoreTag, GulpMissileTag, HelpingHandTag, SemiInvulnerableTag, ShellTrapTag, StockpilingTag, TrappedTag, TypeBoostTag } from "./battler-tags";
import { getPokemonNameWithAffix } from "../messages";
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects} from "./status-effect";
import { getTypeResistances, Type } from "./type";
import { StatusEffect, getStatusEffectHealText, isNonVolatileStatusEffect, getNonVolatileStatusEffects } from "./status-effect";
import { getTypeDamageMultiplier, Type } from "./type";
import { Constructor } from "#app/utils";
import * as Utils from "../utils";
import { WeatherType } from "./weather";
Expand Down Expand Up @@ -36,6 +36,9 @@ import { StatStageChangePhase } from "#app/phases/stat-stage-change-phase";
import { SwitchPhase } from "#app/phases/switch-phase";
import { SwitchSummonPhase } from "#app/phases/switch-summon-phase";
import { SpeciesFormChangeRevertWeatherFormTrigger } from "./pokemon-forms";
import { NumberHolder } from "#app/utils";
import { GameMode } from "#app/game-mode";
import { applyChallenges, ChallengeType } from "./challenge";

export enum MoveCategory {
PHYSICAL,
Expand Down Expand Up @@ -4199,8 +4202,12 @@ export class WaterSuperEffectTypeMultiplierAttr extends VariableMoveTypeMultipli
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
const multiplier = args[0] as Utils.NumberHolder;
if (target.isOfType(Type.WATER)) {
multiplier.value *= 4; // Increased twice because initial reduction against water
return true;
const effectivenessAgainstWater = new Utils.NumberHolder(getTypeDamageMultiplier(move.type, Type.WATER));
applyChallenges(user.scene.gameMode, ChallengeType.TYPE_EFFECTIVENESS, effectivenessAgainstWater);
if (effectivenessAgainstWater.value !== 0) {
multiplier.value *= 2 / effectivenessAgainstWater.value;
return true;
}
}

return false;
Expand Down Expand Up @@ -6320,7 +6327,7 @@ export class ResistLastMoveTypeAttr extends MoveEffectAttr {
return false;
}
const userTypes = user.getTypes();
const validTypes = getTypeResistances(moveData.type).filter(t => !userTypes.includes(t)); // valid types are ones that are not already the user's types
const validTypes = this.getTypeResistances(user.scene.gameMode, moveData.type).filter(t => !userTypes.includes(t)); // valid types are ones that are not already the user's types
if (!validTypes.length) {
return false;
}
Expand All @@ -6332,6 +6339,25 @@ export class ResistLastMoveTypeAttr extends MoveEffectAttr {
return true;
}

/**
* Retrieve the types resisting a given type. Used by Conversion 2
* @returns An array populated with Types, or an empty array if no resistances exist (Unknown or Stellar type)
*/
getTypeResistances(gameMode: GameMode, type: number): Type[] {
const typeResistances: Type[] = [];

for (let i = 0; i < Object.keys(Type).length; i++) {
const multiplier = new NumberHolder(1);
multiplier.value = getTypeDamageMultiplier(type, i);
applyChallenges(gameMode, ChallengeType.TYPE_EFFECTIVENESS, multiplier);
if (multiplier.value < 1) {
typeResistances.push(i);
}
}

return typeResistances;
}

getCondition(): MoveConditionFunc {
return (user, target, move) => {
const moveHistory = target.getLastXMoves();
Expand Down Expand Up @@ -6971,7 +6997,16 @@ export function initMoves() {
.attr(ExposedMoveAttr, BattlerTagType.IGNORE_GHOST),
new SelfStatusMove(Moves.DESTINY_BOND, Type.GHOST, -1, 5, -1, 0, 2)
.ignoresProtect()
.attr(DestinyBondAttr),
.attr(DestinyBondAttr)
.condition((user, target, move) => {
// Retrieves user's previous move, returns empty array if no moves have been used
const lastTurnMove = user.getLastXMoves(1);
// Checks last move and allows destiny bond to be used if:
// - no previous moves have been made
// - the previous move used was not destiny bond
// - the previous move was unsuccessful
return lastTurnMove.length === 0 || lastTurnMove[0].move !== move.id || lastTurnMove[0].result !== MoveResult.SUCCESS;
}),
new StatusMove(Moves.PERISH_SONG, Type.NORMAL, -1, 5, -1, 0, 2)
.attr(FaintCountdownAttr)
.ignoresProtect()
Expand Down Expand Up @@ -8048,7 +8083,8 @@ export function initMoves() {
.target(MoveTarget.ALL_NEAR_OTHERS),
new AttackMove(Moves.FREEZE_DRY, Type.ICE, MoveCategory.SPECIAL, 70, 100, 20, 10, 0, 6)
.attr(StatusEffectAttr, StatusEffect.FREEZE)
.attr(WaterSuperEffectTypeMultiplierAttr),
.attr(WaterSuperEffectTypeMultiplierAttr)
.partial(), // This currently just multiplies the move's power instead of changing its effectiveness. It also doesn't account for abilities that modify type effectiveness such as tera shell.
new AttackMove(Moves.DISARMING_VOICE, Type.FAIRY, MoveCategory.SPECIAL, 40, -1, 15, -1, 0, 6)
.soundBased()
.target(MoveTarget.ALL_NEAR_ENEMIES),
Expand Down
Loading

0 comments on commit 747e088

Please sign in to comment.