ajout des mutation et refonte de l'inspecteur
* ajout des mutations #86 * changement de l'objectif #85 * refonte de l'inspecteur #71 * changement léger de la plantation * les plantes ne donnent que des graines de leurs espèces * refonte partielle du code, refacto
This commit is contained in:
23
entities/plants/scripts/plant_mutation/ancient_mutation.gd
Normal file
23
entities/plants/scripts/plant_mutation/ancient_mutation.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends PlantMutation
|
||||
class_name AncientMutation
|
||||
|
||||
const DEFAULT_DAY_FACTOR = 5
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/wood.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Ancient"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]1[/b] to the score for each [b]%d[/b] days passed" % get_day_factor()
|
||||
|
||||
func get_day_factor():
|
||||
return max(1, DEFAULT_DAY_FACTOR - level + 1)
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
|
||||
return score + floori(plant.day / get_day_factor())
|
||||
@@ -0,0 +1 @@
|
||||
uid://c7po0bstyg80u
|
||||
26
entities/plants/scripts/plant_mutation/elitist_mutation.gd
Normal file
26
entities/plants/scripts/plant_mutation/elitist_mutation.gd
Normal file
@@ -0,0 +1,26 @@
|
||||
extends PlantMutation
|
||||
class_name ElitistMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/copy.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Intolerant"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score for each plant of the same species around, but score become 0 if none is around." % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant and area.plant_type.name == plant.plant_type.name:
|
||||
plant_count += 1
|
||||
|
||||
if plant_count == 0:
|
||||
return 0
|
||||
else :
|
||||
return score + level * plant_count
|
||||
@@ -0,0 +1 @@
|
||||
uid://bt1xh7ss13e5e
|
||||
21
entities/plants/scripts/plant_mutation/ermit_mutation.gd
Normal file
21
entities/plants/scripts/plant_mutation/ermit_mutation.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends PlantMutation
|
||||
class_name ErmitMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling-off.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Ermit"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Multiply the score by %d if no plant is near, but set it to 0 otherwise." % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant:
|
||||
return 0
|
||||
|
||||
return score * 2
|
||||
@@ -0,0 +1 @@
|
||||
uid://domy822vgxfxs
|
||||
@@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name PrecociousMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/hourglass-empty.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Precocious"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score while the plant is growing" % level
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
return score + (0 if plant.state == Plant.State.MATURE else level)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cx5mg5vf62bia
|
||||
17
entities/plants/scripts/plant_mutation/quality_mutation.gd
Normal file
17
entities/plants/scripts/plant_mutation/quality_mutation.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name QualityMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/north-star.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Quality"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score if the plant is mature." % level
|
||||
|
||||
func mutate_score(plant : Plant, score : int) -> int:
|
||||
return score + (level if plant.state == Plant.State.MATURE else 0)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bdobyk2j625lb
|
||||
17
entities/plants/scripts/plant_mutation/quick_mutation.gd
Normal file
17
entities/plants/scripts/plant_mutation/quick_mutation.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends PlantMutation
|
||||
class_name QuickMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/chevrons-up.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Quick"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Reduce the grow time by %d" % level
|
||||
|
||||
func mutate_grow_time(_plant : Plant, grow_time : int) -> int:
|
||||
return max(grow_time - level, 0)
|
||||
@@ -0,0 +1 @@
|
||||
uid://bhtq0cbrgu58v
|
||||
28
entities/plants/scripts/plant_mutation/sociable_mutation.gd
Normal file
28
entities/plants/scripts/plant_mutation/sociable_mutation.gd
Normal file
@@ -0,0 +1,28 @@
|
||||
extends PlantMutation
|
||||
class_name SociableMutation
|
||||
|
||||
const NEAR_PLANT_NEEDED = 2
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/seedling.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Sociable"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Add [b]%d[/b] to the score if near %d other plants" % [get_score_bonus(), NEAR_PLANT_NEEDED]
|
||||
|
||||
func get_score_bonus():
|
||||
return (level + 2)
|
||||
|
||||
func mutate_score(plant : Plant, score) -> int:
|
||||
var plant_count = 0
|
||||
|
||||
for area in plant.influence_zone.get_overlapping_areas():
|
||||
if area is Plant:
|
||||
plant_count += 1
|
||||
|
||||
return score + (get_score_bonus() if plant_count >= NEAR_PLANT_NEEDED else 0)
|
||||
@@ -0,0 +1 @@
|
||||
uid://b8q5xgvy85qeb
|
||||
20
entities/plants/scripts/plant_mutation/strong_mutation.gd
Normal file
20
entities/plants/scripts/plant_mutation/strong_mutation.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
extends PlantMutation
|
||||
class_name StrongMutation
|
||||
|
||||
func get_icon() -> Texture:
|
||||
return preload("res://common/icons/dna.svg")
|
||||
|
||||
func get_base_rarity() -> int:
|
||||
return 0
|
||||
|
||||
func get_mutation_name() -> String:
|
||||
return "Strong"
|
||||
|
||||
func get_mutation_description() -> String:
|
||||
return "Plus [b]%d[/b] percent of the score" % roundi(get_score_multiplier() * 100)
|
||||
|
||||
func get_score_multiplier():
|
||||
return float(level)/2.
|
||||
|
||||
func mutate_score(_plant : Plant, score: int) -> int:
|
||||
return score + roundi(score * get_score_multiplier())
|
||||
@@ -0,0 +1 @@
|
||||
uid://cwj3k4p6ci5t4
|
||||
Reference in New Issue
Block a user