import { FLAG_MEDIA_NAME, PowerUp } from '../domains';

export const allPowerUps: PowerUp[] = [
  {
    id: 'battle-god',
    name: 'Battle God',
    imageName: 'power-up-battle-god.png',
    description: 'Increase speed, slow down enemies near, enable shortcuts',
    level: 5,
    shield: {
      duration: 5,
    },
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_HELMET,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'speed',
        action: 'change',
        params: {
          speed: '$kart.configuredSpeed * 2',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Star Effect',
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_god_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'leftStarBackLaser',
        action: 'action',
        params: {
          laserAction: 'Init Attack',
          starAction: 'Init Attack',
        },
      },
      {
        module: 'rightStarFrontLaser',
        action: 'action',
        params: {
          laserAction: 'Init Attack',
          starAction: 'Init Attack',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.BR_CHANGE_COLOR,
          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  {
    id: 'battle-nitro',
    name: 'Battle Nitro',
    imageName: 'power-up-battle-nitro.png',
    description: 'Double the speed of the user for 2 seconds.',
    level: 1,
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_EXHAUST,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'speed',
        action: 'change',
        params: {
          speed: '$kart.configuredSpeed * 2',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Speed Boost Effect',
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_turbo_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.NITRO_BOTTLE,
          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  {
    id: 'battle-pulse',
    name: 'Battle Pulse',
    imageName: 'power-up-battle-pulse.png',
    description: 'Slow down all the enemies for 2 seconds.',
    level: 5,
    networkDamage: {
      name: 'Pulse Hit',
      target: 'All',
    },
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_LIGHTNING,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Ray Effect',
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_pulse_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.THUNDER_EXPLOSION,
          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  {
    id: 'battle-shield',
    name: 'Battle Shield',
    imageName: 'power-up-battle-shield.png',
    description: 'A shield that blocks all the damage.',
    level: 4,
    shield: {
      duration: 5,
    },
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_SHIELD,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Shield Effect',
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_shield_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.SHIELD_BLUE_TO_PINK,
          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  {
    id: 'battle-shot',
    name: 'Battle Shot',
    imageName: 'power-up-battle-shot.png',
    description: 'Slow Down Specifc Enemy for 2 seconds.',
    level: 3,
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
      {
        module: 'diskSensorBallShooter',
        action: 'prepareShooter',
      },
    ],
    activationCommands: [
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Ball Shot Effect',
        },
      },
      {
        module: 'diskSensorBallShooter',
        action: 'shootBall',
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_shot_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.FIREBALL,

          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  {
    id: 'battle-trap',
    name: 'Battle Trap',
    imageName: 'power-up-battle-trap.png',
    description: 'Slow Down Specifc Enemy for 3 seconds.',
    level: 2,
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_OIL_DROP,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },

      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'ballSensorDiskThrower',
        action: 'throwDisk',
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'battle_trap_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.OIL_DROP_COLORS,

          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
  // TODO: Change The media names
  {
    id: 'battle-blue-shot',
    name: 'Battle Blue Shot',
    imageName: 'power-up-battle-blue-shot.png',
    description: 'Deal shot hit damage to the first player in the race.',
    level: 4,
    networkDamage: {
      name: 'Blue Shot Hit',
      target: 'First',
    },
    assignationCommands: [
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
          screens: {
            left: true,
            right: true,
            back: true,
            front: true,
          },
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          soundName: 'power_up_selection.mp3',
        },
      },
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Roulette Effect',
        },
      },
    ],
    activationCommands: [
      {
        module: 'rgb',
        action: 'showEffect',
        params: {
          effect: 'Ray Effect',
        },
      },
      {
        module: 'sound',
        action: 'play',
        params: {
          // TODO: Change to blue shot activation
          soundName: 'battle_shot_activation.mp3',
          durationMs: '$kart.powerUpTime * 1000',
        },
      },
      {
        module: 'flag',
        action: 'showMediaTemporarily',
        params: {
          // TODO: Change to blue shot
          mediaSourceName: FLAG_MEDIA_NAME.STATIC_FIREBALL,
          screens: {
            left: true,
            right: true,
            front: true,
            back: true,
          },
        },
      },
    ],
  },
];

export const defaultPowerUps: PowerUp[] = allPowerUps.filter((powerUp) =>
  ['battle-god', 'battle-pulse', 'battle-shield', 'battle-nitro', 'battle-blue-shot'].includes(powerUp.id),
);
