aboutsummaryrefslogtreecommitdiff
path: root/buildings/dev.gd
blob: 5785ebc800803e982c4482c0b566724c2a8f0b50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
extends BuildingInterface


var riot := preload("res://riot/riot.tscn")
var law_suit := preload("res://lawsuit/lawsuit.tscn")

func _tick() -> void:
	if get_amount() == 0:
		return

	if SaveState.riot_cooldown == 0:
		SaveState.coffee -= get_amount() * int(pow(2, SaveState.upgrades['wageslavery']))
		if SaveState.coffee < 0:
			invoke_riot()
			SaveState.coffee = 0
		else:
			SaveState.gain_bitcoin(int(
				pow(get_amount(), 
					1 + SaveState.upgrades['wageslavery'] / 10.0)
				 * (SaveState.upgrades['sunglasses'] + 1)))
	else:
		SaveState.riot_cooldown -= 1


func invoke_riot() -> void:
	SaveState.riot_cooldown = -1
	var mgt = find_parent('management')
	mgt.hide()
	mgt.pause_mode = PAUSE_MODE_STOP
	var i = null
	if randf() < 0.5:
		i = riot.instance()
	else:
		i = law_suit.instance()
	mgt.get_parent().add_child(i)