Skip to content

Commit

Permalink
feat: Add 4.8 items
Browse files Browse the repository at this point in the history
  • Loading branch information
wormtql committed Jul 17, 2024
1 parent 8da0e35 commit 3dcbc71
Show file tree
Hide file tree
Showing 21 changed files with 574 additions and 91 deletions.
56 changes: 49 additions & 7 deletions mona_core/src/attribute/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,40 +112,70 @@ impl<T: Attribute> AttributeCommon<T> for T {
let key1 = AttributeName::atk_ratio_name_by_element(element);
let key2 = AttributeName::atk_ratio_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::ATKRatioBase)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_def_ratio(&self, element: Element, skill: SkillType) -> f64 {
let key1 = AttributeName::def_ratio_name_by_element(element);
let key2 = AttributeName::def_ratio_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::DEFRatioBase)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_hp_ratio(&self, element: Element, skill: SkillType) -> f64 {
let key1 = AttributeName::hp_ratio_name_by_element(element);
let key2 = AttributeName::hp_ratio_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::HPRatioBase)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_extra_damage(&self, element: Element, skill: SkillType) -> f64 {
let key1 = AttributeName::extra_dmg_name_by_element(element);
let key2 = AttributeName::extra_dmg_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::ExtraDmgBase)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_bonus(&self, element: Element, skill: SkillType) -> f64 {
let key1 = AttributeName::bonus_name_by_element(element);
let key2 = AttributeName::bonus_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

let mut temp = self.get_value(AttributeName::BonusBase)
+ self.get_value(key1) + self.get_value(key2);
+ self.get_value(key1) + value2;
// todo refactor
if element != Element::Physical && skill == SkillType::NormalAttack {
temp += self.get_value(AttributeName::BonusNormalAndElemental);
Expand All @@ -157,16 +187,28 @@ impl<T: Attribute> AttributeCommon<T> for T {
let key1 = AttributeName::critical_rate_name_by_element(element);
let key2 = AttributeName::critical_rate_name_by_skill_type(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::CriticalBase) + self.get_value(AttributeName::CriticalAttacking)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_critical_damage(&self, element: Element, skill: SkillType) -> f64 {
let key1 = AttributeName::critical_damage_name_by_element(element);
let key2 = AttributeName::critical_damage_name_by_skill_name(skill);

let value2 = if let Some(name) = key2 {
self.get_value(name)
} else {
0.0
};

self.get_value(AttributeName::CriticalDamageBase)
+ self.get_value(key1) + self.get_value(key2)
+ self.get_value(key1) + value2
}

fn get_enemy_res_minus(&self, element: Element, _skill: SkillType) -> f64 {
Expand Down
91 changes: 49 additions & 42 deletions mona_core/src/attribute/attribute_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ impl AttributeName {
}
}

pub fn bonus_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn bonus_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::BonusNormalAttack,
SkillType::ChargedAttack => AttributeName::BonusChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::BonusPlungingAttack,
SkillType::ElementalSkill => AttributeName::BonusElementalSkill,
SkillType::ElementalBurst => AttributeName::BonusElementalBurst,
SkillType::NormalAttack => Some(AttributeName::BonusNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::BonusChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::BonusPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::BonusElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::BonusElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -212,13 +213,14 @@ impl AttributeName {
}
}

pub fn critical_rate_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn critical_rate_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::CriticalNormalAttack,
SkillType::ChargedAttack => AttributeName::CriticalChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::CriticalPlungingAttack,
SkillType::ElementalSkill => AttributeName::CriticalElementalSkill,
SkillType::ElementalBurst => AttributeName::CriticalElementalBurst,
SkillType::NormalAttack => Some(AttributeName::CriticalNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::CriticalChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::CriticalPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::CriticalElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::CriticalElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -235,13 +237,14 @@ impl AttributeName {
}
}

pub fn critical_damage_name_by_skill_name(skill_type: SkillType) -> AttributeName {
pub fn critical_damage_name_by_skill_name(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::CriticalDamageNormalAttack,
SkillType::ChargedAttack => AttributeName::CriticalDamageChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::CriticalDamagePlungingAttack,
SkillType::ElementalSkill => AttributeName::CriticalDamageElementalSkill,
SkillType::ElementalBurst => AttributeName::CriticalDamageElementalBurst,
SkillType::NormalAttack => Some(AttributeName::CriticalDamageNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::CriticalDamageChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::CriticalDamagePlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::CriticalDamageElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::CriticalDamageElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -258,13 +261,14 @@ impl AttributeName {
}
}

pub fn hp_ratio_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn hp_ratio_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::HPRatioNormalAttack,
SkillType::ChargedAttack => AttributeName::HPRatioChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::HPRatioPlungingAttack,
SkillType::ElementalSkill => AttributeName::HPRatioElementalSkill,
SkillType::ElementalBurst => AttributeName::HPRatioElementalBurst,
SkillType::NormalAttack => Some(AttributeName::HPRatioNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::HPRatioChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::HPRatioPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::HPRatioElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::HPRatioElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -281,13 +285,14 @@ impl AttributeName {
}
}

pub fn def_ratio_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn def_ratio_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::DEFRatioNormalAttack,
SkillType::ChargedAttack => AttributeName::DEFRatioChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::DEFRatioPlungingAttack,
SkillType::ElementalSkill => AttributeName::DEFRatioElementalSkill,
SkillType::ElementalBurst => AttributeName::DEFRatioElementalBurst,
SkillType::NormalAttack => Some(AttributeName::DEFRatioNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::DEFRatioChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::DEFRatioPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::DEFRatioElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::DEFRatioElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -304,13 +309,14 @@ impl AttributeName {
}
}

pub fn atk_ratio_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn atk_ratio_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::ATKRatioNormalAttack,
SkillType::ChargedAttack => AttributeName::ATKRatioChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::ATKRatioPlungingAttack,
SkillType::ElementalSkill => AttributeName::ATKRatioElementalSkill,
SkillType::ElementalBurst => AttributeName::ATKRatioElementalBurst,
SkillType::NormalAttack => Some(AttributeName::ATKRatioNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::ATKRatioChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::ATKRatioPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::ATKRatioElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::ATKRatioElementalBurst),
SkillType::NoneType => None,
}
}

Expand All @@ -327,13 +333,14 @@ impl AttributeName {
}
}

pub fn extra_dmg_name_by_skill_type(skill_type: SkillType) -> AttributeName {
pub fn extra_dmg_name_by_skill_type(skill_type: SkillType) -> Option<AttributeName> {
match skill_type {
SkillType::NormalAttack => AttributeName::ExtraDmgNormalAttack,
SkillType::ChargedAttack => AttributeName::ExtraDmgChargedAttack,
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => AttributeName::ExtraDmgPlungingAttack,
SkillType::ElementalSkill => AttributeName::ExtraDmgElementalSkill,
SkillType::ElementalBurst => AttributeName::ExtraDmgElementalBurst,
SkillType::NormalAttack => Some(AttributeName::ExtraDmgNormalAttack),
SkillType::ChargedAttack => Some(AttributeName::ExtraDmgChargedAttack),
SkillType::PlungingAttackOnGround | SkillType::PlungingAttackInAction => Some(AttributeName::ExtraDmgPlungingAttack),
SkillType::ElementalSkill => Some(AttributeName::ExtraDmgElementalSkill),
SkillType::ElementalBurst => Some(AttributeName::ExtraDmgElementalBurst),
SkillType::NoneType => None,
}
}

Expand Down
11 changes: 8 additions & 3 deletions mona_core/src/attribute/complicated_attribute_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,16 @@ impl ComplicatedAttributeGraph {
}

pub fn get_critical_composition(&self, element: Element, skill: SkillType) -> EntryType {
self.get_composition_merge(&vec![
let skill_type_critical_name = AttributeName::critical_rate_name_by_skill_type(skill);
let mut names = vec![
AttributeName::CriticalBase,
AttributeName::CriticalAttacking,
AttributeName::critical_rate_name_by_element(element),
AttributeName::critical_rate_name_by_skill_type(skill)
])
];
if let Some(name) = skill_type_critical_name {
names.push(name);
}

self.get_composition_merge(&names)
}
}
1 change: 1 addition & 0 deletions mona_core/src/character/character_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,5 @@ pub enum CharacterName {
Clorinde,
Sigewinne,
Sethos,
Emilie,
}
Loading

0 comments on commit 3dcbc71

Please sign in to comment.