* Changement du son de récupération d'objet * Ajout d'une couleur de rareté et suppression de la boucle sur la couleur de rareté * Changement de la mutation Prolifique : n'ajoute des graines que si mature * Changement de la mutation Rapide : réduction du debuff de temps de vie par 2 * Modification de la mutation Vivace : Augmentation des points ajoutés * Les graines données sur des plantes non mature ne mutent plus * Fix sur la plantation, on ne peut plus planter là où il y a de la roche * Fix visuel : les particule de vent ne s'affichent plus lorsqu'il pleut
128 lines
2.9 KiB
GDScript
128 lines
2.9 KiB
GDScript
@abstract
|
|
extends Resource
|
|
class_name PlantMutation
|
|
|
|
@export var level: int = 1
|
|
|
|
var id: String: get = get_mutation_id
|
|
var name: String: get = get_mutation_name
|
|
|
|
func _init(_level: int = 1):
|
|
level = _level
|
|
|
|
func get_icon() -> Texture:
|
|
return preload("res://common/icons/dna.svg")
|
|
|
|
func get_base_rarity() -> int:
|
|
return 0
|
|
|
|
@abstract func get_mutation_id() -> String
|
|
|
|
func get_mutation_name() -> String:
|
|
return tr(get_mutation_id())
|
|
|
|
@abstract func get_mutation_description() -> String
|
|
|
|
func mutate_plant_data(_plant_data: PlantData):
|
|
pass
|
|
|
|
func mutate_score(_plant_data: PlantData, score: int) -> int:
|
|
return score
|
|
|
|
func mutate_score_multiplier(_plant_data: PlantData, multiplier: int) -> int:
|
|
return multiplier
|
|
|
|
func mutate_lifetime(_plant_data: PlantData, lifetime: int) -> int:
|
|
return lifetime
|
|
|
|
func mutate_growing_time(_plant_data: PlantData, growing_time: int) -> int:
|
|
return growing_time
|
|
|
|
func mutate_seed_number(_plant_data: PlantData, seed_number: int) -> int:
|
|
return seed_number
|
|
|
|
func mutate_seed_random_loose(_plant_data: PlantData, seed_random_loose) -> int:
|
|
return seed_random_loose
|
|
|
|
func mutate_lifetime_buff(_plant_data: PlantData, lifetime_buff : int) -> int:
|
|
return lifetime_buff
|
|
|
|
func mutate_seed_buff(_plant_data: PlantData, seed_buff : int) -> int:
|
|
return seed_buff
|
|
|
|
func mutate_score_buff(_plant_data: PlantData, score_buff : int) -> int:
|
|
return score_buff
|
|
|
|
func _start_planted_effect(_plant: Plant):
|
|
pass
|
|
|
|
func _start_day_effect(_plant: Plant):
|
|
pass
|
|
|
|
func _start_maturation_effect(_plant: Plant):
|
|
pass
|
|
|
|
func _start_dead_effect(_plant: Plant):
|
|
pass
|
|
|
|
func _start_harvested_effect(_plant: Plant):
|
|
pass
|
|
|
|
func get_level_for_rarity(rarity: int) -> int:
|
|
return rarity - get_base_rarity() + 1
|
|
|
|
func get_rarity() -> int:
|
|
return get_base_rarity() + level - 1
|
|
|
|
func card_info() -> CardInfo:
|
|
var info = CardInfo.new(
|
|
get_mutation_name(),
|
|
tr("MUTATION")
|
|
)
|
|
info.important_stat_icon = get_icon()
|
|
|
|
var desc_section := CardSectionInfo.new(
|
|
tr("DESCRIPTION"),
|
|
get_mutation_description(),
|
|
)
|
|
desc_section.title_icon = InspectableEntity.DESC_ICON
|
|
|
|
info.sections.append(desc_section)
|
|
|
|
return info
|
|
|
|
func card_section() -> CardSectionInfo:
|
|
var section = CardSectionInfo.new(
|
|
get_mutation_name() + (" %d" % level if level > 1 else ""),
|
|
get_mutation_description()
|
|
)
|
|
|
|
section.color = PlantMutation.get_rarity_color(get_rarity())
|
|
section.title_icon = get_icon()
|
|
|
|
return section
|
|
|
|
static func get_rarity_text(rarity) -> String:
|
|
var rarity_text: Array[String] = [
|
|
"COMMON",
|
|
"RARE",
|
|
"VERY_RARE",
|
|
"IMPOSSIBLE",
|
|
"ABSURD",
|
|
]
|
|
|
|
if rarity < len(rarity_text):
|
|
return rarity_text[rarity]
|
|
else:
|
|
return rarity_text[len(rarity_text) - 1]
|
|
|
|
static func get_rarity_color(rarity: int) -> Color:
|
|
var rarity_colors: Array[Color] = [
|
|
Color("2364AA"),
|
|
Color("25C147"),
|
|
Color("8B2DFF"),
|
|
Color("FF006E"),
|
|
Color("FFA617"),
|
|
]
|
|
|
|
return rarity_colors[min(rarity, len(rarity_colors) - 1)] |