test implementation of bad luck protection using rand_weighted, change time to float (will use unix timestamp)

This commit is contained in:
tonydero 2024-10-21 16:31:33 -06:00
parent 70a879529a
commit a6f704039b
2 changed files with 10 additions and 5 deletions

View File

@ -3,4 +3,4 @@ extends Node
@export var current_zone: Globals.World.Zone
@export var last_played: Dictionary
@export var last_played: float

View File

@ -2,8 +2,8 @@
extends Control
var deltaCount := 0
var enemyMoveSpeed := 5.0
# var deltaCount := 0
# var enemyMoveSpeed := 5.0
# var questComplete := false
var canContinue := false
@ -23,7 +23,7 @@ func _ready() -> void:
func _process(_delta: float) -> void:
deltaCount += 1
# deltaCount += 1
if canContinue:
_continue_show()
@ -34,7 +34,12 @@ func _create_area() -> void:
move_child(worldArea, 0)
func _on_button_test_pressed() -> void:
pass
# slowly increasing chance to get 1
# bad luck protection for rare spawns, drops, etc.
var testVal := 0.0
for i in range(1000):
testVal += 0.001
print(testVal, bool(RandomNumberGenerator.new().rand_weighted([1, testVal])))
func _on_button_exit_pressed() -> void: