seeding-planets/entities/plants/scripts/plant_mutation/sociable_mutation.gd
Zacharie Guet f1ef41323a équilibrages, fix et évolutions
* résolution du bug de disparition des items #94
* améliorations définitives dans le camion via compost #88
* ajout de plus d'aléatoire dans le zone de départ
* suppression des récompenses de quota (pour l'instant)
* équilibrage du gain en graine
* ajout de la clarté dans les actions
2025-10-17 17:53:38 +02:00

30 lines
831 B
GDScript

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 "When mature, 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:
if plant.state != Plant.State.MATURE:
return score
var plant_count = 0
for area in plant.influence_zone.get_overlapping_areas():
if area is Plant and area != plant :
plant_count += 1
return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0)