Skip to content

Commit

Permalink
Disable Bubble wrap power for Command invasions.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 24473a4052258410fabdc3db9bb1eac211e6f4ad
  • Loading branch information
cpojer committed Nov 1, 2024
1 parent a476ba2 commit 161f617
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 8 deletions.
5 changes: 2 additions & 3 deletions apollo/Effects.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getSkillConfig } from '@deities/athena/info/Skill.tsx';
import {
PlayerIDs,
PlayerIDSet,
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
15 changes: 15 additions & 0 deletions apollo/invasions/shouldActivateCrystalPower.tsx
Original file line number Diff line number Diff line change
@@ -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))
);
}
3 changes: 3 additions & 0 deletions athena/info/Skill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export enum SkillGroup {

const activateOnInvasion = true;
const requiresCrystal = true;
const ignoreCommandCrystal = true;

const skillConfig: Record<
Skill,
Expand All @@ -119,6 +120,7 @@ const skillConfig: Record<
charges?: number;
cost: number | null;
group: SkillGroup;
ignoreCommandCrystal?: true;
requiresCrystal?: true;
}>
> = {
Expand Down Expand Up @@ -265,6 +267,7 @@ const skillConfig: Record<
charges: 8,
cost: 1500,
group: SkillGroup.Invasion,
ignoreCommandCrystal,
},
[Skill.Charge]: {
activateOnInvasion,
Expand Down
27 changes: 22 additions & 5 deletions hera/ui/SkillDescription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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';

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -1077,9 +1084,19 @@ export default memo(function SkillDescription({
Crystal:
</fbt>
</span>{' '}
<fbt desc="Description for skill behavior">
This power activates when you consume a crystal.
</fbt>
{ignoreCommandCrystal ? (
<fbt desc="Description for skill behavior">
Consume any crystal except a{' '}
<fbt:param name="crystalName">
{getTranslatedCrystalName(Crystal.Command)}
</fbt:param>{' '}
to activate this power.
</fbt>
) : (
<fbt desc="Description for skill behavior">
Consume a crystal to activate this power.
</fbt>
)}
</div>
) : null,
isPower && requiresCrystal ? (
Expand Down

0 comments on commit 161f617

Please sign in to comment.