new mutations wip
This commit is contained in:
31
entities/plants/scripts/plant_mutation/solar_mutation.gd
Normal file
31
entities/plants/scripts/plant_mutation/solar_mutation.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends PlantMutation
|
||||
class_name SolarMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 1
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "SOLAR"
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return tr("SOLAR")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("SOLAR_EFFECT_TEXT").format({
|
||||
"bonus_chance": get_bonus_chance(),
|
||||
"bonus_energy": get_bonus_energy()
|
||||
})
|
||||
|
||||
func _start_day_effect(plant: Plant):
|
||||
var rng := RandomNumberGenerator.new()
|
||||
if rng.randf() < get_bonus_chance():
|
||||
plant.region.player.data.energy += get_bonus_energy()
|
||||
|
||||
func get_bonus_chance() -> float:
|
||||
return 1 / (6 - min(level, 5))
|
||||
|
||||
func get_bonus_energy() -> int:
|
||||
return 1
|
||||
Reference in New Issue
Block a user