ajout de la porte et équilibrage des mutations

This commit is contained in:
2026-03-06 18:15:10 +01:00
parent 263f6c42a7
commit 2cd16acd6a
92 changed files with 1420 additions and 582 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://s0bn2kt1bpkn"
path="res://.godot/imported/door_1.png-dd51326c0be9b6ca6b377054f3b2e77d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_1.png"
dest_files=["res://.godot/imported/door_1.png-dd51326c0be9b6ca6b377054f3b2e77d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bc1ab3tf6vpqy"
path="res://.godot/imported/door_2.png-ffb500b8948b67d03b116bc31932d2e7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_2.png"
dest_files=["res://.godot/imported/door_2.png-ffb500b8948b67d03b116bc31932d2e7.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://jmen57sr5vk4"
path="res://.godot/imported/door_3.png-d482e5ec97272ac7dd5a7b3a5a9537ae.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_3.png"
dest_files=["res://.godot/imported/door_3.png-d482e5ec97272ac7dd5a7b3a5a9537ae.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5gstknno4mka"
path="res://.godot/imported/door_4.png-3f16467270ce8b1707ea531e940f078d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_4.png"
dest_files=["res://.godot/imported/door_4.png-3f16467270ce8b1707ea531e940f078d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dd7jl1yyfs7l1"
path="res://.godot/imported/door_5.png-119cfb6fd418806a8ada16cab3be9800.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_5.png"
dest_files=["res://.godot/imported/door_5.png-119cfb6fd418806a8ada16cab3be9800.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cht54x4mugr5p"
path="res://.godot/imported/door_6.png-e383976c062791fd56ea66dee70eef77.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_6.png"
dest_files=["res://.godot/imported/door_6.png-e383976c062791fd56ea66dee70eef77.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1hac868r8p6j"
path="res://.godot/imported/door_7.png-e59924662d7e8532a3fd4cd279271ad9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_7.png"
dest_files=["res://.godot/imported/door_7.png-e59924662d7e8532a3fd4cd279271ad9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dtyaykvtikvfx"
path="res://.godot/imported/door_8.png-7f02c4bb4f5ac7ca8b7b1c6a36f870f5.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_8.png"
dest_files=["res://.godot/imported/door_8.png-7f02c4bb4f5ac7ca8b7b1c6a36f870f5.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ddmriwgrr3mj5"
path="res://.godot/imported/door_9.png-ba922b9855fd185769933e59b1b2c98b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_9.png"
dest_files=["res://.godot/imported/door_9.png-ba922b9855fd185769933e59b1b2c98b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dqjqwmck0rgkh"
path="res://.godot/imported/door_screen.png-f9e60b58530d2cc65beea7b37c212496.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/interactables/door/assets/sprites/door_screen.png"
dest_files=["res://.godot/imported/door_screen.png-f9e60b58530d2cc65beea7b37c212496.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -1,22 +1,146 @@
[gd_scene format=3 uid="uid://b8m537op75gib"]
[ext_resource type="Script" uid="uid://bmxuqj0c6h60d" path="res://entities/interactables/door/script/door.gd" id="1_8kdwv"]
[sub_resource type="Gradient" id="Gradient_8kdwv"]
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_oarg0"]
gradient = SubResource("Gradient_8kdwv")
[ext_resource type="Texture2D" uid="uid://ddmriwgrr3mj5" path="res://entities/interactables/door/assets/sprites/door_9.png" id="2_0mw24"]
[ext_resource type="Texture2D" uid="uid://be7ietbjlmgtt" path="res://common/icons/map-pin-empty.svg" id="2_6w4e0"]
[ext_resource type="Texture2D" uid="uid://dtyaykvtikvfx" path="res://entities/interactables/door/assets/sprites/door_8.png" id="3_6w4e0"]
[ext_resource type="Texture2D" uid="uid://1hac868r8p6j" path="res://entities/interactables/door/assets/sprites/door_7.png" id="4_tu3nm"]
[ext_resource type="Texture2D" uid="uid://cht54x4mugr5p" path="res://entities/interactables/door/assets/sprites/door_6.png" id="5_wnnbj"]
[ext_resource type="Texture2D" uid="uid://dd7jl1yyfs7l1" path="res://entities/interactables/door/assets/sprites/door_5.png" id="6_xqykn"]
[ext_resource type="Texture2D" uid="uid://c5gstknno4mka" path="res://entities/interactables/door/assets/sprites/door_4.png" id="7_obnqv"]
[ext_resource type="Texture2D" uid="uid://jmen57sr5vk4" path="res://entities/interactables/door/assets/sprites/door_3.png" id="8_0ctdk"]
[ext_resource type="Texture2D" uid="uid://bc1ab3tf6vpqy" path="res://entities/interactables/door/assets/sprites/door_2.png" id="9_2jahp"]
[ext_resource type="Texture2D" uid="uid://s0bn2kt1bpkn" path="res://entities/interactables/door/assets/sprites/door_1.png" id="10_8yes4"]
[ext_resource type="Texture2D" uid="uid://dqjqwmck0rgkh" path="res://entities/interactables/door/assets/sprites/door_screen.png" id="12_6w4e0"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y51rk"]
size = Vector2(64, 64)
size = Vector2(106, 120)
[sub_resource type="SpriteFrames" id="SpriteFrames_4aafg"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_0mw24")
}, {
"duration": 1.0,
"texture": ExtResource("3_6w4e0")
}, {
"duration": 1.0,
"texture": ExtResource("4_tu3nm")
}, {
"duration": 1.0,
"texture": ExtResource("5_wnnbj")
}, {
"duration": 1.0,
"texture": ExtResource("6_xqykn")
}, {
"duration": 1.0,
"texture": ExtResource("7_obnqv")
}, {
"duration": 1.0,
"texture": ExtResource("8_0ctdk")
}, {
"duration": 1.0,
"texture": ExtResource("9_2jahp")
}, {
"duration": 1.0,
"texture": ExtResource("10_8yes4")
}],
"loop": false,
"name": &"close",
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_8yes4")
}],
"loop": true,
"name": &"closed",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("10_8yes4")
}, {
"duration": 1.0,
"texture": ExtResource("9_2jahp")
}, {
"duration": 1.0,
"texture": ExtResource("8_0ctdk")
}, {
"duration": 1.0,
"texture": ExtResource("7_obnqv")
}, {
"duration": 1.0,
"texture": ExtResource("6_xqykn")
}, {
"duration": 1.0,
"texture": ExtResource("5_wnnbj")
}, {
"duration": 1.0,
"texture": ExtResource("4_tu3nm")
}, {
"duration": 1.0,
"texture": ExtResource("3_6w4e0")
}, {
"duration": 1.0,
"texture": ExtResource("2_0mw24")
}],
"loop": false,
"name": &"open",
"speed": 20.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("2_0mw24")
}],
"loop": false,
"name": &"opened",
"speed": 20.0
}]
[sub_resource type="Gradient" id="Gradient_tu3nm"]
interpolation_mode = 1
offsets = PackedFloat32Array(0, 0.91845495, 1)
colors = PackedColorArray(0.0627451, 0.05882353, 0.16862746, 1, 0.06318334, 0.059500005, 0.17, 0, 1, 1, 1, 0)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_wnnbj"]
gradient = SubResource("Gradient_tu3nm")
width = 125
height = 126
fill = 1
fill_from = Vector2(0.5, 0.5)
fill_to = Vector2(1, 0.5)
[node name="Door" type="Area2D" unique_id=2053096538]
script = ExtResource("1_8kdwv")
icon = ExtResource("2_6w4e0")
available = false
metadata/_custom_type_script = "uid://dyprcd68fjstf"
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=874210487]
texture = SubResource("GradientTexture2D_oarg0")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1809395872]
shape = SubResource("RectangleShape2D_y51rk")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=879120806]
unique_name_in_owner = true
scale = Vector2(0.33, 0.33)
sprite_frames = SubResource("SpriteFrames_4aafg")
animation = &"close"
frame = 8
frame_progress = 1.0
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1875435966]
position = Vector2(0.99999994, -41)
scale = Vector2(0.2833334, 0.28333336)
texture = SubResource("GradientTexture2D_wnnbj")
[node name="Icon" type="Sprite2D" parent="." unique_id=874210487]
unique_name_in_owner = true
position = Vector2(1, -42)
scale = Vector2(0.4583333, 0.4583333)
texture = ExtResource("2_6w4e0")
[node name="DoorScreen" type="Sprite2D" parent="." unique_id=236947304]
position = Vector2(5.684342e-14, 2.2737368e-13)
scale = Vector2(0.33, 0.33)
texture = ExtResource("12_6w4e0")

View File

@@ -3,9 +3,14 @@ extends Interactable
class_name Door
@export var to_scene_id = ""
@export var icon : Texture : set = set_icon
func _ready():
modulate = Color.WHITE if available else Color.RED
if available:
%AnimatedSprite2D.play("opened")
else:
%AnimatedSprite2D.play("closed")
set_icon()
func interact(_p : Player) -> bool:
if available and to_scene_id:
@@ -16,4 +21,14 @@ func interact(_p : Player) -> bool:
func set_available(v : bool):
available = v
modulate = Color.WHITE if available else Color.RED
if is_node_ready():
if available:
AudioManager.play_sfx("DoorOpen")
%AnimatedSprite2D.play("open")
else:
%AnimatedSprite2D.play("close")
func set_icon(i: Texture = icon):
icon = i
if is_node_ready():
%Icon.texture = icon

View File

@@ -34,6 +34,14 @@ func _ready():
influence_zone = generate_influence_zone()
plant_sprite.setup_plant_sprite(data)
if region:
region.data.updated.connect(
func (_d : RegionData):
await get_tree().create_timer(0.05).timeout
update_nearby_plant()
)
await get_tree().create_timer(0.05).timeout
update_nearby_plant()
func pointer_text() -> String:
return data.plant_name
@@ -133,13 +141,21 @@ func disappear():
data.disappear()
queue_free()
func update_nearby_plant():
data.nearby_plants = []
for area in influence_zone.get_overlapping_areas():
if area is Plant and area != self:
data.nearby_plants.append(area.data)
data.nearby_plant_updated.emit()
func save() -> EntityData:
return data
func card_info() -> CardInfo:
var info = CardInfo.new(
data.plant_name,
data.archetype.archetype_name
tr("MATURE") if data.is_mature() else tr("GROWING")# data.archetype.archetype_name
)
info.important_stat_icon = PLANT_POINT_ICON
@@ -176,4 +192,4 @@ func get_card_up_padding() -> float:
return 75
PlantData.State.PLANTED:
return 50
return Pointer.CARD_UP_PADDING
return Pointer.CARD_UP_PADDING

View File

@@ -5,7 +5,7 @@ class_name PlantArchetype
@export var plant_area_radius = 20
@export var plant_influence_radius = 100
@export var growing_time = 2
@export var lifetime = 8
@export var lifetime = 6
@export var base_score = 1
@export var seed_number = 2
@export var seed_random_loose = 1

View File

@@ -3,6 +3,7 @@ class_name PlantData
signal updated(p: PlantData)
signal disappeared(p: PlantData)
signal nearby_plant_updated()
enum State {PLANTED, GROWING, MATURE, DEAD}
@@ -20,6 +21,8 @@ enum State {PLANTED, GROWING, MATURE, DEAD}
# var texture_builder: TextureBuilder = preload("res://entities/plants/scripts/texture_builder/texture_builder.tres")
var nearby_plants : Array[PlantData]
func _init(
_position: Vector2 = Vector2.ZERO,
_archetype: PlantArchetype = PlantArchetype.get_random(),
@@ -57,7 +60,10 @@ func get_lifetime() -> int:
for m in mutations:
lifetime = m.mutate_lifetime(self , lifetime)
for pd in nearby_plants:
lifetime += pd.get_lifetime_buff()
return lifetime
func get_growing_time() -> int:
@@ -84,16 +90,22 @@ func get_state() -> State:
return State.DEAD
elif day == 0:
return State.PLANTED
elif day < archetype.growing_time:
elif day < get_growing_time():
return State.GROWING
return State.MATURE
func is_mature() -> bool:
return get_state() == State.MATURE
func get_seed_number(state = get_state()):
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)
for pd in nearby_plants:
seed_number += pd.get_seed_buff()
return seed_number
func get_seed_random_loose():
@@ -109,5 +121,21 @@ func get_random_seed_income():
0
)
func get_lifetime_buff() -> int:
var buff = 0
for m in mutations:
buff += m.mutate_lifetime_buff(self)
return buff
func get_seed_buff() -> int:
var buff = 0
for m in mutations:
buff += m.mutate_seed_buff(self)
return buff
func disappear():
disappeared.emit(self )

View File

@@ -42,12 +42,18 @@ func mutate_lifetime(_plant_data: PlantData, lifetime: int) -> int:
func mutate_growing_time(_plant_data: PlantData, growing_time: int) -> int:
return growing_time
func mutate_seed_number(_plant_data: PlantData, seed_number: int):
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):
func mutate_seed_random_loose(_plant_data: PlantData, seed_random_loose) -> int:
return seed_random_loose
func mutate_lifetime_buff(_plant_data: PlantData) -> int:
return 0
func mutate_seed_buff(_plant_data: PlantData) -> int:
return 0
func _start_planted_effect(_plant: Plant):
pass

View File

@@ -1,14 +1,11 @@
extends PlantMutation
class_name AncientMutation
const DEFAULT_DAY_FACTOR = 3
const DEFAULT_DAY_FACTOR = 4
func get_icon() -> Texture:
return preload("res://common/icons/wood.svg")
func get_base_rarity() -> int:
return 0
func get_mutation_id() -> String:
return "ANCIENT"
@@ -16,10 +13,18 @@ func get_mutation_name() -> String:
return tr("ANCIENT")
func get_mutation_description() -> String:
return tr("ANCIENT_EFFECT_TEXT_LEVEL_%d") % get_day_factor()
return tr("ANCIENT_EFFECT_TEXT_LEVEL").format(
{
"score_increase": get_score_increase(),
"day_factor": get_day_factor()
}
)
func get_day_factor():
return max(1, DEFAULT_DAY_FACTOR - level + 1)
return max(1, DEFAULT_DAY_FACTOR - level)
func get_score_increase():
return max(1, level - DEFAULT_DAY_FACTOR)
func mutate_score(data : PlantData, score) -> int:
if data.get_state() != PlantData.State.MATURE:

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name EphemeralMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/butterfly.svg")
func get_mutation_id() -> String:
return "EPHEMERAL"
@@ -17,7 +14,7 @@ func get_mutation_description() -> String:
return tr("EPHEMERAL_EFFECT_TEXT_LEVEL").format({"seed_number": level, "lifetime_change": get_lifetime_change()})
func mutate_lifetime(_plant_data: PlantData, lifetime: int) -> int:
return lifetime - get_lifetime_change()
return lifetime + get_lifetime_change()
func mutate_seed_number(_plant_data: PlantData, seed_number: int):
return seed_number + level
@@ -26,4 +23,4 @@ func get_seed_increase() -> int:
return floori((level + 1.0) / 2)
func get_lifetime_change() -> int:
return maxi(0, 6 - get_seed_increase())
return -2

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name FertileMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/seedling.svg")
func get_mutation_id() -> String:
return "FERTILE"
@@ -16,6 +13,5 @@ func get_mutation_name() -> String:
func get_mutation_description() -> String:
return tr("FERTILE_EFFECT_TEXT_LEVEL_%d") % level
func mutate_lifetime(_plant_data : PlantData, lifetime : int) -> int:
print("TODO:: Implemnt FERTILE lifetime based on plants around")
return lifetime + level
func mutate_seed_buff(_plant_data: PlantData) -> int:
return level

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name PrecociousMutation
func get_icon() -> Texture:
return preload("res://common/icons/hourglass-empty.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/rocket.svg")
func get_mutation_id() -> String:
return "PRECOCIOUS"

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name PurificationMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/droplet.svg")
func get_mutation_id() -> String:
return "PURIFICATION"
@@ -16,9 +13,12 @@ func get_mutation_name() -> String:
func get_mutation_description() -> String:
return tr("PURIFICATION_EFFECT_TEXT_LEVEL_%d") % get_purification_radius()
func _start_maturation_effect(_plant : Plant):
print("Implement purification maturation effect")
pass
func _start_maturation_effect(plant : Plant):
plant.region.decontaminate(Math.get_tiles_in_circle(
plant.global_position,
get_purification_radius() * (Region.TILE_SIZE + Region.TILE_SIZE/2.)
))
func get_purification_radius() -> int:
return level

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name QuickMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/hourglass-empty.svg")
func get_mutation_id() -> String:
return "QUICK"
@@ -16,14 +13,17 @@ func get_mutation_name() -> String:
func get_mutation_description() -> String:
return tr("QUICK_EFFECT_TEXT_LEVEL").format({"score_increase": get_score_increase(), "lifetime_decrease": get_lifetime_decrease()})
func mutate_score(_plant_data: PlantData, score: int) -> int:
func mutate_score(plant_data: PlantData, score: int) -> int:
if not plant_data.is_mature():
return score
return score + level
func mutate_lifetime(_plant_data: PlantData, lifetime: int) -> int:
return max(lifetime - level, 1)
return max(1, lifetime-get_lifetime_decrease())
func get_score_increase() -> int:
return floori((level + 1.0) / 2)
return level * 2
func get_lifetime_decrease() -> int:
return maxi(0, 6 - get_score_increase())
return 3

View File

@@ -1,11 +1,10 @@
extends PlantMutation
class_name SocialMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
const DEFAULT_PLANT_BY_POINT = 4
func get_base_rarity() -> int:
return 0
func get_icon() -> Texture:
return preload("res://common/icons/users-group.svg")
func get_mutation_id() -> String:
return "SOCIABLE"
@@ -14,11 +13,21 @@ func get_mutation_name() -> String:
return tr("SOCIABLE")
func get_mutation_description() -> String:
return tr("SOCIABLE_EFFECT_TEXT_LEVEL").format({"near_amount": get_near_plants_around()})
return tr("SOCIABLE_EFFECT_TEXT_LEVEL").format(
{
"near_amount": get_near_plants_around(),
"score_increase": get_score_increase()
}
)
func mutate_score(_plant_data: PlantData, score: int) -> int:
printerr("TODO:: implement SOCIABLE score based on plants around")
return score + level
func mutate_score(plant_data: PlantData, score: int) -> int:
if plant_data.get_state() != PlantData.State.MATURE:
return score
return score + get_score_increase() * floori(len(plant_data.nearby_plants)/get_near_plants_around())
func get_near_plants_around():
return 5 - level
return max(DEFAULT_PLANT_BY_POINT - level,1)
func get_score_increase():
return max(level - DEFAULT_PLANT_BY_POINT,1)

View File

@@ -2,10 +2,7 @@ extends PlantMutation
class_name ToughMutation
func get_icon() -> Texture:
return preload("res://common/icons/chevrons-up.svg")
func get_base_rarity() -> int:
return 0
return preload("res://common/icons/shield.svg")
func get_mutation_id() -> String:
return "TOUGH"
@@ -20,7 +17,7 @@ func mutate_score_multiplier(_plant_data: PlantData, multiplier: int) -> int:
return multiplier * 2
func mutate_growing_time(_plant_data: PlantData, growing_time: int) -> int:
return growing_time + get_growing_time_increase()
return maxi(0, growing_time + get_growing_time_increase())
func get_growing_time_increase()->int:
return maxi(0, 3 - level)
return 4 - level

View File

@@ -13,14 +13,18 @@ const RAY_LENGTH = 10.
var cockpit_action_hovered : Interactable3D = null
var query_mouse := false
@export var controlling_player = true
func _ready():
Dialogic.timeline_started.connect(
func():
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
controlling_player = false
)
Dialogic.timeline_ended.connect(
func():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
controlling_player = true
)
func _input(event):
@@ -34,32 +38,33 @@ func _input(event):
func _physics_process(delta):
if query_mouse:
update_mouse_hovered_cockpit_actions()
%PointerTexture.texture = (
POINTER_ACTION_TEXTURE if cockpit_action_hovered != null
else POINTER_TEXTURE
)
query_mouse = false
if controlling_player:
if query_mouse:
update_mouse_hovered_cockpit_actions()
%PointerTexture.texture = (
POINTER_ACTION_TEXTURE if cockpit_action_hovered != null
else POINTER_TEXTURE
)
query_mouse = false
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Add the gravity.
if not is_on_floor():
velocity += get_gravity() * delta
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
if Input.is_action_pressed("move_pointer"):
input_dir.y = -1
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = move_toward(velocity.x, 0, speed)
velocity.z = move_toward(velocity.z, 0, speed)
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir = Input.get_vector("move_left", "move_right", "move_up", "move_down")
if Input.is_action_pressed("move_pointer"):
input_dir.y = -1
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * speed
velocity.z = direction.z * speed
else:
velocity.x = move_toward(velocity.x, 0, speed)
velocity.z = move_toward(velocity.z, 0, speed)
move_and_slide()
move_and_slide()
func update_mouse_hovered_cockpit_actions() -> void: