-
Notifications
You must be signed in to change notification settings - Fork 15
/
FormEditSpecialEffect.cs
67 lines (56 loc) · 1.98 KB
/
FormEditSpecialEffect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Rawr
{
public partial class FormEditSpecialEffect : Form
{
public Stats Stats { get; set; }
public Trigger Trigger { get; set; }
public float Duration { get; set; }
public float Cooldown { get; set; }
public float Chance { get; set; }
public int Stacks { get; set; }
public FormEditSpecialEffect()
: this(new Stats(), Trigger.MeleeHit, 20f, 120f, 1f, 1)
{
Text = "Add Special Effect";
}
public FormEditSpecialEffect(Stats stats, Trigger trigger, float duration, float cooldown, float chance, int stacks)
{
Stats = stats.Clone();
InitializeComponent();
propertyGridStats.SelectedObject = Stats;
cmbTrigger.DataSource = Enum.GetNames(typeof(Trigger));
cmbTrigger.SelectedIndex = (int)trigger;
nudDuration.Value = (decimal)duration;
nudCooldown.Value = (decimal)cooldown;
nudStacks.Value = (decimal)stacks;
if (chance < 0)
{
nudChance.Value = (decimal)-chance;
cmbPPM.SelectedIndex = 1;
}
else
{
nudChance.Value = (decimal)(chance * 100f);
cmbPPM.SelectedIndex = 0;
}
}
private void butOkay_Click(object sender, EventArgs e)
{
Trigger = (Trigger)cmbTrigger.SelectedIndex;
Duration = (float)nudDuration.Value;
Cooldown = (float)nudCooldown.Value;
Stacks = (int)nudStacks.Value;
if (cmbPPM.SelectedIndex == 1) Chance = -(float)nudChance.Value;
else Chance = (float)nudChance.Value / 100f;
this.DialogResult = DialogResult.OK;
this.Close();
}
}
}