Ajout des mutation Nettoyage, Ermite, Tropicale, Rhizome et Spontanée
This commit is contained in:
@@ -125,7 +125,8 @@ func calculate_plant_score(
|
||||
func harvest():
|
||||
var do_produce_seeds := true
|
||||
for m in data.mutations:
|
||||
do_produce_seeds = do_produce_seeds && m.produce_seeds()
|
||||
if m.nullify_seed_production():
|
||||
do_produce_seeds = false
|
||||
|
||||
if do_produce_seeds:
|
||||
for i in range(data.get_seed_number()):
|
||||
@@ -156,13 +157,14 @@ func mature():
|
||||
func die():
|
||||
for m in data.mutations:
|
||||
m._start_dead_effect(self)
|
||||
|
||||
|
||||
var do_produce_seeds := true
|
||||
for m in data.mutations:
|
||||
do_produce_seeds = do_produce_seeds && m.produce_seeds_on_maturation()
|
||||
if m.nullify_seed_production():
|
||||
do_produce_seeds = false
|
||||
|
||||
if do_produce_seeds:
|
||||
for i in range(data.get_seed_number()):
|
||||
for i in range(data.get_seed_number(data.get_state())):
|
||||
await produce_seed()
|
||||
|
||||
AudioManager.play_sfx("Harvest")
|
||||
|
||||
@@ -70,6 +70,10 @@ func get_growing_time() -> int:
|
||||
return max(1,growing_time)
|
||||
|
||||
func get_score(state: State = get_state()) -> int:
|
||||
for m in mutations:
|
||||
if m.nullify_score(self):
|
||||
return 0
|
||||
|
||||
var score = get_plant_info().get_base_score() if state == State.MATURE else 0
|
||||
|
||||
var mult := 1.
|
||||
|
||||
@@ -28,8 +28,8 @@ func get_mutation_name() -> String:
|
||||
func mutate_plant_data(_plant_data: PlantData):
|
||||
pass
|
||||
|
||||
func has_score(_plant_data: PlantData) -> bool:
|
||||
return true
|
||||
func nullify_score(_plant_data: PlantData) -> bool:
|
||||
return false
|
||||
|
||||
func mutate_score(_plant_data: PlantData, score: int) -> int:
|
||||
return score
|
||||
@@ -43,8 +43,8 @@ func mutate_lifetime(_plant_data: PlantData, lifetime: int) -> int:
|
||||
func mutate_growing_time(_plant_data: PlantData, growing_time: int) -> int:
|
||||
return growing_time
|
||||
|
||||
func produce_seeds() -> bool:
|
||||
return true
|
||||
func nullify_seed_production() -> bool:
|
||||
return false
|
||||
|
||||
func mutate_seed_number(_plant_data: PlantData, seed_number: int) -> int:
|
||||
return seed_number
|
||||
@@ -82,6 +82,9 @@ func get_level_for_rarity(rarity: int) -> int:
|
||||
func get_rarity() -> int:
|
||||
return get_base_rarity() + level - 1
|
||||
|
||||
func is_max_level() -> bool:
|
||||
return get_base_rarity() + level < MAX_RARITY
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
var info = CardInfo.new(
|
||||
get_mutation_name(),
|
||||
|
||||
@@ -2,7 +2,7 @@ extends PlantMutation
|
||||
class_name CleaningMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
return preload("res://common/icons/bug.svg")
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "CLEANING"
|
||||
@@ -22,4 +22,4 @@ func _start_dead_effect(plant: Plant):
|
||||
))
|
||||
|
||||
func get_purification_radius() -> int:
|
||||
return level + 1 # one more than purification
|
||||
return level * 2
|
||||
|
||||
@@ -20,10 +20,12 @@ func get_mutation_description() -> String:
|
||||
|
||||
func _start_day_effect(plant: Plant):
|
||||
var cut_left := get_cutable_per_day()
|
||||
for p in plant.data.nearby_plants:
|
||||
if cut_left > 0 && p.is_mature():
|
||||
p.harvest()
|
||||
cut_left -= 1
|
||||
|
||||
# Ne fonctionnera pas, nearby plants c'est des plantData donc on peut pas faire d'action dessus
|
||||
# for p in plant.data.nearby_plants:
|
||||
# if cut_left > 0 && p.is_mature():
|
||||
# p.harvest()
|
||||
# cut_left -= 1
|
||||
|
||||
func get_cutable_per_day() -> int:
|
||||
return level
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
extends PlantMutation
|
||||
class_name EnergizingMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 1
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "ENERGIZING"
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return tr("ENERGIZING")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("ENERGIZING_EFFECT_TEXT").format({
|
||||
"bonus_energy": get_bonus_energy()
|
||||
})
|
||||
|
||||
func _start_dead_effect(plant: Plant):
|
||||
plant.region.player.data.energy += get_bonus_energy()
|
||||
|
||||
func get_bonus_energy() -> int:
|
||||
return level
|
||||
@@ -1 +0,0 @@
|
||||
uid://byj1hq1w42i7
|
||||
@@ -2,26 +2,27 @@ extends PlantMutation
|
||||
class_name ErmitMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
return preload("res://common/icons/christmas-tree.svg")
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "ERMIT"
|
||||
return "HERMIT"
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return tr("ERMIT")
|
||||
return tr("HERMIT")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("ERMIT_EFFECT_TEXT").format(
|
||||
return tr("HERMIT_EFFECT_TEXT").format(
|
||||
{
|
||||
"score_increase": get_score_increase(),
|
||||
"score_icon": Text.bbcode_icon(Plant.SCORE_ICON),
|
||||
"score_multiplier": get_score_multiplier() + 1.0,
|
||||
}
|
||||
)
|
||||
|
||||
func has_score(plant_data: PlantData) -> bool:
|
||||
return false if plant_data.nearby_plants.size() > 0 else true
|
||||
func nullify_score(plant_data: PlantData) -> bool:
|
||||
return true if len(plant_data.nearby_plants) > 0 else false
|
||||
|
||||
func mutate_score(plant_data: PlantData, score: int) -> int:
|
||||
return score + get_score_increase() if plant_data.nearby_plants.size() == 0 else 0
|
||||
func mutate_score_multiplier(_plant_data: PlantData, multiplier: float) -> float:
|
||||
return multiplier + get_score_multiplier()
|
||||
|
||||
func get_score_increase():
|
||||
return 2 * level
|
||||
func get_score_multiplier()->float:
|
||||
return level
|
||||
|
||||
@@ -16,8 +16,8 @@ func get_mutation_description() -> String:
|
||||
"score_icon": Text.bbcode_icon(Plant.SCORE_ICON)
|
||||
})
|
||||
|
||||
func mutate_score_multiplier(_pd: PlantData, _m: float) -> float:
|
||||
return 0
|
||||
func nullify_score(_plant_data: PlantData) -> bool:
|
||||
return true
|
||||
|
||||
func mutate_score_buff(plant_data: PlantData, score_buff : int) -> int:
|
||||
if plant_data.get_state() == PlantData.State.MATURE:
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
uid://beualsis6xc8a
|
||||
@@ -2,7 +2,7 @@ extends PlantMutation
|
||||
class_name PurificationMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/droplet.svg")
|
||||
return preload("res://common/icons/leaf.svg")
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "PURIFICATION"
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
extends PlantMutation
|
||||
class_name RhizomeMutation
|
||||
|
||||
const DIG_PARTICLES := preload("res://entities/player/inventory/scripts/items/utils/dig_particles.tscn")
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
return preload("res://common/icons/pick.svg")
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "RHIZOME"
|
||||
@@ -16,7 +18,17 @@ func get_mutation_description() -> String:
|
||||
})
|
||||
|
||||
func _start_maturation_effect(plant: Plant):
|
||||
plant.region.dig_hole(plant.global_position, get_digging_radius())
|
||||
plant.region.dig_rocks(
|
||||
Math.get_tiles_in_circle(
|
||||
plant.global_position,
|
||||
get_digging_radius() * (Region.TILE_SIZE + Region.TILE_SIZE / 2.)
|
||||
)
|
||||
)
|
||||
|
||||
var particles := (DIG_PARTICLES.instantiate() as DigParticleEmmitter)
|
||||
plant.region.add_child(particles)
|
||||
particles.global_position = plant.get_global_position()
|
||||
particles.emit()
|
||||
|
||||
func get_digging_radius() -> int:
|
||||
return level
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
extends PlantMutation
|
||||
class_name SolarMutation
|
||||
|
||||
# Du coup on va probablement pas la mettre celle là
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/alert-triangle.svg")
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@ extends PlantMutation
|
||||
class_name SpontaneousMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/droplet.svg")
|
||||
return preload("res://common/icons/sparkles.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
func is_max_level() -> bool:
|
||||
return true
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "SPONTANEOUS"
|
||||
@@ -14,19 +17,12 @@ func get_mutation_name() -> String:
|
||||
return tr("SPONTANEOUS")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("SPONTANEOUS_EFFECT_TEXT").format({
|
||||
"bonus_seed": get_bonus_seed()
|
||||
})
|
||||
return tr("SPONTANEOUS_EFFECT_TEXT")
|
||||
|
||||
func produce_seeds() -> bool:
|
||||
return false
|
||||
|
||||
func mutate_seed_number(_plant_data: PlantData, seed_number: int) -> int:
|
||||
return seed_number + get_bonus_seed()
|
||||
func nullify_seed_production() -> bool:
|
||||
return true
|
||||
|
||||
func _start_maturation_effect(plant: Plant):
|
||||
for i in range(plant.data.get_seed_number()):
|
||||
await plant.produce_seed()
|
||||
|
||||
func get_bonus_seed() -> int:
|
||||
return level - 1
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name HumideMutation
|
||||
class_name TropicalMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/shield.svg")
|
||||
return preload("res://common/icons/cloud-rain.svg")
|
||||
|
||||
func get_mutation_id() -> String:
|
||||
return "HUMIDE"
|
||||
return "TROPICAL"
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return tr("HUMIDE")
|
||||
return tr("TROPICAL")
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return tr("HUMIDE_EFFECT_TEXT").format({
|
||||
return tr("TROPICAL_EFFECT_TEXT").format({
|
||||
"score_icon": Text.bbcode_icon(Plant.SCORE_ICON),
|
||||
"score_multiplier": get_score_multiplier() + 1.,
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
uid://c4ruhg7wg2kta
|
||||
Reference in New Issue
Block a user