Files
seeding-planets/entities/plants/scripts/plant_mutation/ancient_mutation.gd

32 lines
814 B
GDScript

extends PlantMutation
class_name AncientMutation
const DEFAULT_DAY_FACTOR = 4
func get_icon() -> Texture:
return preload("res://common/icons/wood.svg")
func get_mutation_id() -> String:
return "ANCIENT"
func get_mutation_name() -> String:
return tr("ANCIENT")
func get_mutation_description() -> String:
return tr("ANCIENT_EFFECT_TEXT_LEVEL").format(
{
"score_increase": get_score_increase(),
"day_factor": get_day_factor()
}
)
func get_day_factor():
return max(1, DEFAULT_DAY_FACTOR - level)
func get_score_increase():
return max(1, level - DEFAULT_DAY_FACTOR)
func mutate_score(data : PlantData, score) -> int:
if data.get_state() != PlantData.State.MATURE:
return score
return score + floori(data.day / get_day_factor())