//
//  Battalion.hpp
//  eagle0
//
//  Created by Dan Crosby on 11/24/14.
//  Copyright (c) 2014 none. All rights reserved.
//

#ifndef __eagle0__Battalion__
#define __eagle0__Battalion__

#include <memory>
#include <unordered_map>
#include <vector>

#include "src/main/cpp/net/eagle0/shardok/library/BattalionType.hpp"
#include "src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp"
#include "src/main/flatbuffer/net/eagle0/shardok/storage/battalion.hpp"
#include "src/main/protobuf/net/eagle0/shardok/common/terrain.pb.h"

namespace shardok {

using BattalionTypeId = net::eagle0::shardok::storage::fb::BattalionTypeId;
using TerrainProto = net::eagle0::shardok::common::Terrain;
using Battalion = net::eagle0::shardok::storage::fb::Battalion;

auto MutatingMaybeAdjustMorale(
        Battalion *battalion,
        double incr,
        double minimum,
        const BattalionTypeSPtr &type) -> double;

auto MutatingMaybeSetMorale(Battalion *battalion, double newVal, const BattalionTypeSPtr &type)
        -> double;

auto MutatingAdjustMorale(
        net::eagle0::shardok::storage::fb::Battalion &battalion,
        double incr,
        double minimum) -> double;

auto MutatingSetMorale(net::eagle0::shardok::storage::fb::Battalion &battalion, double newVal)
        -> double;

auto MutatingTakeDamageFrom(
        Battalion *battalion,
        Battalion *from,
        const CombatDamage &damage,
        const Terrain &terrain,
        AttackOrientation direction,
        double cmdrBravery,
        double moralePerCasualty,
        double baseDeadliness,
        const BattalionTypeSPtr &recipientType,
        const BattalionTypeSPtr &fromType) -> int32_t;

auto MutatingTakeEnvironmentalDamage(
        Battalion *battalion,
        const CombatDamage &damage,
        const Terrain &terrain,
        double moralePerCasualty,
        double baseDeadliness,
        const BattalionTypeSPtr &type) -> int32_t;

}  // namespace shardok

#endif /* defined(__eagle0__Battalion__) */
