Fix: revise meat code

This commit is contained in:
2019-12-12 10:09:17 +09:00
parent 8dce19a228
commit 8f9e0e6a87
4 changed files with 62 additions and 51 deletions
+18 -19
View File
@@ -78,8 +78,8 @@ MeatBase.prototype.initScoreArray = function() {
MeatBase.prototype.initCookingTimeForGradeArray = function() {
this.cookingTimeForGradeArray = [];
this.cookingTimeForGradeArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.COOKING_TIME_WELLDONE_MS;
this.cookingTimeForGradeArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.COOKING_TIME_BURN_BLACK_MS;
this.cookingTimeForGradeArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.COOKING_TIME_WELLDONE;
this.cookingTimeForGradeArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.COOKING_TIME_BURN_BLACK;
}
MeatBase.prototype.initMouseEventHandler = function() {
@@ -180,7 +180,7 @@ MeatBase.prototype.getScore = function() {
return scoreDoneness;
var totalCookingTime = this.getTotalCookingTime();
return scoreDoneness * totalCookingTime;
return Math.floor(scoreDoneness * totalCookingTime);
}
MeatBase.prototype.isFront = function() {
@@ -234,7 +234,7 @@ MeatBase.prototype.hide = function() {
this.stopCook();
}
MeatBase.prototype.isActivate = function() {
MeatBase.prototype.isActive = function() {
return this.isActivated;
}
@@ -301,27 +301,26 @@ MeatBase.prototype.setActive = function(isActivated, x, y) {
}
MeatBase.prototype.cooking = function() {
var side = this.cookingSide;
var burnLevel = this.mainGame.getBurnLevel();
var cookingSpeed = this.cookingSpeedArray[burnLevel];
this.cookingTimeBySide[this.cookingSide] += 1 * cookingSpeed;
this.cookingTimeBySide[side] += 1 * cookingSpeed;
var cookingTimeBurnBlack = this.cookingTimeForGradeArray[MeatBase.DONENESS_BURN_BLACK];
var cookingTimeWelldone = this.cookingTimeForGradeArray[MeatBase.DONENESS_WELLDONE];
if(this.cookingTimeBySide[this.cookingSide] > cookingTimeBurnBlack) {
if(this.getMeatGradeBySide(this.cookingSide) != MeatBase.DONENESS_BURN_BLACK) {
this.cookingGradeBySide[this.cookingSide] = MeatBase.DONENESS_BURN_BLACK;
this.changeAnimateSmokeColor(MeatBase.DONENESS_BURN_BLACK);
}
} else if(this.cookingTimeBySide[this.cookingSide] > cookingTimeWelldone) {
if(this.getMeatGradeBySide(this.cookingSide) != MeatBase.DONENESS_WELLDONE) {
this.cookingGradeBySide[this.cookingSide] = MeatBase.DONENESS_WELLDONE;
this.changeAnimateSmokeColor(MeatBase.DONENESS_WELLDONE);
}
if(this.cookingTimeBySide[side] > cookingTimeBurnBlack) {
if(this.getMeatGradeBySide(side) != MeatBase.DONENESS_BURN_BLACK)
this.setMeatGrade(side, MeatBase.DONENESS_BURN_BLACK);
} else if(this.cookingTimeBySide[side] > cookingTimeWelldone) {
if(this.getMeatGradeBySide(side) != MeatBase.DONENESS_WELLDONE)
this.setMeatGrade(side, MeatBase.DONENESS_WELLDONE);
}
}
MeatBase.prototype.setMeatGrade = function(side, grade) {
this.cookingGradeBySide[side] = grade;
this.changeAnimateSmokeColor(grade);
}
MeatBase.prototype.stopAnimateSmoke = function() {
@@ -371,9 +370,9 @@ MeatBase.DONENESS_WELLDONE = 1;
MeatBase.DONENESS_BURN_BLACK = 2;
MeatBase.DONENESS_NONE = 3;
MeatBase.COOKING_TIME_WELLDONE_MS = 200;
MeatBase.COOKING_TIME_BURN_BLACK_MS = 400;
MeatBase.COOKING_TIME_WELLDONE = 200;
MeatBase.COOKING_TIME_BURN_BLACK = 400;
MeatBase.COOKING_SPEED_BURN_LEVEL_WEAK = 1;
MeatBase.COOKING_SPEED_BURN_LEVEL_NORMAL = 1.5;
MeatBase.COOKING_SPEED_BURN_LEVEL_WEAK = 0.7;
MeatBase.COOKING_SPEED_BURN_LEVEL_NORMAL = 1;
MeatBase.COOKING_SPEED_BURN_LEVEL_STRONG = 2;