From b17a2f9fdcdbf6790b2fdfad4397f2b47a8b3cf8 Mon Sep 17 00:00:00 2001 From: traffic95 Date: Tue, 18 Mar 2025 21:12:09 +0100 Subject: [PATCH] Moved EPropertyType to trigger_logic::battle --- Cargo.lock | 1 - crates/battle-server/Cargo.toml | 1 - .../battle-server/src/logic/property_util.rs | 91 +------------------ crates/trigger-logic/src/battle.rs | 90 ++++++++++++++++++ crates/trigger-logic/src/lib.rs | 3 +- 5 files changed, 93 insertions(+), 93 deletions(-) create mode 100644 crates/trigger-logic/src/battle.rs diff --git a/Cargo.lock b/Cargo.lock index 96f086e..c1d30fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3599,7 +3599,6 @@ name = "trigger-battle-server" version = "0.0.1" dependencies = [ "dashmap 6.1.0", - "num_enum", "paste", "serde", "serde_json", diff --git a/crates/battle-server/Cargo.toml b/crates/battle-server/Cargo.toml index 74179dd..e380bec 100644 --- a/crates/battle-server/Cargo.toml +++ b/crates/battle-server/Cargo.toml @@ -6,7 +6,6 @@ version.workspace = true [dependencies] tokio.workspace = true -num_enum.workspace = true paste.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/crates/battle-server/src/logic/property_util.rs b/crates/battle-server/src/logic/property_util.rs index 6a4cd93..fa90e59 100644 --- a/crates/battle-server/src/logic/property_util.rs +++ b/crates/battle-server/src/logic/property_util.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use trigger_fileconfig::{AvatarBattleTemplate, AvatarLevelAdvanceTemplate, AvatarPassiveSkillTemplate, NapFileCfg, WeaponLevelTemplate, WeaponStarTemplate, WeaponTemplate}; -use trigger_logic::skill::EAvatarSkillType; +use trigger_logic::{battle::EPropertyType, skill::EAvatarSkillType}; use trigger_protocol::{Avatar, DungeonEquipInfo, Equip, Weapon}; struct AvatarFileCfg<'a> { @@ -19,95 +19,6 @@ struct WeaponFileCfg<'a> { const BEN_AVATAR_ID: u32 = 1121; const BEN_CORE_PASSIVE_PERCENTAGE: [i32;7] = [40, 46, 52, 60, 66, 72, 80]; -#[repr(u32)] -#[derive(num_enum::IntoPrimitive, num_enum::TryFromPrimitive)] -pub enum EPropertyType { - HpMax = 111, - Atk = 121, - BreakStun = 122, - Def = 131, - Crit = 201, - CritDmg = 211, - Pen = 231, - PenValue = 232, - SpRecover = 305, - ElementMystery = 312, - ElementAbnormalPower = 314, - AddedDamageRatioPhysics = 315, - AddedDamageRatioFire = 316, - AddedDamageRatioIce = 317, - AddedDamageRatioElec = 318, - AddedDamageRatioEther = 319, - // battle - HpMaxBattle = 1111, - AtkBattle = 1121, - BreakStunBattle = 1122, - DefBattle = 1131, - CritBattle = 1201, - CritDmgBattle = 1211, - PenRatioBattle = 1231, - PenDeltaBattle = 1232, - SpRecoverBattle = 1305, - ElementMysteryBattle = 1312, - ElementAbnormalPowerBattle = 1314, - AddedDamageRatioPhysicsBattle = 1315, - AddedDamageRatioFireBattle = 1316, - AddedDamageRatioIceBattle = 1317, - AddedDamageRatioElecBattle = 1318, - AddedDamageRatioEtherBattle = 1319, - // base - HpMaxBase = 11101, - AtkBase = 12101, - BreakStunBase = 12201, - DefBase = 13101, - CritBase = 20101, - CritDmgBase = 21101, - PenBase = 23101, - PenValueBase = 23201, - SpRecoverBase = 30501, - ElementMysteryBase = 31201, - ElementAbnormalPowerBase = 31401, - // ratio - HpMaxRatio = 11102, - AtkRatio = 12102, - BreakStunRatio = 12202, - DefRatio = 13102, - SpRecoverRatio = 30502, - ElementAbnormalPowerRatio = 31402, - // delta - HpMaxDelta = 11103, - AtkDelta = 12103, - BreakStunDelta = 12203, - DefDelta = 13103, - CritDelta = 20103, - CritDmgDelta = 21103, - PenDelta = 23103, - PenValueDelta = 23203, - SpRecoverDelta = 30503, - ElementMysteryDelta = 31203, - ElementAbnormalPowerDelta = 31403, - // damage ratios 1/3 - AddedDamageRatioPhysics1 = 31501, - AddedDamageRatioPhysics3 = 31503, - AddedDamageRatioFire1 = 31601, - AddedDamageRatioFire3 = 31603, - AddedDamageRatioIce1 = 31701, - AddedDamageRatioIce3 = 31703, - AddedDamageRatioElec1 = 31801, - AddedDamageRatioElec3 = 31803, - AddedDamageRatioEther1 = 31901, - AddedDamageRatioEther3 = 31903, - // --- custom - // growth - HpMaxGrowth = 9999_111_0, - AtkGrowth = 9999_121_0, - DefGrowth = 9999_131_0, - // advance - HpMaxAdvance = 9999_111_1, - AtkAdvance = 9999_121_1, - DefAdvance = 9999_131_1, -} - pub fn calculate_for_avatar( avatar_id: u32, filecfg: &'static NapFileCfg, diff --git a/crates/trigger-logic/src/battle.rs b/crates/trigger-logic/src/battle.rs new file mode 100644 index 0000000..c61acb7 --- /dev/null +++ b/crates/trigger-logic/src/battle.rs @@ -0,0 +1,90 @@ +use num_enum::{IntoPrimitive, TryFromPrimitive}; + +#[repr(u32)] +#[derive(IntoPrimitive, TryFromPrimitive)] +pub enum EPropertyType { + HpMax = 111, + Atk = 121, + BreakStun = 122, + Def = 131, + Crit = 201, + CritDmg = 211, + Pen = 231, + PenValue = 232, + SpRecover = 305, + ElementMystery = 312, + ElementAbnormalPower = 314, + AddedDamageRatioPhysics = 315, + AddedDamageRatioFire = 316, + AddedDamageRatioIce = 317, + AddedDamageRatioElec = 318, + AddedDamageRatioEther = 319, + // battle + HpMaxBattle = 1111, + AtkBattle = 1121, + BreakStunBattle = 1122, + DefBattle = 1131, + CritBattle = 1201, + CritDmgBattle = 1211, + PenRatioBattle = 1231, + PenDeltaBattle = 1232, + SpRecoverBattle = 1305, + ElementMysteryBattle = 1312, + ElementAbnormalPowerBattle = 1314, + AddedDamageRatioPhysicsBattle = 1315, + AddedDamageRatioFireBattle = 1316, + AddedDamageRatioIceBattle = 1317, + AddedDamageRatioElecBattle = 1318, + AddedDamageRatioEtherBattle = 1319, + // base + HpMaxBase = 11101, + AtkBase = 12101, + BreakStunBase = 12201, + DefBase = 13101, + CritBase = 20101, + CritDmgBase = 21101, + PenBase = 23101, + PenValueBase = 23201, + SpRecoverBase = 30501, + ElementMysteryBase = 31201, + ElementAbnormalPowerBase = 31401, + // ratio + HpMaxRatio = 11102, + AtkRatio = 12102, + BreakStunRatio = 12202, + DefRatio = 13102, + SpRecoverRatio = 30502, + ElementAbnormalPowerRatio = 31402, + // delta + HpMaxDelta = 11103, + AtkDelta = 12103, + BreakStunDelta = 12203, + DefDelta = 13103, + CritDelta = 20103, + CritDmgDelta = 21103, + PenDelta = 23103, + PenValueDelta = 23203, + SpRecoverDelta = 30503, + ElementMysteryDelta = 31203, + ElementAbnormalPowerDelta = 31403, + // damage ratios 1/3 + AddedDamageRatioPhysics1 = 31501, + AddedDamageRatioPhysics3 = 31503, + AddedDamageRatioFire1 = 31601, + AddedDamageRatioFire3 = 31603, + AddedDamageRatioIce1 = 31701, + AddedDamageRatioIce3 = 31703, + AddedDamageRatioElec1 = 31801, + AddedDamageRatioElec3 = 31803, + AddedDamageRatioEther1 = 31901, + AddedDamageRatioEther3 = 31903, + // --- custom + // growth + HpMaxGrowth = 9999_111_0, + AtkGrowth = 9999_121_0, + DefGrowth = 9999_131_0, + // advance + HpMaxAdvance = 9999_111_1, + AtkAdvance = 9999_121_1, + DefAdvance = 9999_131_1, +} \ No newline at end of file diff --git a/crates/trigger-logic/src/lib.rs b/crates/trigger-logic/src/lib.rs index 982a71e..4dd8f48 100644 --- a/crates/trigger-logic/src/lib.rs +++ b/crates/trigger-logic/src/lib.rs @@ -1,6 +1,7 @@ pub mod action_pb; +pub mod battle; pub mod item; pub mod quest; pub mod scene; pub mod skill; -pub mod template_ext; +pub mod template_ext; \ No newline at end of file