ajout du déblocage/évolutions des plantes (#89) et fix divers
This commit is contained in:
@@ -29,7 +29,7 @@ func use_text() -> String:
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
func can_use(player : Player, _zone : Player.ActionZone) -> bool:
|
||||
return player.terrain is Planet
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
|
||||
@@ -24,7 +24,7 @@ func use_text() -> String:
|
||||
func is_one_time_use():
|
||||
return true
|
||||
|
||||
func can_use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
func can_use(player : Player, _zone : Player.ActionZone) -> bool:
|
||||
return player.planet != null
|
||||
|
||||
func use(player : Player, zone : Player.ActionZone) -> bool:
|
||||
|
||||
@@ -23,7 +23,7 @@ func get_energy_used() -> int:
|
||||
return 1
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return 30
|
||||
return 40
|
||||
|
||||
func get_usage_object_affected(i : InspectableEntity) -> bool:
|
||||
return i is Plant
|
||||
@@ -137,11 +137,19 @@ static func mutate(parent_mutation : Array[PlantMutation] = []) -> Array[PlantMu
|
||||
AddMutation.new()
|
||||
]
|
||||
|
||||
if len(parent_mutation):
|
||||
possible_mutations.append_array( [
|
||||
if (
|
||||
len(parent_mutation) > 2
|
||||
):
|
||||
possible_mutations = [
|
||||
UpgradeMutation.new(),
|
||||
RemoveMutation.new(),
|
||||
])
|
||||
]
|
||||
elif len(parent_mutation) > 0:
|
||||
possible_mutations = [
|
||||
AddMutation.new(),
|
||||
UpgradeMutation.new(),
|
||||
RemoveMutation.new(),
|
||||
]
|
||||
|
||||
var chosen_mutation = possible_mutations.pick_random()
|
||||
|
||||
@@ -159,10 +167,10 @@ class DontMutate extends MutationPossibility:
|
||||
class AddMutation extends MutationPossibility:
|
||||
func mutate(parent_mutation : Array[PlantMutation] = [])-> Array[PlantMutation]:
|
||||
var new_mutations = parent_mutation.duplicate_deep()
|
||||
var mut = PlantMutation.random_mutation()
|
||||
var mut = PlantMutation.random_mutation(parent_mutation)
|
||||
|
||||
if mut:
|
||||
var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): m.get_mutation_name() == mut.get_mutation_name())
|
||||
var existing_mut_id = new_mutations.find_custom(func(m:PlantMutation): return m.get_mutation_name() == mut.get_mutation_name())
|
||||
|
||||
if existing_mut_id >= 0:
|
||||
new_mutations[existing_mut_id].level += 1
|
||||
|
||||
Reference in New Issue
Block a user