forked from noxious/server
56 lines
909 B
TypeScript
56 lines
909 B
TypeScript
import { randomUUID } from 'node:crypto'
|
|
import { BaseEntity } from '@/application/base/baseEntity'
|
|
import type { UUID } from '@/application/types'
|
|
import type { Map } from '@/entities/map'
|
|
import { ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
|
|
|
|
export class BaseMapEffect extends BaseEntity {
|
|
@PrimaryKey()
|
|
id = randomUUID()
|
|
|
|
@ManyToOne({ deleteRule: 'cascade' })
|
|
map!: Map
|
|
|
|
@Property()
|
|
effect!: string
|
|
|
|
@Property()
|
|
strength!: number
|
|
|
|
setId(id: UUID) {
|
|
this.id = id
|
|
return this
|
|
}
|
|
|
|
getId() {
|
|
return this.id
|
|
}
|
|
|
|
setMap(map: Map) {
|
|
this.map = map
|
|
return this
|
|
}
|
|
|
|
getMap() {
|
|
return this.map
|
|
}
|
|
|
|
setEffect(effect: string) {
|
|
this.effect = effect
|
|
return this
|
|
}
|
|
|
|
getEffect() {
|
|
return this.effect
|
|
}
|
|
|
|
setStrength(strength: number) {
|
|
this.strength = strength
|
|
return this
|
|
}
|
|
|
|
getStrength() {
|
|
return this.strength
|
|
}
|
|
}
|