diff --git a/apollo/Effects.tsx b/apollo/Effects.tsx index e4a7be3f..e7d04d43 100644 --- a/apollo/Effects.tsx +++ b/apollo/Effects.tsx @@ -1,4 +1,3 @@ -import { getSkillConfig } from '@deities/athena/info/Skill.tsx'; import { PlayerIDs, PlayerIDSet, @@ -27,6 +26,7 @@ import { EncodedActions, EncodedConditions, } from './EncodedActions.tsx'; +import shouldActivateCrystalPower from './invasions/shouldActivateCrystalPower.tsx'; import getActivatePowerActionResponse from './lib/getActivatePowerActionResponse.tsx'; import transformEffectValue from './lib/transformEffectValue.tsx'; import { GameStateWithEffects } from './Types.tsx'; @@ -99,8 +99,7 @@ const handleDefaultEffects = ( ) { const currentPlayer = activeMap.getCurrentPlayer(); for (const skill of currentPlayer.skills) { - const { activateOnInvasion } = getSkillConfig(skill); - if (activateOnInvasion) { + if (shouldActivateCrystalPower(currentPlayer, skill)) { const activatePowerActionResponse = getActivatePowerActionResponse( activeMap, currentPlayer.id, diff --git a/apollo/invasions/shouldActivateCrystalPower.tsx b/apollo/invasions/shouldActivateCrystalPower.tsx new file mode 100644 index 00000000..c30221f4 --- /dev/null +++ b/apollo/invasions/shouldActivateCrystalPower.tsx @@ -0,0 +1,15 @@ +import { getSkillConfig, Skill } from '@deities/athena/info/Skill.tsx'; +import { Crystal } from '@deities/athena/invasions/Crystal.tsx'; +import Player, { isHumanPlayer } from '@deities/athena/map/Player.tsx'; + +export default function shouldActivateCrystalPower( + player: Player, + skill: Skill, +) { + const { activateOnInvasion, ignoreCommandCrystal } = getSkillConfig(skill); + return ( + activateOnInvasion && + (!ignoreCommandCrystal || + (isHumanPlayer(player) && player.crystal !== Crystal.Command)) + ); +} diff --git a/athena/info/Skill.tsx b/athena/info/Skill.tsx index 04d08168..3b213d4a 100644 --- a/athena/info/Skill.tsx +++ b/athena/info/Skill.tsx @@ -110,6 +110,7 @@ export enum SkillGroup { const activateOnInvasion = true; const requiresCrystal = true; +const ignoreCommandCrystal = true; const skillConfig: Record< Skill, @@ -119,6 +120,7 @@ const skillConfig: Record< charges?: number; cost: number | null; group: SkillGroup; + ignoreCommandCrystal?: true; requiresCrystal?: true; }> > = { @@ -265,6 +267,7 @@ const skillConfig: Record< charges: 8, cost: 1500, group: SkillGroup.Invasion, + ignoreCommandCrystal, }, [Skill.Charge]: { activateOnInvasion, diff --git a/hera/ui/SkillDescription.tsx b/hera/ui/SkillDescription.tsx index 3585c52b..bd0a6800 100644 --- a/hera/ui/SkillDescription.tsx +++ b/hera/ui/SkillDescription.tsx @@ -53,6 +53,7 @@ import { UnitInfo, Zombie, } from '@deities/athena/info/Unit.tsx'; +import { Crystal } from '@deities/athena/invasions/Crystal.tsx'; import { Biome } from '@deities/athena/map/Biome.tsx'; import { AnimationConfig, @@ -78,6 +79,7 @@ import WarningBox from '@iconify-icons/pixelarticons/warning-box.js'; import { Fragment, memo } from 'react'; import BuildingTile from '../Building.tsx'; import intlList, { Conjunctions, Delimiters } from '../i18n/intlList.tsx'; +import getTranslatedCrystalName from '../invasions/getTranslatedCrystalName.tsx'; import getTranslatedTileTypeName from '../lib/getTranslatedTileTypeName.tsx'; import UnitTile from '../Unit.tsx'; @@ -965,8 +967,13 @@ export default memo(function SkillDescription({ }) { const isRegular = type === 'regular'; const isPower = !isRegular; - const { activateOnInvasion, campaignOnly, charges, requiresCrystal } = - getSkillConfig(skill); + const { + activateOnInvasion, + campaignOnly, + charges, + ignoreCommandCrystal, + requiresCrystal, + } = getSkillConfig(skill); if ((charges == null || charges === 0) && isPower) { return null; } @@ -1077,9 +1084,19 @@ export default memo(function SkillDescription({ Crystal: {' '} - - This power activates when you consume a crystal. - + {ignoreCommandCrystal ? ( + + Consume any crystal except a{' '} + + {getTranslatedCrystalName(Crystal.Command)} + {' '} + to activate this power. + + ) : ( + + Consume a crystal to activate this power. + + )} ) : null, isPower && requiresCrystal ? (