ajout du déblocage/évolutions des plantes (#89) et fix divers

This commit is contained in:
2025-11-07 13:26:04 +01:00
parent 11ae967845
commit ed675ed532
54 changed files with 901 additions and 483 deletions

View File

@@ -23,7 +23,7 @@ func get_energy_used() -> int:
return 1
func get_usage_zone_radius() -> int:
return 30
return 40
func get_usage_object_affected(i : InspectableEntity) -> bool:
return i is Plant
@@ -137,11 +137,19 @@ static func mutate(parent_mutation : Array[PlantMutation] = []) -> Array[PlantMu
AddMutation.new()
]
if len(parent_mutation):
possible_mutations.append_array( [
if (
len(parent_mutation) > 2
):
possible_mutations = [
UpgradeMutation.new(),
RemoveMutation.new(),
])
]
elif len(parent_mutation) > 0:
possible_mutations = [
AddMutation.new(),
UpgradeMutation.new(),
RemoveMutation.new(),
]
var chosen_mutation = possible_mutations.pick_random()
@@ -159,10 +167,10 @@ class DontMutate extends MutationPossibility:
class AddMutation extends MutationPossibility:
func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
var new_mutations = parent_mutation.duplicate_deep()
var mut = PlantMutation.random_mutation()
var mut = PlantMutation.random_mutation(parent_mutation)
if mut:
var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): m.get_mutation_name() == mut.get_mutation_name())
var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): return m.get_mutation_name() == mut.get_mutation_name())
if existing_mut_id >= 0:
new_mutations[existing_mut_id].level += 1