gros dev pre proto
* Changement de l'UI, ajouts de l'inspecteur par carte et changement de police * Ajout d'un semblant d'exploration * Ajout de la sauvegarde des entités * Restructuration mineure de l'arborescence * Fix divers et réécriture des textes
This commit is contained in:
@@ -2,11 +2,10 @@ extends Resource
|
||||
class_name PlantMutation
|
||||
|
||||
const BASE_RARITY_CHANCE : Array[float] = [
|
||||
0.6,
|
||||
0.8,
|
||||
0.75,
|
||||
0.9,
|
||||
0.95,
|
||||
1
|
||||
1,
|
||||
1,
|
||||
]
|
||||
|
||||
@export var level : int = 1
|
||||
@@ -28,7 +27,7 @@ func get_mutation_description() -> String:
|
||||
printerr("Classe abstraite PlantMutation appelée")
|
||||
return ""
|
||||
|
||||
func mutate_score(_plant : Plant, score) -> int:
|
||||
func mutate_score(_plant_state : Plant.State, _plant : Plant, score,) -> int:
|
||||
return score
|
||||
|
||||
func mutate_grow_time(_plant : Plant, grow_time : int) -> int:
|
||||
@@ -40,56 +39,44 @@ func mutate_plant(_plant : Plant):
|
||||
func get_level_for_rarity(rarity : int) -> int :
|
||||
return rarity - get_base_rarity() + 1
|
||||
|
||||
static func get_rarity(mutation : PlantMutation) -> int:
|
||||
return mutation.get_base_rarity() + mutation.level - 1
|
||||
func get_rarity() -> int:
|
||||
return get_base_rarity() + level - 1
|
||||
|
||||
static func get_rarity_text(mutation : PlantMutation) -> String:
|
||||
func card_section() -> CardSectionInfo:
|
||||
var section = CardSectionInfo.new(
|
||||
get_mutation_name() + (" %d" % level if level > 1 else ""),
|
||||
"[b]%s[/b] %s" % [PlantMutation.get_rarity_text(get_rarity()), get_mutation_description()]
|
||||
)
|
||||
|
||||
section.title_color = PlantMutation.get_rarity_color(get_rarity())
|
||||
section.title_colored = true
|
||||
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",
|
||||
"[rainbow]Absurd[/rainbow]",
|
||||
]
|
||||
|
||||
var rarity = PlantMutation.get_rarity(mutation)
|
||||
|
||||
if rarity < len(rarity_text):
|
||||
return rarity_text[rarity]
|
||||
else :
|
||||
return rarity_text[len(rarity_text) - 1] + " " + str(rarity - len(rarity_text) + 2)
|
||||
|
||||
static func get_rarity_bg_color(mutation : PlantMutation) -> Color:
|
||||
static func get_rarity_color(rarity : int) -> Color:
|
||||
var rarity_colors : Array[Color] = [
|
||||
Color("4b3700"),
|
||||
Color("6d2300"),
|
||||
Color("001f50"),
|
||||
Color("311558"),
|
||||
Color("780235"),
|
||||
]
|
||||
|
||||
return rarity_colors[min(PlantMutation.get_rarity(mutation), len(rarity_colors) - 1)]
|
||||
|
||||
static func get_rarity_color(mutation : PlantMutation) -> Color:
|
||||
var rarity_colors : Array[Color] = [
|
||||
Color("FFBE0B"),
|
||||
Color("FB5607"),
|
||||
Color("3A86FF"),
|
||||
Color("8338EC"),
|
||||
Color("25C147"),
|
||||
Color("8B2DFF"),
|
||||
Color("FF006E"),
|
||||
Color("FFA617"),
|
||||
]
|
||||
|
||||
return rarity_colors[min(PlantMutation.get_rarity(mutation), len(rarity_colors) - 1)]
|
||||
|
||||
static func get_framed_info_from_mutation(
|
||||
mutation : PlantMutation
|
||||
) -> Inspector.FramedInfo:
|
||||
return Inspector.FramedInfo.new(
|
||||
mutation.get_mutation_name() + (" %d" % mutation.level if mutation.level > 1 else ""),
|
||||
"[b]%s[/b] %s" % [PlantMutation.get_rarity_text(mutation), mutation.get_mutation_description()],
|
||||
mutation.get_icon(),
|
||||
PlantMutation.get_rarity_bg_color(mutation)
|
||||
)
|
||||
return rarity_colors[min(rarity, len(rarity_colors) - 1)]
|
||||
|
||||
static func random_rarity() -> int:
|
||||
var random_float = randf()
|
||||
|
||||
Reference in New Issue
Block a user