Ajout des mutation Nettoyage, Ermite, Tropicale, Rhizome et Spontanée
This commit is contained in:
@@ -180,20 +180,24 @@ static func generate_first_mutations(rarity := 0) -> Array[PlantMutation]:
|
||||
|
||||
var possible_mutation : PlantMutation = GameInfo.game_data.progression_data.get_available_mutations().filter(
|
||||
func (m : PlantMutation): return m.get_base_rarity() <= rarity
|
||||
).pick_random().duplicate_deep()
|
||||
).pick_random()
|
||||
|
||||
if possible_mutation:
|
||||
possible_mutation = possible_mutation.duplicate_deep()
|
||||
|
||||
var level_to_add = rarity - possible_mutation.get_base_rarity()
|
||||
var level_to_add = rarity - possible_mutation.get_base_rarity()
|
||||
|
||||
possible_mutation.level += level_to_add
|
||||
possible_mutation.level += level_to_add
|
||||
|
||||
return [possible_mutation]
|
||||
return [possible_mutation]
|
||||
return []
|
||||
|
||||
static func mutate_mutations(mutations : Array[PlantMutation], nearby_mutations : Array[PlantMutation]) -> Array[PlantMutation]:
|
||||
|
||||
var mutation_possibility : Array[MutationPossibility] = []
|
||||
|
||||
var evolvable_mutations : Array[PlantMutation] = mutations.filter(
|
||||
func (m : PlantMutation): return m.get_rarity() < PlantMutation.MAX_RARITY
|
||||
func (m : PlantMutation): return not m.is_max_level()
|
||||
)
|
||||
|
||||
if (
|
||||
@@ -206,7 +210,7 @@ static func mutate_mutations(mutations : Array[PlantMutation], nearby_mutations
|
||||
|
||||
var chosen_mutation_possibility = mutation_possibility.pick_random()
|
||||
|
||||
return chosen_mutation_possibility.mutate(mutations)
|
||||
return chosen_mutation_possibility.mutate(mutations,nearby_mutations)
|
||||
|
||||
class MutationPossibility:
|
||||
func mutate(_mutations : Array[PlantMutation], _nearby_mutations : Array[PlantMutation])-> Array[PlantMutation]:
|
||||
|
||||
Reference in New Issue
Block a user