This commit is contained in:
2024-04-26 16:08:04 +02:00
parent 6e9077404a
commit d0816f9fc9
9 changed files with 169 additions and 65 deletions
+4 -3
View File
@@ -1,6 +1,7 @@
import type { GameObjectRegister } from "."
import type { Effect } from "./Effect"
import type { GameObjectNetcode } from "./GameObject"
import type { Turn } from "./Turn"
enum CardRole {
PERSONAL = "personal",
@@ -8,7 +9,7 @@ enum CardRole {
FIRE_GEM = "fire_gem"
}
enum CardType {
export enum CardType {
HERO = "hero",
HERO_ABILITY = "hero_ability",
CURRENCY = "currency",
@@ -48,10 +49,10 @@ export function create_card(input: CardNetcode, register: GameObjectRegister) {
const card = new Proxy<any>(input, {
get(target: CardNetcode, prop, reciever) {
if (prop == "effects") {
return target.effects.map((e) => register.effects[e])
return target.effects.map((e) => register.effects.get(e))
}
if (prop == "health_as_champion") {
return Object.values(register.turns).find(e => e.champions_health.has(card))?.champions_health.get(card)
return Array.from(register.turns.values()).find(e => e.champions_health.has(card.uuid))?.champions_health.get(card.uuid)
}
return Reflect.get(target, prop, reciever);
},