système de sauvegarde, scène 3D de test sur la base astra et passage en forward+
This commit is contained in:
@@ -121,6 +121,8 @@ func mature():
|
||||
func die():
|
||||
for m in data.mutations:
|
||||
m._start_dead_effect(self)
|
||||
for i in range(data.get_random_seed_income()):
|
||||
produce_seed()
|
||||
disappear()
|
||||
|
||||
func disappear():
|
||||
@@ -132,52 +134,36 @@ func save() -> EntityData:
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
var info = CardInfo.new(
|
||||
pointer_text()
|
||||
data.plant_name,
|
||||
data.archetype.archetype_name
|
||||
)
|
||||
|
||||
var state = data.get_state()
|
||||
|
||||
info.important_stat_icon = PLANT_POINT_ICON
|
||||
info.important_stat_text = "%d" % calculate_plant_score()
|
||||
info.texture = null #TODO
|
||||
info.type_icon = PLANT_TYPE_ICON
|
||||
|
||||
var state_text = tr("MATURE")
|
||||
if state != PlantData.State.MATURE:
|
||||
state_text = tr("GROWING")
|
||||
|
||||
info.stats.append(CardStatInfo.new(
|
||||
tr("DAY_%d") % data.day,
|
||||
LIFETIME_ICON
|
||||
))
|
||||
|
||||
info.stats.append(CardStatInfo.new(
|
||||
state_text,
|
||||
PLANT_TYPE_ICON
|
||||
))
|
||||
|
||||
if state != PlantData.State.MATURE:
|
||||
info.stats.append(CardStatInfo.new(
|
||||
tr("MATURE_ON_DAY_%d") % data.get_growing_time(),
|
||||
GROWING_ICON
|
||||
))
|
||||
|
||||
info.stats.append(CardStatInfo.new(
|
||||
tr("%d_SCORE_WHEN_MATURE") % data.get_score(PlantData.State.MATURE),
|
||||
PLANT_POINT_ICON
|
||||
))
|
||||
|
||||
info.stats.append(CardStatInfo.new(
|
||||
tr("DIE_ON_DAY_%d") % (data.get_lifetime()),
|
||||
DEATH_ICON
|
||||
))
|
||||
|
||||
info.stats.append_array([
|
||||
CardStatInfo.new(
|
||||
str(data.day),
|
||||
LIFETIME_ICON
|
||||
),
|
||||
CardStatInfo.new(
|
||||
str(data.get_growing_time()),
|
||||
GROWING_ICON
|
||||
),
|
||||
CardStatInfo.new(
|
||||
str(data.get_lifetime()),
|
||||
DEATH_ICON
|
||||
),
|
||||
])
|
||||
|
||||
if len(data.mutations) != 0:
|
||||
var rarest : int = data.mutations.map(
|
||||
func(m : PlantMutation) : return m.get_rarity()
|
||||
).max()
|
||||
info.bg_color = PlantMutation.get_rarity_color(rarest)
|
||||
for m in data.mutations:
|
||||
info.sections.append(m.card_section())
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
extends Resource
|
||||
class_name PlantArchetype
|
||||
|
||||
@export var archetype_name = Random.generate_random_name()
|
||||
@export var archetype_name = Random.generate_random_word()
|
||||
@export var texture_builder = TextureBuilder.new()
|
||||
@export var plant_area_radius = 20
|
||||
@export var plant_influence_radius = 100
|
||||
@export var growing_time= 2
|
||||
@export var lifetime = 5
|
||||
@export var lifetime = 8
|
||||
@export var base_score = 1
|
||||
@export var seed_number = 2
|
||||
@export var seed_random_loose = 1
|
||||
@@ -16,4 +16,12 @@ class_name PlantArchetype
|
||||
PrecociousMutation.new(),
|
||||
QualityMutation.new(),
|
||||
QuickMutation.new()
|
||||
]
|
||||
]
|
||||
|
||||
static func get_all() -> Array[PlantArchetype]:
|
||||
return [
|
||||
PlantArchetype.new()
|
||||
]
|
||||
|
||||
static func get_random() -> PlantArchetype:
|
||||
return get_all().pick_random()
|
||||
|
||||
@@ -19,9 +19,9 @@ enum State {PLANTED, GROWING, MATURE, DEAD}
|
||||
@export var roots = 0 # +1 lifetime
|
||||
|
||||
func _init(
|
||||
_position : Vector2,
|
||||
_archetype : PlantArchetype,
|
||||
_plant_name : String = Random.generate_random_name(),
|
||||
_position : Vector2 = Vector2.ZERO,
|
||||
_archetype : PlantArchetype = PlantArchetype.get_random(),
|
||||
_plant_name : String = Random.generate_random_word(),
|
||||
_mutations : Array[PlantMutation] = [],
|
||||
_day : int = 0,
|
||||
_random_seed = randi()
|
||||
@@ -90,7 +90,7 @@ func get_seed_texture():
|
||||
return archetype.texture_builder.build_seed_texture(random_seed)
|
||||
|
||||
func get_seed_number(state = get_state()):
|
||||
var seed_number = archetype.seed_number if state == State.MATURE else 0
|
||||
var seed_number = archetype.seed_number if (state == State.MATURE or state == State.DEAD) else 0
|
||||
|
||||
for m in mutations:
|
||||
seed_number = m.mutate_seed_number(self, seed_number)
|
||||
|
||||
@@ -3,6 +3,8 @@ class_name PlantMutation
|
||||
|
||||
@export var level : int = 1
|
||||
|
||||
var name : String : get = get_mutation_name
|
||||
|
||||
func _init(_level : int = 1):
|
||||
level = _level
|
||||
|
||||
@@ -65,8 +67,7 @@ func card_section() -> CardSectionInfo:
|
||||
"[b]%s[/b] %s" % [tr(PlantMutation.get_rarity_text(get_rarity())), get_mutation_description()]
|
||||
)
|
||||
|
||||
section.title_color = PlantMutation.get_rarity_color(get_rarity())
|
||||
section.title_colored = true
|
||||
section.color = PlantMutation.get_rarity_color(get_rarity())
|
||||
section.title_icon = get_icon()
|
||||
|
||||
return section
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends PlantMutation
|
||||
class_name AncientMutation
|
||||
|
||||
const DEFAULT_DAY_FACTOR = 5
|
||||
const DEFAULT_DAY_FACTOR = 3
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/wood.svg")
|
||||
|
||||
@@ -13,5 +13,5 @@ func get_mutation_name() -> String:
|
||||
func get_mutation_description() -> String:
|
||||
return tr("QUICK_EFFECT_TEXT_LEVEL_%d") % level
|
||||
|
||||
func mutate_grow_time(_data : PlantData, grow_time : int) -> int:
|
||||
func mutate_growing_time(_data : PlantData, grow_time : int) -> int:
|
||||
return max(grow_time - level, 0)
|
||||
Reference in New Issue
Block a user