Skip to content

Commit

Permalink
feat: correct smoke dissolve time
Browse files Browse the repository at this point in the history
  • Loading branch information
thirdmadman committed Oct 7, 2023
1 parent 2d4ddca commit f9d68ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/app/data/UnitTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,14 @@ export const UnitTypesArray = [
unitIsFlammable: false,
unitDefaultFlameSustainability: 1,
unitDefaultFireHP: 0,
unitDefaultHealth: 10,
unitDefaultHealth: 100,
unitDurability: 0,
unitDensity: 0.00061,
unitDefaultColor: {
minRandomColor: 0x0a,
maxRandomColor: 0x52,
maxRandomColor: 0x10,
colorShiftNumbers: 0xfff,
baseColor: 0x818181 + 0x99000000,
baseColor: 0x818181 + 0x77000000,
},
unitTransformations: {
toFreeze: null,
Expand Down
7 changes: 6 additions & 1 deletion src/app/engine/PhysicEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ export class PhysicEngine {
const isToDestroy = currentWorld[x][y]?.unitTypeName === 'gray-smoke'
&& currentWorld[x][y + 1]?.getUnitType().unitIsStatic;

if (isToDestroy) currentWorld[x][y]!.unitState.unitHealth -= 1;
if (isToDestroy) {
const random = getRandomInt(0, currentWorld[x][y]?.getUnitType().unitDefaultHealth || 1);
if (random >= (currentWorld[x][y]?.unitState?.unitHealth || 1)) {
currentWorld[x][y]!.unitState.unitHealth -= 1;
}
}

if (isUpperEmpty) {
replaceUnit(x, y, x, y + 1);
Expand Down

0 comments on commit f9d68ef

Please sign in to comment.