Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to latest data-files #49

Merged
merged 1 commit into from
Jul 6, 2024
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ This Dogma engine implements a multi-pass approach.
- [pass 1](./src/calculate/pass_1.rs): collect all the Dogma attributes of the hull and modules.
- [pass 2](./src/calculate/pass_2.rs): collect all the Dogma effects of the hull and modules.
- [pass 3](./src/calculate/pass_3.rs): apply all the Dogma effects to the hull/modules, calculating the actual Dogma attribute values.
- [pass 4](./src/calculate/pass_4.rs): augment the Dogma attributes with EVEShip.fit specific attributes.
- [pass 4](./src/calculate/pass_4.rs): augment the Dogma attributes with EVEShip.fit specific attributes, that are too complex for the Dogma itself to handle.

## EVEShip.fit's specific attributes

`Pass 4` create Dogma attributes that do not exist in-game, but are calculated based on other Dogma attributes.
`Pass 4` create Dogma attributes that do not exist in-game, but are rather complicated to calculate.
To make rendering a fit easier, these are calculated by this library, and presented as new Dogma attributes.

Their identifier is always a negative value, to visually separate them.
Expand Down
124 changes: 2 additions & 122 deletions src/calculate/pass_4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,106 +3,20 @@ use super::{Info, Item, Pass, Ship};

pub struct PassFour {}

mod align_time;
mod capacitor;
mod cpu_power;
mod damage;
mod drone;
mod ehp;
mod recharge;
mod scan_strength;

#[allow(non_camel_case_types)]
pub enum AttributeId {
alignTime = -1,
scanStrength = -2,
cpuUsed = -3,
powerUsed = -4,
cpuUnused = -5,
powerUnused = -6,
#[allow(dead_code)]
velocityBoost = -7, // Is taken care of with effects.
shieldEhpMultiplier = -8,
armorEhpMultiplier = -9,
hullEhpMultiplier = -10,
shieldEhp = -11,
armorEhp = -12,
hullEhp = -13,
ehp = -14,
passiveShieldRecharge = -15,
shieldRecharge = -16,
armorRecharge = -17,
hullRecharge = -18,
passiveShieldRechargeEhp = -19,
shieldRechargeEhp = -20,
armorRechargeEhp = -21,
hullRechargeEhp = -22,
capacitorPeakRecharge = -23,
capacitorPeakUsage = -24,
capacitorPeakDelta = -25,
capacitorPeakDeltaPercentage = -26,
capacitorDepletesIn = -27,
damageWithoutReloadDps = -28,
damageWithReloadDps = -29,
damageAlphaHp = -30,
droneActive = -31,
droneBandwidthUsedTotal = -32,
droneDamageAlphaHp = -33,
droneDamageDps = -34,
droneCapacityUsed = -35,
capacitorPeakDelta = -1,
capacitorDepletesIn = -2,

mass = 4,
capacitorNeed = 6,
hp = 9,
powerOutput = 11,
power = 30,
capacity = 38,

cpuOutput = 48,
cpu = 50,
speed = 51,
rechargeRate = 55,
damageMultiplier = 64,
shieldBonus = 68,
agility = 70,
duration = 73,
structureDamageAmount = 83,
armorDamageAmount = 84,

kineticDamageResonance = 109,
thermalDamageResonance = 110,
explosiveDamageResonance = 111,
emDamageResonance = 113,

emDamage = 114,
explosiveDamage = 116,
kineticDamage = 117,
thermalDamage = 118,

volume = 161,

scanRadarStrength = 208,
scanLadarStrength = 209,
scanMagnetometricStrength = 210,
scanGravimetricStrength = 211,

shieldCapacity = 263,
armorHp = 265,

armorEmDamageResonance = 267,
armorExplosiveDamageResonance = 268,
armorKineticDamageResonance = 269,
armorThermalDamageResonance = 270,
shieldEmDamageResonance = 271,
shieldExplosiveDamageResonance = 272,
shieldKineticDamageResonance = 273,
shieldThermalDamageResonance = 274,

shieldRechargeRate = 479,
capacitorCapacity = 482,

droneBandwidthUsed = 1272,
reloadTime = 1795,
}

impl Item {
Expand All @@ -116,40 +30,6 @@ impl Item {
/* Attributes don't contain all information displayed, so we calculate some fake attributes with those values. */
impl Pass for PassFour {
fn pass(_info: &Info, ship: &mut Ship) {
align_time::attribute_align_time(ship);
scan_strength::attribute_scan_strength(ship);

cpu_power::attribute_cpu_used(ship);
cpu_power::attribute_power_used(ship);
cpu_power::attribute_cpu_unused(ship);
cpu_power::attribute_power_unused(ship);

ehp::attribute_shield_ehp_multiplier(ship);
ehp::attribute_armor_ehp_multiplier(ship);
ehp::attribute_hull_ehp_multiplier(ship);
ehp::attribute_shield_ehp(ship);
ehp::attribute_armor_ehp(ship);
ehp::attribute_hull_ehp(ship);
ehp::attribute_ehp(ship);

recharge::attribute_passive_shield_recharge(ship);
recharge::attribute_shield_recharge(ship);
recharge::attribute_armor_recharge(ship);
recharge::attribute_hull_recharge(ship);

capacitor::attribute_capacitor_peak_recharge(ship);
capacitor::attribute_capacitor_peak_usage(ship);
capacitor::attribute_capacitor_peak_delta(ship);
capacitor::attribute_capacitor_peak_delta_percentage(ship);
capacitor::attribute_capacitor_depletes_in(ship);

damage::attribute_damage_alpha_hp(ship);
damage::attribute_damage_without_reload(ship);
damage::attribute_damage_with_reload(ship);

drone::attribute_drone_active(ship);
drone::attribute_drone_capacity_used(ship);
drone::attribute_drone_bandwidth_used(ship);
drone::attribute_drone_damage(ship);
}
}
37 changes: 0 additions & 37 deletions src/calculate/pass_4/align_time.rs

This file was deleted.

145 changes: 0 additions & 145 deletions src/calculate/pass_4/capacitor.rs
Original file line number Diff line number Diff line change
@@ -1,151 +1,6 @@
use super::super::Ship;
use super::AttributeId;

pub fn attribute_capacitor_peak_recharge(ship: &mut Ship) {
/* The peak recharge rate of the capacitor (in GJ/s). This happens at 25% of the capacity. */

let attr_capacitor_capacity = ship
.hull
.attributes
.get(&(AttributeId::capacitorCapacity as i32))
.unwrap();
let attr_recharge_rate = ship
.hull
.attributes
.get(&(AttributeId::rechargeRate as i32))
.unwrap();

let base_capacitor_capacity = attr_capacitor_capacity.base_value;
let base_recharge_rate = attr_recharge_rate.base_value / 1000.0;
let base_peak_recharge = 5.0 / 2.0 * base_capacitor_capacity / base_recharge_rate;

let capacitor_capacity = attr_capacitor_capacity.value.unwrap();
let recharge_rate = attr_recharge_rate.value.unwrap() / 1000.0;
let peak_recharge = 5.0 / 2.0 * capacitor_capacity / recharge_rate;

ship.hull.add_attribute(
AttributeId::capacitorPeakRecharge,
base_peak_recharge,
peak_recharge,
);
}

pub fn attribute_capacitor_peak_usage(ship: &mut Ship) {
/* The peak capacitor usage if all modules would activate at the same time, in GJ/s. */

let attr_capacitor_need = AttributeId::capacitorNeed as i32;
let attr_duration = AttributeId::duration as i32;
let attr_rate_of_fire = AttributeId::speed as i32;

let mut base_peak_usage = 0.0;
let mut peak_usage = 0.0;
for item in &ship.items {
if !item.slot.is_module() || !item.state.is_active() {
continue;
}

if !item.attributes.contains_key(&attr_capacitor_need) {
continue;
}

/* Depending on the module, the duration is based either on "duration" or on "speed" (read: rate-of-fire). */
let (duration_base, duration) = if item.attributes.contains_key(&attr_duration) {
(
item.attributes.get(&attr_duration).unwrap().base_value,
item.attributes.get(&attr_duration).unwrap().value.unwrap(),
)
} else if item.attributes.contains_key(&attr_rate_of_fire) {
(
item.attributes.get(&attr_rate_of_fire).unwrap().base_value,
item.attributes
.get(&attr_rate_of_fire)
.unwrap()
.value
.unwrap(),
)
} else {
/* Neither speed nor duration; so no cap use. */
continue;
};

base_peak_usage += item
.attributes
.get(&attr_capacitor_need)
.unwrap()
.base_value
/ duration_base
* 1000.0;
peak_usage += item
.attributes
.get(&attr_capacitor_need)
.unwrap()
.value
.unwrap()
/ duration
* 1000.0;
}

ship.hull
.add_attribute(AttributeId::capacitorPeakUsage, base_peak_usage, peak_usage);
}

pub fn attribute_capacitor_peak_delta(ship: &mut Ship) {
/* The delta between peak recharge and peak usage, in GJ/s. */

let attr_capacitor_peak_recharge = ship
.hull
.attributes
.get(&(AttributeId::capacitorPeakRecharge as i32))
.unwrap();
let attr_capacitor_peak_usage = ship
.hull
.attributes
.get(&(AttributeId::capacitorPeakUsage as i32))
.unwrap();

let base_peak_recharge = attr_capacitor_peak_recharge.base_value;
let base_peak_usage = attr_capacitor_peak_usage.base_value;
let base_peak_delta = base_peak_recharge - base_peak_usage;

let peak_recharge = attr_capacitor_peak_recharge.value.unwrap();
let peak_usage = attr_capacitor_peak_usage.value.unwrap();
let peak_delta = peak_recharge - peak_usage;

ship.hull
.add_attribute(AttributeId::capacitorPeakDelta, base_peak_delta, peak_delta);
}

pub fn attribute_capacitor_peak_delta_percentage(ship: &mut Ship) {
/* The delta between peak recharge and peak usage, in % of peak recharge. */

let attr_capacitor_peak_recharge = ship
.hull
.attributes
.get(&(AttributeId::capacitorPeakRecharge as i32))
.unwrap();
let attr_capacitor_peak_usage = ship
.hull
.attributes
.get(&(AttributeId::capacitorPeakUsage as i32))
.unwrap();

let base_peak_recharge = attr_capacitor_peak_recharge.base_value;
let base_peak_usage = attr_capacitor_peak_usage.base_value;
let base_peak_delta = base_peak_recharge - base_peak_usage;
let base_peak_delta_percentage = base_peak_delta / base_peak_recharge * 100.0;

let peak_recharge = attr_capacitor_peak_recharge.value.unwrap();
let peak_usage = attr_capacitor_peak_usage.value.unwrap();
let peak_delta = peak_recharge - peak_usage;
let peak_delta_percentage = peak_delta / peak_recharge * 100.0;

ship.hull.add_attribute(
AttributeId::capacitorPeakDeltaPercentage,
base_peak_delta_percentage,
peak_delta_percentage,
);
}

struct Module {
capacitor_need: f64,
duration: f64,
Expand Down
Loading
Loading