Skip to content

Commit 0a5ee21

Browse files
authored
New stages integration (#205)
* Created Event, Elite, and Shop Handling Created Elite stages MapArea and StageProducer should now be ready for new planned stages * Added Sprites Added Elite, Shop, and Event map icons Added money icon * Flipped Shop and Money sprites * Setting Up second area level Also tweaking cartographer camera scroll * Fix Effect Application Effects aren't placed at <= 0 hp Battle Director effectively handles false status application Battle director creates instances of status effects for each enemy, if multiple Renamed GetInstance for clarity * Added PFly effects PFly adds shield after death and from enemy note Updated GWS note icon for easier visibility * Added BossBlood Effects Extra damage on miss/ok and heal
1 parent 15ec83b commit 0a5ee21

35 files changed

+518
-49
lines changed

Classes/MapAreas/MapLevels.cs

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,26 @@ public MapConfig AddSetRoom(int height, Stages roomType)
3232
return this;
3333
}
3434

35-
public const int NumStages = 2;
36-
37-
public static readonly Stages[] StagsToRoll = new[] { Stages.Battle, Stages.Chest };
35+
public static readonly Stages[] StagesToRoll = new[]
36+
{
37+
Stages.Battle,
38+
Stages.Chest,
39+
Stages.Elite,
40+
Stages.Event,
41+
Stages.Shop,
42+
};
3843

3944
/// <summary>
4045
/// The odds for each stage to appear in a non-set room position.
4146
/// </summary>
42-
public float[] StageOdds = new float[2];
47+
public float[] StageOdds = new float[5];
4348

4449
public MapConfig(int width, int height, int paths, float[] odds)
4550
{
4651
Width = width;
4752
Height = height;
4853
Paths = paths;
49-
for (int i = 0; i < NumStages; i++)
54+
for (int i = 0; i < StagesToRoll.Length; i++)
5055
{
5156
StageOdds[i] = odds[i];
5257
}
@@ -75,6 +80,7 @@ private MapLevels(
7580
int[] battleSongs,
7681
int[] eliteSongs,
7782
int[] bossSongs,
83+
int[] eventIds,
7884
int nextLevelId = -1,
7985
string backgroundPath = "res://SharedAssets/BackGround_Full.png"
8086
)
@@ -84,6 +90,7 @@ private MapLevels(
8490
NormalBattles = battleSongs;
8591
EliteBattles = eliteSongs;
8692
BossBattles = bossSongs;
93+
EventIds = eventIds;
8794
NextLevel = nextLevelId;
8895
BackgroundPath = backgroundPath;
8996
}
@@ -97,18 +104,38 @@ private MapLevels(
97104
public int[] NormalBattles { get; private set; }
98105
public int[] EliteBattles { get; private set; }
99106
public int[] BossBattles { get; private set; }
107+
public int[] EventIds { get; private set; }
100108

101109
#region Preset Levels
102-
private static readonly MapConfig FirstMapConfig = new MapConfig(7, 6, 3, [10, 1])
110+
private static readonly MapConfig FirstMapConfig = new MapConfig(7, 7, 3, [10, 2, 5, 6, 5])
103111
.AddSetRoom(3, Stages.Chest)
104-
.AddMinHeight(Stages.Chest, 2);
112+
.AddMinHeight(Stages.Chest, 2)
113+
.AddMinHeight(Stages.Shop, 3)
114+
.AddMinHeight(Stages.Elite, 3);
115+
116+
private static readonly MapConfig CityMapConfig = new MapConfig(9, 10, 5, [12, 1, 5, 5, 4])
117+
.AddSetRoom(2, Stages.Chest)
118+
.AddSetRoom(4, Stages.Shop)
119+
.AddMinHeight(Stages.Chest, 1)
120+
.AddMinHeight(Stages.Shop, 3)
121+
.AddMinHeight(Stages.Elite, 2);
105122

106-
private static readonly MapConfig TutorialMapConfig = new MapConfig(1, 2, 1, [10, 0]);
123+
private static readonly MapConfig TutorialMapConfig = new MapConfig(1, 2, 1, [10, 0, 0, 0, 0]);
107124

108125
private static readonly MapLevels[] PresetLevels = new[]
109126
{
110-
new MapLevels(0, TutorialMapConfig, [4], [], [5], 1),
111-
new MapLevels(1, FirstMapConfig, [1, 2, 3], [], [0], -1),
127+
new MapLevels(0, TutorialMapConfig, [4], [0], [5], [], 1),
128+
new MapLevels(1, FirstMapConfig, [1, 2], [3], [0], [], 2),
129+
new MapLevels(
130+
2,
131+
CityMapConfig,
132+
[1, 2],
133+
[3],
134+
[0],
135+
[],
136+
-1,
137+
"res://SharedAssets/BackGround_City.png"
138+
),
112139
};
113140
#endregion
114141

487 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://c6gaprxxf71mm"
6+
path="res://.godot/imported/Note_BossBlood.png-867ef730738d75280fbaf251b1d84cde.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Classes/Notes/Assets/Note_BossBlood.png"
14+
dest_files=["res://.godot/imported/Note_BossBlood.png-867ef730738d75280fbaf251b1d84cde.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1

Classes/Notes/Assets/Note_GWS.png

-152 Bytes
Loading
427 Bytes
Loading
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[remap]
2+
3+
importer="texture"
4+
type="CompressedTexture2D"
5+
uid="uid://b5rpamdpcjrbj"
6+
path="res://.godot/imported/Note_Parasifly.png-3e72dc1cfeaf988046fea33e3d40a914.ctex"
7+
metadata={
8+
"vram_texture": false
9+
}
10+
11+
[deps]
12+
13+
source_file="res://Classes/Notes/Assets/Note_Parasifly.png"
14+
dest_files=["res://.godot/imported/Note_Parasifly.png-3e72dc1cfeaf988046fea33e3d40a914.ctex"]
15+
16+
[params]
17+
18+
compress/mode=0
19+
compress/high_quality=false
20+
compress/lossy_quality=0.7
21+
compress/hdr_compression=1
22+
compress/normal_map=0
23+
compress/channel_pack=0
24+
mipmaps/generate=false
25+
mipmaps/limit=-1
26+
roughness/mode=0
27+
roughness/src_normal=""
28+
process/fix_alpha_border=true
29+
process/premult_alpha=false
30+
process/normal_map_invert_y=false
31+
process/hdr_as_srgb=false
32+
process/hdr_clamp_exposure=false
33+
process/size_limit=0
34+
detect_3d/compress_to=1

Classes/StatusEffects/StatusEffect.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public StatusEffect InitStatus(
116116
return this;
117117
}
118118

119-
public StatusEffect GetInstance(int count = 1)
119+
public StatusEffect CreateInstance(int count = 1)
120120
{
121121
StatusEffect result = GD.Load<PackedScene>(LoadPath).Instantiate<StatusEffect>();
122122
result.SetCount(count);

Globals/FunkEngineNameSpace.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ public enum Stages
259259
{
260260
Battle = 0,
261261
Chest = 1,
262+
Elite = 2,
263+
Event = 3,
264+
Shop = 4,
262265
Boss,
263266
Quit,
264267
Map,
@@ -288,6 +291,7 @@ public class MapGrid
288291
private int[,] _map;
289292
private Room[] _rooms;
290293
private int _curIdx;
294+
public int Width { get; private set; }
291295

292296
public Room[] GetRooms()
293297
{
@@ -327,6 +331,7 @@ public void AddChild(int newIdx)
327331
*/
328332
public void InitMapGrid(MapLevels.MapConfig curConfig)
329333
{
334+
Width = curConfig.Width;
330335
_curIdx = 0;
331336
_rooms = [];
332337
_map = new int[curConfig.Width, curConfig.Height]; //x,y
@@ -387,7 +392,7 @@ private Stages PickRoomType(int x, int y, MapLevels.MapConfig curConfig)
387392
}
388393
}
389394
int idx = (int)StageProducer.GlobalRng.RandWeighted(validRooms);
390-
return MapLevels.MapConfig.StagsToRoll[idx];
395+
return MapLevels.MapConfig.StagesToRoll[idx];
391396
}
392397

393398
//Asserts that if there is a room at the same x, but y+1 they are connected

Globals/Scribe.cs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Linq;
34
using FunkEngine;
@@ -96,7 +97,7 @@ public partial class Scribe : Node
9697
{
9798
if (timing == Timing.Miss)
9899
return;
99-
director.AddStatus(Targetting.Player, StatusEffect.Block.GetInstance()); //todo: should scale with timing????
100+
director.AddStatus(Targetting.Player, StatusEffect.Block.CreateInstance()); //todo: should scale with timing????
100101
}
101102
),
102103
new Note(
@@ -135,7 +136,7 @@ public partial class Scribe : Node
135136
{
136137
if (timing == Timing.Miss)
137138
return;
138-
director.AddStatus(Targetting.First, StatusEffect.Poison.GetInstance((int)timing));
139+
director.AddStatus(Targetting.First, StatusEffect.Poison, (int)timing);
139140
}
140141
),
141142
new Note(
@@ -178,6 +179,32 @@ public partial class Scribe : Node
178179
);
179180
}
180181
),
182+
new Note(
183+
13,
184+
"Parasifly",
185+
GD.Load<Texture2D>("res://Classes/Notes/Assets/Note_Parasifly.png"),
186+
1,
187+
(director, note, timing) =>
188+
{
189+
int amt = Math.Max((3 - (int)timing) * note.GetBaseVal(), 0);
190+
director.AddStatus(Targetting.All, StatusEffect.Block, amt);
191+
}
192+
),
193+
new Note(
194+
14,
195+
"BossBlood",
196+
GD.Load<Texture2D>("res://Classes/Notes/Assets/Note_BossBlood.png"),
197+
2,
198+
(director, note, timing) =>
199+
{
200+
int dmg = (3 - (int)timing) * note.GetBaseVal();
201+
director.DealDamage(note, dmg, note.Owner);
202+
if (dmg > 0)
203+
note.Owner.Heal((3 - (int)timing));
204+
},
205+
default,
206+
Targetting.Player
207+
),
181208
};
182209

183210
public static readonly RelicTemplate[] RelicDictionary = new[]
@@ -395,7 +422,7 @@ public partial class Scribe : Node
395422
e is BattleDirector.Harbinger.OnDamageInstanceArgs dmgArgs
396423
&& dmgArgs.Dmg.Target == e.BD.Player
397424
&& dmgArgs.Dmg.Damage > 0
398-
&& e.BD.Player.HasStatus(StatusEffect.Block.GetInstance())
425+
&& e.BD.Player.HasStatus(StatusEffect.Block.CreateInstance())
399426
)
400427
{
401428
e.BD.DealDamage(Targetting.First, val, null);

Globals/StageProducer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public void PreloadScene(int nextRoomIdx)
131131
Config = MakeBattleConfig(nextStage, nextRoomIdx);
132132
switch (nextStage)
133133
{
134+
case Stages.Elite:
134135
case Stages.Battle:
135136
case Stages.Boss:
136137
_loadTask = Task.Run(() =>
@@ -139,6 +140,8 @@ public void PreloadScene(int nextRoomIdx)
139140
.Instantiate<Node>();
140141
});
141142
break;
143+
case Stages.Shop:
144+
case Stages.Event:
142145
case Stages.Chest:
143146
_loadTask = Task.Run(() =>
144147
{
@@ -162,6 +165,9 @@ public void TransitionStage(Stages nextStage, int nextRoomIdx = -1)
162165
break;
163166
case Stages.Battle: //Currently these are only ever entered from map. Be aware if we change
164167
case Stages.Boss: //this, scenes either need to be preloaded first, or a different setup is needed.
168+
case Stages.Event:
169+
case Stages.Elite:
170+
case Stages.Shop:
165171
case Stages.Chest:
166172
_loadTask.Wait(); //Should always finish by the time it gets here, this guarantees it.
167173
GetTree().GetCurrentScene().Free();
@@ -217,13 +223,22 @@ private BattleConfig MakeBattleConfig(Stages nextRoom, int nextRoomIdx)
217223
.SongDictionary[CurLevel.NormalBattles[songIdx]]
218224
.EnemyScenePath;
219225
break;
226+
case Stages.Elite:
227+
int elitIdx = stageRng.RandiRange(0, CurLevel.EliteBattles.Length - 1);
228+
result.CurSong = Scribe.SongDictionary[CurLevel.EliteBattles[elitIdx]];
229+
result.EnemyScenePath = Scribe
230+
.SongDictionary[CurLevel.EliteBattles[elitIdx]]
231+
.EnemyScenePath;
232+
break;
220233
case Stages.Boss:
221234
int bossIdx = stageRng.RandiRange(0, CurLevel.BossBattles.Length - 1);
222235
result.CurSong = Scribe.SongDictionary[CurLevel.BossBattles[bossIdx]];
223236
result.EnemyScenePath = Scribe
224237
.SongDictionary[CurLevel.BossBattles[bossIdx]]
225238
.EnemyScenePath;
226239
break;
240+
case Stages.Event:
241+
case Stages.Shop:
227242
case Stages.Chest:
228243
break;
229244
default:
@@ -259,6 +274,7 @@ public static bool IsMoreLevels()
259274

260275
public void ProgressLevels()
261276
{
277+
GD.Print(CurLevel.Id);
262278
CurLevel = CurLevel.GetNextLevel();
263279

264280
Map = new();

0 commit comments

Comments
 (0)