-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfight.js
More file actions
45 lines (34 loc) · 867 Bytes
/
fight.js
File metadata and controls
45 lines (34 loc) · 867 Bytes
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
state = require('./state')
function attack(pl, c){
var atk = pl.message.text.toLowerCase()
if(Math.random() < 0.7){
c.say('Attack: ' + atk + ' OP -1, EXP +1').then(pl => {
c.ask({
text: 'how are you going to defend yourself?',
quickReplies: ['wet towel', 'kitchensink']
}, defense)
})
}
}
function defense(pl, c){
var def = pl.message.text.toLowerCase()
if(Math.random() < 0.3){
c.say('Defense: ' + def + ' OP -1, EXP +1').then(pl => {
c.end()
})
}
}
function opponentAttack(pl, co){
}
function opponentDefense(pl, co){
}
module.exports = {
startFight: function(convo){
convo.say('A big ghost is right in front of you').then((pl) => {
convo.ask({
text: 'how do you attack?',
quickReplies: ['dagger', 'spell', 'spear']
}, attack);
})
}
}