Skip to content

Commit 10e8173

Browse files
authored
add some module + workflow
1 parent ea72271 commit 10e8173

File tree

3 files changed

+62
-18
lines changed

3 files changed

+62
-18
lines changed

.github/workflows/build_all.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build All
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '**/*.md'
7+
pull_request:
8+
paths-ignore:
9+
- '**/*.md'
10+
workflow_dispatch:
11+
# allows manual trigger
12+
13+
jobs:
14+
build:
15+
runs-on: windows-latest
16+
strategy:
17+
matrix:
18+
projname: [ 'EIV_Core', 'EIV_Modules' ]
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Clone EIV Nuget repository
24+
uses: actions/checkout@v4
25+
with:
26+
repository: ExtractIntoVoid/Nuget
27+
path: eiv_nuget
28+
29+
- name: Setup .NET
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: '8.0.x'
33+
34+
- name: Add eiv_nuget to nuget souce
35+
run: dotnet nuget add source --name eiv_nuget $env:GITHUB_WORKSPACE/eiv_nuget
36+
37+
- name: Publish
38+
run: dotnet publish ${{ matrix.projname }}/${{ matrix.projname }}.csproj -c Release -o Out
39+
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: ${{ matrix.projname }}
44+
path: Out
45+
if-no-files-found: error

EIV_Modules/Modules/BaseChangingModule.cs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,33 +33,32 @@ public BaseChangingModule(T minValue, T maxValue, T currentValue)
3333

3434
public virtual void AddValue(T value, bool EnableOverflow)
3535
{
36-
if (value < T.Zero)
36+
if (value == T.Zero)
3737
return;
3838
var newValue = CurrentValue + value;
39-
if (newValue > this.MaxValue)
39+
if (newValue <= MaxValue)
4040
{
41-
if (EnableOverflow)
42-
{
43-
this.MaxValue = newValue;
44-
this.CurrentValue = newValue;
45-
}
41+
CurrentValue = newValue;
42+
return;
4643
}
47-
else
44+
if (EnableOverflow)
4845
{
49-
this.CurrentValue = newValue;
46+
MaxValue = newValue;
47+
CurrentValue = newValue;
5048
}
5149
}
5250

5351
public virtual void RemoveValue(T value)
5452
{
55-
if (value < T.Zero)
53+
if (value == T.Zero)
5654
return;
57-
this.CurrentValue -= value;
58-
if (this.CurrentValue == this.MinValue)
59-
{
55+
var newValue = CurrentValue - value;
56+
if (newValue < MinValue)
57+
return;
58+
CurrentValue = newValue;
59+
if (CurrentValue == MinValue)
6060
OnMinimum?.Invoke();
61-
}
6261
}
63-
62+
6463
public event Action OnMinimum;
6564
}

EIV_Modules/Modules/HealthModule.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public HealthModule() : base(0, 100)
77
OnMinimum += Minimum;
88
}
99

10-
public string LastCause { get; private set;}
10+
public string LastCause { get; private set; }
1111

1212
public void Damage(int value, string Cause)
1313
{
@@ -28,6 +28,6 @@ private void Minimum()
2828
}
2929

3030
public event Action<string> OnDeath;
31-
public event Action<int value, string Cause> OnDamage;
32-
public event Action<int value, bool EnableOverHeal> OnHeal;
31+
public event Action<int, string> OnDamage;
32+
public event Action<int, bool> OnHeal;
3333
}

0 commit comments

Comments
 (0)