Codepoint Leech Virus

Suggested by Rylan.
This commit is contained in:
Michael 2017-06-28 21:48:03 -04:00
parent a15fc8c28a
commit ae293c61ac
2 changed files with 35 additions and 0 deletions

View file

@ -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" />

View file

@ -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();
}
}
}