* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police * Ajout d'un semblant d'exploration * Ajout de la sauvegarde des entités * Restructuration mineure de l'arborescence * Fix divers et réécriture des textes
32 lines
916 B
GDScript
32 lines
916 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_state : Plant.State, plant : Plant, score) -> int:
|
|
if plant.influence_zone == null:
|
|
return score
|
|
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) |