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
645b87c2
Commit
645b87c2
authored
Jul 18, 2019
by
18손재민
Committed by
18신대성
Jul 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
반격에 성공 시 그 단어를 공격자에게 되돌림
parent
ba5266f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
+18
-6
Client.js
js/Client.js
+1
-1
WordObject.js
js/WordObject.js
+15
-3
WordSpace.js
js/WordSpace.js
+2
-2
No files found.
js/Client.js
View file @
645b87c2
...
@@ -115,7 +115,7 @@ socket.on('attacked', function(msg) // object attackData
...
@@ -115,7 +115,7 @@ socket.on('attacked', function(msg) // object attackData
//console.log('attacked by ' + msg.attacker.nickname);
//console.log('attacked by ' + msg.attacker.nickname);
setTimeout
(
function
()
setTimeout
(
function
()
{
{
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
isStrong
);
WordSpace
.
generateWord
.
Attack
(
ScenesData
.
gameScene
,
msg
.
text
,
msg
.
grade
,
msg
.
attacker
,
msg
.
isStrong
,
msg
.
isCountable
);
},
4000
);
},
4000
);
});
});
socket
.
on
(
'
defeat
'
,
function
(
msg
)
// object player
socket
.
on
(
'
defeat
'
,
function
(
msg
)
// object player
...
...
js/WordObject.js
View file @
645b87c2
...
@@ -138,15 +138,16 @@ class NormalWord extends WordObject
...
@@ -138,15 +138,16 @@ class NormalWord extends WordObject
class
AttackWord
extends
WordObject
class
AttackWord
extends
WordObject
{
{
constructor
(
text
,
_wordGrade
,
_playerData
,
isStrong
)
constructor
(
text
,
_wordGrade
,
_playerData
,
_isStrong
,
_isCountable
=
true
,
lenRate
)
{
{
super
(
text
);
super
(
text
);
this
.
wordGrade
=
_wordGrade
;
this
.
wordGrade
=
_wordGrade
;
this
.
wordWeight
=
this
.
isStrong
?
WordReader
.
strongAttackWeight
[
3
-
this
.
wordGrade
]
:
WordReader
.
attackWeight
[
3
-
this
.
wordGrade
];
this
.
wordWeight
=
_
isStrong
?
WordReader
.
strongAttackWeight
[
3
-
this
.
wordGrade
]
:
WordReader
.
attackWeight
[
3
-
this
.
wordGrade
];
if
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
>
9
)
if
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
>
9
)
this
.
wordWeight
+=
this
.
wordWeight
*
0.2
*
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
-
9
);
this
.
wordWeight
+=
this
.
wordWeight
*
0.2
*
(
WordReader
.
getWordTyping
(
_playerData
.
nickname
)
-
9
);
this
.
attacker
=
_playerData
;
this
.
attacker
=
_playerData
;
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
:
if
(
!
_isCountable
)
this
.
counterTime
=
0
;
else
this
.
counterTime
=
WordSpace
.
gameTimer
.
now
+
1000
*
(
this
.
wordTyping
<=
(
5
-
_wordGrade
)
*
2.5
?
this
.
wordTyping
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
:
((
5
-
_wordGrade
)
*
3
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
/
(
Math
.
max
(
200
,
WordSpace
.
playerTyping
)
/
60
)
*
1.5
);
((
5
-
_wordGrade
)
*
3
+
(
this
.
wordTyping
-
(
5
-
_wordGrade
)
*
2.5
)
*
2.5
)
/
(
Math
.
max
(
200
,
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
);
...
@@ -197,6 +198,17 @@ class AttackWord extends WordObject
...
@@ -197,6 +198,17 @@ class AttackWord extends WordObject
tempWord
.
physicsObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
tempWord
.
physicsObj
.
setPosition
(
this
.
physicsObj
.
x
,
this
.
physicsObj
.
y
);
tempWord
.
wordObj
.
setPosition
(
tempWord
.
physicsObj
.
x
,
tempWord
.
physicsObj
.
y
);
tempWord
.
wordObj
.
setPosition
(
tempWord
.
physicsObj
.
x
,
tempWord
.
physicsObj
.
y
);
tempWord
.
destroy
();
tempWord
.
destroy
();
let
attackData
=
{
roomNum
:
RoomData
.
roomId
,
attacker
:
RoomData
.
myself
,
target
:
this
.
attacker
.
id
,
text
:
this
.
wordText
,
grade
:
Math
.
min
(
3
,
this
.
wordGrade
+
1
),
isStrong
:
false
,
isCountable
:
false
}
socket
.
emit
(
'
attack
'
,
attackData
);
}
}
if
(
this
.
maskBackground
!=
null
)
this
.
maskBackground
.
destroy
();
if
(
this
.
maskBackground
!=
null
)
this
.
maskBackground
.
destroy
();
super
.
destroy
();
super
.
destroy
();
...
...
js/WordSpace.js
View file @
645b87c2
...
@@ -287,9 +287,9 @@ WordSpace.generateWord =
...
@@ -287,9 +287,9 @@ WordSpace.generateWord =
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
return
word
;
return
word
;
},
},
Attack
:
function
(
scene
,
wordText
,
grade
,
attacker
,
isStrong
,
lenRate
)
Attack
:
function
(
scene
,
wordText
,
grade
,
attacker
,
isStrong
,
isCountable
,
lenRate
)
{
{
word
=
new
AttackWord
(
wordText
,
grade
,
attacker
,
isStrong
);
word
=
new
AttackWord
(
wordText
,
grade
,
attacker
,
isStrong
,
isCountable
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
WordSpace
.
pushWord
(
scene
,
word
,
lenRate
);
return
word
;
return
word
;
},
},
...
...
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