-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
255 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
( | ||
name: "Short Sword" | ||
attributes: [ | ||
( | ||
parent: 0, | ||
name: Endurance, | ||
value: (0..10), | ||
base_value: 5, | ||
), | ||
( | ||
parent: 0, | ||
name: Strength, | ||
value: 2, | ||
base_value: 2, | ||
), | ||
], | ||
stats: [ | ||
( | ||
name: Damage, | ||
value: 10, | ||
max: 0, | ||
), | ||
], | ||
modifier: [ | ||
Poison(( | ||
parent: 0, | ||
last_update: 0, | ||
current: 0, | ||
seconds: 5, | ||
damage: 2, | ||
total: 5, | ||
)), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use std::fs::File; | ||
use std::io::Write; | ||
use bevy::prelude::*; | ||
use rogue_like_prototype::game::{gameplay::{attributes::{Attribute, AttributeNames, build_basic_character_attributes}, character::Character, equipment::EquipmentBase, modifiers::{ModifierBase, poison::Poison}, stats::{Stat, StatName}}}; | ||
use ron::ser::PrettyConfig; | ||
|
||
fn startup( | ||
mut commands: Commands | ||
) { | ||
let character = commands.spawn() | ||
.insert(Character::default()) | ||
.id(); | ||
build_basic_character_attributes(&mut commands, character); | ||
|
||
|
||
let sword = EquipmentBase { | ||
name: String::from("sword"), | ||
attributes: vec![ | ||
Attribute { | ||
name: AttributeNames::Endurance, | ||
value: 5.0, | ||
base_value: 5.0, | ||
..Default::default() | ||
}, | ||
Attribute { | ||
name: AttributeNames::Strength, | ||
value: 2.0, | ||
base_value: 2.0, | ||
..Default::default() | ||
}, | ||
], | ||
stats: vec![ | ||
Stat::new(StatName::Damage, 10.0), | ||
], | ||
modifier: vec![ | ||
ModifierBase::Poison(Poison::new(Entity::new(0), 5.0, 2.0, 5)), | ||
], | ||
}; | ||
|
||
let ron_file_data = ron::ser::to_string_pretty(&sword, PrettyConfig::default()).unwrap(); | ||
|
||
let mut output = File::create("./test.ron").unwrap(); | ||
write!(output, "{}", ron_file_data).unwrap(); | ||
} | ||
|
||
fn main() { | ||
App::build() | ||
.insert_resource(WindowDescriptor { | ||
width: 1270.0, | ||
height: 720.0, | ||
title: String::from("equipment"), | ||
..Default::default() | ||
}) | ||
.add_plugins(DefaultPlugins) | ||
.add_startup_system(startup.system()) | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use bevy::reflect::TypeUuid; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use super::{attributes::Attribute, modifiers::ModifierBase, stats::Stat}; | ||
|
||
#[derive(Debug, Deserialize, Serialize, TypeUuid, Clone)] | ||
#[uuid = "0ca8e168-cfd1-4b49-ae85-12d8e94070fd"] | ||
pub struct EquipmentBase { | ||
pub name: String, // Random Equipment name idea: `{Person/Location/The}{equipment base name}{highest valued attribute} and {random modifier name}` | ||
pub attributes: Vec<Attribute>, | ||
pub stats: Vec<Stat>, | ||
pub modifier: Vec<ModifierBase>, | ||
} | ||
|
||
// Example of how equipment gets applied to a entity. | ||
// equipment entity(sword) > | ||
// attributes entities > | ||
// endurance + 5 | ||
// strength + 2 | ||
// stat entities > | ||
// damage = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use self::{curse::Curse, poison::Poison}; | ||
|
||
pub mod poison; | ||
pub mod curse; | ||
pub mod curse; | ||
|
||
#[derive(Deserialize, Serialize, Debug, Clone, Copy)] | ||
pub enum ModifierBase { | ||
Poison(Poison), | ||
Curse(Curse) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.