ajout du déblocage/évolutions des plantes (#89) et fix divers

This commit is contained in:
2025-11-07 13:26:04 +01:00
parent 11ae967845
commit ed675ed532
54 changed files with 901 additions and 483 deletions

View File

@@ -5,9 +5,15 @@ signal updated(inventory: Inventory)
@export var items: Array[Item] = []
@export var current_item_ind: int = 0
@export var size = 0 :
set(s):
size = s
items.resize(size)
updated.emit(self)
func _init(inventory_size: int = 1):
items.resize(inventory_size)
size = inventory_size
func get_best_available_slot_ind():
if items[current_item_ind] == null:

View File

@@ -33,13 +33,13 @@ func get_usage_object_affected(_i : InspectableEntity) -> bool:
func is_one_time_use():
return false
func can_use(_player : Player, zone: Player.ActionZone) -> bool:
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
return false
func use_text() -> String:
return ""
func use(_player : Player, zone: Player.ActionZone):
func use(_player : Player, _zone: Player.ActionZone):
return false
func card_info() -> CardInfo:

View File

@@ -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:

View File

@@ -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:

View File

@@ -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

View File

@@ -187,7 +187,7 @@ func upgrade_max_energy(amount = 1):
player_updated.emit(self)
func upgrade_inventory_size(amount = 1):
data.inventory.items.resize(data.inventory.items.size() + amount)
data.inventory.size += 1
upgraded.emit()
player_updated.emit(self)