Exemplo n.º 1
0
        private void initCanFight(Entities.Battle battle, IWarService warService)
        {
            bool canFight = SessionHelper.CurrentEntity.GetEntityType() == Entities.enums.EntityTypeEnum.Citizen && SessionHelper.CurrentEntity.Citizen.HitPoints > 5;

            if (canFight)
            {
                var fightingSide = warService.GetFightingSide(battle.War, SessionHelper.CurrentEntity.Citizen);

                if (fightingSide == Entities.enums.WarSideEnum.Attacker)
                {
                    CanFightAsAttacker = true;
                }
                else if (fightingSide == Entities.enums.WarSideEnum.Defender)
                {
                    CanFighstAsDefender = true;
                }
                else
                {
                    if (battle.RegionID == SessionHelper.CurrentEntity.GetCurrentRegion().ID)
                    {
                        CanFighstAsDefender = CanFightAsAttacker = true;
                    }
                }

                if (!battle.AttackerInitiatedBattle)
                {
                    var att = CanFightAsAttacker;
                    CanFightAsAttacker  = CanFighstAsDefender;
                    CanFighstAsDefender = att;
                }
            }
        }