Skip to content

Commit

Permalink
future sight impl (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
keldaan-ag authored Feb 17, 2023
1 parent 99ed4d2 commit 992a017
Show file tree
Hide file tree
Showing 13 changed files with 364 additions and 21 deletions.
40 changes: 40 additions & 0 deletions app/core/attack-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1219,6 +1219,46 @@ export class EchoStrategy extends AttackStrategy {
}
}

export class FutureSightStrategy extends AttackStrategy {
process(
pokemon: PokemonEntity,
state: PokemonState,
board: Board,
target: PokemonEntity
) {
super.process(pokemon, state, board, target)

let damage = 0
let count = 0

switch (pokemon.stars) {
case 1:
damage = 15
count = 5
break
case 2:
damage = 30
count = 5
break
case 3:
damage = 60
count = 5
break
default:
break
}

board.forEach((x: number, y: number, tg: PokemonEntity | undefined) => {
if (tg && pokemon.team != tg.team && count > 0) {
const cells = board.getAdjacentCells(tg.positionX, tg.positionY)
tg.handleSpellDamage(damage, board, AttackType.SPECIAL, pokemon)
count--
tg.count.futureSightCount++
}
})
}
}

export class PetalDanceStrategy extends AttackStrategy {
process(
pokemon: PokemonEntity,
Expand Down
1 change: 1 addition & 0 deletions app/models/colyseus-models/count.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ export default class Count extends Schema implements ICount {
@type("uint8") spellBlockedCount = 0
@type("uint8") manaBurnCount = 0
@type("uint8") moneyCount = 0
@type("uint8") futureSightCount = 0
}
30 changes: 13 additions & 17 deletions app/models/colyseus-models/pokemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

import { Schema, type, ArraySchema, SetSchema } from "@colyseus/schema"
import { nanoid } from "nanoid"
import {
Emotion,
IPokemon,
AttackSprite
} from "../../types"
import { Emotion, IPokemon, AttackSprite } from "../../types"
import { EvolutionTime, PkmCost } from "../../types/Config"
import { Item } from "../../types/enum/Item"
import { Pkm, PkmIndex } from "../../types/enum/Pokemon"
Expand Down Expand Up @@ -1238,8 +1234,8 @@ export class Ralts extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
1,
100,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
false
Expand All @@ -1262,8 +1258,8 @@ export class Kirlia extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
2,
100,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
false
Expand All @@ -1286,8 +1282,8 @@ export class Gardevoir extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
3,
100,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
true
Expand Down Expand Up @@ -11203,8 +11199,8 @@ export class Gothita extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
1,
90,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
false
Expand All @@ -11227,8 +11223,8 @@ export class Gothorita extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
2,
90,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
false
Expand All @@ -11251,8 +11247,8 @@ export class Gothitelle extends Pokemon {
AttackSprite.PSYCHIC_RANGE,
AttackType.PHYSICAL,
3,
90,
Ability.CALM_MIND,
110,
Ability.FUTURE_SIGHT,
shiny,
emotion,
true
Expand Down
251 changes: 251 additions & 0 deletions app/public/dist/client/assets/attacks/FUTURE_SIGHT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
{
"textures": [
{
"image": "FUTURE_SIGHT.png",
"format": "RGBA8888",
"size": {
"w": 127,
"h": 261
},
"scale": 1,
"frames": [
{
"filename": "006",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"frame": {
"x": 1,
"y": 1,
"w": 64,
"h": 64
}
},
{
"filename": "010",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 4,
"y": 4,
"w": 56,
"h": 57
},
"frame": {
"x": 67,
"y": 1,
"w": 56,
"h": 57
}
},
{
"filename": "004",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 9,
"y": 9,
"w": 43,
"h": 45
},
"frame": {
"x": 67,
"y": 60,
"w": 43,
"h": 45
}
},
{
"filename": "007",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 64,
"h": 64
},
"frame": {
"x": 1,
"y": 67,
"w": 64,
"h": 64
}
},
{
"filename": "003",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 32
},
"spriteSourceSize": {
"x": 16,
"y": 0,
"w": 36,
"h": 31
},
"frame": {
"x": 67,
"y": 107,
"w": 36,
"h": 31
}
},
{
"filename": "008",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 0,
"y": 1,
"w": 64,
"h": 63
},
"frame": {
"x": 1,
"y": 133,
"w": 64,
"h": 63
}
},
{
"filename": "009",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 1,
"y": 1,
"w": 63,
"h": 62
},
"frame": {
"x": 1,
"y": 198,
"w": 63,
"h": 62
}
},
{
"filename": "005",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 64,
"h": 64
},
"spriteSourceSize": {
"x": 3,
"y": 3,
"w": 60,
"h": 60
},
"frame": {
"x": 66,
"y": 198,
"w": 60,
"h": 60
}
},
{
"filename": "000",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 16,
"h": 16
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 16,
"h": 16
},
"frame": {
"x": 105,
"y": 107,
"w": 16,
"h": 16
}
},
{
"filename": "001",
"rotated": false,
"trimmed": false,
"sourceSize": {
"w": 16,
"h": 16
},
"spriteSourceSize": {
"x": 0,
"y": 0,
"w": 16,
"h": 16
},
"frame": {
"x": 105,
"y": 125,
"w": 16,
"h": 16
}
},
{
"filename": "002",
"rotated": false,
"trimmed": true,
"sourceSize": {
"w": 32,
"h": 32
},
"spriteSourceSize": {
"x": 3,
"y": 4,
"w": 24,
"h": 23
},
"frame": {
"x": 67,
"y": 140,
"w": 24,
"h": 23
}
}
]
}
],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "3.0",
"smartupdate": "$TexturePacker:SmartUpdate:92b87f713818f0549df626ca1a62b589:bbcd02f43d9b2cbd71166ca9cbd1bb16:26ebbc3c2feed020a2d7b7c25f87f799$"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/public/dist/client/sw.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Change this cache name every time you want to force players
to invalidate their cache and download all assets again */

const CACHE_NAME = 'CACHE v2.8.0';
const CACHE_NAME = 'CACHE v2.8.1';

// Cache-first strategy
const cacheFirst = (event) => {
Expand Down
Loading

0 comments on commit 992a017

Please sign in to comment.