diff --git a/athena/lib/getSabotageableVectors.tsx b/athena/lib/getSabotageableVectors.tsx index 069a65d7..25973cc7 100644 --- a/athena/lib/getSabotageableVectors.tsx +++ b/athena/lib/getSabotageableVectors.tsx @@ -2,17 +2,19 @@ import { Ability } from '../info/Unit.tsx'; import Vector from '../map/Vector.tsx'; import MapData from '../MapData.tsx'; -export default function getSabotageableVectors(map: MapData, position: Vector) { +export default function getSabotageableVectors( + map: MapData, + position: Vector, +): ReadonlySet { const unitA = map.units.get(position); - const sabotageTypes = unitA?.info.configuration.sabotageTypes; return new Set( - sabotageTypes && unitA.info.hasAbility(Ability.Sabotage) + unitA?.info.hasAbility(Ability.Sabotage) ? position.adjacent().filter((vector) => { const unitB = map.units.get(vector); return ( unitB && map.isOpponent(unitB, unitA) && - sabotageTypes.has(unitB.info.type) + unitA.info.canSabotageUnitType(unitB.info) ); }) : [], diff --git a/hera/Map.tsx b/hera/Map.tsx index 02366b9b..700d3e59 100644 --- a/hera/Map.tsx +++ b/hera/Map.tsx @@ -152,6 +152,7 @@ const MapComponent = ({ radius && ((hasRadius && (radius.type === RadiusType.Attackable || + radius.type === RadiusType.Sabotage || radius.type === RadiusType.Defense || radius.type === RadiusType.Rescue || radius.type === RadiusType.Highlight)) || @@ -255,7 +256,8 @@ const MapComponent = ({ radius && (radius.type === RadiusType.Defense || radius.type === RadiusType.Rescue || - radius.type === RadiusType.Attackable)) + radius.type === RadiusType.Attackable || + radius.type === RadiusType.Sabotage)) ) } onAnimationComplete={onAnimationComplete} @@ -265,11 +267,13 @@ const MapComponent = ({ ? 'defense' : radius.type === RadiusType.Rescue ? 'rescue' - : radius.type !== RadiusType.Highlight - ? canAttackEntity(unit) - ? 'attack' + : radius.type === RadiusType.Sabotage + ? 'sabotage' + : radius.type !== RadiusType.Highlight + ? canAttackEntity(unit) + ? 'attack' + : undefined : undefined - : undefined : undefined } position={vector} diff --git a/hera/Radius.tsx b/hera/Radius.tsx index e939bc92..3d6ac639 100644 --- a/hera/Radius.tsx +++ b/hera/Radius.tsx @@ -25,6 +25,7 @@ export enum RadiusType { Lightning, Move, Rescue, + Sabotage, } export type RadiusInfo = Readonly<{ @@ -396,6 +397,7 @@ const colors: Record = { [RadiusType.Move]: css` ${vars.set('color', '19, 19, 209')} `, + [RadiusType.Sabotage]: ``, }; const alternateAttackStyle = css` diff --git a/hera/Unit.tsx b/hera/Unit.tsx index 1d9a2977..5779c04d 100644 --- a/hera/Unit.tsx +++ b/hera/Unit.tsx @@ -284,7 +284,7 @@ export default function UnitTile({ highlightStyle?: 'move' | 'idle' | 'idle-null' | 'move-null' | undefined; maybeOutline?: boolean; onAnimationComplete?: (position: Vector, animation: UnitAnimation) => void; - outline?: 'attack' | 'defense' | 'rescue' | undefined; + outline?: 'attack' | 'sabotage' | 'defense' | 'rescue' | undefined; position?: Vector; power?: boolean; requestFrame?: RequestFrameFunction; @@ -823,7 +823,7 @@ export default function UnitTile({ baseUnitStyle, player === 0 && neutralStyle, (maybeOutline || highlightOutline) && maybeOutlineStyle, - outline === 'attack' + outline === 'attack' || outline === 'sabotage' ? biome === Biome.Volcano || biome === Biome.Luna ? alternateAttackOutlineStyle : attackOutlineStyle diff --git a/hera/behavior/Sabotage.tsx b/hera/behavior/Sabotage.tsx index cb9be634..3e33b8e6 100644 --- a/hera/behavior/Sabotage.tsx +++ b/hera/behavior/Sabotage.tsx @@ -41,7 +41,7 @@ export default class Sabotage { radius: { fields, path: first ? [first] : null, - type: RadiusType.Attackable, + type: RadiusType.Sabotage, }, }; }