diff options
Diffstat (limited to 'src/stats.rs')
-rw-r--r-- | src/stats.rs | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/stats.rs b/src/stats.rs new file mode 100644 index 000000000000..d679c3e7d38c --- /dev/null +++ b/src/stats.rs @@ -0,0 +1,80 @@ +//! This file contains balancing data +//! +//! Each type of node and packet is being balanced for different +//! factors. The stats are just returned by these functions. +//! Whenever there is some effect that can happen in the game, it's +//! value (strength) will be derived from here. + +/// The cost of doing business +pub mod cost { + use crate::data::{Level, PacketType, Upgrade}; + + /// Takes the current node and desired upgrade level + pub fn upgrade(curr: &Upgrade, want: &Upgrade) -> u32 { + use self::{Level::*, Upgrade::*}; + match (curr, want) { + // Base upgrades + (Base, Guard(One)) => 30, + (Base, Compute(One)) => 25, + (Base, Relay(One)) => 20, + + // Guards + (Guard(One), Guard(Two)) => 50, + (Guard(Two), Guard(Three)) => 75, + + // Compute is expensive + (Compute(One), Compute(Two)) => 50, + (Compute(Two), Compute(Three)) => 95, + + // Relays + (Relay(One), Relay(Two)) => 35, + (Relay(Two), Relay(Three)) => 55, + + // Can't touch this + (_, _) => unreachable!(), + } + } + + /// Sending certain packets costs money, let's find out how much + pub fn packets(node: &Upgrade, packet: &PacketType) -> u32 { + use { + Level::*, + PacketType::*, + Upgrade::{Base, Compute as Cc, Guard, Relay}, + }; + match (node, packet) { + // Sending pings is free forever + (_, Ping) => 0, + // Capture packets always cost the same + (_, Capture) => 15, + + // The cost of compute packets increases with levels + // because their efficiency increases more dramatically + (Cc(One), Compute { .. }) => 7, + (Cc(Two), Compute { .. }) => 14, + (Cc(Three), Compute { .. }) => 21, + + // Payloads can only be sent from guards + (Guard(_), Payload { .. }) => 12, + + // Resets are relatively cheap + (Guard(One), Reset) => 16, + (Guard(Two), Reset) => 32, + (Guard(Three), Reset) => 48, + + (Guard(One), Nitm) => 28, + (Guard(Two), Nitm) => 64, + (Guard(Three), Nitm) => 148, + + (Guard(One), Virus) => 18, + (Guard(Two), Virus) => 40, + (Guard(Three), Virus) => 60, + + // Only level 3 guards can send takeovers + (Guard(Three), TakeOver) => 256, + + // Can't touch this + (_, _) => unreachable!() + } + } +} |