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:
28
entities/plants/scripts/plant_mutation/sociable_mutation.gd
Normal file
28
entities/plants/scripts/plant_mutation/sociable_mutation.gd
Normal 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)
|
||||
Reference in New Issue
Block a user