aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Viruses/CPLeach.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-28 21:48:03 -0400
committerMichael <[email protected]>2017-06-28 21:48:03 -0400
commitae293c61acbfde26618da14605a985fc00f46677 (patch)
treecb4a9f5a5b85d7f48e95b480da91200708bb85b3 /ShiftOS.WinForms/Viruses/CPLeach.cs
parenta15fc8c28a0f5fa36c0e38602730701fb108325a (diff)
downloadshiftos_thereturn-ae293c61acbfde26618da14605a985fc00f46677.tar.gz
shiftos_thereturn-ae293c61acbfde26618da14605a985fc00f46677.tar.bz2
shiftos_thereturn-ae293c61acbfde26618da14605a985fc00f46677.zip
Codepoint Leech Virus
Suggested by Rylan.
Diffstat (limited to 'ShiftOS.WinForms/Viruses/CPLeach.cs')
-rw-r--r--ShiftOS.WinForms/Viruses/CPLeach.cs34
1 files changed, 34 insertions, 0 deletions
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();
+ }
+ }
+}