Skip to content

Commit

Permalink
rename MANA → PP (keldaanCommunity#901)
Browse files Browse the repository at this point in the history
Co-authored-by: Keldaan <[email protected]>
  • Loading branch information
sylvainpolletvillard and keldaan-ag authored Aug 13, 2023
1 parent 13cd9da commit 0ca30cd
Show file tree
Hide file tree
Showing 43 changed files with 510 additions and 503 deletions.
8 changes: 4 additions & 4 deletions app/core/abilities/hidden-power.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class HiddenPowerKStrategy extends HiddenPowerStrategy {
)
hitmonlee.items.add(Item.RED_ORB)
hitmonlee.simulation.applyItemsEffects(hitmonlee)
hitmonlee.mana = hitmonlee.maxMana - 1
hitmonlee.pp = hitmonlee.maxPP - 1
}
}

Expand Down Expand Up @@ -321,7 +321,7 @@ export class HiddenPowerMStrategy extends HiddenPowerStrategy {
board.forEach(
(x: number, y: number, pokemon: PokemonEntity | undefined) => {
if (pokemon && unown.team === pokemon.team) {
pokemon.mana = pokemon.maxMana
pokemon.pp = pokemon.maxPP
}
}
)
Expand Down Expand Up @@ -522,7 +522,7 @@ export class HiddenPowerTStrategy extends HiddenPowerStrategy {
)
tapu.items.add(Item.CHOICE_SPECS)
tapu.simulation.applyItemsEffects(tapu)
tapu.mana = tapu.maxMana
tapu.pp = tapu.maxPP
}
}

Expand All @@ -548,7 +548,7 @@ export class HiddenPowerUStrategy extends HiddenPowerStrategy {
)
uxie.items.add(Item.AQUA_EGG)
uxie.simulation.applyItemsEffects(uxie)
uxie.mana = uxie.maxMana - 1
uxie.pp = uxie.maxPP - 1
}
}

Expand Down
34 changes: 17 additions & 17 deletions app/core/attack-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class AttackStrategy {
target: PokemonEntity,
crit: boolean
) {
pokemon.mana = 0
pokemon.pp = 0
pokemon.count.ult += 1
pokemon.simulation.room.broadcast(Transfer.ABILITY, {
id: pokemon.simulation.id,
Expand Down Expand Up @@ -63,7 +63,7 @@ export class AttackStrategy {
ally.addAttackSpeed(5, false)
}
if (pokemon.effects.includes(Effect.PRESTO)) {
ally.setMana(ally.mana + 3)
ally.setPP(ally.pp + 3)
}
}
})
Expand All @@ -76,7 +76,7 @@ export class AttackStrategy {
pkm.team !== pokemon.team &&
pkm.id !== pokemon.id
) {
pkm.setMana(pkm.mana + 5)
pkm.setPP(pkm.pp + 5)
pkm.simulation.room.broadcast(Transfer.ABILITY, {
id: pokemon.simulation.id,
skill: pkm.skill,
Expand All @@ -87,11 +87,11 @@ export class AttackStrategy {
})

if (pokemon.items.has(Item.AQUA_EGG)) {
pokemon.setMana(pokemon.mana + 20)
pokemon.setPP(pokemon.pp + 20)
}

if (pokemon.items.has(Item.STAR_DUST)) {
pokemon.handleShield(Math.round(0.6 * pokemon.maxMana), pokemon, false)
pokemon.handleShield(Math.round(0.6 * pokemon.maxPP), pokemon, false)
pokemon.count.starDustCount++
}

Expand Down Expand Up @@ -586,7 +586,7 @@ export class ShadowBallStrategy extends AttackStrategy {

const cells = board.getAdjacentCells(target.positionX, target.positionY)
target.handleSpecialDamage(damage, board, AttackType.SPECIAL, pokemon, crit)
target.setMana(target.mana - 15)
target.setPP(target.pp - 15)
target.count.manaBurnCount++
cells.forEach((cell) => {
if (cell.value && cell.value.team !== pokemon.team) {
Expand All @@ -597,7 +597,7 @@ export class ShadowBallStrategy extends AttackStrategy {
pokemon,
crit
)
cell.value.setMana(cell.value.mana - 15)
cell.value.setPP(cell.value.pp - 15)
cell.value.count.manaBurnCount++
}
})
Expand Down Expand Up @@ -1507,7 +1507,7 @@ export class DisarmingVoiceStrategy extends AttackStrategy {
heal = Math.round(heal * (1 + pokemon.ap / 200))
board.forEach((x: number, y: number, tg: PokemonEntity | undefined) => {
if (tg && pokemon.team === tg.team && tg.id !== pokemon.id) {
tg.setMana(tg.mana + heal)
tg.setPP(tg.pp + heal)
pokemon.simulation.room.broadcast(Transfer.ABILITY, {
id: pokemon.simulation.id,
skill: pokemon.skill,
Expand Down Expand Up @@ -1542,8 +1542,8 @@ export class HighJumpKickStrategy extends AttackStrategy {
default:
break
}
pokemon.setMana(target.mana)
target.setMana(0)
pokemon.setPP(target.pp)
target.setPP(0)
target.count.manaBurnCount++
target.handleSpecialDamage(damage, board, AttackType.SPECIAL, pokemon, crit)
}
Expand Down Expand Up @@ -2410,7 +2410,7 @@ export class GuillotineStrategy extends AttackStrategy {
crit
)
if (death) {
pokemon.setMana(pokemon.maxMana)
pokemon.setPP(pokemon.maxPP)
}
}
}
Expand Down Expand Up @@ -2568,7 +2568,7 @@ export class SolarBeamStrategy extends AttackStrategy {
let damage = pokemon.stars === 3 ? 120 : pokemon.stars === 2 ? 60 : 30
if (pokemon.simulation.weather === Weather.SUN) {
damage = damage * 2
pokemon.setMana(pokemon.mana + 40)
pokemon.setPP(pokemon.pp + 40)
}
effectInLine(board, pokemon, target, (targetInLine) => {
if (targetInLine != null && targetInLine.team !== pokemon.team) {
Expand Down Expand Up @@ -2772,7 +2772,7 @@ export class SoakStrategy extends AttackStrategy {

board.forEach((x: number, y: number, ally: PokemonEntity | undefined) => {
if (ally && pokemon.team == ally.team) {
ally.setMana(ally.mana + 10)
ally.setPP(ally.pp + 10)
}
})

Expand Down Expand Up @@ -3899,7 +3899,7 @@ export class DragonDartsStrategy extends AttackStrategy {
)
}
if (target.life <= 0) {
pokemon.setMana(pokemon.mana + 40)
pokemon.setPP(pokemon.pp + 40)
}
}
}
Expand Down Expand Up @@ -4131,7 +4131,7 @@ export class ForecastStrategy extends AttackStrategy {
p.addAttack(3, true)
}
if (pokemon.name === Pkm.CASTFORM_RAIN) {
p.setMana(p.mana + Math.round(20 * (1 + pokemon.ap / 100)))
p.setPP(p.pp + Math.round(20 * (1 + pokemon.ap / 100)))
}
if (pokemon.name === Pkm.CASTFORM_HAIL) {
p.addDefense(2, true)
Expand Down Expand Up @@ -4357,13 +4357,13 @@ export class ShellTrapStrategy extends AttackStrategy {
) {
super.process(pokemon, state, board, target, crit)
target.status.triggerSilence(3000, target, pokemon, board)
target.setMana(target.mana - 40)
target.setPP(target.pp - 40)

const cells = board.getAdjacentCells(target.positionX, target.positionY)

cells.forEach((cell) => {
if (cell.value && cell.value.team !== pokemon.team) {
cell.value.setMana(cell.value.mana - 40)
cell.value.setPP(cell.value.pp - 40)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion app/core/attacking-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class AttackingState extends PokemonState {
pokemon.toMovingState()
} else if (
target &&
pokemon.mana >= pokemon.maxMana &&
pokemon.pp >= pokemon.maxPP &&
!pokemon.status.silence
) {
// CAST ABILITY
Expand Down
8 changes: 4 additions & 4 deletions app/core/idle-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class IdleState extends PokemonState {
super.update(pokemon, dt, board, weather)

if (pokemon.status.tree) {
if (pokemon.mana >= pokemon.maxMana) {
pokemon.mana = 0
if (pokemon.pp >= pokemon.maxPP) {
pokemon.pp = 0
pokemon.status.tree = false
pokemon.toMovingState()
}
Expand All @@ -30,9 +30,9 @@ export class IdleState extends PokemonState {

onEnter(pokemon: PokemonEntity) {
super.onEnter(pokemon)
if(pokemon.status.tree) {
if (pokemon.status.tree) {
pokemon.action = PokemonActionState.IDLE
} else if(pokemon.status.resurecting){
} else if (pokemon.status.resurecting) {
pokemon.action = PokemonActionState.HURT
} else {
pokemon.action = PokemonActionState.SLEEP
Expand Down
28 changes: 14 additions & 14 deletions app/core/pokemon-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
@type("string") id: string
@type("string") orientation = Orientation.DOWNLEFT
@type("uint16") hp: number
@type("uint8") mana = 0
@type("uint8") maxMana: number
@type("uint8") pp = 0
@type("uint8") maxPP: number
@type("uint16") atk: number
@type("uint16") def: number
@type("uint16") speDef: number
Expand Down Expand Up @@ -128,7 +128,7 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
this.speDef = pokemon.speDef
this.attackType = pokemon.attackType
this.hp = pokemon.hp
this.maxMana = pokemon.maxMana
this.maxPP = pokemon.maxPP
this.life = pokemon.hp
this.atkSpeed = pokemon.atkSpeed
this.range = pokemon.range
Expand Down Expand Up @@ -266,13 +266,13 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
this.changeState(new IdleState())
}

setMana(mana: number) {
setPP(pp: number) {
if (
!this.status.silence &&
!this.status.protect &&
!this.status.resurecting
) {
this.mana = Math.max(0, Math.min(mana, this.maxMana))
this.pp = Math.max(0, Math.min(pp, this.maxPP))
}
}

Expand Down Expand Up @@ -354,7 +354,7 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
trueDamage: number
totalDamage: number
}) {
this.setMana(this.mana + 5)
this.setPP(this.pp + 5)

if (this.items.has(Item.BLUE_ORB)) {
this.count.staticHolderCount++
Expand All @@ -365,7 +365,7 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
board.forEach((x, y, tg) => {
if (tg && this.team != tg.team && c > 0) {
tg.count.staticCount++
tg.setMana(tg.mana - 20)
tg.setPP(tg.pp - 20)
tg.count.manaBurnCount++
c--
}
Expand Down Expand Up @@ -412,10 +412,10 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
}

if (this.items.has(Item.MANA_SCARF)) {
this.setMana(this.mana + 8)
this.setPP(this.pp + 8)
}
if (this.status.deltaOrb) {
this.setMana(this.mana + 4)
this.setPP(this.pp + 4)
}

if (this.effects.includes(Effect.TELEPORT_NEXT_ATTACK)) {
Expand Down Expand Up @@ -518,9 +518,9 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
? 30
: 45
if (chance(burnManaChance)) {
target.setMana(target.mana - 20)
target.setPP(target.pp - 20)
target.count.manaBurnCount++
this.setMana(this.mana + manaGain)
this.setPP(this.pp + manaGain)
}
}

Expand Down Expand Up @@ -620,8 +620,8 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
})

if (this.items.has(Item.SCOPE_LENS)) {
this.setMana(this.mana + 15)
target.setMana(target.mana - 15)
this.setPP(this.pp + 15)
target.setPP(target.pp - 15)
target.count.manaBurnCount++
}

Expand Down Expand Up @@ -738,7 +738,7 @@ export default class PokemonEntity extends Schema implements IPokemonEntity {
)
this.life = cloneForStatsReference.hp
this.shield = 0
this.mana = 0
this.pp = 0
this.ap = 0
this.atk = cloneForStatsReference.atk
this.def = cloneForStatsReference.def
Expand Down
6 changes: 3 additions & 3 deletions app/core/pokemon-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export default class PokemonState {

if (pokemon) {
if (shouldTargetGainMana) {
pokemon.setMana(pokemon.mana + Math.ceil(damage / 10))
pokemon.setPP(pokemon.pp + Math.ceil(damage / 10))
}

if (
Expand Down Expand Up @@ -530,9 +530,9 @@ export default class PokemonState {
}

if (pokemon.manaCooldown <= 0) {
pokemon.setMana(pokemon.mana + 10)
pokemon.setPP(pokemon.pp + 10)
if (pokemon.simulation.weather === Weather.RAIN) {
pokemon.setMana(pokemon.mana + 3)
pokemon.setPP(pokemon.pp + 3)
}
pokemon.manaCooldown = 1000
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/core/simulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ export default class Simulation extends Schema implements ISimulation {
case Stat.AP:
pokemon.addAbilityPower(value)
break
case Stat.MANA:
pokemon.setMana(pokemon.mana + value)
case Stat.PP:
pokemon.setPP(pokemon.pp + value)
break
case Stat.ATK_SPEED:
pokemon.addAttackSpeed(value)
Expand Down
6 changes: 3 additions & 3 deletions app/models/colyseus-models/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class Pokemon extends Schema implements IPokemon {
@type("uint16") hp: number
@type("uint8") range: number
@type("uint8") stars: number
@type("uint8") maxMana: number
@type("uint8") maxPP: number
@type("string") skill: Ability
@type("string") passive: Passive = Passive.NONE
@type({ set: "string" }) items = new SetSchema<Item>()
Expand All @@ -54,7 +54,7 @@ export class Pokemon extends Schema implements IPokemon {
range: number,
attackSprite: AttackSprite,
stars: number,
maxMana: number,
maxPP: number,
skill: Ability,
shiny: boolean,
emotion: Emotion,
Expand All @@ -76,7 +76,7 @@ export class Pokemon extends Schema implements IPokemon {
this.attackSprite = attackSprite
this.attackType = AttackType.PHYSICAL
this.stars = stars
this.maxMana = maxMana
this.maxPP = maxPP
this.skill = skill
this.passive = passive ?? Passive.NONE
this.shiny = shiny
Expand Down
File renamed without changes
Loading

0 comments on commit 0ca30cd

Please sign in to comment.