fix target check, rename some variables
This commit is contained in:
parent
9ab9d2da7d
commit
06d03773b5
@ -14,7 +14,11 @@ script = ExtResource("1_o0k38")
|
|||||||
[node name="QuestProgress" type="HBoxContainer" parent="."]
|
[node name="QuestProgress" type="HBoxContainer" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="GoalTextVal" type="Label" parent="QuestProgress"]
|
[node name="GoalTypeVal" type="Label" parent="QuestProgress"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Quest Objective"
|
||||||
|
|
||||||
|
[node name="KillTypeVal" type="Label" parent="QuestProgress"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Quest Objective"
|
text = "Quest Objective"
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
script = ExtResource("1_gc1kb")
|
script = ExtResource("1_gc1kb")
|
||||||
debug = true
|
debug = true
|
||||||
spawnTimerValue = 0.75
|
|
||||||
|
|
||||||
[node name="SpawnTimer" type="Timer" parent="."]
|
[node name="SpawnTimer" type="Timer" parent="."]
|
||||||
|
|
||||||
@ -125,7 +124,7 @@ layout_mode = 2
|
|||||||
size_flags_horizontal = 6
|
size_flags_horizontal = 6
|
||||||
attack_range = 200
|
attack_range = 200
|
||||||
target_type = 3
|
target_type = 3
|
||||||
attack_damage = 500
|
attack_damage = 50
|
||||||
auto_speed = 5.0
|
auto_speed = 5.0
|
||||||
|
|
||||||
[node name="AbilityA3" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
|
[node name="AbilityA3" parent="MarginContainer/UIBottom/UIBottomCenter/AbilityBar" instance=ExtResource("2_heria")]
|
||||||
|
@ -65,11 +65,13 @@ func _deal_idle_damage(enemiesList) -> void:
|
|||||||
match target_type:
|
match target_type:
|
||||||
TargTypes.SINGLE:
|
TargTypes.SINGLE:
|
||||||
var target = _get_target(enemiesList)
|
var target = _get_target(enemiesList)
|
||||||
target.damageTaken += attack_damage
|
if target:
|
||||||
|
target.damageTaken += attack_damage
|
||||||
_:
|
_:
|
||||||
var targets = _get_targets(enemiesList)
|
var targets = _get_targets(enemiesList)
|
||||||
for target in targets:
|
if targets:
|
||||||
target.damageTaken += attack_damage
|
for target in targets:
|
||||||
|
target.damageTaken += attack_damage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,16 +3,16 @@ class_name NPC
|
|||||||
extends CharacterBody2D
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
enum NPCDifficulties {MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG}
|
enum NPCDifficulty {MINION, NORMAL, ELITE, BOSS, ELITEBOSS, BBEG}
|
||||||
enum NPCTiers {I, II, III, IV, V, VI, VII, VIII, IX, X}
|
enum NPCTier {I, II, III, IV, V, VI, VII, VIII, IX, X}
|
||||||
|
|
||||||
signal npc_died(npcTier: NPCTiers)
|
signal npc_died(npcTier: NPCTier)
|
||||||
|
|
||||||
@export var charName := "Character"
|
@export var charName := "Character"
|
||||||
@export var maxHealth := 10
|
@export var maxHealth := 10
|
||||||
@export var damageTaken := 0
|
@export var damageTaken := 0
|
||||||
@export var npcDifficulty: NPCDifficulties
|
@export var npcDifficulty: NPCDifficulty
|
||||||
@export var npcTier: NPCTiers
|
@export var npcTier: NPCTier
|
||||||
|
|
||||||
func _random_mod_health() -> void:
|
func _random_mod_health() -> void:
|
||||||
randomize()
|
randomize()
|
||||||
@ -21,15 +21,15 @@ func _random_mod_health() -> void:
|
|||||||
self.maxHealth *= noise_factor
|
self.maxHealth *= noise_factor
|
||||||
# difficulty factor
|
# difficulty factor
|
||||||
match self.npcDifficulty:
|
match self.npcDifficulty:
|
||||||
NPCDifficulties.MINION:
|
NPCDifficulty.MINION:
|
||||||
self.maxHealth /= 2
|
self.maxHealth /= 2
|
||||||
NPCDifficulties.ELITE:
|
NPCDifficulty.ELITE:
|
||||||
self.maxHealth *= 2
|
self.maxHealth *= 2
|
||||||
NPCDifficulties.BOSS:
|
NPCDifficulty.BOSS:
|
||||||
self.maxHealth *= 4
|
self.maxHealth *= 4
|
||||||
NPCDifficulties.ELITEBOSS:
|
NPCDifficulty.ELITEBOSS:
|
||||||
self.maxHealth *= 8
|
self.maxHealth *= 8
|
||||||
NPCDifficulties.BBEG:
|
NPCDifficulty.BBEG:
|
||||||
self.maxHealth *= 16
|
self.maxHealth *= 16
|
||||||
# npcTier factor
|
# npcTier factor
|
||||||
self.maxHealth *= exp(self.npcTier)
|
self.maxHealth *= exp(self.npcTier)
|
||||||
@ -38,8 +38,8 @@ func _random_mod_health() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
self.npcDifficulty = NPCDifficulties.NORMAL
|
self.npcDifficulty = NPCDifficulty.NORMAL
|
||||||
self.npcTier = NPCTiers.I
|
self.npcTier = NPCTier.I
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
@ -3,7 +3,7 @@ class_name NPCEnemy
|
|||||||
extends NPC
|
extends NPC
|
||||||
|
|
||||||
|
|
||||||
@export var killType: WorldArea.KillTypes = WorldArea.KillTypes.NATURAL
|
@export var killType: WorldArea.Faction = WorldArea.Faction.CREATURE
|
||||||
|
|
||||||
var target
|
var target
|
||||||
var speed := 200
|
var speed := 200
|
||||||
@ -11,8 +11,9 @@ var prevCollisions := 0
|
|||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
self.npcDifficulty = NPCDifficulties.NORMAL
|
# TODO: randomize within area restrictions? or put this in area?
|
||||||
self.npcTier = NPCTiers.I
|
self.npcDifficulty = NPCDifficulty.NORMAL
|
||||||
|
self.npcTier = NPCTier.I
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
@ -2,8 +2,8 @@ class_name Quest
|
|||||||
extends PanelContainer
|
extends PanelContainer
|
||||||
|
|
||||||
|
|
||||||
@export var goalType := WorldArea.GoalTypes.KILLMANY
|
@export var goalType := WorldArea.GoalType.KILL
|
||||||
@export var killType := WorldArea.KillTypes.NATURAL
|
@export var faction := WorldArea.Faction.CREATURE
|
||||||
|
|
||||||
@export var goalTotal := 1
|
@export var goalTotal := 1
|
||||||
@export var goalCurrent := 0
|
@export var goalCurrent := 0
|
||||||
@ -24,17 +24,18 @@ func _process(_delta: float) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _set_goal_text() -> void:
|
func _set_goal_text() -> void:
|
||||||
|
var factionStr = WorldArea.Faction.keys()[self.faction].capitalize()
|
||||||
match self.goalType:
|
match self.goalType:
|
||||||
WorldArea.GoalTypes.KILLMANY:
|
WorldArea.GoalType.KILL:
|
||||||
$QuestProgress/GoalTextVal.text = "Kill Many"
|
$QuestProgress/GoalTypeVal.text = "Kill " + factionStr + "s"
|
||||||
|
|
||||||
|
|
||||||
func _set_goal_val() -> void:
|
func _set_goal_val() -> void:
|
||||||
$QuestProgress/GoalVal.text = str(self.goalTotal)
|
$QuestProgress/GoalVal.text = str(self.goalTotal)
|
||||||
|
|
||||||
|
|
||||||
func _quest_goal_check(enemyKillType: WorldArea.KillTypes) -> void:
|
func _quest_goal_check(enemyKillType: WorldArea.Faction) -> void:
|
||||||
if enemyKillType == self.killType:
|
if enemyKillType == self.faction:
|
||||||
self.goalCurrent += 1
|
self.goalCurrent += 1
|
||||||
$QuestProgress/CompletedVal.text = str(self.goalCurrent)
|
$QuestProgress/CompletedVal.text = str(self.goalCurrent)
|
||||||
if self.goalCurrent == self.goalTotal:
|
if self.goalCurrent == self.goalTotal:
|
||||||
@ -57,8 +58,8 @@ func _generate_random_quest() -> void:
|
|||||||
# self.goalType = GoalTypes.
|
# self.goalType = GoalTypes.
|
||||||
# match self.goalType:
|
# match self.goalType:
|
||||||
# GoalTypes.KILLMANY:
|
# GoalTypes.KILLMANY:
|
||||||
# self.killType = KillTypes.NATURAL
|
# self.faction = KillTypes.NATURAL
|
||||||
|
|
||||||
|
|
||||||
func _on_enemy_died(_enemyDifficulty: NPC.NPCDifficulties, enemyKillType: WorldArea.KillTypes):
|
func _on_enemy_died(_enemyDifficulty: NPC.NPCDifficulty, enemyFaction: WorldArea.Faction):
|
||||||
_quest_goal_check(enemyKillType)
|
_quest_goal_check(enemyFaction)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# signal bus to relay signals
|
# signal bus to relay signals
|
||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
signal enemy_died(npcDifficulty: NPC.NPCDifficulties, killType: WorldArea.KillTypes)
|
|
||||||
|
signal enemy_died(npcDifficulty: NPC.NPCDifficulty, faction: WorldArea.Faction)
|
||||||
signal quest_completed
|
signal quest_completed
|
@ -1,25 +1,25 @@
|
|||||||
extends Node
|
extends Node
|
||||||
|
|
||||||
|
|
||||||
func format_label_difficulty(label: Node, difficulty: NPC.NPCDifficulties) -> void:
|
func format_label_difficulty(label: Node, difficulty: NPC.NPCDifficulty) -> void:
|
||||||
label.label_settings.outline_size = 4
|
label.label_settings.outline_size = 4
|
||||||
match difficulty:
|
match difficulty:
|
||||||
NPC.NPCDifficulties.MINION:
|
NPC.NPCDifficulty.MINION:
|
||||||
label.label_settings.outline_color = Color.BLACK
|
label.label_settings.outline_color = Color.BLACK
|
||||||
label.label_settings.font_color = Color.LIGHT_GRAY
|
label.label_settings.font_color = Color.LIGHT_GRAY
|
||||||
NPC.NPCDifficulties.NORMAL:
|
NPC.NPCDifficulty.NORMAL:
|
||||||
label.label_settings.outline_color = Color.DARK_GREEN
|
label.label_settings.outline_color = Color.DARK_GREEN
|
||||||
label.label_settings.font_color = Color.LIME_GREEN
|
label.label_settings.font_color = Color.LIME_GREEN
|
||||||
NPC.NPCDifficulties.ELITE:
|
NPC.NPCDifficulty.ELITE:
|
||||||
label.label_settings.outline_color = Color.DARK_BLUE
|
label.label_settings.outline_color = Color.DARK_BLUE
|
||||||
label.label_settings.font_color = Color.DARK_CYAN
|
label.label_settings.font_color = Color.DARK_CYAN
|
||||||
NPC.NPCDifficulties.BOSS:
|
NPC.NPCDifficulty.BOSS:
|
||||||
label.label_settings.outline_color = Color.PURPLE
|
label.label_settings.outline_color = Color.PURPLE
|
||||||
label.label_settings.font_color = Color.MAGENTA
|
label.label_settings.font_color = Color.MAGENTA
|
||||||
NPC.NPCDifficulties.ELITEBOSS:
|
NPC.NPCDifficulty.ELITEBOSS:
|
||||||
label.label_settings.outline_color = Color.ORANGE_RED
|
label.label_settings.outline_color = Color.ORANGE_RED
|
||||||
label.label_settings.font_color = Color.ORANGE
|
label.label_settings.font_color = Color.ORANGE
|
||||||
NPC.NPCDifficulties.BBEG:
|
NPC.NPCDifficulty.BBEG:
|
||||||
label.label_settings.font_color = Color.GOLD
|
label.label_settings.font_color = Color.GOLD
|
||||||
label.label_settings.outline_size = 8
|
label.label_settings.outline_size = 8
|
||||||
label.label_settings.outline_color = Color.DARK_RED
|
label.label_settings.outline_color = Color.DARK_RED
|
||||||
|
@ -3,8 +3,8 @@ class_name WorldArea
|
|||||||
extends PanelContainer
|
extends PanelContainer
|
||||||
|
|
||||||
|
|
||||||
enum GoalTypes { KILLMANY, KILLFEW, KILLONE, GETMANY, GETFEW, GETONE }
|
enum GoalType {KILL, FIND}
|
||||||
enum KillTypes { NATURAL, VOID }
|
enum Faction {CREATURE, MONSTER}
|
||||||
|
|
||||||
@export var area_type := Globals.World.AreaTypes.WILDS
|
@export var area_type := Globals.World.AreaTypes.WILDS
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func _on_button_instantiate_pressed() -> void:
|
|||||||
enemies[i].position = Vector2(posX, middleY)
|
enemies[i].position = Vector2(posX, middleY)
|
||||||
enemies[0].get_node("%NPCNameLabel").text = "Test"
|
enemies[0].get_node("%NPCNameLabel").text = "Test"
|
||||||
var bossEnemy = load("res://scenes/npc.tscn").instantiate()
|
var bossEnemy = load("res://scenes/npc.tscn").instantiate()
|
||||||
bossEnemy.npcDifficulty = NPC.NPCDifficulties.BOSS
|
bossEnemy.npcDifficulty = NPC.NPCDifficulty.BOSS
|
||||||
add_child(bossEnemy)
|
add_child(bossEnemy)
|
||||||
bossEnemy.position = Vector2(middleX, upperY)
|
bossEnemy.position = Vector2(middleX, upperY)
|
||||||
#print(bossEnemy.npcDifficulty)
|
#print(bossEnemy.npcDifficulty)
|
||||||
|
@ -9,13 +9,13 @@ func _on_exit_button_pressed() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func _on_test_button_pressed() -> void:
|
func _on_test_button_pressed() -> void:
|
||||||
var rand_difficulty = NPC.NPCDifficulties.values().pick_random()
|
var rand_difficulty = NPC.NPCDifficulty.values().pick_random()
|
||||||
var rand_tier = NPC.NPCTiers.values().pick_random()
|
var rand_tier = NPC.NPCTier.values().pick_random()
|
||||||
var anNPC = NPC.new()
|
var anNPC = NPC.new()
|
||||||
%TestNMEMaxHealthVal.text = str(anNPC.maxHealth)
|
%TestNMEMaxHealthVal.text = str(anNPC.maxHealth)
|
||||||
#TestEMaxHealthVal.label_settings = LabelSettings.new()
|
#TestEMaxHealthVal.label_settings = LabelSettings.new()
|
||||||
%TestNMEName.text = str(NPC.NPCDifficulties.find_key(anNPC.npcDifficulty))
|
%TestNMEName.text = str(NPC.NPCDifficulty.find_key(anNPC.npcDifficulty))
|
||||||
%TestNMETierVal.text = str(NPC.NPCTiers.find_key(anNPC.npcTier))
|
%TestNMETierVal.text = str(NPC.NPCTier.find_key(anNPC.npcTier))
|
||||||
# style the name label based on the difficulty
|
# style the name label based on the difficulty
|
||||||
styling.format_label_difficulty(%TestNMEName, anNPC.npcDifficulty)
|
styling.format_label_difficulty(%TestNMEName, anNPC.npcDifficulty)
|
||||||
#anNPC.position = Vector2(64, 64)
|
#anNPC.position = Vector2(64, 64)
|
||||||
|
Loading…
Reference in New Issue
Block a user