{
    onBeforeTurn(pokemon) {
        for (const side of this.sides) {
            if (side.hasAlly(pokemon)) continue;
            side.addSideCondition('shadowtag', pokemon);
            const data = side.getSideConditionData('shadowtag');
            if (!data.sources) {
                data.sources = [];
            }
            data.sources.push(pokemon);
        }
    },
    onBasePower(relayVar, source, target, move) {
        if (target.beingCalledBack || target.switchFlag) {
            this.debug('Pursuit damage boost');
            return move.basePower * 2;
        }
        return move.basePower;
    },
    condition: {
        duration: 1,
        onBeforeSwitchOut(pokemon) {
            const move = this.queue.willMove(pokemon.foes()[0]);
            const moveName = move && move.moveid ? move.moveid.toString() : "";
            this.debug('Pursuit start');
            let alreadyAdded = false;
            pokemon.removeVolatile('destinybond');
            for (const source of this.effectState.sources) {
                if (!source.isAdjacent(pokemon) || !this.queue.cancelMove(source) || !source.hp) continue;
                if (!alreadyAdded) {
                    this.add('-activate', pokemon.foes()[0], 'ability: Shadow Tag');
                    alreadyAdded = true;
                }
                if (source.canMegaEvo || source.canUltraBurst) {
                    for (const [actionIndex, action] of this.queue.entries()) {
                        if (action.pokemon === source && action.choice === 'megaEvo') {
                            this.actions.runMegaEvo(source);
                            this.queue.list.splice(actionIndex, 1);
                            break;
                        }
                    }
                }
                this.actions.runMove(moveName, source, source.getLocOf(pokemon));
            }
        },
    },
    flags: {},
    name: "Shadow Tag",
    rating: 5,
    num: 23
}
