-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
f01cf0f
commit ce254fb
Showing
8 changed files
with
157 additions
and
33 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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
mod owner; | ||
mod value_in_game; | ||
mod occupied; | ||
mod familiar; | ||
|
||
use owner::Owner; | ||
use value_in_game::ValueInGame; | ||
use occupied::Occupied; | ||
use familiar::Familiar; |
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,9 @@ | ||
|
||
// Represents an entity that is a familiar | ||
#[derive(Model, Copy, Drop, Serde)] | ||
struct Familiar { | ||
#[key] | ||
entity_id: u128, | ||
game_id: u128, | ||
familiar_type_id: u128, | ||
} |
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,16 +1,35 @@ | ||
/// Game Params /// | ||
|
||
const INITIAL_BARRIERS: u32 = 3; | ||
const CHAOS_PER_FORAGE: u32 = 3; | ||
const ITEM_LIMIT: u32 = 7; | ||
const FAMILIAR_LIMIT: u32 = 1; | ||
|
||
// How many ticks each kind of action takes | ||
const TICKS_PER_FORAGE: u32 = 3; | ||
const TICKS_PER_SUMMON: u32 = 5; | ||
const TICKS_PER_SEND: u32 = 3; | ||
const CHAOS_PER_TICK: u32 = 1; | ||
|
||
/// Valid IDs /// | ||
|
||
// ensure these dont collide with card ids | ||
const CHAOS_STAT: u128 = 10000; | ||
const POWER_STAT: u128 = 10001; | ||
const BARRIERS_STAT: u128 = 10002; | ||
const ITEMS_HELD: u128 = 10003; | ||
const FAMILIARS_HELD: u128 = 10004; | ||
const TICKS: u128 = 10005; | ||
|
||
// this is zero for stats that can go +/- | ||
const POLAR_STAT_MIDPOINT: u32 = 2_147_483_647; | ||
|
||
// polar stats | ||
const HOTCOLD_STAT: u128 = 10004; | ||
const LIGHTDARK_STAT: u128 = 10005; | ||
|
||
// familiars | ||
const RAVENS: u128 = 30001; | ||
const CATS: u128 = 30002; | ||
const SALAMANDERS: u128 = 30003; | ||
const WOLF_SPIDERS: u128 = 30004; |
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,3 +1,7 @@ | ||
mod region; | ||
mod action; | ||
mod familiar; | ||
|
||
use region::Region; | ||
use action::{Action, ActionTrait}; | ||
use familiar::{FamiliarType, FamiliarTypeTrait}; |
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,22 @@ | ||
/// An action that an entity can be performing while time passes | ||
#[derive(Serde, Copy, Drop, Introspect)] | ||
enum Action { | ||
None: (), | ||
ForageForest: (), | ||
ForageMeadow: (), | ||
ForageVolcano: (), | ||
ForageCave: (), | ||
} | ||
|
||
#[generate_trait] | ||
impl ImplAction of ActionTrait { | ||
fn id(self: Action) -> u8 { | ||
match self { | ||
Action::None => 0, | ||
Action::ForageForest => 1, | ||
Action::ForageMeadow => 2, | ||
Action::ForageVolcano => 3, | ||
Action::ForageCave => 4, | ||
} | ||
} | ||
} |
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,31 @@ | ||
use spellcrafter::constants::{RAVENS, CATS, SALAMANDERS, WOLF_SPIDERS}; | ||
use spellcrafter::types::{Action, ActionTrait}; | ||
|
||
#[derive(Serde, Copy, Drop, Introspect)] | ||
enum FamiliarType { | ||
Raven: (), | ||
Cat: (), | ||
Salamanger: (), | ||
WolfSpider: (), | ||
} | ||
|
||
#[generate_trait] | ||
impl ImplFamiliarType of FamiliarTypeTrait { | ||
fn stat_id(self: FamiliarType) -> u128 { | ||
match self { | ||
FamiliarType::Raven => RAVENS, | ||
FamiliarType::Cat => CATS, | ||
FamiliarType::Salamanger => SALAMANDERS, | ||
FamiliarType::WolfSpider => WOLF_SPIDERS, | ||
} | ||
} | ||
|
||
fn default_action_id(self: FamiliarType) -> u8 { | ||
match self { | ||
FamiliarType::Raven => Action::ForageForest.id(), | ||
FamiliarType::Cat => Action::ForageMeadow.id(), | ||
FamiliarType::Salamanger => Action::ForageVolcano.id(), | ||
FamiliarType::WolfSpider => Action::ForageCave.id(), | ||
} | ||
} | ||
} |