aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms')
-rw-r--r--ShiftOS.WinForms/ShiftOS.WinForms.csproj1
-rw-r--r--ShiftOS.WinForms/Viruses/CPLeach.cs34
2 files changed, 35 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
index f1c92da..c531c30 100644
--- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj
+++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj
@@ -463,6 +463,7 @@
<DependentUpon>UniteSignupDialog.cs</DependentUpon>
</Compile>
<Compile Include="VirtualEnvironments.cs" />
+ <Compile Include="Viruses\CPLeach.cs" />
<Compile Include="Viruses\WindowsEverywhere.cs" />
<Compile Include="VirusTestCommands.cs" />
<Compile Include="VisualBasicStuff.cs" />
diff --git a/ShiftOS.WinForms/Viruses/CPLeach.cs b/ShiftOS.WinForms/Viruses/CPLeach.cs
new file mode 100644
index 0000000..0d82187
--- /dev/null
+++ b/ShiftOS.WinForms/Viruses/CPLeach.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Viruses
+{
+ public class CPLeach : IVirus
+ {
+ public System.Windows.Forms.Timer Timer = null;
+
+ public void Infect(int threatlevel)
+ {
+ Timer = new System.Windows.Forms.Timer();
+ Timer.Interval = 6000;
+ Timer.Tick += (o, a) =>
+ {
+ ulong codepointDecrease = (ulong)threatlevel * 4;
+ if (SaveSystem.CurrentSave.Codepoints >= codepointDecrease)
+ SaveSystem.CurrentSave.Codepoints -= codepointDecrease;
+ else
+ SaveSystem.CurrentSave.Codepoints = 0;
+ };
+ Timer.Start();
+ }
+
+ public void Disinfect()
+ {
+ Timer.Stop();
+ }
+ }
+}