Skip to content

Commit 95810d4

Browse files
Merge branch 'master' into translation/de-1783846133943
2 parents 58fe1cb + 954c455 commit 95810d4

165 files changed

Lines changed: 12070 additions & 2271 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,8 @@ id_digital_ocean.pub
4040
/app/public/dist/server/app/public/src/assets/atlas.json
4141
/app/public/dist/server/package.json
4242
/app/public/dist/server/app/public/src/assets/pokemons/durations.json
43+
/app/public/dist/server/app/public/dist/client/locales
4344
.devmode.json
44-
.assetpack/
45+
.assetpack/
46+
app/public/dist/client/recorder.worker.js
47+
app/public/dist/client/recorder.worker.js.map

app/app.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ export const server = defineServer({
299299
res.sendFile(viewsSrc)
300300
})
301301

302+
app.get("/replay", (req, res) => {
303+
res.sendFile(viewsSrc)
304+
})
305+
302306
app.get("/after", (req, res) => {
303307
res.sendFile(viewsSrc)
304308
})

app/config/game/experience.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export const ExpTable: { [key: number]: number } = Object.freeze({
1515
6: 34,
1616
7: 52,
1717
8: 72,
18-
9: 255
18+
9: 72,
19+
10: 255
1920
})

app/config/game/shop.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export const RarityProbabilityPerLevel: { [key: number]: number[] } = {
6262
6: [0.25, 0.4, 0.3, 0.05, 0],
6363
7: [0.16, 0.33, 0.35, 0.15, 0.01],
6464
8: [0.11, 0.27, 0.35, 0.22, 0.05],
65-
9: [0.05, 0.2, 0.35, 0.3, 0.1]
65+
9: [0.05, 0.2, 0.35, 0.3, 0.1],
66+
10: [0.05, 0.2, 0.3, 0.3, 0.15]
6667
}
6768

6869
/* Special Pokemon rates */

app/config/game/stages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ export const PORTAL_CAROUSEL_BASE_DURATION = 23000
2020
export const ItemCarouselStages = [4, 12, 17, 22, 27, 34]
2121
export const AdditionalPicksStages = [5, 8, 11]
2222
export const PortalCarouselStages = [0, 10, 20]
23+
export const GiftShopStages = [15, 16, 25, 26]

app/core/abilities/entrainment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export class EntrainmentStrategy extends AbilityStrategy {
2020
const potentialTargets: { x: number; y: number; value: PokemonEntity }[] =
2121
[]
2222
board.forEach(
23-
(x: number, y: number, value: PokemonEntity | undefined) => {
24-
if (value && value.team !== pokemon.team && value.hp > 0) {
25-
potentialTargets.push({ x, y, value })
23+
(x: number, y: number, entity?: PokemonEntity) => {
24+
if (entity && entity.team !== pokemon.team && entity.hp > 0 && entity.skill !== Ability.ENTRAINMENT) {
25+
potentialTargets.push({ x, y, value: entity })
2626
}
2727
}
2828
)

app/core/abilities/petal-dance.ts

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,54 @@ import { AttackType } from "../../types/enum/Game"
22
import { distanceM } from "../../utils/distance"
33
import type { Board } from "../board"
44
import type { PokemonEntity } from "../pokemon-entity"
5+
import { DelayedCommand } from "../simulation-command"
56
import { AbilityStrategy } from "./ability-strategy"
67

78
export class PetalDanceStrategy extends AbilityStrategy {
89
requiresTarget = false
910
process(pokemon: PokemonEntity, board: Board, target: null, crit: boolean) {
10-
super.process(pokemon, board, target, crit, true)
11+
super.process(pokemon, board, target, crit)
1112

1213
const damage = [20, 30, 50, 100][pokemon.stars - 1] ?? 100
1314
const count = [3, 4, 5, 6][pokemon.stars - 1] ?? 6
1415

15-
const enemies = board.cells.filter(
16-
(p) => p && p.team !== pokemon.team
17-
) as PokemonEntity[]
18-
const enemiesHit = enemies
19-
.sort(
20-
(a, b) =>
21-
distanceM(
22-
a.positionX,
23-
a.positionY,
24-
pokemon.positionX,
25-
pokemon.positionY
26-
) -
27-
distanceM(
28-
b.positionX,
29-
b.positionY,
30-
pokemon.positionX,
31-
pokemon.positionY
32-
)
33-
)
34-
.slice(0, count)
16+
const enemies = board.cells
17+
.filter((p): p is PokemonEntity => p != null && p.team !== pokemon.team)
18+
.map((entity) => ({
19+
entity,
20+
distance: distanceM(
21+
entity.positionX,
22+
entity.positionY,
23+
pokemon.positionX,
24+
pokemon.positionY
25+
)
26+
}))
27+
.sort((a, b) => a.distance - b.distance)
28+
29+
const projectileSpeed = 10
3530

36-
enemiesHit.forEach((enemy) => {
37-
enemy.handleSpecialDamage(
38-
damage,
39-
board,
40-
AttackType.SPECIAL,
41-
pokemon,
42-
crit
31+
for (let i = 0; i < count; i++) {
32+
const { entity: enemy, distance } = enemies[i % enemies.length]
33+
pokemon.commands.push(
34+
new DelayedCommand(() => {
35+
if (enemy.hp > 0) {
36+
enemy.handleSpecialDamage(
37+
damage,
38+
board,
39+
AttackType.SPECIAL,
40+
pokemon,
41+
crit
42+
)
43+
}
44+
}, i * 100 + (distance * 1000 / projectileSpeed))
4345
)
46+
4447
pokemon.broadcastAbility({
45-
positionX: enemy.positionX,
46-
positionY: enemy.positionY
48+
skill: "PETAL_DANCE_PROJECTILE",
49+
targetX: enemy.positionX,
50+
targetY: enemy.positionY,
51+
delay: i * 100
4752
})
48-
})
53+
}
4954
}
5055
}

app/core/matchmaking.ts

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,57 @@ function completeMatchupCombination(
7171
remainingPlayers.includes(m.redPlayer)
7272
)
7373
if (remainingMatchups.length === 0) {
74-
// no more matchups, need to complete with a ghost matchup
75-
return completeMatchupCombination([...combination], matchups, players)
74+
/*
75+
No more matchups but at least 2 players without matchup
76+
this case should only happen in double up mode,
77+
when you got AB-CD-EF as player teams and get into the case AD-BC-EF matchup combination.
78+
E and F are in the same team so zero matchups remain and 2 players still have no match
79+
returning empty array to the flatMap excludes that branch of matchups completely
80+
*/
81+
return []
7682
}
7783
return remainingMatchups.flatMap((m) =>
7884
completeMatchupCombination([...combination, m], matchups, players)
7985
)
8086
}
8187
}
8288

89+
export function selectDoubleUpMatchups(state: GameState): Matchup[] {
90+
const players = shuffleArray(
91+
schemaValues(state.players).filter((p) => p.alive)
92+
)
93+
if (players.length <= 1) return []
94+
95+
// Same pipeline as selectMatchups, but teammates are never paired
96+
const matchups = getAllPossibleMatchups(players).filter(
97+
(m) => m.bluePlayer.doubleUpTeamId !== m.redPlayer.doubleUpTeamId
98+
)
99+
100+
const matchupCombinations: Matchup[][] = completeMatchupCombination(
101+
[],
102+
matchups,
103+
players
104+
)
105+
106+
const matchupCombinationsCount = matchupCombinations.map((combination) =>
107+
sum(combination.map((m) => m.count))
108+
)
109+
const lowestTotalCount = Math.min(...matchupCombinationsCount)
110+
const lowestTotalCountMatchupCombinations = matchupCombinations.filter(
111+
(matchups, index) => matchupCombinationsCount[index] === lowestTotalCount
112+
)
113+
114+
const matchupCombinationsDistance = lowestTotalCountMatchupCombinations.map(
115+
(combination) => sum(combination.map((m) => m.distance))
116+
)
117+
const maxDistance = Math.max(...matchupCombinationsDistance)
118+
const mostDistantMatchups = lowestTotalCountMatchupCombinations.filter(
119+
(matchups, index) => matchupCombinationsDistance[index] === maxDistance
120+
)
121+
122+
return pickRandomIn(mostDistantMatchups)
123+
}
124+
83125
export function selectMatchups(state: GameState): Matchup[] {
84126
/* step 1) establish all the matchups possible with players alive and their associated count
85127
count = number of times A fought B or his ghost) + (number of times B fought A or his ghost) */

app/core/pokemon-entity.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
147147
refToBoardPokemon: IPokemon
148148
commands = new Array<SimulationCommand>()
149149
effectsSet = new Set<EffectClass>()
150+
sourcePlayer: Player | undefined = undefined // used to distinguish entities from double up partners joining the board
150151

151152
constructor(
152153
pokemon: IPokemon,
@@ -206,16 +207,17 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
206207
this.shieldDamageTaken = 0
207208
this.healDone = 0
208209
this.shieldDone = 0
210+
211+
pokemon.types.forEach((type) => {
212+
this.types.add(type)
213+
})
214+
209215
if (this.types.has(Synergy.DARK) && this.range === 1) {
210216
this.cooldown = 300 // ensure dark assassins move first
211217
} else {
212218
this.resetCooldown(500)
213219
}
214220

215-
pokemon.types.forEach((type) => {
216-
this.types.add(type)
217-
})
218-
219221
this.passive = Passive.NONE
220222
this.changePassive(pokemon.passive)
221223
}
@@ -284,6 +286,7 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
284286
}
285287

286288
get player(): Player | undefined {
289+
if (this.sourcePlayer) return this.sourcePlayer
287290
const player =
288291
this.baseTeam === Team.BLUE_TEAM
289292
? this.simulation.bluePlayer
@@ -1617,7 +1620,7 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
16171620
break
16181621
case Item.PECHA_BERRY:
16191622
heal(100)
1620-
this.status.poisonOrigin = undefined
1623+
this.status.poisonOrigin = null
16211624
this.status.poisonStacks = 0
16221625
this.status.poisonDamageCooldown = 0
16231626
this.effects.add(EffectEnum.IMMUNITY_POISON)

app/core/pokemon-state.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ export default abstract class PokemonState {
11031103
attacker: null,
11041104
shouldTargetGainMana: true
11051105
})
1106-
pokemon.status.triggerBurn(1100, pokemon, null)
1106+
pokemon.status.triggerBurn(2200, pokemon, null)
11071107
}
11081108
}
11091109

0 commit comments

Comments
 (0)