Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

fixed missing on eggs and fixed naming #327

Merged
merged 2 commits into from
Jul 13, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,11 @@ impl WrappedAvatar {
DnaUtils::read_attribute::<T>(&self.inner, AvatarAttr::CustomType2)
}

pub fn set_custom_type_2<T>(&mut self, custom_type_1: T)
pub fn set_custom_type_2<T>(&mut self, custom_type_2: T)
where
T: ByteConvertible,
{
DnaUtils::write_attribute::<T>(&mut self.inner, AvatarAttr::CustomType2, &custom_type_1)
DnaUtils::write_attribute::<T>(&mut self.inner, AvatarAttr::CustomType2, &custom_type_2)
}

pub fn same_custom_type_2(&self, other: &WrappedAvatar) -> bool {
Expand Down
22 changes: 7 additions & 15 deletions pallets/ajuna-awesome-avatars/src/types/avatar/versions/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,7 @@ impl<T: Config> ForgerV2<T> {
}) {
ForgeType::Mate
} else if sacrifices.iter().all(|sacrifice| {
sacrifice.same_item_type(leader) &&
sacrifice.has_subtype(PetItemType::Egg) &&
sacrifice.get_rarity() < RarityTier::Legendary
sacrifice.same_item_type(leader) && sacrifice.has_subtype(PetItemType::Egg)
}) {
ForgeType::Feed
} else {
Expand Down Expand Up @@ -683,19 +681,19 @@ mod test {
ForgeType::Feed
);

// Feed with Legendary egg sacrifices fails
// Feed with Legendary egg sacrifices doesn't fail anymore
let sacrifices_err = [&create_random_egg(
None,
&ALICE,
&RarityTier::Legendary,
0b0001_0010,
0b0000_0000,
10,
[2; 11],
)
.1];
assert_eq!(
ForgerV2::<Test>::determine_forge_type(&leader, &sacrifices_err),
ForgeType::None
ForgeType::Feed
);

// Feed with non-eggs fails
Expand Down Expand Up @@ -830,15 +828,9 @@ mod test {
);

// Mate with non-pet fails
let sacrifices_err = [&create_random_egg(
None,
&ALICE,
&RarityTier::Legendary,
0b0001_0010,
10,
[2; 11],
)
.1];

let sacrifices_err =
[&create_random_pet_part(&ALICE, &PetType::FoxishDude, &SlotType::Head, 1).1];
assert_eq!(
ForgerV2::<Test>::determine_forge_type(&leader, &sacrifices_err),
ForgeType::None
Expand Down