Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李楚霏
/
refactorTest
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1e689b2d
authored
Jun 06, 2020
by
李楚霏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
task10--调整子类;增加新的conjured子类
parent
24efc7bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
19 deletions
+35
-19
gildedRose/src/AgedBrie.js
+4
-4
gildedRose/src/BackstagePass.js
+11
-11
gildedRose/src/Conjured.js
+16
-0
gildedRose/src/Sulfuras.js
+4
-4
No files found.
gildedRose/src/AgedBrie.js
View file @
1e689b2d
...
...
@@ -6,12 +6,12 @@ export class AgedBrie extends Item {
this
.
name
=
'Aged Brie'
}
updateQuality
(
item
)
{
if
(
item
.
quality
<
50
)
{
item
.
quality
=
item
.
quality
+
1
updateQuality
()
{
if
(
this
.
quality
<
50
)
{
this
.
quality
=
this
.
quality
+
1
}
}
updateQualityAfterExpired
(
item
)
{
updateQualityAfterExpired
()
{
return
}
isAgedBire
()
{
...
...
gildedRose/src/BackstagePass.js
View file @
1e689b2d
...
...
@@ -9,24 +9,24 @@ export class BackstagePass extends Item{
isBackStage
()
{
return
true
}
updateQuality
(
item
)
{
if
(
item
.
quality
>=
50
)
{
updateQuality
()
{
if
(
this
.
quality
>=
50
)
{
return
}
if
(
item
.
sell_in
<
11
)
{
if
(
item
.
quality
<
50
)
{
item
.
quality
=
item
.
quality
+
1
if
(
this
.
sell_in
<
11
)
{
if
(
this
.
quality
<
50
)
{
this
.
quality
=
this
.
quality
+
1
}
}
if
(
item
.
sell_in
<
6
)
{
if
(
item
.
quality
<
50
)
{
item
.
quality
=
item
.
quality
+
1
if
(
this
.
sell_in
<
6
)
{
if
(
this
.
quality
<
50
)
{
this
.
quality
=
this
.
quality
+
1
}
}
}
updateQualityAfterExpired
(
item
)
{
if
(
item
.
quality
<
50
)
{
item
.
quality
=
item
.
quality
+
1
updateQualityAfterExpired
()
{
if
(
this
.
quality
<
50
)
{
this
.
quality
=
this
.
quality
+
1
}
}
}
gildedRose/src/Conjured.js
0 → 100644
View file @
1e689b2d
import
{
Item
}
from
'./item'
export
class
Conjured
extends
Item
{
constructor
(
sell_in
,
quality
)
{
super
(
sell_in
,
quality
)
this
.
name
=
'Conjured'
}
updateQuality
()
{}
updateQualityAfterExpired
()
{
this
.
quality
-=
2
}
isConjured
()
{
return
true
}
}
gildedRose/src/Sulfuras.js
View file @
1e689b2d
import
{
Item
}
from
'./item'
export
class
Sulfuras
extends
Item
{
export
class
Sulfuras
extends
Item
{
constructor
(
sell_in
,
quality
)
{
super
(
sell_in
,
quality
)
this
.
name
=
'Sulfuras, Hand of Ragnaros'
...
...
@@ -9,11 +9,11 @@ export class Sulfuras extends Item{
isSulfuras
()
{
return
true
}
updateQuality
(
item
)
{}
updateQualityAfterExpired
(
item
)
{
updateQuality
()
{}
updateQualityAfterExpired
()
{
return
}
updateSellIn
(
item
)
{
updateSellIn
()
{
return
}
}
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