Skip to content

Commit

Permalink
replace hp based by stack based cosmog evolution (#2683)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainpolletvillard authored Jan 11, 2025
1 parent b1ee832 commit ee79501
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/core/evolution-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export abstract class EvolutionRule {
): boolean
abstract evolve(pokemon: Pokemon, player: Player, stageLevel: number): Pokemon
divergentEvolution?: DivergentEvolution
stacks: number

constructor(divergentEvolution?: DivergentEvolution) {
if (divergentEvolution) this.divergentEvolution = divergentEvolution
this.stacks = 0
}

getEvolution(
Expand Down Expand Up @@ -65,6 +67,7 @@ export abstract class EvolutionRule {
pokemonEvolved.passive !== Passive.COSMOEM
) {
pokemon.hp += 10
pokemon.evolutionRule.stacks++
}
// check evolutions again if it can evolve twice in a row
pokemon.evolutionRule.tryEvolve(pokemon, player, stageLevel)
Expand Down
4 changes: 2 additions & 2 deletions app/models/colyseus-models/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13318,7 +13318,7 @@ export class Cosmog extends Pokemon {
rarity = Rarity.UNIQUE
evolution = Pkm.COSMOEM
evolutionRule = new ConditionBasedEvolutionRule(
(pokemon) => pokemon.hp >= 200
(pokemon) => pokemon.evolutionRule.stacks >= 10
)
stars = 1
hp = 100
Expand All @@ -13338,7 +13338,7 @@ export class Cosmoem extends Pokemon {
evolution = Pkm.LUNALA
stars = 2
evolutionRule = new ConditionBasedEvolutionRule(
(pokemon) => pokemon.hp >= 300,
(pokemon) => pokemon.evolutionRule.stacks >= 10,
(pokemon, player) => {
if (
pokemon.positionX === player.lightX &&
Expand Down

0 comments on commit ee79501

Please sign in to comment.