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

Commit

Permalink
fixed missing on eggs and fixed naming (#327)
Browse files Browse the repository at this point in the history
* fixed missing on eggs and fixed naming

---------

Co-authored-by: darkfriend77 <darkfriend@swissonline.ch>
Co-authored-by: Didac Semente Fernandez <didac@ajuna.io>
  • Loading branch information
3 people authored Jul 13, 2023
1 parent 175d047 commit 2c6c404
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 17 deletions.
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

0 comments on commit 2c6c404

Please sign in to comment.