Skip to content

Commit

Permalink
trophy and statue names; faster deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Oct 8, 2023
1 parent 4624433 commit 1db2005
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 57 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Deploy
on: [push, pull_request]

jobs:
Ubuntu:
name: ubuntu-${{ matrix.os-version }}-${{ matrix.build-config }}-${{ matrix.compiler.cc }}
runs-on: ubuntu-${{ matrix.os-version }}.04
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
strategy:
fail-fast: false
matrix:
os-version: [22]
build-config: [release]
compiler:
- {
cc: clang-14,
cxx: clang++-14,
install: clang-14
}

steps:
- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y xorg-dev nasm ${{ matrix.compiler.install }}
- name: Versions
run: |
cmake --version
${{ matrix.compiler.cc }} --version
${{ matrix.compiler.cxx }} --version
git --version
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build-config }} ..
- name: Build
run: |
cd build
cmake --build . --config ${{ matrix.build-config }} -- -j3
- name: Upload Artifact
if: matrix.build-config == 'release' && matrix.compiler.cc == 'clang-14'
uses: actions/upload-artifact@v3
with:
name: dntgenerator
path: |
build/result/${{ matrix.build-config }}/libcage-core.so
build/result/${{ matrix.build-config }}/dntgenerator
20 changes: 1 addition & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ jobs:
cd build/result/${{ matrix.build-config }}
./dntgenerator.exe -s 20 -e 22 -m 30
- name: Upload Artifact
if: matrix.os-version == '2019' && matrix.build-config == 'release'
uses: actions/upload-artifact@v3
with:
name: dntgenerator
path: |
build/result/${{ matrix.build-config }}/cage-core.dll
build/result/${{ matrix.build-config }}/dntgenerator.exe
Ubuntu:
name: ubuntu-${{ matrix.os-version }}-${{ matrix.build-config }}-${{ matrix.compiler.cc }}
Expand Down Expand Up @@ -109,15 +100,6 @@ jobs:
cd build/result/${{ matrix.build-config }}
./dntgenerator -s 20 -e 22 -m 30
- name: Upload Artifact
if: matrix.build-config == 'release' && matrix.compiler.cc == 'clang-14'
uses: actions/upload-artifact@v3
with:
name: dntgenerator
path: |
build/result/${{ matrix.build-config }}/libcage-core.so
build/result/${{ matrix.build-config }}/dntgenerator
- name: List Icons
if: matrix.build-config == 'release' && matrix.compiler.cc == 'gcc-13'
shell: bash
Expand All @@ -136,7 +118,7 @@ jobs:
if: matrix.build-config == 'release' && matrix.compiler.cc == 'gcc-13'
uses: actions/upload-artifact@v3
with:
name: dntgenerator
name: dnticons
path: |
build/result/${{ matrix.build-config }}/icons.txt
build/result/${{ matrix.build-config }}/icons_decoration.txt
Expand Down
38 changes: 4 additions & 34 deletions sources/generateFloor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Item itemShop(uint32 maxLevel);
Item itemPrimitive(SlotEnum slot);
Item itemSprayCan();
Monster monsterGeneric(const Generate &generate);
std::string floorBossName(uint32 level);
Decoration floorBossStatue(uint32 bossIndex);
Decoration floorBossTrophy(uint32 bossIndex);
Monster monsterChest(const Generate &generate);
Monster monsterFloorBoss(uint32 level);
Holder<PointerRange<Monster>> generateAntiHeroes();
Expand Down Expand Up @@ -587,37 +588,6 @@ namespace
}
}

Decoration floorBossPedestalDecoration(uint32 bossIndex)
{
switch (bossIndex)
{
case 1:
return Decoration{ "sword" };
case 2:
return Decoration{ "bow" };
case 3:
return Decoration{ "scythe" };
case 4:
return Decoration{ "magic" };
case 5:
return Decoration{ "duration" };
case 6:
return Decoration{ "support" };
case 7:
return Decoration{ "poison" };
case 8:
return Decoration{ "ground" };
case 9:
return Decoration{ "stun" };
case 10:
return Decoration{ "summon" };
case 11:
return Decoration{ "electric" };
default:
return Decoration{ "scroll", "Certificate of excellence" };
}
}

void generateShopFloor(Floor &f, uint32 maxLevel)
{
const uint32 portals = levelToBossIndex(maxLevel - 1);
Expand Down Expand Up @@ -665,9 +635,9 @@ namespace
f.tile(x, h / 2) = TileEnum::Waypoint;
f.extra(x, h / 2).push_back(Waypoint{ bossIndexToLevel(i) + 1 });
f.tile(x, 2) = TileEnum::Decoration;
f.extra(x, 2).push_back(Decoration{ "trophy", floorBossName(bossIndexToLevel(i)) });
f.extra(x, 2).push_back(floorBossStatue(i));
f.tile(x, 6) = TileEnum::Decoration;
f.extra(x, 6).push_back(floorBossPedestalDecoration(i));
f.extra(x, 6).push_back(floorBossTrophy(i));
}

if (maxLevel > 100)
Expand Down
4 changes: 2 additions & 2 deletions sources/generateItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace
{
Candidates<void (*)(Item &)> candidates(item.generate);
candidates.slotMismatchPenalty = 0.5;
candidates.randomness = 1.5;
candidates.randomness = 2.0;

candidates.add(0, 0, 0, H, SlotEnum::MainHand, { Nothing }, addBoost<AttributeEnum::Strength>);
candidates.add(0, 1, 0, H, SlotEnum::MainHand, { Nothing }, addBoost<AttributeEnum::Dexterity>);
Expand Down Expand Up @@ -89,7 +89,7 @@ namespace
{
Candidates<void (*)(Item &)> candidates(item.generate);
candidates.slotMismatchPenalty = 0.5;
candidates.randomness = 1.5;
candidates.randomness = 2.0;

candidates.add(0, 0, H, H, SlotEnum::MainHand, { Nothing }, addRequirement<AttributeEnum::Strength>);
candidates.add(0, 1, H, H, SlotEnum::MainHand, { Nothing }, addRequirement<AttributeEnum::Dexterity>);
Expand Down
50 changes: 48 additions & 2 deletions sources/generateMonsters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace
if (available == 0)
return;

const Real damageWeight = 2 - mr.generate.support;
std::map<AttributeEnum, Real> weights;
for (const Item &it : mr.equippedItems)
{
Expand All @@ -61,7 +62,7 @@ namespace
for (const auto &a : sk.duration)
weights[a.first] += max(a.second, 0);
for (const auto &a : sk.damageAmount)
weights[a.first] += max(a.second, 0) * 1.5;
weights[a.first] += max(a.second, 0) * damageWeight;
for (const auto &a : sk.caster.attributes)
for (const auto &b : a.second)
weights[b.first] += max(b.second, 0);
Expand Down Expand Up @@ -948,6 +949,51 @@ std::string floorBossName(uint32 level)
return (Stringizer() + "Guardian Of " + level + "th Floor").value.c_str();
}

namespace
{
const char *floorBossIconImpl(uint32 bossIndex)
{
switch (bossIndex)
{
case 1:
return "Sword";
case 2:
return "Bow";
case 3:
return "Scythe";
case 4:
return "Magic";
case 5:
return "Duration";
case 6:
return "Support";
case 7:
return "Poison";
case 8:
return "Ground";
case 9:
return "Stun";
case 10:
return "Summon";
case 11:
return "Electric";
default:
return "Scroll";
}
}

}

Decoration floorBossStatue(uint32 bossIndex)
{
return Decoration{ String("statue") + floorBossIconImpl(bossIndex), floorBossName(bossIndexToLevel(bossIndex)) };
}

Decoration floorBossTrophy(uint32 bossIndex)
{
return Decoration{ String("trophy") + floorBossIconImpl(bossIndex), floorBossIconImpl(bossIndex) };
}

Monster monsterFloorBoss(uint32 level)
{
const auto &levelSwitch = [level](uint32 floor) -> Real
Expand All @@ -969,7 +1015,7 @@ Monster monsterFloorBoss(uint32 level)

Monster mr = generateMonsterImpl(g, &selectOutlawMonster);
mr.attributes[AttributeEnum::Life] *= 5;
mr.icon = "guardian";
mr.icon = Stringizer() + "guardian" + floorBossIconImpl(levelToBossIndex(level));
mr.algorithm = "guardian";
mr.faction = "monster";

Expand Down

0 comments on commit 1db2005

Please sign in to comment.