refactor
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
class_name ScarcityModel
|
||||
extends RefCounted
|
||||
|
||||
# ScarcityModel - Data definitions for tile scarcity
|
||||
|
||||
# Standard tiles
|
||||
const TILE_HEART = 7
|
||||
const TILE_DIAMOND = 8
|
||||
const TILE_STAR = 9
|
||||
const TILE_COIN = 10
|
||||
|
||||
# Special tiles (Holo)
|
||||
const TILE_BURN = 11
|
||||
const TILE_SPAWN = 12
|
||||
const TILE_FREEZE = 13
|
||||
const TILE_BLOCK = 14
|
||||
|
||||
const STANDARD_TILES = [
|
||||
TILE_HEART, TILE_DIAMOND, TILE_STAR, TILE_COIN
|
||||
]
|
||||
|
||||
const SPECIAL_TILES = [
|
||||
TILE_BURN, TILE_SPAWN, TILE_FREEZE, TILE_BLOCK
|
||||
]
|
||||
|
||||
# Weights (higher = more common)
|
||||
const STANDARD_WEIGHT = 100
|
||||
const SPECIAL_WEIGHT = 5
|
||||
|
||||
# Configuration
|
||||
static var current_mode: String = "Normal"
|
||||
|
||||
# Mode Weights (Special Tile Weight)
|
||||
const WEIGHTS = {
|
||||
"Normal": 5, # 5% chance relative to 100
|
||||
"Aggressive": 25, # 25% chance
|
||||
"Chaos": 50 # 50% chance
|
||||
}
|
||||
|
||||
static func set_mode(mode: String):
|
||||
if mode in WEIGHTS:
|
||||
current_mode = mode
|
||||
|
||||
static func get_tile_weights() -> Dictionary:
|
||||
var weights = {}
|
||||
var special_weight = WEIGHTS.get(current_mode, 5)
|
||||
|
||||
# Standard tiles
|
||||
for tile in STANDARD_TILES:
|
||||
weights[tile] = STANDARD_WEIGHT
|
||||
|
||||
# Special tiles
|
||||
for tile in SPECIAL_TILES:
|
||||
weights[tile] = special_weight
|
||||
|
||||
return weights
|
||||
@@ -0,0 +1 @@
|
||||
uid://dh2t1v7y0e61q
|
||||
Reference in New Issue
Block a user