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
19ac797c
Commit
19ac797c
authored
Jul 09, 2019
by
18손재민
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
공격 단어 오타낼 시 강호패가 공격자에게 생기는 기능 구현. 이제 공격할 경우 호패 2개가 추가로 생김.
parent
13860f74
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
Client.js
js/Client.js
+5
-0
WordObject.js
js/WordObject.js
+8
-3
WordSpace.js
js/WordSpace.js
+8
-2
No files found.
js/Client.js
View file @
19ac797c
...
@@ -43,6 +43,11 @@ socket.on('defeat', function(msg) // object player
...
@@ -43,6 +43,11 @@ socket.on('defeat', function(msg) // object player
console
.
log
(
RoomData
.
players
[
msg
.
index
].
nickname
+
'
defeated
'
);
console
.
log
(
RoomData
.
players
[
msg
.
index
].
nickname
+
'
defeated
'
);
});
});
socket
.
on
(
'
attacksuccess
'
,
function
(
msg
)
{
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
msg
.
victim
,
true
));
});
// out game
// out game
socket
.
on
(
'
userDisconnect
'
,
function
(
msg
)
// {num index , num id, str nickname}
socket
.
on
(
'
userDisconnect
'
,
function
(
msg
)
// {num index , num id, str nickname}
{
{
...
...
js/WordObject.js
View file @
19ac797c
...
@@ -140,8 +140,8 @@ class AttackWord extends WordObject
...
@@ -140,8 +140,8 @@ class AttackWord extends WordObject
this
.
wordWeight
*=
isStrong
?
3
:
2
;
this
.
wordWeight
*=
isStrong
?
3
:
2
;
this
.
attacker
=
_playerData
;
this
.
attacker
=
_playerData
;
//서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함
//서버 사용하게 되면 PlayerTyping을 피격자의 것으로 바꿔야 함
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
*
(
WordSpace
.
playerTyping
/
60
)
*
2
:
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
*
(
WordSpace
.
playerTyping
/
60
)
*
1.5
:
((
5
-
_wordGrade
)
*
2.5
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
3
)
*
(
WordSpace
.
playerTyping
/
60
)
*
2
);
((
5
-
_wordGrade
)
*
2.5
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
*
(
WordSpace
.
playerTyping
/
60
)
*
1.5
);
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
.
nickname
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Attack text :
'
+
text
+
'
, Attacker :
'
+
this
.
attacker
.
nickname
+
'
, Weight :
'
+
this
.
wordWeight
);
console
.
log
(
'
Counter time :
'
+
this
.
counterTime
);
console
.
log
(
'
Counter time :
'
+
this
.
counterTime
);
}
}
...
@@ -155,7 +155,12 @@ class AttackWord extends WordObject
...
@@ -155,7 +155,12 @@ class AttackWord extends WordObject
case
3
:
WordSpace
.
attackGauge
.
add
(
0.5
);
break
;
case
3
:
WordSpace
.
attackGauge
.
add
(
0.5
);
break
;
default
:
console
.
log
(
'
[ERR] wrong grade of word
'
);
break
;
default
:
console
.
log
(
'
[ERR] wrong grade of word
'
);
break
;
}
}
if
(
WordSpace
.
gameTimer
.
now
<
this
.
counterTime
)
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
this
.
attacker
,
true
));
if
(
WordSpace
.
gameTimer
.
now
<
this
.
counterTime
)
{
WordSpace
.
nameGroup
.
push
(
new
NameWord
(
this
.
attacker
,
true
));
WordSpace
.
generateWord
.
Name
(
WordSpace
.
gameSceneForTest
,
false
);
WordSpace
.
generateWord
.
Name
(
WordSpace
.
gameSceneForTest
,
false
);
}
//강호패 넣기 구현해야됨
//강호패 넣기 구현해야됨
//WordSpace.generateWord.Name(WordSpace.gameSceneForTest, true);
//WordSpace.generateWord.Name(WordSpace.gameSceneForTest, true);
super
.
destroy
();
super
.
destroy
();
...
...
js/WordSpace.js
View file @
19ac797c
...
@@ -354,8 +354,14 @@ WordSpace.findWord = function(wordText)
...
@@ -354,8 +354,14 @@ WordSpace.findWord = function(wordText)
{
{
if
(
WordSpace
.
getEditDistance
(
wordText
,
element
.
wordText
)
==
minDist
)
if
(
WordSpace
.
getEditDistance
(
wordText
,
element
.
wordText
)
==
minDist
)
{
{
//강호패 보내야 함
//console.log('Attack word : ' + element.wordText + ' of ' + element.attacker.nickname + ' 오타임');
console
.
log
(
'
Attack word :
'
+
element
.
wordText
+
'
of
'
+
element
.
attacker
.
nickname
+
'
오타임
'
);
let
attackedData
=
{
roomNum
:
RoomData
.
roomNum
,
victim
:
RoomData
.
myself
,
target
:
element
.
attacker
.
ownerId
}
socket
.
emit
(
'
defenseFailed
'
,
attackedData
);
}
}
});
});
this
.
attackGauge
.
sub
(
2
);
this
.
attackGauge
.
sub
(
2
);
...
...
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