Commit 1e689b2d by 李楚霏

task10--调整子类;增加新的conjured子类

parent 24efc7bd
......@@ -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() {
......
......@@ -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
}
}
}
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
}
}
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
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment