-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathitems.wlk
53 lines (46 loc) · 1.43 KB
/
items.wlk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import HUD.*
import main.posicionAleatoria
import mapa.*
import alf.*
class Item {
const property image
var property position = posicionAleatoria.calcular()
method accion()
method irAlInventario(){
inventarioHUD.tomar(self)
}
}
class ItemOfensivo inherits Item {
const property danioExtra
override method accion() {
alf.danio(danioExtra)
}
}
class ItemDeCuracion inherits Item {
const property curacion
override method accion() {
alf.curarse(curacion)
}
}
class ItemDeApertura inherits Item {
const abreA
override method accion() {
abreA.accion()
}
}
class ItemDeAlmacenamiento inherits Item () {
override method accion() {
if(alf.position().distance(self.position()) == 1) {
alf.habitacionActual().itemsDisponibles().remove(self)
alf.habitacionActual().itemsDisponibles().add(llaveJefe)
game.addVisual(llaveJefe)
game.removeVisual(self)
}
}
override method irAlInventario() {}
}
const espada = new ItemOfensivo(image = "espada.png", danioExtra = 20, position = game.at(11,6))
const hamburgesa = new ItemDeCuracion(image = "hamburguesa.png", curacion = 50, position = game.at(10,3))
const cofre = new ItemDeAlmacenamiento(image = "cofre.png", position = game.at(14,4))
const llave = new ItemDeApertura(abreA = cofre, image = "llave.png", position = game.at(13,6))
const llaveJefe = new ItemDeApertura(abreA = puerta3, image = "llaveJefe.png", position = cofre.position())