ajout des mutation et refonte de l'inspecteur

* ajout des mutations #86
* changement de l'objectif #85
* refonte de l'inspecteur #71
* changement léger de la plantation
* les plantes ne donnent que des graines de leurs espèces
* refonte partielle du code, refacto
This commit is contained in:
2025-10-12 01:03:08 +02:00
parent bb24efe46b
commit ef392595de
108 changed files with 1921 additions and 477 deletions

View File

@@ -0,0 +1,23 @@
extends PlantMutation
class_name AncientMutation
const DEFAULT_DAY_FACTOR = 5
func get_icon() -> Texture:
return preload("res://common/icons/wood.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Ancient"
func get_mutation_description() -> String:
return "Add [b]1[/b] to the score for each [b]%d[/b] days passed" % get_day_factor()
func get_day_factor():
return max(1, DEFAULT_DAY_FACTOR - level + 1)
func mutate_score(plant : Plant, score) -> int:
return score + floori(plant.day / get_day_factor())

View File

@@ -0,0 +1 @@
uid://c7po0bstyg80u

View File

@@ -0,0 +1,26 @@
extends PlantMutation
class_name ElitistMutation
func get_icon() -> Texture:
return preload("res://common/icons/copy.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Intolerant"
func get_mutation_description() -> String:
return "Add [b]%d[/b] to the score for each plant of the same species around, but score become 0 if none is around." % level
func mutate_score(plant : Plant, score) -> int:
var plant_count = 0
for area in plant.influence_zone.get_overlapping_areas():
if area is Plant and area.plant_type.name == plant.plant_type.name:
plant_count += 1
if plant_count == 0:
return 0
else :
return score + level * plant_count

View File

@@ -0,0 +1 @@
uid://bt1xh7ss13e5e

View File

@@ -0,0 +1,21 @@
extends PlantMutation
class_name ErmitMutation
func get_icon() -> Texture:
return preload("res://common/icons/seedling-off.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Ermit"
func get_mutation_description() -> String:
return "Multiply the score by %d if no plant is near, but set it to 0 otherwise." % level
func mutate_score(plant : Plant, score) -> int:
for area in plant.influence_zone.get_overlapping_areas():
if area is Plant:
return 0
return score * 2

View File

@@ -0,0 +1 @@
uid://domy822vgxfxs

View File

@@ -0,0 +1,17 @@
extends PlantMutation
class_name PrecociousMutation
func get_icon() -> Texture:
return preload("res://common/icons/hourglass-empty.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Precocious"
func get_mutation_description() -> String:
return "Add [b]%d[/b] to the score while the plant is growing" % level
func mutate_score(plant : Plant, score) -> int:
return score + (0 if plant.state == Plant.State.MATURE else level)

View File

@@ -0,0 +1 @@
uid://cx5mg5vf62bia

View File

@@ -0,0 +1,17 @@
extends PlantMutation
class_name QualityMutation
func get_icon() -> Texture:
return preload("res://common/icons/north-star.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Quality"
func get_mutation_description() -> String:
return "Add [b]%d[/b] to the score if the plant is mature." % level
func mutate_score(plant : Plant, score : int) -> int:
return score + (level if plant.state == Plant.State.MATURE else 0)

View File

@@ -0,0 +1 @@
uid://bdobyk2j625lb

View File

@@ -0,0 +1,17 @@
extends PlantMutation
class_name QuickMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Quick"
func get_mutation_description() -> String:
return "Reduce the grow time by %d" % level
func mutate_grow_time(_plant : Plant, grow_time : int) -> int:
return max(grow_time - level, 0)

View File

@@ -0,0 +1 @@
uid://bhtq0cbrgu58v

View File

@@ -0,0 +1,28 @@
extends PlantMutation
class_name SociableMutation
const NEAR_PLANT_NEEDED = 2
func get_icon() -> Texture:
return preload("res://common/icons/seedling.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Sociable"
func get_mutation_description() -> String:
return "Add [b]%d[/b] to the score if near %d other plants" % [get_score_bonus(), NEAR_PLANT_NEEDED]
func get_score_bonus():
return (level + 2)
func mutate_score(plant : Plant, score) -> int:
var plant_count = 0
for area in plant.influence_zone.get_overlapping_areas():
if area is Plant:
plant_count += 1
return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0)

View File

@@ -0,0 +1 @@
uid://b8q5xgvy85qeb

View File

@@ -0,0 +1,20 @@
extends PlantMutation
class_name StrongMutation
func get_icon() -> Texture:
return preload("res://common/icons/dna.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_name() -> String:
return "Strong"
func get_mutation_description() -> String:
return "Plus [b]%d[/b] percent of the score" % roundi(get_score_multiplier() * 100)
func get_score_multiplier():
return float(level)/2.
func mutate_score(_plant : Plant, score: int) -> int:
return score + roundi(score * get_score_multiplier())

View File

@@ -0,0 +1 @@
uid://cwj3k4p6ci5t4