Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Added class and spells icons #126

Merged
merged 1 commit into from
Dec 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions data/db/classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"farmer": {
"starter": true,
"desc": "Farmer description",
"icon": "icons/farmer.png",
"icon": "icons/classes/farmer.png",
"assetGraph": "anims/classes/farmer/farmer.data.json",
"health": 10,
"speed": 10.1,
Expand All @@ -22,7 +22,7 @@
},
"soldier": {
"desc": "Soldier description",
"icon": "icons/soldier.png",
"icon": "icons/classes/soldier.png",
"assetGraph": "anims/classes/soldier/soldier.data.json",
"health": 20,
"speed": 10.1,
Expand All @@ -42,7 +42,7 @@
},
"shooter": {
"desc": "Shooter description",
"icon": "icons/shooter.png",
"icon": "icons/classes/shooter.png",
"assetGraph": "anims/classes/shooter/shooter.data.json",
"health": 10,
"speed": 10.3,
Expand All @@ -61,7 +61,7 @@
},
"sorcerer": {
"desc": "Sorcerer description",
"icon": "icons/sorcerer.png",
"icon": "icons/classes/sorcerer.png",
"assetGraph": "anims/classes/sorcerer/sorcerer.data.json",
"health": 5,
"speed": 10.2,
Expand All @@ -79,7 +79,7 @@
},
"assassin": {
"desc": "Assassin description",
"icon": "icons/soldier.png",
"icon": "icons/classes/soldier.png",
"assetGraph": "anims/classes/soldier/soldier.data.json",
"health": 25,
"speed": 11,
Expand All @@ -93,7 +93,7 @@
},
"warrior": {
"desc": "Warrior description",
"icon": "icons/soldier.png",
"icon": "icons/classes/soldier.png",
"assetGraph": "anims/classes/soldier/soldier.data.json",
"health": 35,
"speed": 10.2,
Expand All @@ -107,7 +107,7 @@
},
"tank": {
"desc": "Tank description",
"icon": "icons/soldier.png",
"icon": "icons/classes/soldier.png",
"assetGraph": "anims/classes/soldier/soldier.data.json",
"health": 50,
"speed": 10,
Expand All @@ -121,7 +121,7 @@
},
"archer": {
"desc": "Archer description",
"icon": "icons/shooter.png",
"icon": "icons/classes/shooter.png",
"assetGraph": "anims/classes/shooter/shooter.data.json",
"health": 22,
"speed": 10.4,
Expand All @@ -135,7 +135,7 @@
},
"gunner": {
"desc": "Gunner description",
"icon": "icons/shooter.png",
"icon": "icons/classes/shooter.png",
"assetGraph": "anims/classes/shooter/shooter.data.json",
"health": 24,
"speed": 10.4,
Expand All @@ -149,7 +149,7 @@
},
"mage": {
"desc": "Mage description",
"icon": "icons/sorcerer.png",
"icon": "icons/classes/sorcerer.png",
"assetGraph": "anims/classes/sorcerer/sorcerer.data.json",
"health": 20,
"speed": 10.3,
Expand Down
282 changes: 144 additions & 138 deletions data/db/spells.json
Original file line number Diff line number Diff line change
@@ -1,140 +1,146 @@
{
"shovel": {
"cooldown": 700,
"damage": 1,
"scale": {
"x": 1.5,
"y": 1.5
},
"hitbox": {
"x": 0.2,
"y": 0.7
},
"lifetime": 200,
"audio_on_cast": "sounds/spells/stick.wav",
"animation": "anims/spells/farmer_attack/farmer_anim.data.json",
"speed": 0,
"offset_to_source": {
"x": 1,
"y": 1
},
"type": [
"projectile"
]
},
"sword": {
"cooldown": 500,
"damage": 5,
"scale": {
"x": 0.7,
"y": 0.7
},
"hitbox": {
"x": 0.3,
"y": 0.7
},
"lifetime": 200,
"audio_on_cast": "sounds/spells/soldier_attack.wav",
"animation": "anims/spells/soldier_attack/soldier_attack.data.json",
"speed": 0,
"offset_to_source": {
"x": 1,
"y": 1
},
"type": [
"projectile"
]
},
"fireball": {
"cooldown": 1500,
"damage": 3,
"scale": {
"x": 2.0,
"y": 2.0
},
"hitbox": {
"x": 0.7,
"y": 0.7
},
"lifetime": 2000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/fireball/fireball.data.json",
"speed": 4.0,
"offset_to_source": {
"x": 2,
"y": 2
},
"type": [
"projectile"
]
},
"firewall": {
"cooldown": 3000,
"damage": 0.5,
"scale": {
"x": 6.0,
"y": 6.0
},
"hitbox": {
"x": 5.0,
"y": 5.0
},
"lifetime": 7000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/firewall/firewall.data.json",
"speed": 0,
"offset_to_source": {
"x": 5,
"y": 5
},
"type": [
"aoe"
]
},
"fireball_blue": {
"cooldown": 2000,
"damage": 5,
"scale": {
"x": 2.5,
"y": 2.5
},
"hitbox": {
"x": 1.2,
"y": 1.2
},
"lifetime": 3000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/fireball_blue/fireball_blue.data.json",
"speed": 3.0,
"offset_to_source": {
"x": 2,
"y": 2
},
"type": [
"projectile"
]
},
"arrow": {
"cooldown": 1000,
"damage": 2,
"scale": {
"x": 1,
"y": 0.2
},
"hitbox": {
"x": 0.7,
"y": 0.3
},
"lifetime": 1000,
"audio_on_cast": "sounds/spells/stick.wav",
"animation": "anims/spells/arrow/arrow.data.json",
"speed": 8.0,
"offset_to_source": {
"x": 1.5,
"y": 1.5
},
"type": [
"projectile"
]
}
"shovel": {
"icon": "icons/spells/shovel.png",
"cooldown": 700,
"damage": 1,
"scale": {
"x": 1.5,
"y": 1.5
},
"hitbox": {
"x": 0.2,
"y": 0.7
},
"lifetime": 200,
"audio_on_cast": "sounds/spells/stick.wav",
"animation": "anims/spells/farmer_attack/farmer_anim.data.json",
"speed": 0,
"offset_to_source": {
"x": 1,
"y": 1
},
"type": [
"projectile"
]
},
"sword": {
"icon": "icons/spells/sword.png",
"cooldown": 500,
"damage": 5,
"scale": {
"x": 0.7,
"y": 0.7
},
"hitbox": {
"x": 0.3,
"y": 0.7
},
"lifetime": 200,
"audio_on_cast": "sounds/spells/soldier_attack.wav",
"animation": "anims/spells/soldier_attack/soldier_attack.data.json",
"speed": 0,
"offset_to_source": {
"x": 1,
"y": 1
},
"type": [
"projectile"
]
},
"fireball": {
"icon": "icons/spells/fireball.png",
"cooldown": 1500,
"damage": 3,
"scale": {
"x": 2.0,
"y": 2.0
},
"hitbox": {
"x": 0.7,
"y": 0.7
},
"lifetime": 2000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/fireball/fireball.data.json",
"speed": 4.0,
"offset_to_source": {
"x": 2,
"y": 2
},
"type": [
"projectile"
]
},
"firewall": {
"icon": "icons/spells/firewall.png",
"cooldown": 3000,
"damage": 0.5,
"scale": {
"x": 6.0,
"y": 6.0
},
"hitbox": {
"x": 5.0,
"y": 5.0
},
"lifetime": 7000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/firewall/firewall.data.json",
"speed": 0,
"offset_to_source": {
"x": 5,
"y": 5
},
"type": [
"aoe"
]
},
"fireball_blue": {
"icon": "icons/spells/fireball_blue.png",
"cooldown": 2000,
"damage": 5,
"scale": {
"x": 2.5,
"y": 2.5
},
"hitbox": {
"x": 1.2,
"y": 1.2
},
"lifetime": 3000,
"audio_on_cast": "sounds/fire_cast.wav",
"animation": "anims/spells/fireball_blue/fireball_blue.data.json",
"speed": 3.0,
"offset_to_source": {
"x": 2,
"y": 2
},
"type": [
"projectile"
]
},
"arrow": {
"icon": "icons/spells/arrow.png",
"cooldown": 1000,
"damage": 2,
"scale": {
"x": 1,
"y": 0.2
},
"hitbox": {
"x": 0.7,
"y": 0.3
},
"lifetime": 1000,
"audio_on_cast": "sounds/spells/stick.wav",
"animation": "anims/spells/arrow/arrow.data.json",
"speed": 8.0,
"offset_to_source": {
"x": 1.5,
"y": 1.5
},
"type": [
"projectile"
]
}
}
Binary file added data/icons/classes/farmer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/classes/shooter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/classes/soldier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/classes/sorcerer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/fireball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/fireball_blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/firewall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/shovel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/spells/sword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/Application/include/models/Spell.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ struct /*[[deprecated]]*/ Spell {
};

struct SpellData {
std::string iconPath;

std::chrono::milliseconds cooldown;

float damage;
Expand Down
2 changes: 2 additions & 0 deletions src/Application/src/models/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ void game::to_json(nlohmann::json &j, const SpellData &spell)
{
// clang-format off
j = nlohmann::json{{
"icon", spell.iconPath,
"cooldown", spell.cooldown.count(),
"damage", spell.damage,
"hitbox", {
Expand All @@ -39,6 +40,7 @@ void game::to_json(nlohmann::json &j, const SpellData &spell)

void game::from_json(const nlohmann::json &j, SpellData &spell) try
{
spell.iconPath = j.at("icon");
spell.cooldown = std::chrono::milliseconds{j.at("cooldown")};
spell.damage = j.at("damage");
spell.hitbox.width = j.at("hitbox").at("x");
Expand Down