-
Notifications
You must be signed in to change notification settings - Fork 0
Divine Gift Base Implementation and Scaffold Stealing Spells #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| extends Resource | ||
| class_name DivineGift | ||
|
|
||
| enum DivineGiftType { | ||
| STEAL_SPELLS | ||
| } | ||
|
|
||
| # General Divine Gift Attributes | ||
| @export var name: String # Used to overwrite button name in combat | ||
| @export var description: String | ||
| @export var divine_gift: DivineGiftType | ||
|
|
||
| # Default function to override divine gift combat button, to be overwritten | ||
| # by resources to call the right combat_manager function | ||
| func _cast() -> void: | ||
| print("Divine Gift: ", name) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://ufvmls6ohupj |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| extends DivineGift | ||
|
|
||
| func _cast() -> void: | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah i see what you're doing here. Do you think this current implementaiton is better or should we go with a "CombatManager is the only interface anything calls in combat"? i.e. the button will call CombatManager::cast_divine_gift() which then calls _cast() which then calls steal_gift() in this case (and steal_gift() implementation is in steal_spells.gd)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking about that too, but then how do we map the button dynamically based on the divine gift the user has? I think keeping it strictly in CombatManager would involve some kind of hard coded map from DivineGiftType to func. In my head I think this is kinda cleaner, since we'd abstract that "map" into these resource scripts. Each DivineGift resource script stores which CombatManager function will need to be called, instead of the CombatManager having to figure it out. Also allows us to extend these
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't "what divine gift X character has" defined by their divine gift component?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah each characters divine gift component holds the divine gift they have, represented as a resource- and the divine gift resource stores whatever config we need (name, description, what CombatManager func to call, etc) |
||
| CombatManager.steal_spell() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://c4of6cad0gjxd |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [gd_resource type="Resource" script_class="DivineGift" load_steps=2 format=3 uid="uid://cpll3f8nqjv27"] | ||
|
|
||
| [ext_resource type="Script" uid="uid://ufvmls6ohupj" path="res://resources/divine_gifts/divine_gift.gd" id="1_1ec7g"] | ||
|
|
||
| [resource] | ||
| script = ExtResource("1_1ec7g") | ||
| name = "Steal" | ||
| description = "Allows the player to steal an enemy spells that persists outside of combat" | ||
| divine_gift = 0 | ||
| metadata/_custom_type_script = "uid://ufvmls6ohupj" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [gd_scene load_steps=2 format=3 uid="uid://cdm43kunrogx"] | ||
|
|
||
| [ext_resource type="Script" path="res://src/components/attack_component.gd" id="1_10dg0"] | ||
| [ext_resource type="Script" uid="uid://cvmbgnm58dvx7" path="res://src/components/attack_component.gd" id="1_10dg0"] | ||
|
|
||
| [node name="AttackComponent" type="Node"] | ||
| script = ExtResource("1_10dg0") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| extends Node | ||
|
|
||
| # Store divine gift resource that this character has | ||
| @export var divine_gift : DivineGift |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://t037q272etvh |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [gd_scene load_steps=2 format=3 uid="uid://coepmnkl23pdw"] | ||
|
|
||
| [ext_resource type="Script" uid="uid://t037q272etvh" path="res://src/components/divine_gift_component.gd" id="1_271up"] | ||
|
|
||
| [node name="DivineGiftComponent" type="Node"] | ||
| script = ExtResource("1_271up") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| extends Node2D | ||
| extends Node | ||
|
|
||
| # Current unit's spells | ||
| @export var MAX_SPELLS = 4 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| [gd_scene load_steps=2 format=3 uid="uid://dprvni6fde6dc"] | ||
|
|
||
| [ext_resource type="Script" path="res://src/components/spells_component.gd" id="1_xm8yn"] | ||
| [ext_resource type="Script" uid="uid://dpat2vlglhmvs" path="res://src/components/spells_component.gd" id="1_xm8yn"] | ||
|
|
||
| [node name="SpellsComponent" type="Node2D" groups=["has_spells"]] | ||
| [node name="SpellsComponent" type="Node" groups=["has_spells"]] | ||
| script = ExtResource("1_xm8yn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this here bc we want everything to first go through combat manager right? I wanna see if maybe we can abstract this into
trigger_divine_giftand figure out the specific implementation it calls later?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we want things to go through the combat manager. I think that works too, having a function
trigger_divine_giftthat gets the correct function to call (for this case, it would just callsteal_spell())?