Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Oct 10, 2023
1 parent 6911e95 commit 7e52eaf
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/game/scenes/system/interface/building-info/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

export const Wrapper = styled.div`
@media ${INTERFACE_DESKTOP_BREAKPOINT} {
width: 260px;
width: 280px;
position: absolute;
transform: translate(-50%, -100%);
margin-top: -32px;
Expand Down
12 changes: 6 additions & 6 deletions src/game/scenes/system/interface/building-params/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const Param = styled.div`
`;

export const IconContainer = styled.div`
width: 34px;
height: 34px;
width: 30px;
height: 30px;
background: ${InterfaceBackgroundColor.BLACK_TRANSPARENT_50};
display: flex;
align-items: center;
Expand All @@ -40,8 +40,8 @@ export const IconContainer = styled.div`
`;

export const Icon = styled.img`
width: 15px;
height: 15px;
width: 14px;
height: 14px;
`;

export const Info = styled.div<{
Expand All @@ -56,8 +56,8 @@ export const Info = styled.div<{

export const Label = styled.div`
font-family: ${InterfaceFont.PIXEL_TEXT};
font-size: 10px;
line-height: 10px;
font-size: 9px;
line-height: 9px;
opacity: 0.75;
margin: -1px 0 2px 0;
@media ${INTERFACE_MOBILE_BREAKPOINT} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { IWorld } from '~type/world';
import { EffectAudio, EffectTexture } from '~type/world/effects';
import { EntityType } from '~type/world/entities';
import { IBuilding } from '~type/world/entities/building';
import { EnemyVariantData, EnemyTexture, IEnemyTarget } from '~type/world/entities/npc/enemy';
import {
EnemyVariantData, EnemyTexture, IEnemyTarget, IEnemy,
} from '~type/world/entities/npc/enemy';

import { Enemy } from '../enemy';

Expand Down Expand Up @@ -45,20 +47,21 @@ export class EnemyExplosive extends Enemy {
},
});

const targets: IEnemyTarget[] = this.scene.getEntities<IBuilding>(EntityType.BUILDING);
let targets: IEnemyTarget[] = [this.scene.player];

targets.push(this.scene.player);
targets = targets.concat(this.scene.getEntities<IEnemy>(EntityType.ENEMY));
targets = targets.concat(this.scene.getEntities<IBuilding>(EntityType.BUILDING));

targets.forEach((target) => {
const distance = getIsometricDistance(position, target.getPositionOnGround());
if (target !== this) {
const distance = getIsometricDistance(position, target.getPositionOnGround());

if (distance >= radius) {
return;
}

const damageByDistance = this.damage * (1 - (distance / radius)) * 0.5;
if (distance < radius) {
const damageByDistance = this.damage * (1 - (distance / radius)) * 0.5;

target.live.damage(damageByDistance);
target.live.damage(damageByDistance);
}
}
});

this.scene.sound.play(EffectAudio.EXPLOSION);
Expand Down
2 changes: 1 addition & 1 deletion src/types/world/entities/building.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export enum BuildingIcon {
DAMAGE = 'building/icons/params/damage',
RESOURCES = 'building/icons/params/resources',
SPEED = 'building/icons/params/speed',
DELAY = 'building/icons/params/pause',
DELAY = 'building/icons/params/delay',
}

export enum BuildingAudio {
Expand Down
2 changes: 1 addition & 1 deletion src/types/world/entities/npc/enemy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface IEnemyFactory {
new (scene: IWorld, data: EnemyVariantData): IEnemy
}

export interface IEnemyTarget extends Vector2D {
export interface IEnemyTarget {
readonly live: ILive
getPositionOnGround(): Vector2D
}
Expand Down

0 comments on commit 7e52eaf

Please sign in to comment.