mirror of
https://github.com/jiojciojsioe3/a3cjroijsiojiorj.git
synced 2024-12-23 01:36:14 +08:00
Game: Improve gauge
This commit is contained in:
parent
09c212df8b
commit
41afc2a905
@ -1347,10 +1347,10 @@
|
||||
var secondTop = config.multiplayer ? 0 : 8
|
||||
|
||||
config.percentage = Math.max(0, Math.min(1, config.percentage))
|
||||
var cleared = config.percentage - 1 / 50 >= config.clear
|
||||
var cleared = config.percentage >= config.clear
|
||||
|
||||
var gaugeW = 14 * 50
|
||||
var gaugeClear = gaugeW * config.clear
|
||||
var gaugeClear = gaugeW * (config.clear - 1 / 50)
|
||||
var gaugeFilled = gaugeW * config.percentage
|
||||
|
||||
ctx.fillStyle = "#000"
|
||||
|
@ -171,7 +171,7 @@ class Controller{
|
||||
gameEnded(){
|
||||
var score = this.getGlobalScore()
|
||||
var vp
|
||||
if(Math.round(score.gauge / 2) - 1 >= 25){
|
||||
if(this.game.rules.clearReached(score.gauge)){
|
||||
if(score.bad === 0){
|
||||
vp = "fullcombo"
|
||||
this.playSound("v_fullcombo", 1.350)
|
||||
|
@ -18,10 +18,11 @@ class Game{
|
||||
title: selectedSong.title,
|
||||
difficulty: this.rules.difficulty
|
||||
}
|
||||
this.HPGain = 100 / this.songData.circles.filter(circle => {
|
||||
var combo = this.songData.circles.filter(circle => {
|
||||
var type = circle.type
|
||||
return (type === "don" || type === "ka" || type === "daiDon" || type === "daiKa") && (!circle.branch || circle.branch.active)
|
||||
}).length
|
||||
this.soulPoints = this.rules.soulPoints(combo)
|
||||
this.paused = false
|
||||
this.started = false
|
||||
this.mainMusicPlaying = false
|
||||
@ -628,12 +629,15 @@ class Game{
|
||||
switch(score){
|
||||
case 450:
|
||||
this.globalScore.good++
|
||||
this.globalScore.gauge += this.soulPoints.good
|
||||
break
|
||||
case 230:
|
||||
this.globalScore.ok++
|
||||
this.globalScore.gauge += this.soulPoints.ok
|
||||
break
|
||||
case 0:
|
||||
this.globalScore.bad++
|
||||
this.globalScore.gauge += this.soulPoints.bad
|
||||
break
|
||||
}
|
||||
if (this.songData.scoremode) {
|
||||
@ -647,12 +651,10 @@ class Game{
|
||||
}
|
||||
}
|
||||
// Gauge update
|
||||
if(score !== 0){
|
||||
this.globalScore.gauge += this.HPGain
|
||||
}else if(this.globalScore.gauge - this.HPGain > 0){
|
||||
this.globalScore.gauge -= this.HPGain
|
||||
}else{
|
||||
if(this.globalScore.gauge < 0){
|
||||
this.globalScore.gauge = 0
|
||||
}else if(this.globalScore.gauge > 10000){
|
||||
this.globalScore.gauge = 10000
|
||||
}
|
||||
// Points update
|
||||
if (this.songData.scoremode == 2) {
|
||||
@ -719,10 +721,6 @@ class Game{
|
||||
this.currentCircle = closestCircle
|
||||
}
|
||||
}
|
||||
this.HPGain = 100 / this.songData.circles.filter(circle => {
|
||||
var type = circle.type
|
||||
return (type === "don" || type === "ka" || type === "daiDon" || type === "daiKa") && (!circle.branch || circle.branch.active)
|
||||
}).length
|
||||
if(this.controller.multiplayer === 1){
|
||||
p2.send("branch", activeName)
|
||||
}
|
||||
|
@ -18,7 +18,51 @@ class GameRules{
|
||||
this.bad = 13 / 2 * frame
|
||||
break
|
||||
}
|
||||
switch(this.difficulty){
|
||||
case "easy":
|
||||
this.gaugeClear = 30 / 50
|
||||
break
|
||||
case "normal":
|
||||
case "hard":
|
||||
this.gaugeClear = 35 / 50
|
||||
break
|
||||
case "oni":
|
||||
case "ura":
|
||||
this.gaugeClear = 40 / 50
|
||||
break
|
||||
}
|
||||
|
||||
this.daiLeniency = 2 * frame
|
||||
}
|
||||
soulPoints(combo){
|
||||
var good, ok, bad
|
||||
switch(this.difficulty){
|
||||
case "easy":
|
||||
good = Math.floor(10000 / combo * 1.575)
|
||||
ok = Math.floor(good * 0.75)
|
||||
bad = Math.ceil(good * -2)
|
||||
break
|
||||
case "normal":
|
||||
good = Math.floor(10000 / combo / 0.7)
|
||||
ok = Math.floor(good * 0.75)
|
||||
bad = Math.ceil(good / -0.75)
|
||||
break
|
||||
case "hard":
|
||||
good = Math.floor(10000 / combo * 1.5)
|
||||
ok = Math.floor(good * 0.75)
|
||||
bad = Math.ceil(good / -0.8)
|
||||
break
|
||||
case "oni":
|
||||
case "ura":
|
||||
good = Math.floor(10000 / combo / 0.7)
|
||||
ok = Math.floor(good * 0.5)
|
||||
bad = Math.ceil(good * -1.6)
|
||||
break
|
||||
}
|
||||
return {good: good, ok: ok, bad: bad}
|
||||
}
|
||||
clearReached(gauge){
|
||||
var gaugePercent = Math.round(gauge / 200) / 50
|
||||
return gaugePercent >= this.gaugeClear
|
||||
}
|
||||
}
|
||||
|
@ -319,15 +319,18 @@ class Scoresheet{
|
||||
var elapsed = 0
|
||||
}
|
||||
|
||||
var gaugePercent = Math.round(this.results.gauge / 2) / 50
|
||||
var gaugePercent = Math.round(this.results.gauge / 200) / 50
|
||||
var gaugeClear = [this.controller.game.rules.gaugeClear]
|
||||
if(players === 2){
|
||||
var gauge2 = Math.round(p2.results.gauge / 2) / 50
|
||||
if(gauge2 > gaugePercent){
|
||||
gaugePercent = gauge2
|
||||
gaugeClear.push(this.controller.syncWith.game.rules.gaugeClear)
|
||||
}
|
||||
var failedOffset = gaugePercent >= gaugeClear[0] ? 0 : -2000
|
||||
if(players === 2){
|
||||
var gauge2 = Math.round(p2.results.gauge / 200) / 50
|
||||
if(gauge2 > gaugePercent && failedOffset !== 0 && gauge2 >= gaugeClear[1]){
|
||||
failedOffset = 0
|
||||
}
|
||||
}
|
||||
var gaugeClear = 25 / 50
|
||||
var failedOffset = gaugePercent >= gaugeClear ? 0 : -2000
|
||||
if(elapsed >= 3100 + failedOffset){
|
||||
for(var p = 0; p < players; p++){
|
||||
ctx.save()
|
||||
@ -335,8 +338,8 @@ class Scoresheet{
|
||||
if(p === 1){
|
||||
results = p2.results
|
||||
}
|
||||
var resultGauge = Math.round(results.gauge / 2) / 50
|
||||
var clear = resultGauge >= gaugeClear
|
||||
var resultGauge = Math.round(results.gauge / 200) / 50
|
||||
var clear = resultGauge >= gaugeClear[p]
|
||||
if(p === 1 || !this.multiplayer && clear){
|
||||
ctx.translate(0, 290)
|
||||
}
|
||||
@ -570,7 +573,7 @@ class Scoresheet{
|
||||
if(this.tetsuoHanaClass){
|
||||
this.tetsuoHana.classList.remove(this.tetsuoHanaClass)
|
||||
}
|
||||
this.tetsuoHanaClass = gaugePercent >= gaugeClear ? "dance" : "failed"
|
||||
this.tetsuoHanaClass = this.controller.game.rules.clearReached(this.results.gauge) ? "dance" : "failed"
|
||||
this.tetsuoHana.classList.add(this.tetsuoHanaClass)
|
||||
}
|
||||
}
|
||||
@ -589,25 +592,26 @@ class Scoresheet{
|
||||
results = p2.results
|
||||
ctx.translate(0, p2Offset)
|
||||
}
|
||||
var gaugePercent = Math.round(results.gauge / 2) / 50
|
||||
var gaugePercent = Math.round(results.gauge / 200) / 50
|
||||
var w = 712
|
||||
this.draw.gauge({
|
||||
ctx: ctx,
|
||||
x: 558 + w,
|
||||
y: 116,
|
||||
clear: 25 / 50,
|
||||
clear: gaugeClear[p],
|
||||
percentage: gaugePercent,
|
||||
font: this.font,
|
||||
scale: w / 788,
|
||||
scoresheet: true,
|
||||
blue: p === 1
|
||||
})
|
||||
var rules = p === 0 ? this.controller.game.rules : this.controller.syncWith.game.rules
|
||||
this.draw.soul({
|
||||
ctx: ctx,
|
||||
x: 1215,
|
||||
y: 144,
|
||||
scale: 36 / 42,
|
||||
cleared: gaugePercent - 1 / 50 >= 25 / 50
|
||||
cleared: rules.clearReached(results.gauge)
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -625,7 +629,8 @@ class Scoresheet{
|
||||
results = p2.results
|
||||
}
|
||||
var crownType = null
|
||||
if(Math.round(results.gauge / 2) - 1 >= 25){
|
||||
var rules = p === 0 ? this.controller.game.rules : this.controller.syncWith.game.rules
|
||||
if(rules.clearReached(results.gauge)){
|
||||
crownType = results.bad === "0" ? "gold" : "silver"
|
||||
}
|
||||
if(crownType !== null){
|
||||
|
@ -17,6 +17,7 @@
|
||||
this.songBg = document.getElementById("songbg")
|
||||
this.songStage = document.getElementById("song-stage")
|
||||
|
||||
this.rules = this.controller.game.rules
|
||||
this.portraitClass = false
|
||||
this.touchp2Class = false
|
||||
this.darkDonBg = false
|
||||
@ -347,7 +348,7 @@
|
||||
}
|
||||
|
||||
var score = this.controller.getGlobalScore()
|
||||
var gaugePercent = Math.round(score.gauge / 2) / 50
|
||||
var gaugePercent = Math.round(score.gauge / 200) / 50
|
||||
|
||||
if(this.multiplayer === 2){
|
||||
var scoreImg = "bg_score_p2"
|
||||
@ -497,7 +498,7 @@
|
||||
ctx: ctx,
|
||||
x: winW,
|
||||
y: this.multiplayer === 2 ? 468 : 273,
|
||||
clear: 25 / 50,
|
||||
clear: this.rules.gaugeClear,
|
||||
percentage: gaugePercent,
|
||||
font: this.font,
|
||||
scale: 0.7,
|
||||
@ -509,7 +510,7 @@
|
||||
x: winW - 40,
|
||||
y: this.multiplayer === 2 ? 484 : 293,
|
||||
scale: 0.75,
|
||||
cleared: gaugePercent - 1 / 50 >= 25 / 50
|
||||
cleared: this.rules.clearReached(score.gauge)
|
||||
})
|
||||
|
||||
// Note bar
|
||||
@ -572,7 +573,7 @@
|
||||
ctx: ctx,
|
||||
x: winW,
|
||||
y: this.multiplayer === 2 ? 357 : 135,
|
||||
clear: 25 / 50,
|
||||
clear: this.rules.gaugeClear,
|
||||
percentage: gaugePercent,
|
||||
font: this.font,
|
||||
multiplayer: this.multiplayer === 2,
|
||||
@ -582,7 +583,7 @@
|
||||
ctx: ctx,
|
||||
x: winW - 57,
|
||||
y: this.multiplayer === 2 ? 378 : 165,
|
||||
cleared: gaugePercent - 1 / 50 >= 25 / 50
|
||||
cleared: this.rules.clearReached(score.gauge)
|
||||
})
|
||||
|
||||
// Note bar
|
||||
@ -1881,8 +1882,8 @@
|
||||
}
|
||||
}else{
|
||||
var animation = this.assets.don.getAnimation()
|
||||
var gauge = this.controller.getGlobalScore().gauge
|
||||
var cleared = Math.round(gauge / 2) - 1 >= 25
|
||||
var score = this.controller.getGlobalScore()
|
||||
var cleared = this.rules.clearReached(score.gauge)
|
||||
if(animation === "gogo" || cleared && animation === "normal" || !cleared && animation === "clear"){
|
||||
this.assets.don.normalAnimation()
|
||||
}
|
||||
|
@ -42,16 +42,20 @@ class ViewAssets{
|
||||
var length = this.don.getAnimationLength("gogo")
|
||||
this.don.setUpdateSpeed(4 / length)
|
||||
this.don.setAnimation("gogo")
|
||||
}else if(Math.round(this.controller.getGlobalScore().gauge / 2) - 1 >= 25){
|
||||
this.don.setAnimationStart(0)
|
||||
var length = this.don.getAnimationLength("clear")
|
||||
this.don.setUpdateSpeed(2 / length)
|
||||
this.don.setAnimation("clear")
|
||||
}else{
|
||||
this.don.setAnimationStart(0)
|
||||
var length = this.don.getAnimationLength("normal")
|
||||
this.don.setUpdateSpeed(4 / length)
|
||||
this.don.setAnimation("normal")
|
||||
var score = this.controller.getGlobalScore()
|
||||
var cleared = this.controller.game.rules.clearReached(score.gauge)
|
||||
if(cleared){
|
||||
this.don.setAnimationStart(0)
|
||||
var length = this.don.getAnimationLength("clear")
|
||||
this.don.setUpdateSpeed(2 / length)
|
||||
this.don.setAnimation("clear")
|
||||
}else{
|
||||
this.don.setAnimationStart(0)
|
||||
var length = this.don.getAnimationLength("normal")
|
||||
this.don.setUpdateSpeed(4 / length)
|
||||
this.don.setAnimation("normal")
|
||||
}
|
||||
}
|
||||
}
|
||||
this.don.addFrames("clear", 30, "don_anim_clear")
|
||||
|
Loading…
Reference in New Issue
Block a user