khanat-client/ressources/scripts/datas/creature.gd

41 lines
1 KiB
GDScript

class_name Creature
extends Data
#
#05. signals
#06. enums
#07. constants
#08. exported variables
#09. public variables
#10. private variables
#11. onready variables
#12. optional built-in virtual _init method
#13. built-in virtual _ready method
#14. remaining built-in virtual methods
#15. public methods
func _init( p_name = null ).( p_name ):
self.set_data( "race", null )
self.set_data( "pseudonym", null )
# Caracteristiques.
self.set_data( "strength", 5 )
self.set_data( "perception", 5 )
self.set_data( "endurance", 5 )
self.set_data( "constitution", 5 )
self.set_data( "agility", 5 )
self.set_data( "current_life", self.get_max_life() )
self.set_data( "current_stamina", self.get_max_stamina() )
# inventaire.
self.set_data( "inventory", [] )
func get_filename():
if not self.get_data( "name", null ):
return "unknow.creature"
return self.get_data( "name" )+".creature"
func get_max_life():
return self.get_data( "constitution", 5 ) * 1000
func get_max_stamina():
return self.get_data( "endurance", 5 ) * 1000
#16. private methods