Add migration for starter gear

This commit is contained in:
jiminycrick 2021-01-25 20:39:13 -08:00
parent 152156d065
commit 46c8c744fa
9 changed files with 44 additions and 5 deletions

View File

@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Skill trees - Skill trees
- Lactose tolerant golems - Lactose tolerant golems
- 6 different gems. (Topaz, Amethyst, Sapphire, Emerald, Ruby and Diamond) - 6 different gems. (Topaz, Amethyst, Sapphire, Emerald, Ruby and Diamond)
- Poise system (not currently accessible to players for balancing reasons)
### Changed ### Changed

View File

@ -4,7 +4,10 @@ ItemDef(
kind: Armor( kind: Armor(
( (
kind: Bag("TestBag18Slot"), kind: Bag("TestBag18Slot"),
stats: (protection: Normal(0.0)), stats: (
protection: Normal(0.0),
poise_protection: Normal(0.0),
),
) )
), ),
quality: High, quality: High,

View File

@ -4,7 +4,10 @@ ItemDef(
kind: Armor( kind: Armor(
( (
kind: Bag("TestBag9Slot"), kind: Bag("TestBag9Slot"),
stats: (protection: Normal(0.0)), stats: (
protection: Normal(0.0),
poise_protection: Normal(0.0),
),
) )
), ),
quality: High, quality: High,

View File

@ -5,7 +5,9 @@ ItemDef(
( (
kind: Foot("Dark"), kind: Foot("Dark"),
stats: ( stats: (
protection: Normal(0.0)), protection: Normal(0.0),
poise_protection: Normal(0.0),
),
) )
), ),
quality: Low, quality: Low,

View File

@ -68,10 +68,17 @@ impl Armor {
pub fn get_poise_protection(&self) -> Protection { self.stats.poise_protection } pub fn get_poise_protection(&self) -> Protection { self.stats.poise_protection }
#[cfg(test)] #[cfg(test)]
pub fn test_armor(kind: ArmorKind, protection: Protection) -> Armor { pub fn test_armor(
kind: ArmorKind,
protection: Protection,
poise_protection: Protection,
) -> Armor {
Armor { Armor {
kind, kind,
stats: Stats { protection }, stats: Stats {
protection,
poise_protection,
},
} }
} }
} }

View File

@ -336,6 +336,7 @@ mod tests {
.get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor( .get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor(
ArmorKind::Bag("test".to_string()), ArmorKind::Bag("test".to_string()),
Protection::Normal(0.0), Protection::Normal(0.0),
Protection::Normal(0.0),
))) )))
.unwrap(); .unwrap();
@ -355,6 +356,7 @@ mod tests {
.get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor( .get_slot_to_equip_into(&ItemKind::Armor(Armor::test_armor(
ArmorKind::Bag("test".to_string()), ArmorKind::Bag("test".to_string()),
Protection::Normal(0.0), Protection::Normal(0.0),
Protection::Normal(0.0),
))) )))
.unwrap(); .unwrap();

View File

@ -15,6 +15,7 @@ pub(super) fn get_test_bag(slots: u16) -> Item {
ItemKind::Armor(armor::Armor::test_armor( ItemKind::Armor(armor::Armor::test_armor(
ArmorKind::Bag("Test Bag".to_string()), ArmorKind::Bag("Test Bag".to_string()),
Protection::Normal(0.0), Protection::Normal(0.0),
Protection::Normal(0.0),
)), )),
Quality::Common, Quality::Common,
slots, slots,

View File

@ -0,0 +1,10 @@
UPDATE item
SET item_definition_id = 'common.items.armor.starter.glider' WHERE item_definition_id = 'common.items.glider.glider_cloverleaf';
UPDATE item
SET item_definition_id = 'common.items.armor.starter.lantern' WHERE item_definition_id = 'common.items.lantern.black_0';
UPDATE item
SET item_definition_id = 'common.items.armor.starter.rugged_chest' WHERE item_definition_id = 'common.items.armor.chest.rugged_chest';
UPDATE item
SET item_definition_id = 'common.items.armor.starter.rugged_pants' WHERE item_definition_id = 'common.items.armor.pants.rugged_pants';
UPDATE item
SET item_definition_id = 'common.items.armor.starter.sandals_0' WHERE item_definition_id = 'common.items.armor.foot.sandals_0';

View File

@ -0,0 +1,10 @@
UPDATE item
SET item_definition_id = 'common.items.glider.glider_cloverleaf' WHERE item_definition_id = 'common.items.armor.starter.glider';
UPDATE item
SET item_definition_id = 'common.items.lantern.black_0' WHERE item_definition_id = 'common.items.armor.starter.lantern';
UPDATE item
SET item_definition_id = 'common.items.armor.chest.rugged_chest' WHERE item_definition_id = 'common.items.armor.starter.rugged_chest';
UPDATE item
SET item_definition_id = 'common.items.armor.pants.rugged_pants' WHERE item_definition_id = 'common.items.armor.starter.rugged_pants';
UPDATE item
SET item_definition_id = 'common.items.armor.foot.sandals_0' WHERE item_definition_id = 'common.items.armor.starter.sandals_0';