Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sejong25
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Tear of Sejong
sejong25
Commits
94d2cd10
Commit
94d2cd10
authored
Jul 22, 2019
by
18신대성
Committed by
18손재민
Jul 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
끝내기단어 조건 변경 및 페이즈변경 조건 변경
parent
e41809ef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
17 deletions
+19
-17
GameServer.js
GameServer.js
+11
-4
WordSpace.js
js/WordSpace.js
+1
-10
server.js
server.js
+7
-3
No files found.
GameServer.js
View file @
94d2cd10
...
...
@@ -212,6 +212,7 @@ class GameRoom
if
(
this
.
phaseChanger
<
0
&&
checkTime
-
this
.
startTime
>
60000
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
this
.
rateArrangePoint
=
150
;
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
}
else
if
(
this
.
phaseChanger
<
0
)
...
...
@@ -219,6 +220,7 @@ class GameRoom
this
.
phaseChanger
=
setTimeout
(
function
(
room
)
{
room
.
currentPhase
=
GameServer
.
Phase
.
MAIN
;
room
.
rateArrangePoint
=
150
;
room
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MAIN
);
room
.
phaseChanger
=
-
1
;
},
60000
-
(
checkTime
-
this
.
startTime
),
this
);
...
...
@@ -226,10 +228,11 @@ class GameRoom
}
else
if
(
this
.
currentPhase
===
GameServer
.
Phase
.
MAIN
)
{
let
playerLimit
=
Math
.
m
ax
(
this
.
currentPlayer
.
length
/
10
,
3
);
let
playerLimit
=
Math
.
m
in
(
Math
.
round
(
this
.
currentPlayer
.
length
/
5
)
,
3
);
if
(
this
.
aliveCount
<=
playerLimit
)
{
this
.
currentPhase
=
GameServer
.
Phase
.
MUSIC
;
this
.
rateArrangePoint
=
50
;
this
.
announceToRoom
(
'
changePhase
'
,
GameServer
.
Phase
.
MUSIC
);
}
}
...
...
@@ -291,7 +294,7 @@ class Player
this
.
rank
=
-
1
;
this
.
playerTyping
=
0
;
this
.
lastAttacks
=
[];
// { attackerId, word, wordGrade, time }
this
.
lastAttacks
=
[];
// { attackerId,
attacker, wrongCount,
word, wordGrade, time }
this
.
lastAttack
=
null
;
}
...
...
@@ -311,12 +314,16 @@ class Player
if
(
this
.
lastAttacks
.
length
>
0
)
{
this
.
lastAttack
=
this
.
lastAttacks
[
this
.
lastAttacks
.
length
-
1
];
if
(
Date
.
now
()
-
this
.
lastAttack
.
time
>
4
0000
)
this
.
lastAttack
=
null
;
if
(
Date
.
now
()
-
this
.
lastAttack
.
time
>
2
0000
)
this
.
lastAttack
=
null
;
else
{
this
.
lastAttacks
.
forEach
(
function
(
element
)
{
if
(
Date
.
now
()
-
element
.
time
<
40000
&&
element
.
wordGrade
>
player
.
lastAttack
.
wordGrade
)
player
.
lastAttack
=
element
;
if
(
Date
.
now
()
-
element
.
time
<
20000
)
{
if
(
element
.
wrongCount
>
player
.
lastAttack
.
wrongCount
)
player
.
lastAttack
=
element
;
else
if
(
element
.
wrongCount
===
player
.
lastAttack
.
wrongCount
&&
element
.
wordGrade
>
player
.
lastAttack
.
wordGrade
)
player
.
lastAttack
=
element
;
}
});
}
}
...
...
js/WordSpace.js
View file @
94d2cd10
...
...
@@ -65,16 +65,7 @@ WordSpace.spaceInitiate = function(scene)
WordSpace
.
AdjustVarByPhase
=
function
(
typingRate
,
phase
)
{
if
(
phase
==
WordSpace
.
Phase
.
READY
)
{
WordSpace
.
delay
.
WordSpawn
=
10000
;
WordSpace
.
delay
.
NameSpawn
=
10000
;
WordSpace
.
NameSpawnReduce
=
0
;
WordSpace
.
GradeProb
[
0
]
=
1
;
WordSpace
.
GradeProb
[
1
]
=
1
;
WordSpace
.
GradeProb
[
2
]
=
1
;
}
else
if
(
phase
==
WordSpace
.
Phase
.
START
)
if
(
phase
==
WordSpace
.
Phase
.
START
)
{
WordSpace
.
delay
.
WordSpawn
=
3000
;
WordSpace
.
delay
.
NameSpawn
=
15000
;
...
...
server.js
View file @
94d2cd10
...
...
@@ -106,16 +106,16 @@ io.on('connection', function(socket)
{
attackerId
:
msg
.
attacker
.
id
,
attacker
:
msg
.
attacker
.
nickname
,
wrongCount
:
0
,
word
:
msg
.
text
,
wordGrade
:
msg
.
grade
,
time
:
Date
.
now
()
}
if
(
target
.
playerData
.
playingData
.
lastAttacks
.
length
<
5
)
target
.
playerData
.
playingData
.
lastAttacks
.
push
(
dataToPush
);
else
target
.
playerData
.
playingData
.
lastAttacks
.
push
(
dataToPush
);
while
(
target
.
playerData
.
playingData
.
lastAttacks
[
0
].
time
+
20000
<
Date
.
now
())
{
target
.
playerData
.
playingData
.
lastAttacks
.
splice
(
0
,
1
);
target
.
playerData
.
playingData
.
lastAttacks
.
push
(
dataToPush
);
}
}
},
4000
);
...
...
@@ -129,6 +129,10 @@ io.on('connection', function(socket)
socket
.
on
(
'
defenseFailed
'
,
function
(
msg
)
{
socket
.
playerData
.
currentRoom
.
announceToTarget
(
msg
.
target
,
'
attackSucceed
'
,
msg
);
//let socket.playerData.playingData.lastAttacks.findIndex(function(element)
//{
//})
});
socket
.
on
(
'
disconnect
'
,
function
(
reason
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment