* 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
28 lines
840 B
GDScript
28 lines
840 B
GDScript
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 "Elitist"
|
|
|
|
func get_mutation_description() -> String:
|
|
return "When mature, 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:
|
|
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 and area.plant_type.name == plant.plant_type.name:
|
|
plant_count += 1
|
|
|
|
if plant_count == 0:
|
|
return 0
|
|
else :
|
|
return score + level * plant_count |