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:
@@ -1,17 +1,18 @@
|
||||
extends PlantEffect
|
||||
class_name DecontaminateTerrainEffect
|
||||
|
||||
@export var impact_radius = 100
|
||||
@export var improve_by_lifetime := false
|
||||
@export var improve_by_lifetime_value := 20
|
||||
@export var improve_by_lifetime_max := 200
|
||||
func get_decontamination_radius():
|
||||
return 100 * level
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Decontaminate"
|
||||
|
||||
func get_effect_description() -> String:
|
||||
var ret = "Decontaminate %d unit around it" % [get_decontamination_radius()]
|
||||
return ret
|
||||
|
||||
func effect(plant):
|
||||
|
||||
var radius = impact_radius
|
||||
|
||||
if improve_by_lifetime:
|
||||
radius = min(radius + improve_by_lifetime_value * plant.day, improve_by_lifetime_max)
|
||||
var radius = get_decontamination_radius()
|
||||
|
||||
plant.planet.impact_contamination(
|
||||
plant.global_position,
|
||||
|
||||
@@ -1,15 +1,29 @@
|
||||
extends PlantEffect
|
||||
class_name ProduceSeedsEffect
|
||||
|
||||
@export_file var produce_types_path : Array[String] = []
|
||||
@export var produce_number : Array[int] = [1]
|
||||
func get_produce_number():
|
||||
return [level - 1, level, level + 1]
|
||||
|
||||
func get_effect_name() -> String:
|
||||
return "Seed Production"
|
||||
|
||||
func get_effect_description() -> String:
|
||||
var number_str = ""
|
||||
|
||||
for i in range(len(get_produce_number())):
|
||||
if i != 0:
|
||||
if i == len(get_produce_number()) - 1:
|
||||
number_str += " or "
|
||||
else :
|
||||
number_str += ", "
|
||||
number_str += str(get_produce_number()[i])
|
||||
|
||||
return "Produce %s seeds" % [number_str]
|
||||
|
||||
func effect(plant):
|
||||
for _i in range(produce_number.pick_random()):
|
||||
if len(produce_types_path):
|
||||
var seed_plant_type = load(produce_types_path.pick_random())
|
||||
plant.planet.drop_item(
|
||||
Seed.new(seed_plant_type),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
for _i in range(get_produce_number().pick_random()):
|
||||
plant.planet.drop_item(
|
||||
Seed.new(plant.plant_type, plant.plant_mutations),
|
||||
plant.global_position,
|
||||
plant.HARVESTED_SEED_DISPLACEMENT_FACTOR,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user