28 lines
755 B
GDScript
28 lines
755 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 "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 and area != plant :
|
|
plant_count += 1
|
|
|
|
return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0) |