// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedInt;
import us.hebi.quickbuf.RepeatedMessage;
import us.hebi.quickbuf.Utf8String;

public final class BattleStatisticsOuterClass {
  /**
   * Protobuf type {@code BattleStatistics}
   */
  public static final class BattleStatistics extends ProtoMessage<BattleStatistics> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional double total_delay_cumulate = 5;</code>
     */
    private double totalDelayCumulate;

    /**
     * <code>optional double cost_time = 6;</code>
     */
    private double costTime;

    /**
     * <code>optional uint32 total_battle_turns = 1;</code>
     */
    private int totalBattleTurns;

    /**
     * <code>optional uint32 total_auto_turns = 2;</code>
     */
    private int totalAutoTurns;

    /**
     * <code>optional uint32 ultra_cnt = 4;</code>
     */
    private int ultraCnt;

    /**
     * <pre>
     * repeated MonsterBattleInfo monster_list = 8;
     * </pre>
     *
     * <code>optional uint32 round_cnt = 9;</code>
     */
    private int roundCnt;

    /**
     * <code>optional uint32 cocoon_dead_wave = 10;</code>
     */
    private int cocoonDeadWave;

    /**
     * <code>optional uint32 avatar_battle_turns = 11;</code>
     */
    private int avatarBattleTurns;

    /**
     * <code>optional uint32 monster_battle_turns = 12;</code>
     */
    private int monsterBattleTurns;

    /**
     * <code>optional uint32 challenge_score = 14;</code>
     */
    private int challengeScore;

    /**
     * <code>optional .BattleEndReason end_reason = 19;</code>
     */
    private int endReason;

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     */
    private final RepeatedInt avatarIdList = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     */
    private final RepeatedMessage<AvatarBattleInfoOuterClass.AvatarBattleInfo> battleAvatarList = RepeatedMessage.newEmptyInstance(AvatarBattleInfoOuterClass.AvatarBattleInfo.getFactory());

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     */
    private final RepeatedMessage<CustomValuesEntry> customValues = RepeatedMessage.newEmptyInstance(CustomValuesEntry.getFactory());

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     */
    private final RepeatedMessage<BattleTargetInfoEntry> battleTargetInfo = RepeatedMessage.newEmptyInstance(BattleTargetInfoEntry.getFactory());

    private BattleStatistics() {
    }

    /**
     * @return a new empty instance of {@code BattleStatistics}
     */
    public static BattleStatistics newInstance() {
      return new BattleStatistics();
    }

    /**
     * <code>optional double total_delay_cumulate = 5;</code>
     * @return whether the totalDelayCumulate field is set
     */
    public boolean hasTotalDelayCumulate() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional double total_delay_cumulate = 5;</code>
     * @return this
     */
    public BattleStatistics clearTotalDelayCumulate() {
      bitField0_ &= ~0x00000001;
      totalDelayCumulate = 0D;
      return this;
    }

    /**
     * <code>optional double total_delay_cumulate = 5;</code>
     * @return the totalDelayCumulate
     */
    public double getTotalDelayCumulate() {
      return totalDelayCumulate;
    }

    /**
     * <code>optional double total_delay_cumulate = 5;</code>
     * @param value the totalDelayCumulate to set
     * @return this
     */
    public BattleStatistics setTotalDelayCumulate(final double value) {
      bitField0_ |= 0x00000001;
      totalDelayCumulate = value;
      return this;
    }

    /**
     * <code>optional double cost_time = 6;</code>
     * @return whether the costTime field is set
     */
    public boolean hasCostTime() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional double cost_time = 6;</code>
     * @return this
     */
    public BattleStatistics clearCostTime() {
      bitField0_ &= ~0x00000002;
      costTime = 0D;
      return this;
    }

    /**
     * <code>optional double cost_time = 6;</code>
     * @return the costTime
     */
    public double getCostTime() {
      return costTime;
    }

    /**
     * <code>optional double cost_time = 6;</code>
     * @param value the costTime to set
     * @return this
     */
    public BattleStatistics setCostTime(final double value) {
      bitField0_ |= 0x00000002;
      costTime = value;
      return this;
    }

    /**
     * <code>optional uint32 total_battle_turns = 1;</code>
     * @return whether the totalBattleTurns field is set
     */
    public boolean hasTotalBattleTurns() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 total_battle_turns = 1;</code>
     * @return this
     */
    public BattleStatistics clearTotalBattleTurns() {
      bitField0_ &= ~0x00000004;
      totalBattleTurns = 0;
      return this;
    }

    /**
     * <code>optional uint32 total_battle_turns = 1;</code>
     * @return the totalBattleTurns
     */
    public int getTotalBattleTurns() {
      return totalBattleTurns;
    }

    /**
     * <code>optional uint32 total_battle_turns = 1;</code>
     * @param value the totalBattleTurns to set
     * @return this
     */
    public BattleStatistics setTotalBattleTurns(final int value) {
      bitField0_ |= 0x00000004;
      totalBattleTurns = value;
      return this;
    }

    /**
     * <code>optional uint32 total_auto_turns = 2;</code>
     * @return whether the totalAutoTurns field is set
     */
    public boolean hasTotalAutoTurns() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 total_auto_turns = 2;</code>
     * @return this
     */
    public BattleStatistics clearTotalAutoTurns() {
      bitField0_ &= ~0x00000008;
      totalAutoTurns = 0;
      return this;
    }

    /**
     * <code>optional uint32 total_auto_turns = 2;</code>
     * @return the totalAutoTurns
     */
    public int getTotalAutoTurns() {
      return totalAutoTurns;
    }

    /**
     * <code>optional uint32 total_auto_turns = 2;</code>
     * @param value the totalAutoTurns to set
     * @return this
     */
    public BattleStatistics setTotalAutoTurns(final int value) {
      bitField0_ |= 0x00000008;
      totalAutoTurns = value;
      return this;
    }

    /**
     * <code>optional uint32 ultra_cnt = 4;</code>
     * @return whether the ultraCnt field is set
     */
    public boolean hasUltraCnt() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 ultra_cnt = 4;</code>
     * @return this
     */
    public BattleStatistics clearUltraCnt() {
      bitField0_ &= ~0x00000010;
      ultraCnt = 0;
      return this;
    }

    /**
     * <code>optional uint32 ultra_cnt = 4;</code>
     * @return the ultraCnt
     */
    public int getUltraCnt() {
      return ultraCnt;
    }

    /**
     * <code>optional uint32 ultra_cnt = 4;</code>
     * @param value the ultraCnt to set
     * @return this
     */
    public BattleStatistics setUltraCnt(final int value) {
      bitField0_ |= 0x00000010;
      ultraCnt = value;
      return this;
    }

    /**
     * <pre>
     * repeated MonsterBattleInfo monster_list = 8;
     * </pre>
     *
     * <code>optional uint32 round_cnt = 9;</code>
     * @return whether the roundCnt field is set
     */
    public boolean hasRoundCnt() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <pre>
     * repeated MonsterBattleInfo monster_list = 8;
     * </pre>
     *
     * <code>optional uint32 round_cnt = 9;</code>
     * @return this
     */
    public BattleStatistics clearRoundCnt() {
      bitField0_ &= ~0x00000020;
      roundCnt = 0;
      return this;
    }

    /**
     * <pre>
     * repeated MonsterBattleInfo monster_list = 8;
     * </pre>
     *
     * <code>optional uint32 round_cnt = 9;</code>
     * @return the roundCnt
     */
    public int getRoundCnt() {
      return roundCnt;
    }

    /**
     * <pre>
     * repeated MonsterBattleInfo monster_list = 8;
     * </pre>
     *
     * <code>optional uint32 round_cnt = 9;</code>
     * @param value the roundCnt to set
     * @return this
     */
    public BattleStatistics setRoundCnt(final int value) {
      bitField0_ |= 0x00000020;
      roundCnt = value;
      return this;
    }

    /**
     * <code>optional uint32 cocoon_dead_wave = 10;</code>
     * @return whether the cocoonDeadWave field is set
     */
    public boolean hasCocoonDeadWave() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional uint32 cocoon_dead_wave = 10;</code>
     * @return this
     */
    public BattleStatistics clearCocoonDeadWave() {
      bitField0_ &= ~0x00000040;
      cocoonDeadWave = 0;
      return this;
    }

    /**
     * <code>optional uint32 cocoon_dead_wave = 10;</code>
     * @return the cocoonDeadWave
     */
    public int getCocoonDeadWave() {
      return cocoonDeadWave;
    }

    /**
     * <code>optional uint32 cocoon_dead_wave = 10;</code>
     * @param value the cocoonDeadWave to set
     * @return this
     */
    public BattleStatistics setCocoonDeadWave(final int value) {
      bitField0_ |= 0x00000040;
      cocoonDeadWave = value;
      return this;
    }

    /**
     * <code>optional uint32 avatar_battle_turns = 11;</code>
     * @return whether the avatarBattleTurns field is set
     */
    public boolean hasAvatarBattleTurns() {
      return (bitField0_ & 0x00000080) != 0;
    }

    /**
     * <code>optional uint32 avatar_battle_turns = 11;</code>
     * @return this
     */
    public BattleStatistics clearAvatarBattleTurns() {
      bitField0_ &= ~0x00000080;
      avatarBattleTurns = 0;
      return this;
    }

    /**
     * <code>optional uint32 avatar_battle_turns = 11;</code>
     * @return the avatarBattleTurns
     */
    public int getAvatarBattleTurns() {
      return avatarBattleTurns;
    }

    /**
     * <code>optional uint32 avatar_battle_turns = 11;</code>
     * @param value the avatarBattleTurns to set
     * @return this
     */
    public BattleStatistics setAvatarBattleTurns(final int value) {
      bitField0_ |= 0x00000080;
      avatarBattleTurns = value;
      return this;
    }

    /**
     * <code>optional uint32 monster_battle_turns = 12;</code>
     * @return whether the monsterBattleTurns field is set
     */
    public boolean hasMonsterBattleTurns() {
      return (bitField0_ & 0x00000100) != 0;
    }

    /**
     * <code>optional uint32 monster_battle_turns = 12;</code>
     * @return this
     */
    public BattleStatistics clearMonsterBattleTurns() {
      bitField0_ &= ~0x00000100;
      monsterBattleTurns = 0;
      return this;
    }

    /**
     * <code>optional uint32 monster_battle_turns = 12;</code>
     * @return the monsterBattleTurns
     */
    public int getMonsterBattleTurns() {
      return monsterBattleTurns;
    }

    /**
     * <code>optional uint32 monster_battle_turns = 12;</code>
     * @param value the monsterBattleTurns to set
     * @return this
     */
    public BattleStatistics setMonsterBattleTurns(final int value) {
      bitField0_ |= 0x00000100;
      monsterBattleTurns = value;
      return this;
    }

    /**
     * <code>optional uint32 challenge_score = 14;</code>
     * @return whether the challengeScore field is set
     */
    public boolean hasChallengeScore() {
      return (bitField0_ & 0x00000200) != 0;
    }

    /**
     * <code>optional uint32 challenge_score = 14;</code>
     * @return this
     */
    public BattleStatistics clearChallengeScore() {
      bitField0_ &= ~0x00000200;
      challengeScore = 0;
      return this;
    }

    /**
     * <code>optional uint32 challenge_score = 14;</code>
     * @return the challengeScore
     */
    public int getChallengeScore() {
      return challengeScore;
    }

    /**
     * <code>optional uint32 challenge_score = 14;</code>
     * @param value the challengeScore to set
     * @return this
     */
    public BattleStatistics setChallengeScore(final int value) {
      bitField0_ |= 0x00000200;
      challengeScore = value;
      return this;
    }

    /**
     * <code>optional .BattleEndReason end_reason = 19;</code>
     * @return whether the endReason field is set
     */
    public boolean hasEndReason() {
      return (bitField0_ & 0x00000400) != 0;
    }

    /**
     * <code>optional .BattleEndReason end_reason = 19;</code>
     * @return this
     */
    public BattleStatistics clearEndReason() {
      bitField0_ &= ~0x00000400;
      endReason = 0;
      return this;
    }

    /**
     * <code>optional .BattleEndReason end_reason = 19;</code>
     * @return the endReason
     */
    public BattleEndReasonOuterClass.BattleEndReason getEndReason() {
      return BattleEndReasonOuterClass.BattleEndReason.forNumber(endReason);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link BattleStatistics#getEndReason()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getEndReasonValue() {
      return endReason;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link BattleEndReasonOuterClass.BattleEndReason}. Setting an invalid value
     * can cause {@link BattleStatistics#getEndReason()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public BattleStatistics setEndReasonValue(final int value) {
      bitField0_ |= 0x00000400;
      endReason = value;
      return this;
    }

    /**
     * <code>optional .BattleEndReason end_reason = 19;</code>
     * @param value the endReason to set
     * @return this
     */
    public BattleStatistics setEndReason(final BattleEndReasonOuterClass.BattleEndReason value) {
      bitField0_ |= 0x00000400;
      endReason = value.getNumber();
      return this;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     * @return whether the avatarIdList field is set
     */
    public boolean hasAvatarIdList() {
      return (bitField0_ & 0x00000800) != 0;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     * @return this
     */
    public BattleStatistics clearAvatarIdList() {
      bitField0_ &= ~0x00000800;
      avatarIdList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableAvatarIdList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getAvatarIdList() {
      return avatarIdList;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutableAvatarIdList() {
      bitField0_ |= 0x00000800;
      return avatarIdList;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     * @param value the avatarIdList to add
     * @return this
     */
    public BattleStatistics addAvatarIdList(final int value) {
      bitField0_ |= 0x00000800;
      avatarIdList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 avatar_id_list = 3;</code>
     * @param values the avatarIdList to add
     * @return this
     */
    public BattleStatistics addAllAvatarIdList(final int... values) {
      bitField0_ |= 0x00000800;
      avatarIdList.addAll(values);
      return this;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     * @return whether the battleAvatarList field is set
     */
    public boolean hasBattleAvatarList() {
      return (bitField0_ & 0x00001000) != 0;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     * @return this
     */
    public BattleStatistics clearBattleAvatarList() {
      bitField0_ &= ~0x00001000;
      battleAvatarList.clear();
      return this;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableBattleAvatarList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<AvatarBattleInfoOuterClass.AvatarBattleInfo> getBattleAvatarList() {
      return battleAvatarList;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<AvatarBattleInfoOuterClass.AvatarBattleInfo> getMutableBattleAvatarList(
        ) {
      bitField0_ |= 0x00001000;
      return battleAvatarList;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     * @param value the battleAvatarList to add
     * @return this
     */
    public BattleStatistics addBattleAvatarList(
        final AvatarBattleInfoOuterClass.AvatarBattleInfo value) {
      bitField0_ |= 0x00001000;
      battleAvatarList.add(value);
      return this;
    }

    /**
     * <code>repeated .AvatarBattleInfo battle_avatar_list = 7;</code>
     * @param values the battleAvatarList to add
     * @return this
     */
    public BattleStatistics addAllBattleAvatarList(
        final AvatarBattleInfoOuterClass.AvatarBattleInfo... values) {
      bitField0_ |= 0x00001000;
      battleAvatarList.addAll(values);
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     * @return whether the customValues field is set
     */
    public boolean hasCustomValues() {
      return (bitField0_ & 0x00002000) != 0;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     * @return this
     */
    public BattleStatistics clearCustomValues() {
      bitField0_ &= ~0x00002000;
      customValues.clear();
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableCustomValues()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<CustomValuesEntry> getCustomValues() {
      return customValues;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<CustomValuesEntry> getMutableCustomValues() {
      bitField0_ |= 0x00002000;
      return customValues;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     * @param value the customValues to add
     * @return this
     */
    public BattleStatistics addCustomValues(final CustomValuesEntry value) {
      bitField0_ |= 0x00002000;
      customValues.add(value);
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.CustomValuesEntry custom_values = 13;</code>
     * @param values the customValues to add
     * @return this
     */
    public BattleStatistics addAllCustomValues(final CustomValuesEntry... values) {
      bitField0_ |= 0x00002000;
      customValues.addAll(values);
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     * @return whether the battleTargetInfo field is set
     */
    public boolean hasBattleTargetInfo() {
      return (bitField0_ & 0x00004000) != 0;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     * @return this
     */
    public BattleStatistics clearBattleTargetInfo() {
      bitField0_ &= ~0x00004000;
      battleTargetInfo.clear();
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableBattleTargetInfo()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<BattleTargetInfoEntry> getBattleTargetInfo() {
      return battleTargetInfo;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<BattleTargetInfoEntry> getMutableBattleTargetInfo() {
      bitField0_ |= 0x00004000;
      return battleTargetInfo;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     * @param value the battleTargetInfo to add
     * @return this
     */
    public BattleStatistics addBattleTargetInfo(final BattleTargetInfoEntry value) {
      bitField0_ |= 0x00004000;
      battleTargetInfo.add(value);
      return this;
    }

    /**
     * <code>repeated .BattleStatistics.BattleTargetInfoEntry battle_target_info = 28;</code>
     * @param values the battleTargetInfo to add
     * @return this
     */
    public BattleStatistics addAllBattleTargetInfo(final BattleTargetInfoEntry... values) {
      bitField0_ |= 0x00004000;
      battleTargetInfo.addAll(values);
      return this;
    }

    @Override
    public BattleStatistics copyFrom(final BattleStatistics other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        totalDelayCumulate = other.totalDelayCumulate;
        costTime = other.costTime;
        totalBattleTurns = other.totalBattleTurns;
        totalAutoTurns = other.totalAutoTurns;
        ultraCnt = other.ultraCnt;
        roundCnt = other.roundCnt;
        cocoonDeadWave = other.cocoonDeadWave;
        avatarBattleTurns = other.avatarBattleTurns;
        monsterBattleTurns = other.monsterBattleTurns;
        challengeScore = other.challengeScore;
        endReason = other.endReason;
        avatarIdList.copyFrom(other.avatarIdList);
        battleAvatarList.copyFrom(other.battleAvatarList);
        customValues.copyFrom(other.customValues);
        battleTargetInfo.copyFrom(other.battleTargetInfo);
      }
      return this;
    }

    @Override
    public BattleStatistics mergeFrom(final BattleStatistics other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasTotalDelayCumulate()) {
        setTotalDelayCumulate(other.totalDelayCumulate);
      }
      if (other.hasCostTime()) {
        setCostTime(other.costTime);
      }
      if (other.hasTotalBattleTurns()) {
        setTotalBattleTurns(other.totalBattleTurns);
      }
      if (other.hasTotalAutoTurns()) {
        setTotalAutoTurns(other.totalAutoTurns);
      }
      if (other.hasUltraCnt()) {
        setUltraCnt(other.ultraCnt);
      }
      if (other.hasRoundCnt()) {
        setRoundCnt(other.roundCnt);
      }
      if (other.hasCocoonDeadWave()) {
        setCocoonDeadWave(other.cocoonDeadWave);
      }
      if (other.hasAvatarBattleTurns()) {
        setAvatarBattleTurns(other.avatarBattleTurns);
      }
      if (other.hasMonsterBattleTurns()) {
        setMonsterBattleTurns(other.monsterBattleTurns);
      }
      if (other.hasChallengeScore()) {
        setChallengeScore(other.challengeScore);
      }
      if (other.hasEndReason()) {
        setEndReasonValue(other.endReason);
      }
      if (other.hasAvatarIdList()) {
        getMutableAvatarIdList().addAll(other.avatarIdList);
      }
      if (other.hasBattleAvatarList()) {
        getMutableBattleAvatarList().addAll(other.battleAvatarList);
      }
      if (other.hasCustomValues()) {
        getMutableCustomValues().addAll(other.customValues);
      }
      if (other.hasBattleTargetInfo()) {
        getMutableBattleTargetInfo().addAll(other.battleTargetInfo);
      }
      return this;
    }

    @Override
    public BattleStatistics clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      totalDelayCumulate = 0D;
      costTime = 0D;
      totalBattleTurns = 0;
      totalAutoTurns = 0;
      ultraCnt = 0;
      roundCnt = 0;
      cocoonDeadWave = 0;
      avatarBattleTurns = 0;
      monsterBattleTurns = 0;
      challengeScore = 0;
      endReason = 0;
      avatarIdList.clear();
      battleAvatarList.clear();
      customValues.clear();
      battleTargetInfo.clear();
      return this;
    }

    @Override
    public BattleStatistics clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      avatarIdList.clear();
      battleAvatarList.clearQuick();
      customValues.clearQuick();
      battleTargetInfo.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof BattleStatistics)) {
        return false;
      }
      BattleStatistics other = (BattleStatistics) o;
      return bitField0_ == other.bitField0_
        && (!hasTotalDelayCumulate() || ProtoUtil.isEqual(totalDelayCumulate, other.totalDelayCumulate))
        && (!hasCostTime() || ProtoUtil.isEqual(costTime, other.costTime))
        && (!hasTotalBattleTurns() || totalBattleTurns == other.totalBattleTurns)
        && (!hasTotalAutoTurns() || totalAutoTurns == other.totalAutoTurns)
        && (!hasUltraCnt() || ultraCnt == other.ultraCnt)
        && (!hasRoundCnt() || roundCnt == other.roundCnt)
        && (!hasCocoonDeadWave() || cocoonDeadWave == other.cocoonDeadWave)
        && (!hasAvatarBattleTurns() || avatarBattleTurns == other.avatarBattleTurns)
        && (!hasMonsterBattleTurns() || monsterBattleTurns == other.monsterBattleTurns)
        && (!hasChallengeScore() || challengeScore == other.challengeScore)
        && (!hasEndReason() || endReason == other.endReason)
        && (!hasAvatarIdList() || avatarIdList.equals(other.avatarIdList))
        && (!hasBattleAvatarList() || battleAvatarList.equals(other.battleAvatarList))
        && (!hasCustomValues() || customValues.equals(other.customValues))
        && (!hasBattleTargetInfo() || battleTargetInfo.equals(other.battleTargetInfo));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 41);
        output.writeDoubleNoTag(totalDelayCumulate);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 49);
        output.writeDoubleNoTag(costTime);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 8);
        output.writeUInt32NoTag(totalBattleTurns);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(totalAutoTurns);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(ultraCnt);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 72);
        output.writeUInt32NoTag(roundCnt);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 80);
        output.writeUInt32NoTag(cocoonDeadWave);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRawByte((byte) 88);
        output.writeUInt32NoTag(avatarBattleTurns);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(monsterBattleTurns);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(challengeScore);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        output.writeRawLittleEndian16((short) 408);
        output.writeEnumNoTag(endReason);
      }
      if ((bitField0_ & 0x00000800) != 0) {
        for (int i = 0; i < avatarIdList.length(); i++) {
          output.writeRawByte((byte) 24);
          output.writeUInt32NoTag(avatarIdList.array()[i]);
        }
      }
      if ((bitField0_ & 0x00001000) != 0) {
        for (int i = 0; i < battleAvatarList.length(); i++) {
          output.writeRawByte((byte) 58);
          output.writeMessageNoTag(battleAvatarList.get(i));
        }
      }
      if ((bitField0_ & 0x00002000) != 0) {
        for (int i = 0; i < customValues.length(); i++) {
          output.writeRawByte((byte) 106);
          output.writeMessageNoTag(customValues.get(i));
        }
      }
      if ((bitField0_ & 0x00004000) != 0) {
        for (int i = 0; i < battleTargetInfo.length(); i++) {
          output.writeRawLittleEndian16((short) 482);
          output.writeMessageNoTag(battleTargetInfo.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 9;
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(totalBattleTurns);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(totalAutoTurns);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(ultraCnt);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(roundCnt);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(cocoonDeadWave);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(avatarBattleTurns);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(monsterBattleTurns);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeScore);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        size += 2 + ProtoSink.computeEnumSizeNoTag(endReason);
      }
      if ((bitField0_ & 0x00000800) != 0) {
        size += (1 * avatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(avatarIdList);
      }
      if ((bitField0_ & 0x00001000) != 0) {
        size += (1 * battleAvatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleAvatarList);
      }
      if ((bitField0_ & 0x00002000) != 0) {
        size += (1 * customValues.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(customValues);
      }
      if ((bitField0_ & 0x00004000) != 0) {
        size += (2 * battleTargetInfo.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleTargetInfo);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public BattleStatistics mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 41: {
            // totalDelayCumulate
            totalDelayCumulate = input.readDouble();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 49) {
              break;
            }
          }
          case 49: {
            // costTime
            costTime = input.readDouble();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 8) {
              break;
            }
          }
          case 8: {
            // totalBattleTurns
            totalBattleTurns = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 16) {
              break;
            }
          }
          case 16: {
            // totalAutoTurns
            totalAutoTurns = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // ultraCnt
            ultraCnt = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 72) {
              break;
            }
          }
          case 72: {
            // roundCnt
            roundCnt = input.readUInt32();
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // cocoonDeadWave
            cocoonDeadWave = input.readUInt32();
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 88) {
              break;
            }
          }
          case 88: {
            // avatarBattleTurns
            avatarBattleTurns = input.readUInt32();
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 96) {
              break;
            }
          }
          case 96: {
            // monsterBattleTurns
            monsterBattleTurns = input.readUInt32();
            bitField0_ |= 0x00000100;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // challengeScore
            challengeScore = input.readUInt32();
            bitField0_ |= 0x00000200;
            tag = input.readTag();
            if (tag != 152) {
              break;
            }
          }
          case 152: {
            // endReason
            final int value = input.readInt32();
            if (BattleEndReasonOuterClass.BattleEndReason.forNumber(value) != null) {
              endReason = value;
              bitField0_ |= 0x00000400;
            }
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // avatarIdList [packed=true]
            input.readPackedUInt32(avatarIdList, tag);
            bitField0_ |= 0x00000800;
            tag = input.readTag();
            if (tag != 58) {
              break;
            }
          }
          case 58: {
            // battleAvatarList
            tag = input.readRepeatedMessage(battleAvatarList, tag);
            bitField0_ |= 0x00001000;
            if (tag != 106) {
              break;
            }
          }
          case 106: {
            // customValues
            tag = input.readRepeatedMessage(customValues, tag);
            bitField0_ |= 0x00002000;
            if (tag != 226) {
              break;
            }
          }
          case 226: {
            // battleTargetInfo
            tag = input.readRepeatedMessage(battleTargetInfo, tag);
            bitField0_ |= 0x00004000;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 24: {
            // avatarIdList [packed=false]
            tag = input.readRepeatedUInt32(avatarIdList, tag);
            bitField0_ |= 0x00000800;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeDouble(FieldNames.totalDelayCumulate, totalDelayCumulate);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeDouble(FieldNames.costTime, costTime);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.totalBattleTurns, totalBattleTurns);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.totalAutoTurns, totalAutoTurns);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.ultraCnt, ultraCnt);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeUInt32(FieldNames.roundCnt, roundCnt);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeUInt32(FieldNames.cocoonDeadWave, cocoonDeadWave);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeUInt32(FieldNames.avatarBattleTurns, avatarBattleTurns);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeUInt32(FieldNames.monsterBattleTurns, monsterBattleTurns);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeUInt32(FieldNames.challengeScore, challengeScore);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        output.writeEnum(FieldNames.endReason, endReason, BattleEndReasonOuterClass.BattleEndReason.converter());
      }
      if ((bitField0_ & 0x00000800) != 0) {
        output.writeRepeatedUInt32(FieldNames.avatarIdList, avatarIdList);
      }
      if ((bitField0_ & 0x00001000) != 0) {
        output.writeRepeatedMessage(FieldNames.battleAvatarList, battleAvatarList);
      }
      if ((bitField0_ & 0x00002000) != 0) {
        output.writeRepeatedMessage(FieldNames.customValues, customValues);
      }
      if ((bitField0_ & 0x00004000) != 0) {
        output.writeRepeatedMessage(FieldNames.battleTargetInfo, battleTargetInfo);
      }
      output.endObject();
    }

    @Override
    public BattleStatistics mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -1914328833:
          case -627205929: {
            if (input.isAtField(FieldNames.totalDelayCumulate)) {
              if (!input.trySkipNullValue()) {
                totalDelayCumulate = input.readDouble();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -424687558:
          case -269929473: {
            if (input.isAtField(FieldNames.costTime)) {
              if (!input.trySkipNullValue()) {
                costTime = input.readDouble();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1501027290:
          case -1314204054: {
            if (input.isAtField(FieldNames.totalBattleTurns)) {
              if (!input.trySkipNullValue()) {
                totalBattleTurns = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1823561661:
          case 1641879777: {
            if (input.isAtField(FieldNames.totalAutoTurns)) {
              if (!input.trySkipNullValue()) {
                totalAutoTurns = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1754250723:
          case 1453625942: {
            if (input.isAtField(FieldNames.ultraCnt)) {
              if (!input.trySkipNullValue()) {
                ultraCnt = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -178949:
          case -4723912: {
            if (input.isAtField(FieldNames.roundCnt)) {
              if (!input.trySkipNullValue()) {
                roundCnt = input.readUInt32();
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 260478036:
          case -1902996116: {
            if (input.isAtField(FieldNames.cocoonDeadWave)) {
              if (!input.trySkipNullValue()) {
                cocoonDeadWave = input.readUInt32();
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -249379163:
          case 172374645: {
            if (input.isAtField(FieldNames.avatarBattleTurns)) {
              if (!input.trySkipNullValue()) {
                avatarBattleTurns = input.readUInt32();
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 192206212:
          case -665842284: {
            if (input.isAtField(FieldNames.monsterBattleTurns)) {
              if (!input.trySkipNullValue()) {
                monsterBattleTurns = input.readUInt32();
                bitField0_ |= 0x00000100;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 591599599:
          case 1517684662: {
            if (input.isAtField(FieldNames.challengeScore)) {
              if (!input.trySkipNullValue()) {
                challengeScore = input.readUInt32();
                bitField0_ |= 0x00000200;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1566226175:
          case 336357928: {
            if (input.isAtField(FieldNames.endReason)) {
              if (!input.trySkipNullValue()) {
                final BattleEndReasonOuterClass.BattleEndReason value = input.readEnum(BattleEndReasonOuterClass.BattleEndReason.converter());
                if (value != null) {
                  endReason = value.getNumber();
                  bitField0_ |= 0x00000400;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1214270702:
          case 1824281692: {
            if (input.isAtField(FieldNames.avatarIdList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(avatarIdList);
                bitField0_ |= 0x00000800;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 768292975:
          case 328463037: {
            if (input.isAtField(FieldNames.battleAvatarList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(battleAvatarList);
                bitField0_ |= 0x00001000;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 455932915:
          case 1237417392: {
            if (input.isAtField(FieldNames.customValues)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(customValues);
                bitField0_ |= 0x00002000;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1657979063:
          case 2141477269: {
            if (input.isAtField(FieldNames.battleTargetInfo)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(battleTargetInfo);
                bitField0_ |= 0x00004000;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

    @Override
    public BattleStatistics clone() {
      return new BattleStatistics().copyFrom(this);
    }

    @Override
    public boolean isEmpty() {
      return ((bitField0_) == 0);
    }

    public static BattleStatistics parseFrom(final byte[] data) throws
        InvalidProtocolBufferException {
      return ProtoMessage.mergeFrom(new BattleStatistics(), data).checkInitialized();
    }

    public static BattleStatistics parseFrom(final ProtoSource input) throws IOException {
      return ProtoMessage.mergeFrom(new BattleStatistics(), input).checkInitialized();
    }

    public static BattleStatistics parseFrom(final JsonSource input) throws IOException {
      return ProtoMessage.mergeFrom(new BattleStatistics(), input).checkInitialized();
    }

    /**
     * @return factory for creating BattleStatistics messages
     */
    public static MessageFactory<BattleStatistics> getFactory() {
      return BattleStatisticsFactory.INSTANCE;
    }

    /**
     * Protobuf type {@code CustomValuesEntry}
     */
    public static final class CustomValuesEntry extends ProtoMessage<CustomValuesEntry> implements Cloneable {
      private static final long serialVersionUID = 0L;

      /**
       * <code>optional float value = 2;</code>
       */
      private float value_;

      /**
       * <code>optional string key = 1;</code>
       */
      private final Utf8String key = Utf8String.newEmptyInstance();

      private CustomValuesEntry() {
      }

      /**
       * @return a new empty instance of {@code CustomValuesEntry}
       */
      public static CustomValuesEntry newInstance() {
        return new CustomValuesEntry();
      }

      /**
       * <code>optional float value = 2;</code>
       * @return whether the value_ field is set
       */
      public boolean hasValue() {
        return (bitField0_ & 0x00000001) != 0;
      }

      /**
       * <code>optional float value = 2;</code>
       * @return this
       */
      public CustomValuesEntry clearValue() {
        bitField0_ &= ~0x00000001;
        value_ = 0F;
        return this;
      }

      /**
       * <code>optional float value = 2;</code>
       * @return the value_
       */
      public float getValue() {
        return value_;
      }

      /**
       * <code>optional float value = 2;</code>
       * @param value the value_ to set
       * @return this
       */
      public CustomValuesEntry setValue(final float value) {
        bitField0_ |= 0x00000001;
        value_ = value;
        return this;
      }

      /**
       * <code>optional string key = 1;</code>
       * @return whether the key field is set
       */
      public boolean hasKey() {
        return (bitField0_ & 0x00000002) != 0;
      }

      /**
       * <code>optional string key = 1;</code>
       * @return this
       */
      public CustomValuesEntry clearKey() {
        bitField0_ &= ~0x00000002;
        key.clear();
        return this;
      }

      /**
       * <code>optional string key = 1;</code>
       * @return the key
       */
      public String getKey() {
        return key.getString();
      }

      /**
       * <code>optional string key = 1;</code>
       * @return internal {@code Utf8String} representation of key for reading
       */
      public Utf8String getKeyBytes() {
        return this.key;
      }

      /**
       * <code>optional string key = 1;</code>
       * @return internal {@code Utf8String} representation of key for modifications
       */
      public Utf8String getMutableKeyBytes() {
        bitField0_ |= 0x00000002;
        return this.key;
      }

      /**
       * <code>optional string key = 1;</code>
       * @param value the key to set
       * @return this
       */
      public CustomValuesEntry setKey(final CharSequence value) {
        bitField0_ |= 0x00000002;
        key.copyFrom(value);
        return this;
      }

      /**
       * <code>optional string key = 1;</code>
       * @param value the key to set
       * @return this
       */
      public CustomValuesEntry setKey(final Utf8String value) {
        bitField0_ |= 0x00000002;
        key.copyFrom(value);
        return this;
      }

      @Override
      public CustomValuesEntry copyFrom(final CustomValuesEntry other) {
        cachedSize = other.cachedSize;
        if ((bitField0_ | other.bitField0_) != 0) {
          bitField0_ = other.bitField0_;
          value_ = other.value_;
          key.copyFrom(other.key);
        }
        return this;
      }

      @Override
      public CustomValuesEntry mergeFrom(final CustomValuesEntry other) {
        if (other.isEmpty()) {
          return this;
        }
        cachedSize = -1;
        if (other.hasValue()) {
          setValue(other.value_);
        }
        if (other.hasKey()) {
          getMutableKeyBytes().copyFrom(other.key);
        }
        return this;
      }

      @Override
      public CustomValuesEntry clear() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        value_ = 0F;
        key.clear();
        return this;
      }

      @Override
      public CustomValuesEntry clearQuick() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        key.clear();
        return this;
      }

      @Override
      public boolean equals(Object o) {
        if (o == this) {
          return true;
        }
        if (!(o instanceof CustomValuesEntry)) {
          return false;
        }
        CustomValuesEntry other = (CustomValuesEntry) o;
        return bitField0_ == other.bitField0_
          && (!hasValue() || ProtoUtil.isEqual(value_, other.value_))
          && (!hasKey() || key.equals(other.key));
      }

      @Override
      public void writeTo(final ProtoSink output) throws IOException {
        if ((bitField0_ & 0x00000001) != 0) {
          output.writeRawByte((byte) 21);
          output.writeFloatNoTag(value_);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          output.writeRawByte((byte) 10);
          output.writeStringNoTag(key);
        }
      }

      @Override
      protected int computeSerializedSize() {
        int size = 0;
        if ((bitField0_ & 0x00000001) != 0) {
          size += 5;
        }
        if ((bitField0_ & 0x00000002) != 0) {
          size += 1 + ProtoSink.computeStringSizeNoTag(key);
        }
        return size;
      }

      @Override
      @SuppressWarnings("fallthrough")
      public CustomValuesEntry mergeFrom(final ProtoSource input) throws IOException {
        // Enabled Fall-Through Optimization (QuickBuffers)
        int tag = input.readTag();
        while (true) {
          switch (tag) {
            case 21: {
              // value_
              value_ = input.readFloat();
              bitField0_ |= 0x00000001;
              tag = input.readTag();
              if (tag != 10) {
                break;
              }
            }
            case 10: {
              // key
              input.readString(key);
              bitField0_ |= 0x00000002;
              tag = input.readTag();
              if (tag != 0) {
                break;
              }
            }
            case 0: {
              return this;
            }
            default: {
              if (!input.skipField(tag)) {
                return this;
              }
              tag = input.readTag();
              break;
            }
          }
        }
      }

      @Override
      public void writeTo(final JsonSink output) throws IOException {
        output.beginObject();
        if ((bitField0_ & 0x00000001) != 0) {
          output.writeFloat(FieldNames.value_, value_);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          output.writeString(FieldNames.key, key);
        }
        output.endObject();
      }

      @Override
      public CustomValuesEntry mergeFrom(final JsonSource input) throws IOException {
        if (!input.beginObject()) {
          return this;
        }
        while (!input.isAtEnd()) {
          switch (input.readFieldHash()) {
            case 111972721: {
              if (input.isAtField(FieldNames.value_)) {
                if (!input.trySkipNullValue()) {
                  value_ = input.readFloat();
                  bitField0_ |= 0x00000001;
                }
              } else {
                input.skipUnknownField();
              }
              break;
            }
            case 106079: {
              if (input.isAtField(FieldNames.key)) {
                if (!input.trySkipNullValue()) {
                  input.readString(key);
                  bitField0_ |= 0x00000002;
                }
              } else {
                input.skipUnknownField();
              }
              break;
            }
            default: {
              input.skipUnknownField();
              break;
            }
          }
        }
        input.endObject();
        return this;
      }

      @Override
      public CustomValuesEntry clone() {
        return new CustomValuesEntry().copyFrom(this);
      }

      @Override
      public boolean isEmpty() {
        return ((bitField0_) == 0);
      }

      public static CustomValuesEntry parseFrom(final byte[] data) throws
          InvalidProtocolBufferException {
        return ProtoMessage.mergeFrom(new CustomValuesEntry(), data).checkInitialized();
      }

      public static CustomValuesEntry parseFrom(final ProtoSource input) throws IOException {
        return ProtoMessage.mergeFrom(new CustomValuesEntry(), input).checkInitialized();
      }

      public static CustomValuesEntry parseFrom(final JsonSource input) throws IOException {
        return ProtoMessage.mergeFrom(new CustomValuesEntry(), input).checkInitialized();
      }

      /**
       * @return factory for creating CustomValuesEntry messages
       */
      public static MessageFactory<CustomValuesEntry> getFactory() {
        return CustomValuesEntryFactory.INSTANCE;
      }

      private enum CustomValuesEntryFactory implements MessageFactory<CustomValuesEntry> {
        INSTANCE;

        @Override
        public CustomValuesEntry create() {
          return CustomValuesEntry.newInstance();
        }
      }

      /**
       * Contains name constants used for serializing JSON
       */
      static class FieldNames {
        static final FieldName value_ = FieldName.forField("value");

        static final FieldName key = FieldName.forField("key");
      }
    }

    /**
     * Protobuf type {@code BattleTargetInfoEntry}
     */
    public static final class BattleTargetInfoEntry extends ProtoMessage<BattleTargetInfoEntry> implements Cloneable {
      private static final long serialVersionUID = 0L;

      /**
       * <code>optional uint32 key = 1;</code>
       */
      private int key;

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       */
      private final BattleTargetListOuterClass.BattleTargetList value_ = BattleTargetListOuterClass.BattleTargetList.newInstance();

      private BattleTargetInfoEntry() {
      }

      /**
       * @return a new empty instance of {@code BattleTargetInfoEntry}
       */
      public static BattleTargetInfoEntry newInstance() {
        return new BattleTargetInfoEntry();
      }

      /**
       * <code>optional uint32 key = 1;</code>
       * @return whether the key field is set
       */
      public boolean hasKey() {
        return (bitField0_ & 0x00000001) != 0;
      }

      /**
       * <code>optional uint32 key = 1;</code>
       * @return this
       */
      public BattleTargetInfoEntry clearKey() {
        bitField0_ &= ~0x00000001;
        key = 0;
        return this;
      }

      /**
       * <code>optional uint32 key = 1;</code>
       * @return the key
       */
      public int getKey() {
        return key;
      }

      /**
       * <code>optional uint32 key = 1;</code>
       * @param value the key to set
       * @return this
       */
      public BattleTargetInfoEntry setKey(final int value) {
        bitField0_ |= 0x00000001;
        key = value;
        return this;
      }

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       * @return whether the value_ field is set
       */
      public boolean hasValue() {
        return (bitField0_ & 0x00000002) != 0;
      }

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       * @return this
       */
      public BattleTargetInfoEntry clearValue() {
        bitField0_ &= ~0x00000002;
        value_.clear();
        return this;
      }

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       *
       * This method returns the internal storage object without modifying any has state.
       * The returned object should not be modified and be treated as read-only.
       *
       * Use {@link #getMutableValue()} if you want to modify it.
       *
       * @return internal storage object for reading
       */
      public BattleTargetListOuterClass.BattleTargetList getValue() {
        return value_;
      }

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       *
       * This method returns the internal storage object and sets the corresponding
       * has state. The returned object will become part of this message and its
       * contents may be modified as long as the has state is not cleared.
       *
       * @return internal storage object for modifications
       */
      public BattleTargetListOuterClass.BattleTargetList getMutableValue() {
        bitField0_ |= 0x00000002;
        return value_;
      }

      /**
       * <code>optional .BattleTargetList value = 2;</code>
       * @param value the value_ to set
       * @return this
       */
      public BattleTargetInfoEntry setValue(
          final BattleTargetListOuterClass.BattleTargetList value) {
        bitField0_ |= 0x00000002;
        value_.copyFrom(value);
        return this;
      }

      @Override
      public BattleTargetInfoEntry copyFrom(final BattleTargetInfoEntry other) {
        cachedSize = other.cachedSize;
        if ((bitField0_ | other.bitField0_) != 0) {
          bitField0_ = other.bitField0_;
          key = other.key;
          value_.copyFrom(other.value_);
        }
        return this;
      }

      @Override
      public BattleTargetInfoEntry mergeFrom(final BattleTargetInfoEntry other) {
        if (other.isEmpty()) {
          return this;
        }
        cachedSize = -1;
        if (other.hasKey()) {
          setKey(other.key);
        }
        if (other.hasValue()) {
          getMutableValue().mergeFrom(other.value_);
        }
        return this;
      }

      @Override
      public BattleTargetInfoEntry clear() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        key = 0;
        value_.clear();
        return this;
      }

      @Override
      public BattleTargetInfoEntry clearQuick() {
        if (isEmpty()) {
          return this;
        }
        cachedSize = -1;
        bitField0_ = 0;
        value_.clearQuick();
        return this;
      }

      @Override
      public boolean equals(Object o) {
        if (o == this) {
          return true;
        }
        if (!(o instanceof BattleTargetInfoEntry)) {
          return false;
        }
        BattleTargetInfoEntry other = (BattleTargetInfoEntry) o;
        return bitField0_ == other.bitField0_
          && (!hasKey() || key == other.key)
          && (!hasValue() || value_.equals(other.value_));
      }

      @Override
      public void writeTo(final ProtoSink output) throws IOException {
        if ((bitField0_ & 0x00000001) != 0) {
          output.writeRawByte((byte) 8);
          output.writeUInt32NoTag(key);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          output.writeRawByte((byte) 18);
          output.writeMessageNoTag(value_);
        }
      }

      @Override
      protected int computeSerializedSize() {
        int size = 0;
        if ((bitField0_ & 0x00000001) != 0) {
          size += 1 + ProtoSink.computeUInt32SizeNoTag(key);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          size += 1 + ProtoSink.computeMessageSizeNoTag(value_);
        }
        return size;
      }

      @Override
      @SuppressWarnings("fallthrough")
      public BattleTargetInfoEntry mergeFrom(final ProtoSource input) throws IOException {
        // Enabled Fall-Through Optimization (QuickBuffers)
        int tag = input.readTag();
        while (true) {
          switch (tag) {
            case 8: {
              // key
              key = input.readUInt32();
              bitField0_ |= 0x00000001;
              tag = input.readTag();
              if (tag != 18) {
                break;
              }
            }
            case 18: {
              // value_
              input.readMessage(value_);
              bitField0_ |= 0x00000002;
              tag = input.readTag();
              if (tag != 0) {
                break;
              }
            }
            case 0: {
              return this;
            }
            default: {
              if (!input.skipField(tag)) {
                return this;
              }
              tag = input.readTag();
              break;
            }
          }
        }
      }

      @Override
      public void writeTo(final JsonSink output) throws IOException {
        output.beginObject();
        if ((bitField0_ & 0x00000001) != 0) {
          output.writeUInt32(FieldNames.key, key);
        }
        if ((bitField0_ & 0x00000002) != 0) {
          output.writeMessage(FieldNames.value_, value_);
        }
        output.endObject();
      }

      @Override
      public BattleTargetInfoEntry mergeFrom(final JsonSource input) throws IOException {
        if (!input.beginObject()) {
          return this;
        }
        while (!input.isAtEnd()) {
          switch (input.readFieldHash()) {
            case 106079: {
              if (input.isAtField(FieldNames.key)) {
                if (!input.trySkipNullValue()) {
                  key = input.readUInt32();
                  bitField0_ |= 0x00000001;
                }
              } else {
                input.skipUnknownField();
              }
              break;
            }
            case 111972721: {
              if (input.isAtField(FieldNames.value_)) {
                if (!input.trySkipNullValue()) {
                  input.readMessage(value_);
                  bitField0_ |= 0x00000002;
                }
              } else {
                input.skipUnknownField();
              }
              break;
            }
            default: {
              input.skipUnknownField();
              break;
            }
          }
        }
        input.endObject();
        return this;
      }

      @Override
      public BattleTargetInfoEntry clone() {
        return new BattleTargetInfoEntry().copyFrom(this);
      }

      @Override
      public boolean isEmpty() {
        return ((bitField0_) == 0);
      }

      public static BattleTargetInfoEntry parseFrom(final byte[] data) throws
          InvalidProtocolBufferException {
        return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), data).checkInitialized();
      }

      public static BattleTargetInfoEntry parseFrom(final ProtoSource input) throws IOException {
        return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), input).checkInitialized();
      }

      public static BattleTargetInfoEntry parseFrom(final JsonSource input) throws IOException {
        return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), input).checkInitialized();
      }

      /**
       * @return factory for creating BattleTargetInfoEntry messages
       */
      public static MessageFactory<BattleTargetInfoEntry> getFactory() {
        return BattleTargetInfoEntryFactory.INSTANCE;
      }

      private enum BattleTargetInfoEntryFactory implements MessageFactory<BattleTargetInfoEntry> {
        INSTANCE;

        @Override
        public BattleTargetInfoEntry create() {
          return BattleTargetInfoEntry.newInstance();
        }
      }

      /**
       * Contains name constants used for serializing JSON
       */
      static class FieldNames {
        static final FieldName key = FieldName.forField("key");

        static final FieldName value_ = FieldName.forField("value");
      }
    }

    private enum BattleStatisticsFactory implements MessageFactory<BattleStatistics> {
      INSTANCE;

      @Override
      public BattleStatistics create() {
        return BattleStatistics.newInstance();
      }
    }

    /**
     * Contains name constants used for serializing JSON
     */
    static class FieldNames {
      static final FieldName totalDelayCumulate = FieldName.forField("totalDelayCumulate", "total_delay_cumulate");

      static final FieldName costTime = FieldName.forField("costTime", "cost_time");

      static final FieldName totalBattleTurns = FieldName.forField("totalBattleTurns", "total_battle_turns");

      static final FieldName totalAutoTurns = FieldName.forField("totalAutoTurns", "total_auto_turns");

      static final FieldName ultraCnt = FieldName.forField("ultraCnt", "ultra_cnt");

      static final FieldName roundCnt = FieldName.forField("roundCnt", "round_cnt");

      static final FieldName cocoonDeadWave = FieldName.forField("cocoonDeadWave", "cocoon_dead_wave");

      static final FieldName avatarBattleTurns = FieldName.forField("avatarBattleTurns", "avatar_battle_turns");

      static final FieldName monsterBattleTurns = FieldName.forField("monsterBattleTurns", "monster_battle_turns");

      static final FieldName challengeScore = FieldName.forField("challengeScore", "challenge_score");

      static final FieldName endReason = FieldName.forField("endReason", "end_reason");

      static final FieldName avatarIdList = FieldName.forField("avatarIdList", "avatar_id_list");

      static final FieldName battleAvatarList = FieldName.forField("battleAvatarList", "battle_avatar_list");

      static final FieldName customValues = FieldName.forField("customValues", "custom_values");

      static final FieldName battleTargetInfo = FieldName.forField("battleTargetInfo", "battle_target_info");
    }
  }
}
