Ajout des mutations Sauveteuse, Adaptative et résistante, ajout des crédits du jeu et d'un splash screen (+ un peu de debug)
This commit is contained in:
@@ -19,7 +19,10 @@ func _init(
|
||||
|
||||
static func generate_from_parent(plant_data : PlantData, nearby_plants : Array[PlantData] = []) -> Seed:
|
||||
var mutations : Array[PlantMutation] = plant_data.mutations
|
||||
var mutation_probability = GameInfo.game_data.current_run.plant_info.get_mutation_probability()
|
||||
var mutation_probability = (
|
||||
GameInfo.game_data.current_run.plant_info.get_mutation_probability()
|
||||
+ plant_data.get_mutation_probability_boost()
|
||||
)
|
||||
|
||||
var nearby_mutations : Array[PlantMutation] = []
|
||||
for pd in nearby_plants:
|
||||
@@ -107,9 +110,15 @@ func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
zone.get_global_position(),
|
||||
)] as Array[Vector2i]
|
||||
|
||||
var is_decontaminated = player.region.is_coords_decontaminated(plant_tiles)
|
||||
|
||||
for m in plant_mutations:
|
||||
if m.allow_planting_on_decontamined_terrain(self):
|
||||
is_decontaminated = true
|
||||
|
||||
return (
|
||||
not is_there_a_plant_here
|
||||
and player.region.is_coords_decontaminated(plant_tiles)
|
||||
and is_decontaminated
|
||||
and not player.region.is_coords_rocky(plant_tiles)
|
||||
)
|
||||
|
||||
@@ -178,11 +187,12 @@ static func generate_first_mutations(rarity := 0) -> Array[PlantMutation]:
|
||||
if rarity < 0:
|
||||
return []
|
||||
|
||||
var possible_mutation : PlantMutation = GameInfo.game_data.progression_data.get_available_mutations().filter(
|
||||
var possible_mutations : Array[PlantMutation] = GameInfo.game_data.progression_data.get_available_mutations().filter(
|
||||
func (m : PlantMutation): return m.get_base_rarity() <= rarity
|
||||
).pick_random()
|
||||
)
|
||||
|
||||
if possible_mutation:
|
||||
if len(possible_mutations):
|
||||
var possible_mutation = possible_mutations.pick_random()
|
||||
possible_mutation = possible_mutation.duplicate_deep()
|
||||
|
||||
var level_to_add = rarity - possible_mutation.get_base_rarity()
|
||||
@@ -197,9 +207,11 @@ static func mutate_mutations(mutations : Array[PlantMutation], nearby_mutations
|
||||
var mutation_possibility : Array[MutationPossibility] = []
|
||||
|
||||
var evolvable_mutations : Array[PlantMutation] = mutations.filter(
|
||||
func (m : PlantMutation): return not m.is_max_level()
|
||||
func (m : PlantMutation):
|
||||
return not m.is_max_level()
|
||||
)
|
||||
|
||||
|
||||
if (
|
||||
len(mutations) < GameInfo.game_data.current_run.plant_info.get_mutation_max_number()
|
||||
):
|
||||
@@ -208,9 +220,12 @@ static func mutate_mutations(mutations : Array[PlantMutation], nearby_mutations
|
||||
if len(evolvable_mutations) > 0:
|
||||
mutation_possibility.append(UpgradeMutation.new())
|
||||
|
||||
var chosen_mutation_possibility = mutation_possibility.pick_random()
|
||||
|
||||
return chosen_mutation_possibility.mutate(mutations,nearby_mutations)
|
||||
if len(mutation_possibility) > 0:
|
||||
var chosen_mutation_possibility = mutation_possibility.pick_random()
|
||||
return chosen_mutation_possibility.mutate(mutations,nearby_mutations)
|
||||
else:
|
||||
print_debug("No mutation possility available")
|
||||
return mutations
|
||||
|
||||
class MutationPossibility:
|
||||
func mutate(_mutations : Array[PlantMutation], _nearby_mutations : Array[PlantMutation])-> Array[PlantMutation]:
|
||||
@@ -229,13 +244,16 @@ class AddMutation extends MutationPossibility:
|
||||
return mutations.find_custom(func(m2: PlantMutation): return m2.id == m.id) == -1
|
||||
)
|
||||
|
||||
var nearby_impacted_possible_new_mutations : Array[PlantMutation] = []
|
||||
|
||||
for m1 in possible_new_mutations:
|
||||
nearby_impacted_possible_new_mutations.append(m1)
|
||||
for m2 in nearby_mutations:
|
||||
if m1.id == m2.id:
|
||||
possible_new_mutations.append(m1) # Double les chances d'avoir la mutation si elle est présente dans les voisins
|
||||
nearby_impacted_possible_new_mutations.append(m1) # Double les chances d'avoir la mutation si elle est présente dans les voisins
|
||||
|
||||
if len(possible_new_mutations):
|
||||
new_mutations.append(possible_new_mutations.pick_random())
|
||||
if len(nearby_impacted_possible_new_mutations):
|
||||
new_mutations.append(nearby_impacted_possible_new_mutations.pick_random())
|
||||
|
||||
return new_mutations
|
||||
|
||||
@@ -250,7 +268,7 @@ class UpgradeMutation extends MutationPossibility:
|
||||
|
||||
for i in range(len(mutations)):
|
||||
var m = mutations[i]
|
||||
if m.get_rarity() < PlantMutation.MAX_RARITY:
|
||||
if not m.is_max_level():
|
||||
evolvable_mutations_id.append(i)
|
||||
|
||||
if len(evolvable_mutations_id):
|
||||
|
||||
Reference in New Issue
Block a user