-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactions.js
55 lines (50 loc) · 1.3 KB
/
actions.js
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
54
55
const state = require('./state')
const fight = require('./fight')
const player = require('./player')
function showRoom(pl, c){
var game = state.getState(pl.sender.id)
c.say('Room is: (' + game.player.pos.x + ', '+ game.player.pos.y +')')
}
module.exports = {
showMap: (pl, c) =>{
console.log(pl)
map = state.getState(pl.sender.id)
c.say(player.getMapAscii(pl.sender.id))
},
showRoom: showRoom,
showInventory: (pl, c) =>{
c.say('here is your Inventory:')
c.say({
attachment: 'image',
url: 'http://ludumdare.com/compo/wp-content/uploads/2016/12/compromise-550x300.png'
})
},
moveUp: function(pl, c){
if(Math.random() > 0.5){
c.conversation(fight.startFight)
}
player.move(pl.sender.id, 'up')
},
moveDown: function(pl, c){
if(Math.random() > 0.5){
c.conversation(fight.startFight)
}
player.move(pl.sender.id, 'down')
},
moveLeft: function(pl, c){
if(Math.random() > 0.5){
c.conversation(fight.startFight)
}
player.move(pl.sender.id, 'left')
},
moveRight: function(pl, c){
if(Math.random() > 0.5){
c.conversation(fight.startFight)
}
player.move(pl.sender.id, 'right')
},
showNeighbors: function(pl, c){
var n = player.getNeighbors(pl.sender.id)
c.say(JSON.stringify(n))
}
}