Revised Object for Special Abliities for Singletons

This commit is contained in:
PersonGuyGit
2023-12-10 12:48:39 -07:00
parent d728383a30
commit e479ffe174
6 changed files with 64 additions and 33 deletions

View File

@ -5,11 +5,9 @@ class_name ConflictResultsProcess
#This class is used to define the player and NPC order in combat. Also called Initiative in some game systems.
#Rough Draft: 12/3/2023: Luke, Godot 3.5
#How are we calculating initiatve. Are we going to pull the formula from the GSAL?
var Initiative_Order : Array
#What do these two variables do? That was not clearly defined in the UML...
var Action_Declared : Array

View File

@ -0,0 +1,48 @@
extends Object
#This class, is used to define special ability data. Such as for attacks like shooting fireballs.
#This is the middle ware, to define the structure of the data, before it is accesable by the character sheet.
#This class is also used to define the structure, as to make it normalized for the database / XML layers.
# Luke, 12/10/2023, Godot 3.5+
var Name: String
var Attribute: Array
var Cost: int
var Damage: int
var LevelRequirement: int
var Duration: float
var AffectedAttribute: String
var DiceRules: Vector3
func _init(initName: String, initAttribute: Array, initCost: int, initDamage: int,
initLevelRequirement: int, initDuration: float, initAffectedAttribute: String,
initDiceRules: Vector3):
Name = initName
# Attribute = initAttribute
Cost = initCost
Damage = initDamage
LevelRequirement = initLevelRequirement
Duration = initDuration
AffectedAttribute = initAffectedAttribute
DiceRules = initDiceRules
Attribute = []
for element in initAttribute:
if typeof(element) == TYPE_STRING:
Attribute.append(element)
else:
print("Warning: Ignoring non-string element in StringArray.")
# Custom method to convert the object to a string
func to_string() -> String:
return "SpecialAbility(Name: {Name}, Attribute: {Attribute}, Cost: {Cost}, Damage: {Damage}, LevelRequirement: {LevelRequirement}, Duration: {Duration}, AffectedAttribute: {AffectedAttribute}, DiceRules: {DiceRules})"

View File

@ -1,24 +0,0 @@
extends Object
class_name SpecialAbility
#This class, is used to define special ability data. Such as for attacks like shooting fireballs.
#This is the middle ware, to define the structure of the data, before it is accesable by the character sheet.
#This class is also used to define the structure, as to make it normalized for the database / XML layers.
# Luke, 12/9/2023, Godot 3.5+
var Name: String
#Add TypeCheck for arrays of only strings at some point.
var Attribute: Array
var Cost: int
var Damage: int
func _init(initName: String, initAttribute: Array, initCost: int, initDamage: int):
Name = initName
Attribute = initAttribute
Cost = initCost
Damage = initDamage

View File

@ -0,0 +1,8 @@
extends Node
func _ready():
var SpecialAbility = preload("res://middleware/specialabliities/SpecialAbility.gd")
var special_ability = SpecialAbility.new("Fireball", ["Fire Type", "Projectile"], 1, 10, 0, 5.0, "strength", Vector3(1, 1, 1))
print(special_ability.to_string())

View File

@ -0,0 +1,3 @@
[gd_scene format=2]
[node name="Node2D" type="Node2D"]