Merge pull request #175 from magickale/gen3-scoring

Added Gen3 scoring
This commit is contained in:
Anthony Samms
2025-12-19 09:40:55 -05:00
committed by GitHub
5 changed files with 53 additions and 3 deletions

View File

@@ -0,0 +1 @@
61506649d1a0f78c7759ffd83b010e58ab0e167bdeb06b11584933d7a7409f35|Dogbite|t+pazolite

View File

@@ -9,6 +9,7 @@ nijiiro_notes = false
log_level = 30 log_level = 30
fake_online = false fake_online = false
practice_mode_bar_delay = 1 practice_mode_bar_delay = 1
score_method = "shinuchi"
[nameplate_1p] [nameplate_1p]
name = 'どんちゃん' name = 'どんちゃん'

View File

@@ -18,6 +18,7 @@ class GeneralConfig(TypedDict):
log_level: int log_level: int
fake_online: bool fake_online: bool
practice_mode_bar_delay: int practice_mode_bar_delay: int
score_method: str
class NameplateConfig(TypedDict): class NameplateConfig(TypedDict):
name: str name: str

View File

@@ -58,6 +58,10 @@ class Judgments(IntEnum):
OK = 1 OK = 1
BAD = 2 BAD = 2
class ScoreMethod():
GEN3 = "gen3"
SHINUCHI = "shinuchi"
class GameScreen(Screen): class GameScreen(Screen):
JUDGE_X = 414 * tex.screen_scale JUDGE_X = 414 * tex.screen_scale
JUDGE_Y = 256 * tex.screen_scale JUDGE_Y = 256 * tex.screen_scale
@@ -314,6 +318,7 @@ class Player:
self.player_num = player_num self.player_num = player_num
self.difficulty = difficulty self.difficulty = difficulty
self.visual_offset = global_data.config["general"]["visual_offset"] self.visual_offset = global_data.config["general"]["visual_offset"]
self.score_method = global_data.config["general"]["score_method"]
self.modifiers = modifiers self.modifiers = modifiers
self.tja = tja self.tja = tja
@@ -405,7 +410,25 @@ class Player:
for section in self.branch_m: for section in self.branch_m:
self.total_notes += len([note for note in section.play_notes if 0 < note.type < 5]) self.total_notes += len([note for note in section.play_notes if 0 < note.type < 5])
total_notes += section total_notes += section
self.base_score = 0
self.score_init = 0
self.score_diff = 0
if self.score_method == ScoreMethod.SHINUCHI:
self.base_score = calculate_base_score(total_notes) self.base_score = calculate_base_score(total_notes)
elif self.score_method == ScoreMethod.GEN3:
self.score_diff = self.tja.metadata.course_data[self.difficulty].scorediff
if self.score_diff <= 0:
logger.warning("Error: No scorediff specified or scorediff less than 0 | Using shinuchi scoring method instead")
self.score_diff = 0
score_init_list = self.tja.metadata.course_data[self.difficulty].scoreinit
if len(score_init_list) <= 0:
logger.warning("Error: No scoreinit specified or scoreinit less than 0 | Using shinuchi scoring method instead")
self.score_init = calculate_base_score(total_notes)
self.score_diff = 0 # in case there is a diff but not an init.
else:
self.score_init = score_init_list[0]
logger.debug(f"debug | score init: {self.score_init} | score diff: {self.score_diff}")
#Note management #Note management
self.timeline = notes.timeline self.timeline = notes.timeline
@@ -781,6 +804,9 @@ class Player:
self.combo_announce = ComboAnnounce(self.combo, current_time, self.player_num, self.is_2p) self.combo_announce = ComboAnnounce(self.combo, current_time, self.player_num, self.is_2p)
if self.combo > self.max_combo: if self.combo > self.max_combo:
self.max_combo = self.combo self.max_combo = self.combo
if self.combo % 100 == 0 and self.score_method == "gen3":
self.score += 10000
self.base_score_list.append(ScoreCounterAnimation(self.player_num, 10000, self.is_2p))
if note.type != NoteType.KUSUDAMA: if note.type != NoteType.KUSUDAMA:
is_big = note.type == NoteType.DON_L or note.type == NoteType.KAT_L or note.type == NoteType.BALLOON_HEAD is_big = note.type == NoteType.DON_L or note.type == NoteType.KAT_L or note.type == NoteType.BALLOON_HEAD
@@ -858,6 +884,17 @@ class Player:
ok_window_ms = Player.TIMING_OK ok_window_ms = Player.TIMING_OK
bad_window_ms = Player.TIMING_BAD bad_window_ms = Player.TIMING_BAD
if self.score_method == ScoreMethod.GEN3:
self.base_score = self.score_init
if 9 < self.combo and self.combo < 30:
self.base_score = math.floor(self.score_init + 1 * self.score_diff)
elif 29 < self.combo and self.combo < 50:
self.base_score = math.floor(self.score_init + 2 * self.score_diff)
elif 49 < self.combo and self.combo < 100:
self.base_score = math.floor(self.score_init + 4 * self.score_diff)
elif 99 < self.combo:
self.base_score = math.floor(self.score_init + 8 * self.score_diff)
curr_note = self.other_notes[0] if self.other_notes else None curr_note = self.other_notes[0] if self.other_notes else None
if self.is_drumroll: if self.is_drumroll:
self.check_drumroll(drum_type, background, current_time) self.check_drumroll(drum_type, background, current_time)
@@ -953,6 +990,9 @@ class Player:
self.chara.set_animation('balloon_popping') self.chara.set_animation('balloon_popping')
self.balloon_anim.update(current_time, self.curr_balloon_count, not self.is_balloon) self.balloon_anim.update(current_time, self.curr_balloon_count, not self.is_balloon)
if self.balloon_anim.is_finished: if self.balloon_anim.is_finished:
if self.score_method == ScoreMethod.GEN3:
self.score += 5000
self.base_score_list.append(ScoreCounterAnimation(self.player_num, 5000, self.is_2p))
self.balloon_anim = None self.balloon_anim = None
self.chara.set_animation('balloon_pop') self.chara.set_animation('balloon_pop')
if self.kusudama_anim is not None: if self.kusudama_anim is not None:
@@ -1228,7 +1268,10 @@ class Player:
def draw_modifiers(self): def draw_modifiers(self):
"""Shows the currently selected modifiers""" """Shows the currently selected modifiers"""
modifiers_to_draw = ['mod_shinuchi'] modifiers_to_draw = []
if self.score_method == ScoreMethod.SHINUCHI:
modifiers_to_draw.append('mod_shinuchi')
# Speed modifiers # Speed modifiers
if global_data.modifiers[self.player_num].speed >= 4: if global_data.modifiers[self.player_num].speed >= 4:

View File

@@ -14,6 +14,7 @@ from libs.utils import (
is_l_don_pressed, is_l_don_pressed,
is_r_don_pressed is_r_don_pressed
) )
from scenes.game import ScoreMethod
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -218,7 +219,10 @@ class ResultPlayer:
""" """
if not self.fade_in_finished: if not self.fade_in_finished:
return return
if global_data.config["general"]["score_method"] == ScoreMethod.SHINUCHI:
tex.draw_texture('score', 'score_shinuchi', index=self.is_2p) tex.draw_texture('score', 'score_shinuchi', index=self.is_2p)
else:
tex.draw_texture('score', 'score', index=self.is_2p)
if self.score != '': if self.score != '':
for i in range(len(str(self.score))): for i in range(len(str(self.score))):
tex.draw_texture('score', 'score_num', x=-(i*tex.skin_config["result_score_margin"].x), frame=int(str(self.score)[::-1][i]), index=self.is_2p) tex.draw_texture('score', 'score_num', x=-(i*tex.skin_config["result_score_margin"].x), frame=int(str(self.score)[::-1][i]), index=self.is_2p)